- Published on
FastAPI Celery UI – Real-Time Task & Worker Monitoring Dashboard
- Authors
- Name
- Saurav Saini
🚀 FastAPI Celery UI - Comprehensive Monitoring Dashboard
Comprehensive, persistent monitoring for Celery tasks & workers — built with FastAPI.
Contents:
✨ Features
- Real-time Worker & Service Status: Displays total Celery services and active workers via Celery introspection.
- Detailed Task Monitoring:
- Task ID – unique identifier.
- Task Name – function name.
- Status –
PENDING
,STARTED
,SUCCESS
,FAILURE
. - Timing –
eta
and runtime. - Details – args/kwargs and tracebacks for failures.
- Persistent Logging & History: Stores all task details in a DB (SQLite by default).
- Dynamic UI with Auto-Refresh: Configurable auto-update interval.
- Asynchronous & Efficient: Built with FastAPI, SQLAlchemy, and aiosqlite.
🛠️ Installation
- Clone:
git clone https://github.com/aimldevs/celery-ui.git cd celery-ui
- Create venv:
# macOS/Linux python3 -m venv venv source venv/bin/activate # Windows python -m venv venv venv\Scripts\activate
- Install:
pip install -r requirements.txt
- Environment variables (optional):
Variable Description Default REDIS_URL
Redis broker URL redis://localhost:6379/0
CELERY_RESULT_URL
Redis result backend redis://localhost:6379/1
DATABASE_URL
SQLAlchemy DB URL sqlite+aiosqlite:///./celery_ui.db
UI_REFRESH_SECONDS
UI auto-refresh (sec) 2
- Migrations:
alembic upgrade head
🚀 Running the Application
- Start Celery workers:
celery -A your_celery_app_file worker --loglevel=info
- Start FastAPI:
uvicorn main:app --reload
- Open UI: http://localhost:8000
🐳 Using Docker
docker run -d \
-p 8000:8000 \
-e REDIS_URL='redis://host.docker.internal:6379/0' \
-e CELERY_RESULT_URL='redis://host.docker.internal:6379/1' \
-e DATABASE_URL='sqlite+aiosqlite:///./celery_ui.db' \
--name celery-ui \
aimldevs/celery-ui
Note: host.docker.internal
maps to the host machine from inside the container.
🤝 Celery Integration
The UI reads the Redis result backend (CELERY_RESULT_URL
), persists results to the configured DB, and provides historical views beyond Redis eviction.