___ _____ _ _
/ _ \ _ _/__ \ ___ _ __ ___ _ __ | | __ _ | |_ ___ ___
/ /_)/| | | | / /\// _ \| '_ ` _ \ | '_ \ | | / _` || __|/ _ \/ __|
/ ___/ | |_| |/ / | __/| | | | | || |_) || || (_| || |_| __/\__ \
\/ \__, |\/ \___||_| |_| |_|| .__/ |_| \__,_| \__|\___||___/
|___/ |_|
A basic microservices template which includes three services: an API built using fastapi, a dashboard built using plotly, and a reverse-proxy built using traefik. The docker-compose.yml can be used to deploy the API and the dashboard behind the reverse-proxy; exposing both services through a single, secure, HTTPS endpoint. The services can be deployed either on a single host machine or on a docker swarm cluster. In either case, the ingress load balancing will be managed by traefik. Multiple uvicorn workers are used to scale the fastapi service, while multiple gunicorn workers are used to scale the plotly dashboard. The docker-compose.override.yml can be used to override the default, multi-worker, production configuration during local development.
The source code for the two services deployed in this template are located in the fastapi and plotly_dash branches respectively. Public demos are also available:
Fastapi Demo - https://api.pytemplates.gallery/
Fastapi Demo Documentation - https://api.pytemplates.gallery/docs
Plotly Dashboard Demo - https://pytemplates.gallery/
Public docker images are also available from the repository crabtr26/pytemplates.
Fastapi:
docker pull crabtr26/pytemplates:fastapi
Plotly Dashboard:
docker pull crabtr26/pytemplates:plotly_dash
Using Docker Compose
:
git clone https://github.com/crabtr26/pytemplates.git
cd pytemplates
docker compose up
On a single server using Docker Compose
:
git clone https://github.com/crabtr26/pytemplates.git
cd pytemplates
docker compose -f docker-compose.yml up
On a single server or a cluster using Docker Swarm
:
git clone https://github.com/crabtr26/pytemplates.git
cd pytemplates
docker stack deploy -c docker-compose.yml pytemplates