Esta é uma prova de conceito usando Tecnologias da Spring Cloud.
Nos exemplos abaixo, vamos criar um serviço de CRUD para Clientes se conectando ao servidor Postgres e EXPOR para o mundo através do Spring Zuul.
No banco Postgres e exposto no Zuul
Ou seja: Postgres <- poc-data <- eureka-server <- poc-client <- poc-zuul
sudo mvn clean package
sudo docker-compose up -d
curl -i -X POST -H "Content-Type:application/json" -d "{ \"nome\" : \"Zuul\" }" http://localhost/api/data/cliente
curl http://localhost/api/data/cliente/1
curl http://localhost/api/poc/primeiro
No kubernets:
kompose -f kube.yml up
# nao funcionou no AWS
kubectl expose deployment poc-zuul --type=LoadBalancer --name=balancer --port=8888 --target-port=8888
# internal
curl -i -X POST -H "Content-Type:application/json" -d "{ \"nome\" : \"Zuul\" }" http://10.43.92.245:8888/api/data/cliente
# external
curl -i -X POST -H "Content-Type:application/json" -d "{ \"nome\" : \"Zuul\" }" http://54.208.58.238:8888/api/data/cliente
#curl http://54.85.148.141:8888/api/data/cliente/1
#curl http://54.85.148.141:8888/api/poc/primeiro
OPA: Subir todas aplicações leva um tempo. O Comando "primeiro" estará sujeito a disponibilidade do Ribbon.
- Postgres 10.1 (docker)
- poc-data:
- POSTGRES 10.1
- Spring HATEOAS
- Spring Data REST uses the HAL format for JSON output. It is flexible and offers a convenient way to supply links adjacent to the data that is served.
- Eureka Client. Microservice Registration and Discovery with Spring Cloud and Netflix's Eureka
- Example Protocol
- Eureka Server (docker)
- poc-client:
- Spring Eureka Client for Exposing "/primeiro" Entry Point
- Spring Ribbon Client for Consumes "poc-data" microservice
- poc-zuul:
- Spring Zuul Proxy Microservices