This project is a POC for microservices which has different flavours of backend written in REST, Reactive and Websockets. The frotnend is written in Angular 8.
The project can be run using docker-compose or deployed in Kubernetes.
To build docker images for backend run following command:
mvn -pl eureka-server,service-one,service-two,reactive-service,websocket-service,gateway -Dmaven.test.skip=true package jib:dockerBuild
or
mvn -pl service-one -Dmaven.test.skip=true package jib:dockerBuild
dockerBuild
requires your system to have the docker demon and will build images locally. build
is more efficient but wont build images locally.
You might need to change the docker.image.url
in pom.xml if you are using build
.
Now, just run all the service using docker-compose:
docker-compose up -d
Go to frontend folder and run
npm install
Then to start run
npm run start
To build docker images for backend run following command:
mvn -pl eureka-server,service-one,service-two,reactive-service,websocket-service,gateway -Dmaven.test.skip=true package jib:dockerBuild
To build docker image for frontend, run the following command inside frontend
folder.
docker build -t dhananjay12/demo-frontend:latest .
Note :- Whatever image prefix
name you give, change in the k8s
accordingly.
https://kubernetes.github.io/ingress-nginx/deploy/
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.41.2/deploy/static/provider/cloud/deploy.yaml
If you want to delete later just use delete
afterwards.
kubectl delete -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.41.2/deploy/static/provider/cloud/deploy.yaml
kubectl apply -f k8s
Open - localhost
Endpoint - /hello
, /headers
and /hop/{status}
.
If calling via gateway then - /api/service-one/hello
/hop/{status}
internally calls service-two
/status/{status}
endpoint and the response will be that code.
Endpoint - /hello
and /status/{status}
If calling via gateway then - /api/service-two/hello
Endpoint - /greetings/sse
and /greetings
If calling via gateway then - /reactive-web-producer/greetings/sse
Websocker Connect Endpoint - /gs-guide-websocket
Topic - /topic/greetings
Message Mapping - /hello
If calling via gateway then - /websocketservice/gs-guide-websocket