BAB 54. DEPLOYMENT ARCHITECTURE
Tujuan
Deployment dirancang agar mudah dimulai dari satu sekolah namun siap berkembang menjadi multi-school nasional tanpa perubahan arsitektur mendasar.
Lingkungan Deployment
| Environment | Fungsi | Akses |
|---|---|---|
| Local | Development dan debugging | Developer |
| Staging | Testing sebelum production | Tim QA + Stakeholder |
| Production | Operasional nyata | Pengguna akhir |
Arsitektur Production
flowchart TD
MOB["📱 Flutter App"] --> CDN["🌐 CDN"]
ADMIN["🖥️ Web Admin"] --> NGINX["⚙️ Nginx\n(Reverse Proxy)"]
CDN --> NGINX
NGINX --> APP["🟥 Laravel App\n(PHP-FPM)"]
APP --> REDIS[("🔴 Redis\n(Cache + Queue)")]
APP --> QUEUE["⏳ Queue Worker\n(Laravel Horizon)"]
APP --> REVERB["⚡ Laravel Reverb\n(WebSocket)"]
APP --> MYSQL[("💾 MySQL\n(Primary)")]
QUEUE --> MYSQL
QUEUE --> FCM["🔥 Firebase FCM"]
style NGINX fill:#059669,color:#fff
style APP fill:#dc2626,color:#fff
style REDIS fill:#dc2626,color:#fff
Komponen Deployment
| Komponen | Teknologi | Fungsi |
|---|---|---|
| Reverse Proxy | Nginx | Load balancing, SSL termination |
| App Server | PHP-FPM 8.4 | Menjalankan Laravel |
| Cache & Queue | Redis 7 | Cache + job queue broker |
| Database | MySQL 8.0 | Penyimpanan data utama |
| Queue Worker | Laravel Horizon | Background job processing |
| WebSocket | Laravel Reverb | Realtime chat |
| Push Notification | Firebase FCM | Notifikasi mobile |
| File Storage | S3-compatible | Upload foto, attachment |
Skalabilitas Bertahap
Tahap 1 — Satu Sekolah (Awal)
1 VM (4 vCPU, 8GB RAM)
├── Nginx
├── Laravel (PHP-FPM)
├── MySQL
├── Redis
├── Queue Worker (1 instance)
└── Reverb WebSocket
Tahap 2 — Multi Sekolah (Berkembang)
Load Balancer
├── App Server 1 (Laravel)
├── App Server 2 (Laravel)
├── App Server 3 (Laravel)
├── MySQL Primary + Read Replica
├── Redis Cluster
└── Queue Worker (Multiple)
Tahap 3 — Nasional (Scale)
CDN (Global)
Kubernetes Cluster
├── Microservice: Auth
├── Microservice: Matching
├── Microservice: Meeting
└── Microservice: Notification
MySQL Sharding + Redis Cluster
Konfigurasi Nginx
server {
listen 443 ssl http2;
server_name api.temubelajar.id;
ssl_certificate /etc/ssl/temubelajar.crt;
ssl_certificate_key /etc/ssl/temubelajar.key;
root /var/www/temubelajar/public;
index index.php;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php/php8.4-fpm.sock;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
# Rate limiting
limit_req_zone $binary_remote_addr zone=api:10m rate=60r/m;
location /api/ {
limit_req zone=api burst=20 nodelay;
}
}