In order for users to better understand how to develop microservices using ServiceComb, an easy to understand demo is provided.
Architecture of Company
- 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:
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
If you are using Docker Toolbox, please add an extra profile
mvn package -Pdocker -Pdocker-machine
Run Integration Tests
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:
- If you use docker machine(supposed your docker machine name is
export HOST=$(docker-machine ip default):8083
- Log in and retrieve token from
AuthorizationsectionThen you can copy the token from the
curl -v -H "Content-Type: application/x-www-form-urlencoded" -d "username=jordan&password=password" -XPOST "http://$HOST/doorman/rest/login"
Authorizationsection and use it to replace the
Authorizationheader 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"
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.
Auto deploy on kubernetes cluster
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 ，实现自动编译、构建、部署和运行的步骤。