|
1 | 1 | # spring-boot-based-microservices
|
2 | 2 |
|
3 |
| -Basic skeleton for Spring Boot Microservices. It includes spring spring security for basic Auth. Zuul is also implemented as an API gateway. Lots of the spring cloud component integrated. |
| 3 | +Basic skeleton for Spring Boot Microservices. It includes spring security for basic Auth. Spring cloud gateway is also implemented as an Edge Service. Lots of the spring cloud component integrated. |
4 | 4 |
|
| 5 | +# How to run |
| 6 | + |
| 7 | +- Navigate to root of the project |
| 8 | +``` |
| 9 | + cd spring-boot-based-microservices |
| 10 | +``` |
| 11 | +- Build the project |
| 12 | +``` |
| 13 | + mvn clean package -DskipTests |
| 14 | +``` |
| 15 | + |
| 16 | + |
| 17 | +- Locate the docker directory from the root directory and run docker compose to startup the containers |
| 18 | +``` |
| 19 | + cd docker && docker compose up --build |
| 20 | +``` |
| 21 | + |
| 22 | + |
| 23 | +- Check if all our services are running and healthy |
| 24 | +``` |
| 25 | + docker ps |
| 26 | +``` |
| 27 | + |
| 28 | + |
| 29 | +- Let's check if all the services are up and running. We will reach to eureka server using gateway. |
| 30 | +Open the browser and hit http://localhost:8443/eureka/web You will need to authenticate yourself before accessing the endpoint. |
| 31 | +``` |
| 32 | +username : user |
| 33 | +password : password |
| 34 | +``` |
| 35 | + |
| 36 | + |
| 37 | +- Now, we have a look at our gateway endpoints configurations as well. Hit http://localhost:8443/actuator/gateway/routes in the browser again and, you should be able to find all the routes configured. |
| 38 | + |
| 39 | + |
| 40 | + |
| 41 | +- Coming to swagger/openapi specs, here is the address to access them - http://localhost:8443/openapi/swagger-ui.html |
| 42 | + |
| 43 | + |
| 44 | +- Please use the below curl to generate the access token with both read and write scope. |
| 45 | +``` |
| 46 | +curl -k http://writer:secret-writer@localhost:8443/oauth2/token -d grant_type=client_credentials -d scope="course:read course:write" |
| 47 | +``` |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | +## Note : Currently this project uses Spring Authorization server. Keep in mind, I'm planning to enhance the whole OAuth flow because it's in shaky state right now and, you may some face issues. We may also move to keycloak. |
| 52 | +## These instructions are basic starting point and, the project does lot of other stuff like elastic and mongo configuration etc. Please feel free to play around. I really want to maintain this and keep up-to-date, however my current role doesn't give me enough spare time. Therefore, contributors and their contributions are welcome :) |
0 commit comments