I have an application in python using port 8004, which has end-points. I need to integrate it into microservices platform, which has Eureka discovery server port 8001, Spring Boot Admin port 8002, gateway port 80. Gateway uses Zuul proxy, and it forwards requests to required services.
I have two options:
- Change the code of my python-app, so it can have endpoints for Spring Cloud services
- Or use Spring Cloud Sidecar - which has these endpoints implemented. https://cloud.spring.io/spring-cloud-netflix/multi/multi__polyglot_support_with_sidecar.html
I decided to have sidecar. Sidecar port 8003, python-app port 8004. @EnableSidecar
annotation + @EnableDiscoveryClient
- and magic. Then I need to add gateway configuration to forward requests to python-service. And I need configuration for sidecar Zuul Proxy, so it forwards requests to the python application.
gateway port 80 -> sidecar port 8003 -> python-app port 8004.
Beautiful, and it works. When I open Eureka web-ui, all services are there. When I open Spring Boot Admin UI, it says that python-service (its sidecar) is down.
Spring Boot Admin client (configuration on the sidecar side), its port is 28003, thus that is different from sidecar.
management:
server:
port: 18003
endpoints:
web:
exposure:
include: '*'
endpoint:
health:
show-details: ALWAYS
I replaced @EnableSidecar with @EnableZuulProxy. Now everything works, and python-app is visible in Spring Boot Admin.
My two questions:
Why does
@EnableSidecar
has@EnableCircuitBreaker
if sidecar does not need circuit breaker by default? It makes sense if there is one instance of sidecar and multiple instances of python-service. I have 1:1 - one sidecar and one python-app. If python app is not available, sidecar should return an error. I do not need the circuit breaker? Or do I?Why annotation
@EnableSidecar
affects Spring Boot client, so it is not displayed on Spring Boot Admin UI. I think there is a bug or how do I enable sidecar to be monitored in Spring Boot Admin web-ui.
Spring Boot version is 2.0.7, Spring Cloud version is 2.0.0