Files
django-interactive-framewor…/compose.yaml
Andros Fenollosa 5b95bb87b0 Add scheduled task to clear alerts daily
- Create clear_alerts Django management command
- Add Ofelia scheduler service to Docker Compose
- Configure daily task to run at 3:00 AM
- Alerts will be automatically cleared every day
2025-12-13 10:40:15 +01:00

43 lines
1.0 KiB
YAML

services:
redis:
image: redis:7-alpine
restart: unless-stopped
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 5
web:
build: .
restart: unless-stopped
command: >
sh -c "python manage.py migrate &&
python manage.py collectstatic --noinput &&
daphne -b 0.0.0.0 -p 8000 config.asgi:application"
volumes:
- .:/app
ports:
- "8000:8000"
environment:
DEBUG: "True"
SECRET_KEY: "django-insecure-demo-secret-key-change-in-production"
ALLOWED_HOSTS: "*"
REDIS_HOST: redis
depends_on:
redis:
condition: service_healthy
labels:
ofelia.enabled: "true"
ofelia.job-exec.clear-alerts.schedule: "0 0 3 * * *"
ofelia.job-exec.clear-alerts.command: "python manage.py clear_alerts"
scheduler:
image: mcuadros/ofelia:latest
restart: unless-stopped
command: daemon --docker
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
depends_on:
- web