From 0079313708b9b103a3cdaf132b54a0224a54db1d Mon Sep 17 00:00:00 2001 From: furkanyigit34 <134547018+furkanyigit34@users.noreply.github.com> Date: Sat, 7 Mar 2026 17:45:01 +0300 Subject: [PATCH] feat: configure Coolify deployment for production - 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 --- .github/workflows/ci.yml | 14 ++++++++++++++ backend/main.py | 3 +++ docker-compose.yml | 16 ++++------------ 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0dbd7dd..7b36846 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -199,3 +199,17 @@ jobs: - name: Cleanup if: always() run: docker compose -f docker-compose.test.yml down -v + + # Deploy to Coolify (only on main push) + deploy: + name: Deploy to Coolify + runs-on: ubuntu-latest + needs: [docker-build, integration] + if: github.ref == 'refs/heads/main' && github.event_name == 'push' + + steps: + - name: Trigger Coolify Deployment + run: | + curl -X POST "${{ secrets.COOLIFY_WEBHOOK }}" \ + -H "Authorization: Bearer ${{ secrets.COOLIFY_TOKEN }}" \ + --fail --max-time 30 diff --git a/backend/main.py b/backend/main.py index 4a7f45b..0d81c62 100644 --- a/backend/main.py +++ b/backend/main.py @@ -282,6 +282,9 @@ allowed_origins = [ "http://localhost:8080", "http://127.0.0.1:80", "http://127.0.0.1:8080", + # Production server (Coolify) + "http://194.187.253.230:3010", + "http://194.187.253.230", ] # Add production domain from environment variable diff --git a/docker-compose.yml b/docker-compose.yml index 811e6d6..5df65ba 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,8 +5,7 @@ services: # PostgreSQL Database # ============================================ postgres: - image: trendyol-postgres:15-alpine - container_name: trendyol-postgres + image: postgres:15-alpine restart: unless-stopped environment: @@ -14,9 +13,6 @@ services: POSTGRES_USER: postgres POSTGRES_PASSWORD: trendyol123 - ports: - - "5410:5432" - volumes: - postgres_data:/var/lib/postgresql/data @@ -33,11 +29,9 @@ services: # Backend Service (FastAPI + PostgreSQL) # ============================================ backend: - image: trendyol-analiz-backend:latest build: context: ./backend dockerfile: Dockerfile - container_name: trendyol-backend restart: unless-stopped ports: @@ -55,7 +49,7 @@ services: REPORTS_DIR: /data/reports # CORS configuration (allow frontend container) - FRONTEND_URL: http://localhost:3010 + FRONTEND_URL: http://194.187.253.230:3010 volumes: # Persistent data volumes @@ -80,14 +74,12 @@ services: # Frontend Service (React + Nginx) # ============================================ frontend: - image: trendyol-analiz-frontend:latest build: context: ./admin-panel dockerfile: Dockerfile args: - # API URL baked into production build - VITE_API_URL: http://localhost:8010 - container_name: trendyol-frontend + # Empty = relative URL, nginx proxy handles /api/ routing + VITE_API_URL: "" restart: unless-stopped ports: