Networking & Load Balancing
Configure networking, reverse proxy, and high availability
Production networking setup for Cadence with reverse proxies, load balancing, and high availability.
Overview
Choose your networking architecture based on your deployment:
| Setup | Method | Complexity | Throughput | Cost |
|---|---|---|---|---|
| Single Server | Direct HTTP | Low | Medium | Low |
| Production | Nginx + HTTPS | Medium | High | Low |
| High Availability | HAProxy + Nginx | High | Very High | Medium |
| Cloud Native | Kubernetes Ingress | High | Very High | High |
Core Components
1. Reverse Proxy (Nginx)
Nginx handles:
- SSL/TLS termination
- Request routing
- Rate limiting
- Load balancing across backends
Setup: Nginx Reverse Proxy
2. High Availability (HA)
HAProxy provides:
- Health checking
- Automatic failover
- Multi-region support
- Session persistence
Setup: High Availability
Quick Setup Guide
Scenario 1: Single Server with HTTPS
┌──────────────┐
│ GitHub │
│ Webhooks │
└──────┬───────┘
│ HTTPS
▼
╔══════════════╗
║ Nginx ║
║ (SSL/TLS) ║
╚──────┬───────╝
│ :8000
▼
┌──────────────┐
│ Cadence │
│ Webhook │
└──────────────┘
Time: 20 minutes Cost: Low
Setup Steps:
- Install Nginx
- Install SSL certificate
- Configure proxy
- Enable HTTPS redirect
Scenario 2: High Availability (3+ servers)
┌──────────────┐
│ GitHub │
│ Webhooks │
└──────┬───────┘
│ HTTPS
▼
╔══════════════════════════════╗
║ Nginx/HAProxy Load Balancer ║
║ (SSL + Health Checks) ║
╚──────┬───────┬───────┬───────╝
│ │ │
:8000 :8001 :8002
│ │ │
▼ ▼ ▼
┌────┬────┬────┐
│ │ │ │
Cadence instances (3+)
Shared Redis Cache
Shared PostgreSQL (replicated)
Time: 1-2 hours Cost: Medium (3+ servers)
Setup Steps:
- Install Cadence on 3+ servers
- Setup Redis cluster for shared cache
- Setup PostgreSQL replication
- Configure HAProxy with health checks
- Setup Nginx for SSL/TLS
- Configure DNS failover
Common Patterns
Pattern 1: Direct HTTPS (Single Server)
Nginx
server {
listen 443 ssl;
server_name cadence.example.com;
ssl_certificate /etc/letsencrypt/certificate.pem;
ssl_certificate_key /etc/letsencrypt/key.pem;
location / {
proxy_pass http://localhost:8000;
}
}
Pattern 2: Load Balanced (Multiple Servers)
Nginx
upstream cadence_backend {
server 10.0.1.10:8000;
server 10.0.1.11:8000;
server 10.0.1.12:8000;
}
server {
listen 443 ssl;
location / {
proxy_pass http://cadence_backend;
}
}
Pattern 3: Geo-Distributed (Multiple Regions)
Primary Region Secondary Region
┌────────────────── └──────────────────┐
│ Cadence x3 │ Cadence x3 │
│ Nginx LB │ Nginx LB │
└──────────────────→ ⟷←──────────────────┘
DNS Failover
Deployment Checklist
- HTTPS certificate obtained (Let's Encrypt or custom)
- Nginx installed and configured
- Webhook secret configured
- Rate limiting enabled
- Health checks working
- Load balancer failover tested
- Monitoring alerts configured
- Backup/recovery plan documented
Next Steps
- Nginx Configuration - Reverse proxy setup
- High Availability - Multi-instance failover
- Monitoring - Health monitoring