Skip to content

huaweicse/ServiceComb-Company-WorkShop

Repository files navigation

ServiceComb Demo - Company Build StatusCoverage Status

Purpose

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.

Prerequisites

You will need:

  1. Oracle JDK 1.8+
  2. Maven 3.x
  3. Docker
  4. Docker compose(optional)
  5. Docker machine(optional)
  6. curl
  7. MySQL

Run Services

A docker-compose.yaml file is provided to start all services and their dependencies as docker containers.

  1. Build all service images using command mvn package -Pdocker
  2. 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

Run Integration Tests

mvn verify -Pdocker -Pdocker-machine

Verify services

You can verify the services using curl by the following steps:

  1. 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
  1. Log in and retrieve token from Authorization section
    curl -v -H "Content-Type: application/x-www-form-urlencoded" -d "username=jordan&password=password" -XPOST "http://$HOST/doorman/rest/login"
    Then you can copy the token from the Authorization section and use it to replace the Authorization header in the following requests.
  2. 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"
  3. 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"
  4. 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:

  1. A registered Service Stage account.
  2. Auto build and publish your docker image to Huawei's Image Warehouse, details can refer to auto publish guide.
  3. 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 ,实现自动编译、构建、部署和运行的步骤。

  1. 一个已注册的Service Stage帐号。
  2. 自动编译、构建和发布Docker镜像到华为的镜像仓库,详情可见自动发布指南
  3. 使用华为云的编排功能自动部署微服务,详情可见自动部署指南