first commit
This commit is contained in:
193
READY_FOR_COOLIFY.md
Normal file
193
READY_FOR_COOLIFY.md
Normal file
@@ -0,0 +1,193 @@
|
||||
# ✅ HAZIR - Coolify Deployment (Port Mapping Kaldırıldı)
|
||||
|
||||
## 🎉 Sorun Çözüldü!
|
||||
|
||||
Port 80'i dışarı açma sorunu çözüldü. Coolify kendi reverse proxy'sini kullandığı için `ports:` mapping'ine ihtiyaç yok.
|
||||
|
||||
## 📋 Final Yapılandırma
|
||||
|
||||
### ✅ Doğru Ayarlar (Şu Anki Durum)
|
||||
|
||||
```yaml
|
||||
nginx:
|
||||
expose:
|
||||
- 80 # ✅ Internal (Coolify için yeterli)
|
||||
labels:
|
||||
- "coolify.managed=true" # ✅ Coolify yönetimi
|
||||
- "coolify.http.port=80" # ✅ Coolify port keşfi
|
||||
networks:
|
||||
coolify: # ✅ Coolify network
|
||||
aliases:
|
||||
- nginx # ✅ DNS alias'ları
|
||||
- nginx_proxy
|
||||
```
|
||||
|
||||
### ❌ Önceki Hatalı Ayar (Kaldırıldı)
|
||||
|
||||
```yaml
|
||||
nginx:
|
||||
ports:
|
||||
- "80:80" # ❌ KALDIRILDI - Coolify proxy ile conflict
|
||||
```
|
||||
|
||||
## 🚀 Deploy - Hemen Şimdi!
|
||||
|
||||
```bash
|
||||
# 1. Git push
|
||||
git add docker-compose.c.yml COOLIFY_NO_PORT_MAPPING.md
|
||||
git commit -m "Fix: Remove port 80 mapping for Coolify compatibility"
|
||||
git push
|
||||
|
||||
# 2. Coolify'da Redeploy butonuna tıklayın
|
||||
# 3. Domain'inizden test edin (örn: https://yourdomain.com)
|
||||
```
|
||||
|
||||
## 🎯 Neden Bu Çalışacak?
|
||||
|
||||
### Coolify Proxy Flow:
|
||||
```
|
||||
[Internet]
|
||||
↓
|
||||
[Coolify Reverse Proxy - Caddy/Traefik]
|
||||
↓ (Port 80/443 dışardan dinlenir)
|
||||
[your-domain.com]
|
||||
↓
|
||||
[Internal Network - coolify]
|
||||
↓
|
||||
[nginx:80] ← exposed, not published
|
||||
↓
|
||||
[django_web_prod:8000] ← upstream backend
|
||||
↓
|
||||
[Django App]
|
||||
```
|
||||
|
||||
**Önemli**:
|
||||
- Coolify proxy dışarıdan 80/443 dinler
|
||||
- Sizin nginx sadece internal network'te 80'de dinler
|
||||
- Port conflict olmaz! ✅
|
||||
|
||||
## 🔍 Deploy Sonrası Kontrol
|
||||
|
||||
```bash
|
||||
# Container durumu
|
||||
docker ps | grep nginx
|
||||
|
||||
# Beklenen çıktı:
|
||||
# ... 80/tcp ... django_nginx
|
||||
# (NOT: 0.0.0.0:80->80/tcp OLMAMALI!)
|
||||
|
||||
# Internal DNS test
|
||||
NGINX_ID=$(docker ps | grep nginx | awk '{print $1}')
|
||||
docker exec $NGINX_ID nslookup django_web_prod
|
||||
|
||||
# Internal HTTP test
|
||||
docker exec $NGINX_ID wget -qO- http://django_web_prod:8000 | head
|
||||
|
||||
# Nginx config
|
||||
docker exec $NGINX_ID nginx -t
|
||||
|
||||
# Loglar
|
||||
docker logs $NGINX_ID --tail 30
|
||||
```
|
||||
|
||||
## ✅ Başarı Kriterleri
|
||||
|
||||
1. ✅ `docker ps` - Nginx çalışıyor, sadece `80/tcp` görünüyor (port mapping YOK)
|
||||
2. ✅ Internal DNS - `django_web_prod` çözülüyor
|
||||
3. ✅ Internal HTTP - Django yanıt veriyor
|
||||
4. ✅ **Browser** - `https://yourdomain.com` açılıyor
|
||||
5. ✅ **SSL** - Coolify Let's Encrypt sertifikası aktif
|
||||
6. ✅ **Static** - CSS/JS yükleniyor
|
||||
7. ✅ **Media** - Görseller görünüyor
|
||||
|
||||
## 📊 Değişiklik Özeti
|
||||
|
||||
| Önceki | Şimdi | Durum |
|
||||
|--------|-------|-------|
|
||||
| `ports: - "80:80"` | `expose: - 80` | ✅ Düzeltildi |
|
||||
| Label yok | `coolify.managed=true` | ✅ Eklendi |
|
||||
| Label yok | `coolify.http.port=80` | ✅ Eklendi |
|
||||
| Upstream yok | `upstream django_backend` | ✅ Zaten var |
|
||||
| Config mount | Config image içinde | ✅ Zaten var |
|
||||
|
||||
## 🐛 Olası Sorunlar ve Çözümler
|
||||
|
||||
### "502 Bad Gateway" (Coolify domain'den)
|
||||
|
||||
**Senaryo 1**: Coolify nginx'i bulamıyor
|
||||
```bash
|
||||
# Labels kontrolü
|
||||
docker inspect $NGINX_ID | grep "coolify"
|
||||
|
||||
# Yoksa redeploy edin
|
||||
```
|
||||
|
||||
**Senaryo 2**: Nginx Django'ya bağlanamıyor
|
||||
```bash
|
||||
# DNS test
|
||||
docker exec $NGINX_ID nslookup django_web_prod
|
||||
|
||||
# HTTP test
|
||||
docker exec $NGINX_ID wget http://django_web_prod:8000
|
||||
|
||||
# Loglar
|
||||
docker logs $NGINX_ID
|
||||
```
|
||||
|
||||
**Senaryo 3**: Django çalışmıyor
|
||||
```bash
|
||||
# Web container
|
||||
WEB_ID=$(docker ps | grep "web" | grep -v nginx | awk '{print $1}')
|
||||
docker logs $WEB_ID --tail 50
|
||||
|
||||
# Port kontrolü
|
||||
docker exec $WEB_ID netstat -tuln | grep 8000
|
||||
```
|
||||
|
||||
### "404 Not Found" (Static dosyalar)
|
||||
|
||||
```bash
|
||||
# Static volume kontrolü
|
||||
docker exec $NGINX_ID ls -la /app/staticfiles/
|
||||
|
||||
# Collectstatic çalıştır
|
||||
docker exec $WEB_ID python manage.py collectstatic --noinput
|
||||
|
||||
# Nginx config
|
||||
docker exec $NGINX_ID cat /etc/nginx/conf.d/default.conf | grep "location /static"
|
||||
```
|
||||
|
||||
## 📚 Dökümanlar
|
||||
|
||||
1. **`COOLIFY_NO_PORT_MAPPING.md`** - Detaylı Coolify rehberi (bu dosya)
|
||||
2. **`NGINX_FIX_SUMMARY.md`** - Nginx-Django bağlantı çözümü
|
||||
3. **`COOLIFY_NGINX_DEBUG.md`** - Troubleshooting rehberi
|
||||
4. **`NGINX_SOLUTION.md`** - Config image içine gömme çözümü
|
||||
|
||||
## 🎯 Son Durum
|
||||
|
||||
```
|
||||
✅ docker-compose.c.yml - Port mapping kaldırıldı, Coolify labels eklendi
|
||||
✅ nginx/default.conf - Upstream stratejisi hazır
|
||||
✅ nginx/Dockerfile - Config image içinde
|
||||
✅ Tüm dökümanlar güncellendi
|
||||
|
||||
Durum: HAZIR - Coolify'da deploy edilebilir! 🚀
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🚨 ÖNEMLI HATIRLATMA
|
||||
|
||||
**Coolify kullanıyorsanız**:
|
||||
- ❌ **ASLA** `ports:` kullanmayın nginx için
|
||||
- ✅ **SADECE** `expose:` kullanın
|
||||
- ✅ **MUTLAKA** Coolify labels ekleyin
|
||||
|
||||
**Yerel Docker Compose kullanıyorsanız**:
|
||||
- ✅ `ports:` kullanabilirsiniz
|
||||
- Farklı bir compose dosyası kullanın (örn: `docker-compose.yml`)
|
||||
|
||||
---
|
||||
**Tarih**: 29 Ocak 2026
|
||||
**Durum**: ✅ **Production Ready - Deploy Edin!**
|
||||
Reference in New Issue
Block a user