Skip to content

Commit

Permalink
Work on guide 09
Browse files Browse the repository at this point in the history
  • Loading branch information
jdubois committed Sep 26, 2019
1 parent 80278c5 commit c87df06
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 5 deletions.
19 changes: 17 additions & 2 deletions 08-build-a-spring-cloud-gateway/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,27 @@ At the end of the application's `pom.xml` file (just before the closing `</proje

## Configure the application

In `src/main/resources/application.properties`, add this configuration line so that Spring Cloud Gateway uses Eureka to discover the available microservices:
Rename `src/main/resources/application.properties` to `src/main/resources/application.yml`, and add the following configuration:

```
spring.cloud.gateway.discovery.locator.enabled=true
spring:
cloud:
gateway:
discovery:
locator:
enabled: true
globalcors:
corsConfigurations:
'[/**]':
allowedOrigins: "*"
allowedMethods:
- GET
```

- The `spring.cloud.gateway.discovery.locator.enabled=true` part is to configure Spring Cloud Gateway to use Eureka to discover the available microservices.
- The `spring.cloud.gateway.globalcors.corsConfiguration` part is to allow CORS requests to our gateway. This will be helpful in the next guide, when we will add a front-end that is not hosted on Azure Spring Cloud.

## Create the application on Azure Spring Cloud

As in [02 - Build a simple Spring Boot microservice](../02-build-a-simple-spring-boot-microservice/README.md), create a specific `gateway` application in your Azure Spring Cloud cluster. As this application is a gateway, we add the `--is-public true` flag so it is exposed publicly.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ spring:
'[/**]':
allowedOrigins: "*"
allowedMethods:
- GET
- GET
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,35 @@

__This guide is part of the [Azure Spring Cloud training](../README.md)__

Run several microservices together and expose them with a gateway, in order to have a full microservices stack running. Will we use Azure Cloud Service's distributing tracing mechanism to better understand this system.
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.

---

## Add a front-end to the microservices stack

We now have a complete microservices stack:

- A gateway based on Spring Cloud Gateway.
- A reactive `city-servivce` 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 have already built a VueJS application, that is available in the ["weather-app" folder](weather-app/).
- This front-end could be hosted in Azure Spring Cloud, or at least under the same domain name.
- 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 has little value for understanding Azure Spring Cloud, we have already this application running:

__[https://spring-training.azureedge.net/](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/](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:

![VueJS front-end](media/01-vuejs-frontend.png)



---

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ Build a [Spring Cloud Gateway](https://spring.io/projects/spring-cloud-gateway)

## [09 - Putting it all together, a complete microservice stack](09-putting-it-all-together-a-complete-microservice-stack/README.md)

Run several microservices together and expose them with a gateway, in order to have a full microservices stack running. Will we use Azure Cloud Service's distributing tracing mechanism to better understand this system.
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.

0 comments on commit c87df06

Please sign in to comment.