version: "3.9" services: postgres: image: postgres:16-alpine environment: POSTGRES_USER: chainwatch POSTGRES_PASSWORD: chainwatch POSTGRES_DB: chainwatch ports: - "5432:5432" volumes: - pgdata:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U chainwatch"] interval: 5s timeout: 5s retries: 5 redis: image: redis:7-alpine ports: - "6379:6379" volumes: - redisdata:/data healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 5s timeout: 3s retries: 5 api: build: . command: uvicorn chainwatch.main:app --host 0.0.0.0 --port 8000 --reload ports: - "8000:8000" env_file: .env depends_on: postgres: condition: service_healthy redis: condition: service_healthy volumes: - .:/app restart: unless-stopped # Block pipeline worker (single concurrency to preserve ordering) worker-blocks: build: . command: celery -A chainwatch.celery_app worker -Q blocks -c 1 --loglevel=INFO env_file: .env depends_on: postgres: condition: service_healthy redis: condition: service_healthy volumes: - .:/app restart: unless-stopped # Alert evaluation worker worker-alerts: build: . command: celery -A chainwatch.celery_app worker -Q alerts -c 4 --loglevel=INFO env_file: .env depends_on: postgres: condition: service_healthy redis: condition: service_healthy volumes: - .:/app restart: unless-stopped # Webhook delivery worker (high concurrency, I/O-bound) worker-webhooks: build: . command: celery -A chainwatch.celery_app worker -Q webhooks -c 16 --loglevel=INFO env_file: .env depends_on: postgres: condition: service_healthy redis: condition: service_healthy volumes: - .:/app restart: unless-stopped # Celery Beat scheduler (block polling + reorg check) beat: build: . command: celery -A chainwatch.celery_app beat --loglevel=INFO env_file: .env depends_on: redis: condition: service_healthy volumes: - .:/app restart: unless-stopped # Flower monitoring (optional) flower: build: . command: celery -A chainwatch.celery_app flower --port=5555 ports: - "5555:5555" env_file: .env depends_on: - redis restart: unless-stopped volumes: pgdata: redisdata: