Nginx / Gunicorn / Flask
🐍
/ Celery / SocketIO / MySQL / Redis / Docker
🐳
sample application
Basic Docker Compose template application for orchestating Flask with a Celery queue task, Redis message broker, MySQL database and support for SocketIO protocol.
Deployed with Nginx server and Gunicorn WSGI.
Flower supervision of Celery workers is also available. SocketIO is implemented through Flask-SocketIO.
Note that this application is almost production-ready. To see a production-ready application that follows this template check out CONTRABASS-webservices.
This template is intended for asynchronous tasks, periodical tasks and apps that require asynchronous communication through WebSockets-like protocols. Note that this makes an ideal backend for long-time execution web apps.
Notice that this application is highly horizontally scalable as it allows replication through multiple nginx, gunicorn, and celery workers.
Requirements
- Python
🐍 >= 3.6 - Docker
🐳 - Docker compose
🐳
Install dependencies
pip install -r requirements.txt
Run
First setup variables on .docker.env
. Assuming you have Docker and docker-compose installed, run on terminal:
docker-compose up
In order to bring it down run:
docker-compose down
Go too:
-
Flower management page
Test
pytest -v