mirror of
https://github.com/nethunterzist/trendyol-analiz
synced 2026-07-01 01:17:04 +00:00
- Fix docker-compose.yml for production: use postgres:15-alpine, remove container names, remove postgres external port, set FRONTEND_URL to server IP, use empty VITE_API_URL for nginx proxy - Add production server CORS origins to backend - Add deploy job to GitHub Actions CI/CD pipeline Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
114 lines
2.5 KiB
YAML
114 lines
2.5 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: ./backend
|
|
dockerfile: Dockerfile
|
|
restart: unless-stopped
|
|
|
|
ports:
|
|
- "8010:8001"
|
|
|
|
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://194.187.253.230:3010
|
|
|
|
volumes:
|
|
# Persistent data volumes
|
|
- ./categories:/data/categories
|
|
- ./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:
|
|
# Empty = relative URL, nginx proxy handles /api/ routing
|
|
VITE_API_URL: ""
|
|
restart: unless-stopped
|
|
|
|
ports:
|
|
- "3010: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:
|