From 3afd2f2ba22f73a2989127b2f1e102207be012bd Mon Sep 17 00:00:00 2001 From: salvacybersec Date: Tue, 11 Nov 2025 05:48:46 +0300 Subject: [PATCH] Docs: Clarify single container uses only port 3000, no need for 4173 --- DOCKER.md | 116 ++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 90 insertions(+), 26 deletions(-) diff --git a/DOCKER.md b/DOCKER.md index 5c7e9eb..08fa08b 100644 --- a/DOCKER.md +++ b/DOCKER.md @@ -77,21 +77,7 @@ Docker entrypoint scripti sayesinde SESSION_SECRET'ı belirtmeseniz bile **otoma # Sadece zorunlu ayarları girin, SESSION_SECRET otomatik! cat > .env << 'EOF' # SESSION_SECRET boş bırakılırsa otomatik oluşturulur! - -# Gmail ayarları (ZORUNLU) -GMAIL_USER=your-email@gmail.com -GMAIL_APP_PASSWORD=your-gmail-app-password - -# Telegram ayarları (ZORUNLU) -TELEGRAM_BOT_TOKEN=your-bot-token -TELEGRAM_CHAT_ID=your-chat-id - -# Opsiyonel: Ollama AI -OLLAMA_SERVER_URL=http://host.docker.internal:11434 -OLLAMA_MODEL=llama3.2:latest - -# Frontend API URL -VITE_API_URL=http://localhost:3000 +c EOF ``` @@ -175,6 +161,11 @@ exit ### 5. Uygulamaya Erişin +#### Single Container (Önerilen): +- **Frontend + API**: http://localhost:3000 +- **Health Check**: http://localhost:3000/health + +#### Multi-Container: - **Frontend**: http://localhost:4173 - **Backend API**: http://localhost:3000 - **Health Check**: http://localhost:3000/health @@ -211,9 +202,63 @@ docker compose -f docker-compose.dev.yml up -d ## 🏭 Production Modu -Production modu için optimize edilmiş, multi-stage build ile küçük image boyutu. +### 🎯 Single Container Setup (Önerilen) -### Başlatma +**Tek container, tek port (3000)** - En basit ve önerilen yöntem! + +Single container setup'ta: +- ✅ **Tek Port**: Sadece 3000 portu kullanılır +- ✅ **Backend + Frontend**: Backend hem API'yi hem frontend'i serve eder +- ✅ **CORS Yok**: Aynı origin'den geldiği için CORS sorunu yok +- ✅ **Daha Az Kaynak**: Tek container, daha az memory/CPU +- ✅ **Basit Yönetim**: Tek container yönetimi + +#### Başlatma + +```bash +# Single container ile başlat +docker compose -f docker-compose.single.yml up -d --build + +# Durum kontrolü +docker compose -f docker-compose.single.yml ps + +# Logları görüntüle +docker compose -f docker-compose.single.yml logs -f oltalama +``` + +#### Port Yapısı + +``` +Tek Port: 3000 +├── /api/* → Backend API +├── /t/* → Tracking routes +├── /health → Health check +└── /* → Frontend SPA (React Router) +``` + +#### Nginx Proxy Manager Konfigürasyonu + +Single container için: +- **Forward Hostname/IP**: `localhost` +- **Forward Port**: `3000` +- **SSL**: ✓ (Let's Encrypt) +- **Websockets**: ✓ (opsiyonel) + +Tüm trafik (API + Frontend) → `localhost:3000` + +#### Erişim + +- **Frontend + API**: http://localhost:3000 +- **Health Check**: http://localhost:3000/health +- **API Endpoint**: http://localhost:3000/api + +--- + +### 🔄 Multi-Container Setup (Alternatif) + +İki ayrı container (backend + frontend) - Daha esnek ama daha karmaşık. + +#### Başlatma ```bash # Production compose ile başlat @@ -227,6 +272,11 @@ docker compose logs -f backend docker compose logs -f frontend ``` +#### Port Yapısı + +- **Backend**: 3000 portu +- **Frontend**: 4173 portu (ayrı container) + ### Container Yönetimi ```bash @@ -357,23 +407,37 @@ server { listen 80; server_name yourdomain.com; + # Single Container Setup için (Önerilen) location / { - proxy_pass http://frontend:4173; + proxy_pass http://localhost:3000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; proxy_cache_bypass $http_upgrade; } - location /api/ { - proxy_pass http://backend:3000/api/; - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection 'upgrade'; - proxy_set_header Host $host; - proxy_cache_bypass $http_upgrade; - } + # Multi-Container Setup için (Alternatif) + # location / { + # proxy_pass http://frontend:4173; + # proxy_http_version 1.1; + # proxy_set_header Upgrade $http_upgrade; + # proxy_set_header Connection 'upgrade'; + # proxy_set_header Host $host; + # proxy_cache_bypass $http_upgrade; + # } + # + # location /api/ { + # proxy_pass http://backend:3000/api/; + # proxy_http_version 1.1; + # proxy_set_header Upgrade $http_upgrade; + # proxy_set_header Connection 'upgrade'; + # proxy_set_header Host $host; + # proxy_cache_bypass $http_upgrade; + # } } ```