Install Java development environment
Install Git, details can refer to Git Installing Guide.
Install JDK 1.8, details can refer to JDK Installing Guide.
Install Maven 3.x, details can refer to Maven Installing Guide.
Install ServiceComb Java Chassis(SDK) by executing the following commands.
git clone https://github.com/apache/incubator-servicecomb-java-chassis.git cd ServiceComb-Java-Chassis mvn clean install -DskipTests
Run Service Center
Service Center enables capabilities of service registration and service discovery in ServiceComb. It can run inside docker.
docker pull servicecomb/service-center docker run -d -p 30100:30100 servicecomb/service-center:latest
Reference to service center deployment to learn deploying Service Center as a local binary.
Create your first microservice application
Let's start the journey of microservice with a simple Body Mass Index(BMI) application. The BMI is an attempt to quantify the amount of tissue mass in an individual. This application contains two separate microservices:
BMI calculator service：A microservice provides calculation of BMI.
Web service：A microservice provides both user interface and gateway service.
The workflow of the application is shown as follows:
Note that the dotted lines indicate the process of service registration and discovery.
Run microservice application
Enter BMI codes directory.
Note: In windows development environment, the docker runs inside the virtual machine. The IP address of Service Center needs to be modified as the virtual machine's IP address. Modify the 2 configuration files [calculator|webapp]/src/main/resources/microservice.yaml, changed http://127.0.0.1:30100 to http://192.168.99.100:30100 , where 192.168.99.100 is the virtual machine's IP address.
cd calculator; mvn spring-boot:run cd webapp; mvn spring-boot:run
Verify the application. Visit http://localhost:8889 in browser. Then input your height and weight to verify.
- Learn how to develop microservice application in minutes.