Skip to content
This repository has been archived by the owner on Sep 21, 2023. It is now read-only.
/ poc-eureka Public archive

Spring Cloud Docker example

Notifications You must be signed in to change notification settings

frkr/poc-eureka

Repository files navigation

POC - EUREKA

O que é?

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.

Onde ficará as informações?

No banco Postgres e exposto no Zuul

Ou seja: Postgres <- poc-data <- eureka-server <- poc-client <- poc-zuul

Rodando tudo:

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.

Tecnologias

  1. Postgres 10.1 (docker)
  2. 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
  3. Eureka Server (docker)
  4. poc-client:
    • Spring Eureka Client for Exposing "/primeiro" Entry Point
    • Spring Ribbon Client for Consumes "poc-data" microservice
  5. poc-zuul:
    • Spring Zuul Proxy Microservices