Server Requirements - luckydeva03/desa_karangrejo GitHub Wiki

πŸ–₯️ Server Requirements

Spesifikasi server dan kebutuhan infrastruktur untuk Website Desa Karangrejo.

🎯 Overview

Dokumen ini menjelaskan kebutuhan server minimal dan yang direkomendasikan untuk menjalankan Website Desa Karangrejo dengan optimal di berbagai skala penggunaan.

πŸ“Š Skala Deployment

🏘️ Desa Kecil (< 5,000 penduduk)

Penggunaan Harian: 50-200 pengunjung/hari

Minimal Requirements

  • CPU: 1 vCPU (2.0 GHz)
  • RAM: 2GB DDR4
  • Storage: 25GB SSD
  • Bandwidth: 500GB/bulan
  • OS: Ubuntu 20.04 LTS

Recommended Specifications

  • CPU: 2 vCPU (2.4 GHz)
  • RAM: 4GB DDR4
  • Storage: 50GB NVMe SSD
  • Bandwidth: 1TB/bulan
  • Backup: 100GB cloud storage

🏘️ Desa Sedang (5,000 - 15,000 penduduk)

Penggunaan Harian: 200-500 pengunjung/hari

Minimal Requirements

  • CPU: 2 vCPU (2.4 GHz)
  • RAM: 4GB DDR4
  • Storage: 50GB SSD
  • Bandwidth: 1TB/bulan

Recommended Specifications

  • CPU: 4 vCPU (2.8 GHz)
  • RAM: 8GB DDR4
  • Storage: 100GB NVMe SSD
  • Bandwidth: 2TB/bulan
  • Backup: 200GB cloud storage

πŸ™οΈ Desa Besar (> 15,000 penduduk)

Penggunaan Harian: 500-1,500 pengunjung/hari

Minimal Requirements

  • CPU: 4 vCPU (2.8 GHz)
  • RAM: 8GB DDR4
  • Storage: 100GB SSD
  • Bandwidth: 2TB/bulan

Recommended Specifications

  • CPU: 8 vCPU (3.0 GHz)
  • RAM: 16GB DDR4
  • Storage: 200GB NVMe SSD
  • Bandwidth: 5TB/bulan
  • Backup: 500GB cloud storage
  • Load Balancer: Optional

πŸ’» Operating System

Supported OS (Recommended)

  1. Ubuntu 20.04 LTS ⭐ (Primary choice)

    • Long-term support until 2025
    • Excellent PHP 8.2+ support
    • Active community and documentation
  2. Ubuntu 22.04 LTS ⭐ (Latest LTS)

    • Long-term support until 2027
    • Latest security updates
    • Native PHP 8.1+ support
  3. CentOS 8 / Rocky Linux 8

    • Enterprise-grade stability
    • SELinux security
  4. Debian 11 (Bullseye)

    • Stable and lightweight
    • Good for resource-constrained environments

Not Recommended

  • Windows Server (compatibility issues)
  • Shared hosting (limited control)
  • Very old Linux distributions (security risks)

πŸ› οΈ Software Stack Requirements

Web Server

# Nginx (Recommended)
- Version: 1.18+
- HTTP/2 support
- SSL/TLS 1.3 support
- Gzip compression
- Security headers

# Apache (Alternative)
- Version: 2.4+
- mod_rewrite enabled
- mod_ssl enabled
- mod_headers enabled

PHP Requirements

# PHP Version
- PHP 8.2+ (Recommended)
- PHP 8.1+ (Minimum supported)

# Required Extensions
php8.2-fpm          # FastCGI Process Manager
php8.2-mysql        # MySQL database support
php8.2-xml          # XML processing
php8.2-gd           # Image processing
php8.2-zip          # Archive handling
php8.2-curl         # HTTP client
php8.2-mbstring     # Multibyte string support
php8.2-bcmath       # Precision mathematics
php8.2-intl         # Internationalization
php8.2-redis        # Redis caching support

# Optional Extensions (Recommended)
php8.2-imagick     # Advanced image processing
php8.2-opcache     # Performance optimization
php8.2-xdebug      # Development debugging (dev only)

Database

# MySQL (Primary choice)
- Version: 8.0+
- InnoDB storage engine
- UTF8MB4 character set support
- SSL connection support

# MariaDB (Alternative)
- Version: 10.6+
- Compatible with MySQL 8.0
- Better performance in some cases

# Configuration Requirements
max_allowed_packet = 64M
innodb_buffer_pool_size = 1G (adjust based on RAM)
innodb_file_per_table = 1
sql_mode = STRICT_TRANS_TABLES,NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO

Caching System

# Redis (Recommended)
- Version: 6.0+
- Memory allocation: 512MB-1GB
- Persistence enabled
- Password authentication

# Alternative: Memcached
- Version: 1.6+
- Memory allocation: 256MB-512MB

Node.js & Build Tools

# Node.js
- Version: 18.0+ LTS
- NPM: 9.0+
- Yarn: 1.22+ (optional)

# Required for asset compilation
- Vite: 4.0+
- PostCSS: 8.0+
- Tailwind CSS: 3.0+

πŸ”§ Additional Software

Process Management

# Supervisor (Queue workers)
- Version: 4.0+
- Process monitoring
- Auto-restart capabilities

# systemd (Service management)
- Built-in with modern Linux
- Service auto-start
- Logging integration

Security & Monitoring

# Firewall
ufw (Ubuntu Firewall) - Simple firewall management
fail2ban - Intrusion prevention

# SSL/TLS
certbot - Let's Encrypt automation
openssl - Certificate management

# Monitoring
htop - System monitoring
iotop - Disk I/O monitoring
netstat - Network monitoring

Backup & Storage

# Local Backup
rsync - File synchronization
tar - Archive creation
gzip - Compression

# Cloud Storage (Choose one)
aws-cli - Amazon S3
gsutil - Google Cloud Storage
rclone - Multiple cloud providers

πŸ“ˆ Performance Considerations

CPU Requirements

# Factors affecting CPU usage:
- Concurrent users
- Image processing (gallery uploads)
- Search functionality
- Report generation
- Background jobs (email, notifications)

# CPU Optimization:
- Enable OPcache
- Use Redis for caching
- Optimize database queries
- Use CDN for static assets

Memory (RAM) Planning

# Memory allocation breakdown:
OS & System:        512MB - 1GB
Nginx:             100MB - 200MB
PHP-FPM:           256MB - 1GB (per pool)
MySQL:             512MB - 2GB
Redis:             256MB - 512MB
Supervisor:        50MB - 100MB
Buffer/Cache:      20% of total RAM

# Example for 4GB RAM server:
OS:                512MB
Nginx:             128MB
PHP-FPM:           1GB
MySQL:             1.5GB
Redis:             256MB
System Buffer:     600MB

Storage Requirements

# Disk space breakdown:
OS & Software:     5GB - 10GB
Application:       1GB - 2GB
Database:          500MB - 5GB (grows over time)
User Uploads:      1GB - 20GB (depends on usage)
Logs:              500MB - 2GB
Backups:           2x (Database + Uploads)
Temp Files:        500MB - 1GB

# Growth estimation:
- Database: ~50MB per 1000 posts
- Images: ~2MB per uploaded image
- Logs: ~10MB per month (normal usage)

Network & Bandwidth

# Bandwidth calculation:
Average page size: 500KB - 1MB
Images per page: 3-5 (150KB each on average)
Monthly visitors: Multiply by page views

# Example calculation for 1000 monthly visitors:
1000 visitors Γ— 5 pages Γ— 1MB = 5GB/month

# Recommended bandwidth:
Calculated usage Γ— 3 (safety factor) + 20% overhead

πŸ—οΈ Infrastructure Architectures

Single Server Setup (Most Common)

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚           Single Server             β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  Nginx + PHP-FPM + MySQL + Redis   β”‚
β”‚  + Application Files + Backups     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Suitable for: Small to medium villages Pros: Simple, cost-effective, easy maintenance Cons: Single point of failure

Separated Database Setup

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Web Server    β”‚    β”‚  Database       β”‚
β”‚  Nginx + PHP    │◄──►│  MySQL + Redis  β”‚
β”‚  Application    β”‚    β”‚  Backups        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Suitable for: Medium to large villages Pros: Better performance, easier scaling Cons: More complex, higher cost

Load Balanced Setup (Enterprise)

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Load Balancer  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
          β”‚
    β”Œβ”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚Web Server β”‚    β”‚  Database   β”‚
    β”‚     1     β”‚    β”‚   Cluster   β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚             β”‚
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚             β”‚
    β”‚Web Server │◄──►│ MySQL Masterβ”‚
    β”‚     2     β”‚    β”‚ MySQL Slave β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Suitable for: Very large villages or multiple villages Pros: High availability, excellent performance Cons: Complex setup, high cost

πŸ’° Cost Estimation

Budget Hosting Options

VPS Providers (Monthly costs)

🟒 DigitalOcean Droplet
- Basic (2GB RAM, 1 vCPU): $12/month
- Standard (4GB RAM, 2 vCPU): $24/month
- Premium (8GB RAM, 4 vCPU): $48/month

🟒 Vultr Cloud Compute
- Regular (2GB RAM, 1 vCPU): $10/month
- High Frequency (4GB RAM, 2 vCPU): $24/month

🟒 Linode
- Nanode (1GB RAM): $5/month
- Standard (2GB RAM): $10/month
- Dedicated (4GB RAM): $30/month

🟑 AWS EC2 (Variable pricing)
- t3.micro (1GB RAM): ~$8-15/month
- t3.small (2GB RAM): ~$15-25/month
- Includes free tier for first year

🟑 Google Cloud Platform
- e2-micro (1GB RAM): ~$6-12/month
- e2-small (2GB RAM): ~$13-24/month
- $300 free credit for new accounts

Local Indonesian Providers

🟒 Dewaweb
- Cloud VPS (2GB): Rp 150k/month
- Cloud VPS (4GB): Rp 300k/month

🟒 IDCloudHost
- VPS SSD (2GB): Rp 120k/month
- VPS SSD (4GB): Rp 240k/month

🟒 Niagahoster
- VPS (2GB): Rp 140k/month
- VPS (4GB): Rp 280k/month

Additional Costs

# Domain & SSL
Domain (.desa.id): FREE (through Kominfo)
SSL Certificate: FREE (Let's Encrypt)

# Backup Storage
Google Drive: Rp 40k/month (100GB)
Dropbox: Rp 50k/month (2TB)
AWS S3: ~$5-10/month (depending on usage)

# Email Service (Optional)
Google Workspace: Rp 90k/user/month
Zoho Mail: Rp 30k/user/month

πŸ” Server Selection Checklist

Before Purchasing

  • Location: Server dekat dengan target audience (Indonesia)
  • Uptime SLA: Minimal 99.9% guaranteed uptime
  • Support: 24/7 technical support dalam bahasa Indonesia
  • Backup: Automatic backup options available
  • Scalability: Easy to upgrade resources
  • Security: DDoS protection included
  • Network: Good connectivity to Indonesian ISPs

Performance Testing

# Test server performance before deployment
# CPU benchmark
sysbench cpu --threads=4 run

# Memory benchmark
sysbench memory run

# Disk I/O benchmark
sysbench fileio --file-test-mode=rndrw run

# Network speed test
curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python3 -

Pre-deployment Verification

# Check system requirements
php --version                    # Should be 8.2+
mysql --version                  # Should be 8.0+
nginx -v                        # Should be 1.18+
redis-server --version          # Should be 6.0+
node --version                  # Should be 18.0+
composer --version              # Should be 2.5+

# Check PHP extensions
php -m | grep -E "(mysql|gd|zip|curl|mbstring|xml|redis)"

# Check disk space
df -h

# Check memory
free -h

# Check network connectivity
ping google.com

Pemilihan server yang tepat adalah fondasi kesuksesan website desa πŸ–₯️