name: trendyol-analiz services: # ============================================ # PostgreSQL Database # ============================================ postgres: image: postgres:15-alpine restart: unless-stopped environment: POSTGRES_DB: trendyol_db POSTGRES_USER: postgres POSTGRES_PASSWORD: trendyol123 volumes: - postgres_data:/var/lib/postgresql/data networks: - trendyol-network healthcheck: test: ["CMD-SHELL", "pg_isready -U postgres"] interval: 10s timeout: 5s retries: 5 # ============================================ # Backend Service (FastAPI + PostgreSQL) # ============================================ backend: build: context: . dockerfile: backend/Dockerfile restart: unless-stopped ports: - "8010:8001" labels: - "traefik.docker.network=coolify" - "traefik.http.services.http-0-x4c08gc84kcw4oow0ggg44cg-backend.loadbalancer.server.port=8001" # SSE streaming support - flush immediately, don't buffer - "traefik.http.services.http-0-x4c08gc84kcw4oow0ggg44cg-backend.loadbalancer.responseForwarding.flushInterval=100ms" # Long timeout for report generation (up to 10 minutes) - "traefik.http.middlewares.backend-timeout.headers.customResponseHeaders.X-Accel-Buffering=no" environment: # Python environment PYTHONUNBUFFERED: 1 # PostgreSQL Database DATABASE_URL: postgresql://postgres:trendyol123@postgres:5432/trendyol_db # Storage paths (Docker volumes) CATEGORIES_DIR: /data/categories REPORTS_DIR: /data/reports # CORS configuration (allow frontend container) FRONTEND_URL: http://trendyol.194.187.253.230.sslip.io volumes: # Persistent data volumes (reports persist across deploys) - ./reports:/data/reports depends_on: postgres: condition: service_healthy networks: - trendyol-network healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8001/health"] interval: 30s timeout: 10s start_period: 40s retries: 5 # ============================================ # Frontend Service (React + Nginx) # ============================================ frontend: build: context: ./admin-panel dockerfile: Dockerfile args: # Backend API URL via Coolify Traefik proxy VITE_API_URL: https://trendyol-api.194.187.253.230.sslip.io restart: unless-stopped ports: - "3010:80" labels: - "traefik.http.services.http-0-x4c08gc84kcw4oow0ggg44cg-frontend.loadbalancer.server.port=80" depends_on: backend: condition: service_healthy networks: - trendyol-network healthcheck: test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://127.0.0.1/"] interval: 30s timeout: 10s start_period: 5s retries: 3 # ============================================ # Networks # ============================================ networks: trendyol-network: driver: bridge # ============================================ # Volumes # ============================================ volumes: postgres_data: