Files
trendyol-analiz/docker-compose.yml
furkanyigit34 0147cbd37e fix: add Traefik port label for frontend service
Ne yaptık:
- Frontend service'ine traefik.http.services.frontend.loadbalancer.server.port=80 label'ı eklendi

Neden yaptık:
- Traefik frontend container'ın hangi portta çalıştığını bilmiyordu (502 Bad Gateway)
- Backend'de bu label vardı ama frontend'de eksikti

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 15:35:46 +03:00

124 lines
3.1 KiB
YAML

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.backend.loadbalancer.server.port=8001"
# SSE streaming support - flush immediately, don't buffer
- "traefik.http.services.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: http://trendyol-api.194.187.253.230.sslip.io
restart: unless-stopped
ports:
- "3010:80"
labels:
- "traefik.http.services.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: