/flask-with-traefik-example

An example of flask microservices behind Traefik which works as a reverse proxy and load balancer.

Primary LanguagePython

Flask microservices with Traefik example

Deploy Flask microservices with Traefik as reverse proxy and load balancer.

How to run

You need to install docker and docker-compose first.

Clone this repository

git clone https://github.com/goldenrati0/flask-with-traefik-example.git

Change working directory

cd flask-with-traefik-example/

Deploy using docker

docker-compose up -d

Test

Test with curl to verify microservices are running

User Service
curl -H "Host:user.localhost" http://localhost/hello

You should receive a response like

{"msg":"Hello from User Service"}
Payment Service
curl -H "Host:payment.localhost" http://localhost/hello

You should receive a response like

{"msg":"Hello from Payment Service"}

You can browse http://localhost:8080/ to view the Traefik dashboard.