This guide is part of the Azure Spring Cloud training
Use a front-end to access graphically our complete microservice stack. Monitor our services with Azure Spring Cloud's distributed tracing mechanism, and scale our services depending on our needs.
We now have a complete microservices stack:
- A gateway based on Spring Cloud Gateway.
- A reactive
city-service
microservice, that stores its data on Cosmos DB. - A
weather-service
microservice, that stores its data on MySQL
In order to finish this architecture, we need to add a front-end to it:
- We've already built a VueJS application, that is available in the "weather-app" folder.
- This front-end could be hosted in Azure Spring Cloud, using the same domain name (this won't be the case in this guide, and that's why we enabled CORS in our gateway earlier).
- If you are familiar with NodeJS and Vue CLI, you can run this application locally by typing
npm install && vue ui
.
In order to simplify this part, which is not relevant to understanding Spring Cloud, we have already built a running front-end:
https://spring-training.azureedge.net/
For your information, this website is hosted on Azure Storage and served through Azure CDN for optimum performance.
Go to https://spring-training.azureedge.net/, input your Spring Cloud Gateway's public URL in the text field and click on "Go". You should see the following screen:
In each application (city-service
, weather-service
, gateway
), open up the pom.xml
file and add the following Maven dependency as a child element of the first <dependencies>
element.
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zipkin</artifactId>
</dependency>
This dependency will add distributed tracing capabilities to our microservices and gateway.
Now you need to update those applications on Azure Spring Cloud.
Re-deploy the city-service
microservice:
cd city-service
./mvnw clean package -DskipTests -Pcloud
az spring-cloud app deploy -n city-service --jar-path target/demo-0.0.1-SNAPSHOT.jar
cd ..
Re-deploy the weather-service
microservice:
cd weather-service
./mvnw clean package -DskipTests -Pcloud
az spring-cloud app deploy -n weather-service --jar-path target/demo-0.0.1-SNAPSHOT.jar
cd ..
Re-deploy the gateway
gateway:
cd gateway
./mvnw clean package -DskipTests -Pcloud
az spring-cloud app deploy -n gateway --jar-path target/demo-0.0.1-SNAPSHOT.jar
cd ..
We have already enabled distributed tracing on our Azure Spring Cloud instance in Section 3. Now, you can use the VueJS application on https://spring-training.azureedge.net/ to generate some traffic on the microservices stack.
💡 Tracing data can take a couple of minutes to be ingested by the system, so use this time to generate some load.
In the "Distributed tracing" menu in Azure Portal, you should now have access to a full application map, as well as a search engine that allows to find performance bottlenecks.
💡 If your application map looks different from the one above, select the hierarchical view from the layout switch in the top-right corner:
Now that distributed tracing is enabled, we can scale applications depending on our needs.
- Go to the Azure portal.
- Go to the overview page of your Azure Spring Cloud server and select "Apps" in the menu.
- Select one service and click on "Scale"
- Modify the number of instances or change the CPU/RAM of the instance
⬅️ Previous guide: 08 - Build a Spring Cloud Gateway
➡️ Next guide: 10 - Blue/Green deployment