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 <noreply@anthropic.com>
This commit is contained in:
furkanyigit34
2026-03-07 17:45:01 +03:00
parent 0d908a1afe
commit 0079313708
3 changed files with 21 additions and 12 deletions

View File

@@ -199,3 +199,17 @@ jobs:
- name: Cleanup - name: Cleanup
if: always() if: always()
run: docker compose -f docker-compose.test.yml down -v 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

View File

@@ -282,6 +282,9 @@ allowed_origins = [
"http://localhost:8080", "http://localhost:8080",
"http://127.0.0.1:80", "http://127.0.0.1:80",
"http://127.0.0.1:8080", "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 # Add production domain from environment variable

View File

@@ -5,8 +5,7 @@ services:
# PostgreSQL Database # PostgreSQL Database
# ============================================ # ============================================
postgres: postgres:
image: trendyol-postgres:15-alpine image: postgres:15-alpine
container_name: trendyol-postgres
restart: unless-stopped restart: unless-stopped
environment: environment:
@@ -14,9 +13,6 @@ services:
POSTGRES_USER: postgres POSTGRES_USER: postgres
POSTGRES_PASSWORD: trendyol123 POSTGRES_PASSWORD: trendyol123
ports:
- "5410:5432"
volumes: volumes:
- postgres_data:/var/lib/postgresql/data - postgres_data:/var/lib/postgresql/data
@@ -33,11 +29,9 @@ services:
# Backend Service (FastAPI + PostgreSQL) # Backend Service (FastAPI + PostgreSQL)
# ============================================ # ============================================
backend: backend:
image: trendyol-analiz-backend:latest
build: build:
context: ./backend context: ./backend
dockerfile: Dockerfile dockerfile: Dockerfile
container_name: trendyol-backend
restart: unless-stopped restart: unless-stopped
ports: ports:
@@ -55,7 +49,7 @@ services:
REPORTS_DIR: /data/reports REPORTS_DIR: /data/reports
# CORS configuration (allow frontend container) # CORS configuration (allow frontend container)
FRONTEND_URL: http://localhost:3010 FRONTEND_URL: http://194.187.253.230:3010
volumes: volumes:
# Persistent data volumes # Persistent data volumes
@@ -80,14 +74,12 @@ services:
# Frontend Service (React + Nginx) # Frontend Service (React + Nginx)
# ============================================ # ============================================
frontend: frontend:
image: trendyol-analiz-frontend:latest
build: build:
context: ./admin-panel context: ./admin-panel
dockerfile: Dockerfile dockerfile: Dockerfile
args: args:
# API URL baked into production build # Empty = relative URL, nginx proxy handles /api/ routing
VITE_API_URL: http://localhost:8010 VITE_API_URL: ""
container_name: trendyol-frontend
restart: unless-stopped restart: unless-stopped
ports: ports: