first (part 2: other directories)
Deploy Iddaai Backend / build-and-deploy (push) Failing after 18s

This commit is contained in:
2026-04-16 15:11:25 +03:00
parent 7814e0bc6b
commit 2f0b85a0c7
203 changed files with 59989 additions and 0 deletions
+167
View File
@@ -0,0 +1,167 @@
# Suggest-Bet Sunucu Güvenlik ve Bağlantı Kılavuzu
**Son Güncelleme:** 2026-01-16
**Olay:** PostgreSQL Ransomware saldırısı sonrası güvenlik sıkılaştırması
---
## 🔐 Güvenlik Özeti
| Önlem | Durum | Açıklama |
| -------------------- | --------------- | ----------------------------- |
| Port 15432 (Postgres) | ❌ Kapalı | Security Group'tan kaldırıldı |
| Port 22 (SSH) | ⚠️ Kapalı | SSM kullan |
| Port 80/443 | ✅ Açık | Nginx için |
| SSM Session Manager | ✅ Aktif | Terminal erişimi için |
| UFW Firewall | ✅ Aktif | 80, 443, localhost:15432 |
| Postgres şifre | ✅ Değiştirildi | Default'tan güçlü şifreye |
---
## 🖥️ Sunucu Erişimi (SSH Yerine SSM)
### AWS Console ile:
1. AWS Console → Systems Manager → Session Manager
2. Start Session → Instance seç
3. Terminal açılır → `sudo su - ubuntu`
### Terminal ile (Mac/Linux):
```bash
# Normal terminal erişimi
aws ssm start-session --target i-0d9dc15ab7c4f5a96
```
---
## 🗄️ Database Bağlantısı (DBeaver)
### Adım 1: SSM Port Forwarding Başlat (Mac'te)
```bash
aws ssm start-session \
--target i-0d9dc15ab7c4f5a96 \
--document-name AWS-StartPortForwardingSession \
--parameters '{"portNumber":["15432"],"localPortNumber":["15432"]}'
```
> **Not:** Mac'te lokal Postgres 15432 portunu kullandığı için `15432` kullanıyoruz.
### Adım 2: DBeaver Ayarları
| Ayar | Değer |
| -------- | ------------------- |
| Host | `localhost` |
| Port | `15432` |
| Database | `boilerplate_db` |
| Username | `suggestbet` |
| Password | `SuGGesT2026SecuRe` |
> **Önemli:** SSH tab'ı **boş/disabled** olmalı!
---
## ⚡ Hızlı Bağlantı Alias'ları
### Mac (zsh)
```bash
# ~/.zshrc dosyasına ekle:
alias dbconnect='aws ssm start-session --target i-0d9dc15ab7c4f5a96 --document-name AWS-StartPortForwardingSession --parameters '\''{"portNumber":["15432"],"localPortNumber":["15432"]}'\'''
# Kullanım:
dbconnect
```
### Windows (PowerShell)
```powershell
# PowerShell Profile'a ekle ($PROFILE dosyası):
function dbconnect {
aws ssm start-session --target i-0d9dc15ab7c4f5a96 --document-name AWS-StartPortForwardingSession --parameters '{"portNumber":["15432"],"localPortNumber":["15432"]}'
}
# Kullanım:
dbconnect
```
### Windows (CMD) - Batch Script
```batch
@echo off
REM dbconnect.bat dosyası oluştur ve PATH'e ekle
aws ssm start-session --target i-0d9dc15ab7c4f5a96 --document-name AWS-StartPortForwardingSession --parameters "{\"portNumber\":[\"15432\"],\"localPortNumber\":[\"15432\"]}"
```
### Windows Kurulum Gereksinimleri
1. AWS CLI: https://aws.amazon.com/cli/
2. Session Manager Plugin: https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-install-plugin.html#install-plugin-windows
3. `aws configure` ile credentials ayarla
---
## 🐳 Docker Ayarları
### Container'lar
```bash
docker ps # Çalışan container'ları gör
```
| Container | Port | Açıklama |
| -------------------- | -------------- | ---------------- |
| boilerplate-postgres | 127.0.0.1:15432 | Sadece localhost |
| boilerplate-redis | 127.0.0.1:6379 | Sadece localhost |
### Database Credentials
- **User:** `suggestbet`
- **Password:** `SuGGesT2026SecuRe`
- **Database:** `boilerplate_db`
### Redis Credentials
- **Password:** `RedisSecure2026`
---
## 🔥 Firewall (UFW) Kuralları
```bash
# Durumu kontrol et
sudo ufw status verbose
# Mevcut kurallar:
# 80/tcp - HTTP (Nginx)
# 443/tcp - HTTPS (Nginx)
# 15432 - Sadece localhost (SSM port forwarding için)
```
---
## 📋 Feeder İşlemleri
```bash
# Feeder durumu
pm2 status
# Log'ları izle
pm2 logs feeder-historical --lines 50
# Yeniden başlat
pm2 restart feeder-historical
```
---
## ⚠️ Önemli Notlar
1. **GitHub Secrets güncelle:**
- `DATABASE_URL`: `postgresql://suggestbet:SuGGesT2026SecuRe@localhost:15432/boilerplate_db?schema=public`
- `REDIS_PASSWORD`: `RedisSecure2026`
2. **IP değişirse:** AWS Security Group güncellemesi gerekmez (SSM kullanıyoruz)
3. **Lokal Mac Postgres:** Port 15432'yi kullanıyor, bu yüzden SSM forwarding için 15432 kullan