hosting-platform/README.md

247 lines
6.8 KiB
Markdown
Raw Normal View History

# 🚀 Hosting Platform - Automated DNS & SSL Management
Modern, otomatik DNS ve SSL yönetim platformu. Cloudflare entegrasyonu ile domain'leri saniyeler içinde yapılandırın.
## 📋 Özellikler
### 🎯 Core Features
-**Cloudflare Entegrasyonu**: API token ile otomatik DNS yönetimi
-**DNS Önizleme**: Değişiklikleri uygulamadan önce görüntüleyin
-**Otomatik SSL**: Cloudflare SSL/TLS yapılandırması
-**Load Balancer**: Hash-based IP dağıtımı
-**Modern UI**: React + Vite ile hızlı ve responsive arayüz
-**Auto-Deploy**: Git push ile otomatik deployment
-**PostgreSQL**: Güvenilir veri saklama
-**Redis**: Hızlı cache ve session yönetimi
### 🆕 Yeni Özellikler (v2.0)
-**CF Account Management**: Admin panelden Cloudflare hesaplarını yönetin
-**Encrypted Token Storage**: API token'ları şifreli olarak saklama
-**DNS Nameserver Checker**: Gerçek zamanlı nameserver kontrolü
-**Advanced Domain Setup**: Gelişmiş domain kurulum sihirbazı
-**CF Token Guide**: Adım adım Cloudflare token oluşturma rehberi
-**Nameserver Instructions**: Kullanıcı dostu NS değiştirme talimatları
## 🏗️ Mimari
```
┌─────────────────────────────────────────────────────────┐
│ Cloudflare CDN │
│ (SSL/TLS + DDoS Protection) │
└─────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────┐
│ Nginx Reverse Proxy │
│ (176.96.129.77 - Load Balancer) │
└─────────────────────────────────────────────────────────┘
┌──────────────┴──────────────┐
▼ ▼
┌───────────────┐ ┌───────────────┐
│ Frontend │ │ Backend │
│ React + Vite │ │ Flask API │
│ Port 3001 │ │ Port 5000 │
└───────────────┘ └───────────────┘
┌────────────────┴────────────────┐
▼ ▼
┌──────────────┐ ┌──────────────┐
│ PostgreSQL │ │ Redis │
│ Port 5432 │ │ Port 6379 │
└──────────────┘ └──────────────┘
```
## 🛠️ Teknolojiler
### Backend
- **Flask 3.0** - Modern Python web framework
- **SQLAlchemy 2.0** - ORM
- **PostgreSQL 16** - Database
- **Redis 7.0** - Cache & Sessions
- **Cloudflare API** - DNS & SSL management
### Frontend
- **React 18** - UI library
- **Vite** - Build tool
- **TailwindCSS** - Styling
- **Axios** - HTTP client
### DevOps
- **Gitea** - Git repository
- **Nginx** - Reverse proxy
- **Supervisor** - Process management
- **Systemd** - Service management
## 📦 Kurulum
### Gereksinimler
- Ubuntu 22.04+
- Python 3.12+
- Node.js 18+
- PostgreSQL 16
- Redis 7.0
### Backend Kurulumu
```bash
cd backend
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
# Environment variables
cp .env.example .env
# .env dosyasını düzenleyin
# Database migration
flask db upgrade
# Başlatma
python app/main.py
```
### Frontend Kurulumu
```bash
cd frontend
npm install
npm run dev
```
## 🔧 Yapılandırma
### Environment Variables
```bash
# Database
DATABASE_URL=postgresql://user:pass@localhost:5432/hosting_db
# Redis
REDIS_URL=redis://localhost:6379/0
# API
API_HOST=0.0.0.0
API_PORT=5000
# Load Balancer IPs
LB_IPS=176.96.129.77,176.96.129.78,176.96.129.79
# Secret
SECRET_KEY=your-secret-key-here
```
## 🚀 API Endpoints
### Health Check
```bash
GET /health
```
### DNS Management
```bash
POST /api/dns/validate-token
POST /api/dns/preview-changes
POST /api/dns/apply-changes
POST /api/dns/check-nameservers # 🆕 Nameserver kontrolü
```
### Domain Management
```bash
GET /api/domains
GET /api/domains/<id>
POST /api/domains
PUT /api/domains/<id>
DELETE /api/domains/<id>
```
### Admin Endpoints (🆕)
```bash
GET /api/admin/cf-accounts # CF hesaplarını listele
POST /api/admin/cf-accounts # Yeni CF hesabı ekle
PUT /api/admin/cf-accounts/<id> # CF hesabını güncelle
DELETE /api/admin/cf-accounts/<id> # CF hesabını sil
```
## 📝 Lisans
MIT License - Detaylar için LICENSE dosyasına bakın.
## 👨‍💻 Geliştirici
Hosting Platform Team
---
## 🚀 Deployment
2026-01-10 12:42:21 +00:00
### 🔗 Auto-Deploy Webhook (Önerilen)
Gitea'ya webhook ekleyerek otomatik deployment yapabilirsiniz:
**Webhook URL**: `https://api.argeict.net/webhook/deploy`
Detaylı kurulum için: [WEBHOOK_SETUP.md](WEBHOOK_SETUP.md)
```bash
# Webhook test
curl -X POST https://api.argeict.net/webhook/deploy \
-H "Content-Type: application/json" \
-d '{"repository":{"name":"hosting-platform"}}'
```
### 📦 Manuel Deployment (SSH)
```bash
./deploy.sh
```
Bu script:
2026-01-10 12:42:21 +00:00
1. ✅ SSH ile sunucuya bağlanır
2. ✅ Gitea'dan son kodu çeker
3. ✅ Backend dependencies yükler
4. ✅ Database migration yapar
5. ✅ Frontend build eder
6. ✅ Servisleri restart eder
7. ✅ Health check yapar
### Manuel Deployment
```bash
# SSH ile sunucuya bağlan
ssh root@176.96.129.77
# Proje dizinine git
cd /opt/hosting-platform
# Git pull
git pull origin main
# Backend güncelle
cd backend
source venv/bin/activate
pip install -r requirements.txt
python -c "from app.main import app, db; app.app_context().push(); db.create_all()"
# Frontend build
cd ../frontend
npm install
npm run build
# Servisleri restart et
supervisorctl restart hosting-backend hosting-frontend
```
### Servis Yönetimi
```bash
# Servis durumu
supervisorctl status
# Logları izle
tail -f /var/log/hosting-backend.log
# Servisleri restart et
supervisorctl restart hosting-backend hosting-frontend
```