This project demonstrates the usage of netflix`s side car polygot. Spring cloud side car helps to register non jvm applications in eureka service registration server and available as part of service discovery to route traffic to non jvm applications through sidecar proxy.
Note: Branches 1.x.x/2.x.x versions makes it compatible with spring boot versions 1.x.x/2.x.x. Kindly choose branch as per spring boot release versions.
choose the branch based on below versions.
Branch/Version | Spring Boot | Spring Cloud | Node Js |
---|---|---|---|
master | 2.3.0.RELEASE | Hoxton.SR5 | 14.4.0 |
2.2.2 | 2.2.2.RELEASE | Hoxton.RELEASE | 12.4.0 |
2.1.5 | 2.1.5.RELEASE | Greenwich.SR1 | 12.4.0 |
2.1.4 | 2.1.4.RELEASE | Greenwich.RELEASE | 12.4.0 |
2.1.2 | 2.1.2.RELEASE | Greenwich.RC2 | 10.16.0 |
2.0.3 | 2.0.3.RELEASE | Finchley.RELEASE | 8.16.0 |
1.5.6 | 1.5.6.RELEASE | Dalston.SR3 | 8.16.0 |
Name | Port | Description |
---|---|---|
eureka-server | 9000 | Eureka server - service registration server |
csstore-microservice | 9001 | Service discovery microservice registered with eureka server |
msstore-microservice | 9002 | Service discovery microservice registered with eureka server |
sidecar | 9004 | Side car proxy for routing and filtering to wstore node app |
wstore-node-express | 3000 | Node express (non jvm ) application |
zuul-proxy | 9005 | Zuul proxy for routing and filtering |
- Download/Clone the repository :
$ git clone https://github.com/BarathArivazhagan/spring-cloud-sidecar-polygot.git
$ cd spring-cloud-sidecar-polygot
- Maven build :
$ ./mvnw clean install
-
Docker image build :
# Note change the docker images as per your image name in docker compose file $ docker-compose build
-
To run the application :
$ docker-compose up
Use zuul proxy to route to respective microservices.
zuul route definition :
zuul:
routes:
msstore :
path: /msstore/**
url: http://localhost:9002
csstore:
path: /csstore/**
url: http://localhost:9001
http://localhost:9005/msstore | msstore |
http://localhost:9005/csstore | csstore |
http://localhost:9005/csstore | wstore |
zuul:
routes:
wstore:
path: /wstore/**
url: http://localhost:3000
sidecar:
port: 3000
health-uri: http://localhost:3000/health
sidecar.port : Port must be same as the non jvm port
sidecar.health-uri: non jvm application should expose this url with json message {"STATUS" : "UP"} to indicate sidecar the app is UP.
yes, thats right. @EnableSideCar
includes @EnableZuulProxy
,so side car can act as zuul proxy itself.
In order to provide separate proxy for side car(non jvm) based applications, this repo contains two proxies
zuul-proxy : provides proxy to jvm based applications.
sidecar : provides proxy to non jvm based applications.
$ docker-compose build