Simple implementations of some of Spring Cloud services
- Each service calls config-service to get their configuration files.
- Each service register itself with Netflix Eureka.
- The gateway-service adds proxy and load balancing to greeting services registered with Eureka.
- The admin-server brings up an easy way to consult actuator services.
This project has no extra external dependencies, you just need to import as a maven project and then run in the root project:
mvn clean install
To start the project, you have two options:
The boot order is:
- config-service
- eureka-service
- greeting-instance
- gateway-service
- admin-service
With Docker Compose
First, initialize the Swarm mode:
docker swarm init
Then create the overlay network:
docker network create -d overlay spring-cloud-network
In the first run and after a project re-build, use:
docker-compose up --build --force-recreate --scale greeting-instance=3
After that, you can just use:
docker-compose up --scale greeting-instance=3
The --scale greeting-instance=3
option will start tree instances of that service, you can choose the number you want.
Greeting service can be called through gateway-service at localport 8080
curl http://localhost:8080/greeting
Greeting service has a basic auth system:
user | password |
---|---|
admin | secret |
To see the currently registered services you can navigate in your preferred browser to the address:
http://localhost:8761
Eureka portal has a basic auth system:
user | password |
---|---|
eureka_admin | secret |
The admin portal will show you all the info from the exposed actuator services. In this sample they all are exposed with no security. (Never replicate this in a production scenario).
Admin portal has a basic auth system:
user | password |
---|---|
admin | secret |
In your preferred browser, navigate to:
http://localhost:8500
All the services here are simple examples of its on projects, configured to work together. More services, tests, and examples will come.