Files
image-apiv3/DOKPLOY_TROUBLESHOOTING.md
Beyhan Oğur 031582ea2c first commit
2026-04-26 22:11:03 +03:00

108 lines
3.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Dokploy Troubleshooting Guide
## PostgreSQL Bağlantı Sorunları
### Hata: `ECONNREFUSED` veya `Failed query`
Bu hata, uygulamanın PostgreSQL sunucusuna bağlanamadığını gösterir.
### Kontrol Listesi
1. **DATABASE_URL Environment Variable Kontrolü**
Dokploy'da environment variables bölümünde `DATABASE_URL` değerini kontrol edin:
```bash
# Doğru format:
DATABASE_URL=postgresql://user:password@host:port/database?search_path=public
# Örnek:
DATABASE_URL=postgresql://cloud:gg7678290@10.80.80.70:5432/image_api?search_path=public
```
2. **Network Erişimi**
- Dokploy container'ından PostgreSQL sunucusuna erişilebilir olmalı
- Eğer PostgreSQL farklı bir network'teyse, network yapılandırmasını kontrol edin
- Firewall kurallarını kontrol edin (port 5432 açık olmalı)
3. **IP Adresi ve Port**
- Hata mesajında görünen IP/port ile DATABASE_URL'deki IP/port eşleşmeli
- Eğer farklıysa, Dokploy'da environment variable'ı güncelleyin
4. **Connection String Formatı**
```bash
# ✅ Doğru
postgresql://user:password@10.80.80.70:5432/dbname
# ❌ Yanlış
postgres://user:password@10.80.80.70:5432/dbname # postgres yerine postgresql kullanın
postgresql://user:password@10.80.80.70/dbname # Port eksik
```
5. **Schema Belirtme**
Eğer `public` dışında bir schema kullanıyorsanız:
```bash
DATABASE_URL=postgresql://user:password@host:port/dbname?search_path=your_schema
```
### Dokploy'da Environment Variables Ayarlama
1. Dokploy dashboard'a giriş yapın
2. Projenizi seçin
3. "Environment Variables" bölümüne gidin
4. `DATABASE_URL` değerini kontrol edin/güncelleyin
5. Değişikliklerden sonra container'ı yeniden başlatın
### Test Komutları
Container içinden bağlantıyı test etmek için:
```bash
# Container'a bağlan
docker exec -it image-api-app sh
# PostgreSQL bağlantısını test et
psql $DATABASE_URL -c "SELECT version();"
```
### Yaygın Hatalar ve Çözümleri
**Hata:** `ECONNREFUSED 10.0.1.215:5455`
- **Sebep:** DATABASE_URL yanlış IP/port içeriyor
- **Çözüm:** Dokploy'da DATABASE_URL'i doğru IP ve port ile güncelleyin
**Hata:** `timeout expired`
- **Sebep:** Network erişim sorunu veya firewall
- **Çözüm:** Network yapılandırmasını ve firewall kurallarını kontrol edin
**Hata:** `password authentication failed`
- **Sebep:** Yanlış kullanıcı adı/şifre
- **Çözüm:** DATABASE_URL'deki credentials'ları kontrol edin
### Örnek Doğru DATABASE_URL
```bash
# Local PostgreSQL
DATABASE_URL=postgresql://postgres:password@localhost:5432/image_api?search_path=public
# Remote PostgreSQL
DATABASE_URL=postgresql://cloud:gg7678290@10.80.80.70:5432/image_api?search_path=public
# SSL ile
DATABASE_URL=postgresql://user:pass@host:5432/dbname?sslmode=require
```
### Debug Modu
Daha detaylı hata mesajları için:
```bash
# db.ts dosyasında pool.on('error') event handler'ı logları gösterir
# Container loglarını kontrol edin:
docker logs image-api-app
```