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

rsadigital.co.za / app.rsadigital.co.za

Backend (Scrapers)

Python-based Gumtree Monitor scrapers with Selenium and automated data collection

Internal service

Nginx (Reverse Proxy)

High-performance reverse proxy handling SSL termination and routing

Port 80/443

Certbot (SSL)

Automated SSL certificate management with Let's Encrypt and cron-based renewal

Auto-renewal enabled

Subdomain Routing Strategy

Intelligent subdomain configuration for application separation and CDN masking

rsadigital.co.za

Main landing page, About Us, Privacy Policy, Case Studies

app.rsadigital.co.za

Admin dashboard for Gumtree Monitor management and analytics

media.rsadigital.co.za

CDN 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

1

Provision VPS

ssh root@<vps-ip>

Set up Digital Ocean Droplet with Docker pre-installed

2

Clone & Configure

git clone <repo> && cp .env.example .env

Clone repositories and configure environment variables

3

Build Containers

docker-compose build --no-cache

Build all Docker images (frontend, backend, nginx, certbot)

4

Initialize SSL

docker-compose run --rm certbot certonly --webroot ...

Generate initial SSL certificates via Let's Encrypt

5

Launch Stack

docker-compose up -d

Start all containers in detached mode with auto-restart

6

Configure DNS

# Point A records to VPS IP

Set up DNS records for rsadigital.co.za, app.*, and media.*

Environment Configuration

.env
VariableDescriptionDefault
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)
HEADLESSRun Chrome headless for scraperstrue

* 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.