In order for users to better understand how to develop microservices using ServiceComb, an easy to understand demo is provided.
- Manager (API gateway)
- Doorman (authentication service)
- Worker (computing service)
- Beekeeper (computing service)
- Bulletin board (service registry)
- Project archive (request cache)
- Human resource (service governance)
Please read the blog post on the detailed explanation of this project.
You will need:
A docker-compose.yaml
file is provided to start all services and their dependencies as docker containers.
- Build all service images using command
mvn package -Pdocker
- Run all service images using command
docker-compose up
If you are using Docker Toolbox, please add an extra profile -Pdocker-machine
.
mvn package -Pdocker -Pdocker-machine
mvn verify -Pdocker -Pdocker-machine
You can verify the services using curl by the following steps:
- Retrieve manager's ip address
- If you use docker compose:
export HOST="127.0.0.1:8083"
- If you use docker machine(supposed your docker machine name is
default
):export HOST=$(docker-machine ip default):8083
- Log in and retrieve token from
Authorization
sectionThen you can copy the token from thecurl -v -H "Content-Type: application/x-www-form-urlencoded" -d "username=jordan&password=password" -XPOST "http://$HOST/doorman/rest/login"
Authorization
section and use it to replace theAuthorization
header in the following requests. - Get the sixth fibonacci number from the worker service
curl -H "Authorization: replace_with_the_authorization_token" -XGET "http://$HOST/worker/fibonacci/term?n=6"
- Get the number of drone's ancestors at the 30th generation from the beekeeper service
curl -H "Authorization: replace_with_the_authorization_token" -XGET "http://$HOST/beekeeper/rest/drone/ancestors/30"
- Get the number of queen's ancestors at the 30th generation from the beekeeper service
curl -H "Authorization: replace_with_the_authorization_token" -XGET "http://$HOST/beekeeper/rest/queen/ancestors/30"
Auto deploy on Huawei Cloud
To auto compile, build, deploy and run this workshop demo on Huawei Cloud's Service Stage Platform, you need the following steps:
- A registered Service Stage account.
- Auto build and publish your docker image to Huawei's Image Warehouse, details can refer to auto publish guide.
- Auto deploy using Huawei Cloud's orchestration feature, details can refer to orchestration guide.
To auto pull images from servicecomb in docker hub, run on kubernetes cluster whether on gce or bare-metal.
Reference to Run Company on Kubernetes Cluster
本章节介绍基于华为微服务云应用平台Service Stage ,实现自动编译、构建、部署和运行的步骤。
- 一个已注册的Service Stage帐号。
- 自动编译、构建和发布Docker镜像到华为的镜像仓库,详情可见自动发布指南 。
- 使用华为云的编排功能自动部署微服务,详情可见自动部署指南 。