version: '3.8' services: redis: image: redis:7-alpine container_name: linkedin-redis restart: unless-stopped command: redis-server --maxmemory 128mb --maxmemory-policy allkeys-lru --save "" healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 10s timeout: 5s retries: 3 start_period: 5s linkedin-scheduler: build: . container_name: linkedin-scheduler restart: unless-stopped command: sh -c "python -m src.services.scheduler_runner" healthcheck: test: ["CMD", "python", "-c", "import os, time; p=os.getenv('SCHEDULER_HEALTH_FILE','/tmp/scheduler_heartbeat'); raise SystemExit(0 if os.path.exists(p) and time.time() - os.path.getmtime(p) < 120 else 1)"] interval: 30s timeout: 5s retries: 3 start_period: 20s env_file: .env environment: - PYTHONPATH=/app - SCHEDULER_ENABLED=true - REDIS_URL=redis://redis:6379/0 - SCHEDULER_HEALTH_FILE=/tmp/scheduler_heartbeat volumes: - ./logs:/app/logs depends_on: redis: condition: service_healthy linkedin-posts: build: . container_name: linkedin-posts restart: unless-stopped command: sh -c "python -m uvicorn src.web.app:app --host 0.0.0.0 --port ${PORT:-8001} --workers 2" ports: - "127.0.0.1:8001:8001" env_file: .env environment: - PYTHONPATH=/app - PORT=8001 - SCHEDULER_ENABLED=false - REDIS_URL=redis://redis:6379/0 volumes: - ./logs:/app/logs depends_on: redis: condition: service_healthy healthcheck: test: ["CMD", "python", "-c", "import httpx; r = httpx.get('http://127.0.0.1:8001/health', timeout=5); raise SystemExit(0 if r.status_code == 200 else 1)"] interval: 30s timeout: 10s retries: 3 start_period: 15s