Infrastructure
Deployment & Operations
A containerized VPS deployment leveraging Docker, Digital Ocean managed services, and industry-standard security practices for production-grade reliability.
Docker Container Architecture
Single VPS hosting four orchestrated containers for complete application isolation and simplified deployment
Frontend (Next.js)
RSA Digital website running in standalone mode with optimized production builds
Backend (Scrapers)
Python-based Gumtree Monitor scrapers with Selenium and automated data collection
Nginx (Reverse Proxy)
High-performance reverse proxy handling SSL termination and routing
Certbot (SSL)
Automated SSL certificate management with Let's Encrypt and cron-based renewal
Subdomain Routing Strategy
Intelligent subdomain configuration for application separation and CDN masking
rsadigital.co.zaMain landing page, About Us, Privacy Policy, Case Studies
app.rsadigital.co.zaAdmin dashboard for Gumtree Monitor management and analytics
media.rsadigital.co.zaCDN endpoint for scraped listing images via Digital Ocean Spaces
Digital Ocean PostgreSQL Cluster
Managed database cluster with multiple isolated environments and automated backups
Production DB
Live database serving the production application
Development DB
Isolated environment for feature development
Staging DB
Pre-production testing with production-like data
Backup DB
Automated backups for disaster recovery
Connection Pooling
PgBouncer-style connection pooling for efficient database resource utilization
Rate Limiting
Nginx-based rate limiting to protect against abuse and ensure fair usage
SSL/TLS Encryption
Let's Encrypt certificates with automated renewal via Certbot cron jobs
CDN Delivery
Digital Ocean Spaces with CDN edge caching for optimal image delivery
Deployment Workflow
Provision VPS
ssh root@<vps-ip>Set up Digital Ocean Droplet with Docker pre-installed
Clone & Configure
git clone <repo> && cp .env.example .envClone repositories and configure environment variables
Build Containers
docker-compose build --no-cacheBuild all Docker images (frontend, backend, nginx, certbot)
Initialize SSL
docker-compose run --rm certbot certonly --webroot ...Generate initial SSL certificates via Let's Encrypt
Launch Stack
docker-compose up -dStart all containers in detached mode with auto-restart
Configure DNS
# Point A records to VPS IPSet up DNS records for rsadigital.co.za, app.*, and media.*
Environment Configuration
| Variable | Description | Default |
|---|---|---|
DATABASE_URL* | Digital Ocean PostgreSQL Connection String (Pooled) | — |
DO_SPACES_KEY* | Digital Ocean Spaces Access Key | — |
DO_SPACES_SECRET* | Digital Ocean Spaces Secret Key | — |
DO_SPACES_CDN_ENDPOINT* | CDN Masked Endpoint (media.rsadigital.co.za) | — |
TWILIO_ACCOUNT_SID* | WhatsApp notification credentials | — |
NEXTAUTH_URL* | Authentication base URL (app.rsadigital.co.za) | — |
HEADLESS | Run Chrome headless for scrapers | true |
* Required variables
Troubleshooting Guide
SSL Certificate Issues
Run 'docker-compose run certbot renew' manually. Check nginx config for proper certificate paths.
Database Connection Pool Exhausted
Increase pool_size in connection string. Check for connection leaks in long-running queries.
CDN Images Not Loading
Verify DO Spaces bucket permissions and CORS configuration. Check CDN endpoint DNS propagation.