Docs: Clarify single container uses only port 3000, no need for 4173
This commit is contained in:
116
DOCKER.md
116
DOCKER.md
@@ -77,21 +77,7 @@ Docker entrypoint scripti sayesinde SESSION_SECRET'ı belirtmeseniz bile **otoma
|
|||||||
# Sadece zorunlu ayarları girin, SESSION_SECRET otomatik!
|
# Sadece zorunlu ayarları girin, SESSION_SECRET otomatik!
|
||||||
cat > .env << 'EOF'
|
cat > .env << 'EOF'
|
||||||
# SESSION_SECRET boş bırakılırsa otomatik oluşturulur!
|
# SESSION_SECRET boş bırakılırsa otomatik oluşturulur!
|
||||||
|
c
|
||||||
# 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
|
|
||||||
EOF
|
EOF
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -175,6 +161,11 @@ exit
|
|||||||
|
|
||||||
### 5. Uygulamaya Erişin
|
### 5. Uygulamaya Erişin
|
||||||
|
|
||||||
|
#### Single Container (Önerilen):
|
||||||
|
- **Frontend + API**: http://localhost:3000
|
||||||
|
- **Health Check**: http://localhost:3000/health
|
||||||
|
|
||||||
|
#### Multi-Container:
|
||||||
- **Frontend**: http://localhost:4173
|
- **Frontend**: http://localhost:4173
|
||||||
- **Backend API**: http://localhost:3000
|
- **Backend API**: http://localhost:3000
|
||||||
- **Health Check**: http://localhost:3000/health
|
- **Health Check**: http://localhost:3000/health
|
||||||
@@ -211,9 +202,63 @@ docker compose -f docker-compose.dev.yml up -d
|
|||||||
|
|
||||||
## 🏭 Production Modu
|
## 🏭 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
|
```bash
|
||||||
# Production compose ile başlat
|
# Production compose ile başlat
|
||||||
@@ -227,6 +272,11 @@ docker compose logs -f backend
|
|||||||
docker compose logs -f frontend
|
docker compose logs -f frontend
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Port Yapısı
|
||||||
|
|
||||||
|
- **Backend**: 3000 portu
|
||||||
|
- **Frontend**: 4173 portu (ayrı container)
|
||||||
|
|
||||||
### Container Yönetimi
|
### Container Yönetimi
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -357,23 +407,37 @@ server {
|
|||||||
listen 80;
|
listen 80;
|
||||||
server_name yourdomain.com;
|
server_name yourdomain.com;
|
||||||
|
|
||||||
|
# Single Container Setup için (Önerilen)
|
||||||
location / {
|
location / {
|
||||||
proxy_pass http://frontend:4173;
|
proxy_pass http://localhost:3000;
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
proxy_set_header Connection 'upgrade';
|
proxy_set_header Connection 'upgrade';
|
||||||
proxy_set_header Host $host;
|
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;
|
proxy_cache_bypass $http_upgrade;
|
||||||
}
|
}
|
||||||
|
|
||||||
location /api/ {
|
# Multi-Container Setup için (Alternatif)
|
||||||
proxy_pass http://backend:3000/api/;
|
# location / {
|
||||||
proxy_http_version 1.1;
|
# proxy_pass http://frontend:4173;
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
# proxy_http_version 1.1;
|
||||||
proxy_set_header Connection 'upgrade';
|
# proxy_set_header Upgrade $http_upgrade;
|
||||||
proxy_set_header Host $host;
|
# proxy_set_header Connection 'upgrade';
|
||||||
proxy_cache_bypass $http_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;
|
||||||
|
# }
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user