fix: correct KubernetesClient import to K8sClient in Celery tasks

This commit is contained in:
2025-10-06 10:40:20 -03:00
parent 5c5afc85ac
commit bf06ae190a
17 changed files with 1233 additions and 0 deletions

86
docker-compose.yml Normal file
View File

@@ -0,0 +1,86 @@
version: '3.8'
services:
# Redis - Message broker for Celery
redis:
image: redis:7-alpine
ports:
- "6379:6379"
volumes:
- redis_data:/data
command: redis-server --appendonly yes
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
# FastAPI Application
web:
build:
context: .
dockerfile: Dockerfile.celery
ports:
- "8080:8080"
environment:
- REDIS_URL=redis://redis:6379/0
- KUBECONFIG=/tmp/kubeconfig
volumes:
- ./kubeconfig:/tmp/kubeconfig:ro
depends_on:
redis:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
interval: 30s
timeout: 10s
retries: 3
# Celery Worker
worker:
build:
context: .
dockerfile: Dockerfile.celery
command: python app/workers/celery_worker.py
environment:
- REDIS_URL=redis://redis:6379/0
- KUBECONFIG=/tmp/kubeconfig
volumes:
- ./kubeconfig:/tmp/kubeconfig:ro
depends_on:
redis:
condition: service_healthy
deploy:
replicas: 2
# Celery Beat Scheduler
beat:
build:
context: .
dockerfile: Dockerfile.celery
command: python app/workers/celery_beat.py
environment:
- REDIS_URL=redis://redis:6379/0
- KUBECONFIG=/tmp/kubeconfig
volumes:
- ./kubeconfig:/tmp/kubeconfig:ro
depends_on:
redis:
condition: service_healthy
# Flower - Celery Monitoring
flower:
build:
context: .
dockerfile: Dockerfile.celery
command: celery -A app.celery_app flower --port=5555
ports:
- "5555:5555"
environment:
- REDIS_URL=redis://redis:6379/0
depends_on:
redis:
condition: service_healthy
volumes:
redis_data: