Example of implementations a simple FastApi app with Celery tasks and Flower UI.
/
: Hello world endpoint/upload_files
: Upload files endpoint
task that handles the upload of files
task that starts periodically and sends a message to the broker every 10 seconds
app
: FastApi app - Web servercelery_worker
: Celery worker - Celery task executorflower
: Flower UI - Celery monitoring toolredis
: Redis broker - Celery message broker
controllers/*
: Contains the FastApi logic for each endpointviews/*
: Contains the FastApi endpointsdata/*
: Contains the test data filescelery_worker.py
: Contains the Celery tasksmain.py
: Contains the FastApi app entrypointrequirements.txt
: Contains the Python dependenciesDockerfile
: Contains the Docker configuration for the FastApi appdocker-compose.yml
: Contains the Docker-compose configuration for the project
- Clone the repository
- Install docker and docker-compose
- Run
docker-compose up --build
- Open http://0.0.0.0:8888/docs in your browser to see the Swagger UI
- Open http://0.0.0.0:5556/ in your browser to see the Flower UI
Notice that .env file is included in the repository for testing purposes only. In a real project, it should be added to .gitignore.