Self-Hosted Infrastructure

Active Development Flagship July 2025 - Present

Production-grade multi-server infrastructure achieving 99.99% uptime with 52% cost reduction vs Azure

Overview

A production-grade infrastructure built from scratch, hosting my portfolio website, services, and development environment across multiple servers. After experimenting with Azure, AWS, and Google Cloud, I designed a hybrid setup combining DigitalOcean VPS instances and a repurposed home server to achieve optimal performance, cost-efficiency, and full control over my stack. The infrastructure now includes a dedicated staging server for testing updates before production deployment.

99.99%
Uptime
52%
Cost Reduction
4
Servers
24/7
Monitoring
Want proof of the 99.99% uptime claim? Check Live Status

Infrastructure Architecture

DigitalOcean VPS #1 - Production Web Server

2GB RAM 1 vCPU 50GB SSD
  • Flask Web Application (chua333.net)
  • Gunicorn WSGI Server
  • Nginx Reverse Proxy
  • Minecraft Server
  • SQLite Database
  • SSL/TLS (Let's Encrypt)
  • Automated Backup (Cron + Healthchecks.io)

DigitalOcean VPS #2 - VPN Gateway

512MB RAM 1 vCPU 10GB SSD
  • WireGuard VPN Server
  • Private VPN Access
  • Secure Remote Connection

DigitalOcean VPS #3 - Development Server

512MB RAM 1 vCPU 10GB SSD
  • Flask Web Application (dev.chua333.net)
  • Gunicorn WSGI Server
  • Nginx Reverse Proxy
  • PostgreSQL Database
  • Deploy from develop branch
  • Automated Backup (Cron + Healthchecks.io)

Mirrors production environment for testing before deployment

Home Server - Development Lab

12GB RAM i5-10210U 500GB SSD MX250 GPU
  • PostgreSQL Database
  • Windows 10 VM
  • Cloudflare Tunnel Gateway
  • Prometheus Monitoring
  • Grafana Dashboards

Repurposed ASUS VivoBook running Ubuntu Linux

Technical Implementation

Nginx Reverse Proxy Configuration

Configured Nginx to efficiently route traffic using Unix socket communication with Gunicorn, serving static files directly, and managing SSL/TLS certificates automatically via Let's Encrypt.

server {
    listen 80;
    server_name chua333.net www.chua333.net;
    
    location / {
        include proxy_params;
        proxy_pass ████████████████████████████.sock;
    }
    
    location /static {
        alias ████████████████████████████;
    }
    
    listen 443 ssl;
    ssl_certificate ████████████████████████████.pem;
    ssl_certificate_key █████████████████████████████.pem;
}

Monitoring & Alerting Stack

Implemented comprehensive monitoring using Prometheus and Grafana to track system health and performance metrics in real-time with automated Discord alerts.

Node Exporter (Port 9100)

Tracks CPU usage, RAM consumption, storage capacity, and network traffic

PostgreSQL Exporter (Port 9187)

Monitors database performance including average CPU and memory usage

Automated Alerts

Discord webhook notifications for high CPU usage (>80%), low disk space (>85%), and website downtime

Secure Remote Access

Configured Cloudflare Tunnel on the home server to enable secure SSH access without exposing ports. The tunnel routes connections like ssh.chua333.net directly to the home server through Cloudflare's network.

Security First: No direct port exposure, all traffic encrypted through Cloudflare's edge network

Automated Backup & Deployment

Implemented a robust multi-layered backup and deployment workflow to ensure data safety and streamlined updates across both production and development environments.

Server-Side Backups (Tier 1)

Cron jobs on production and development servers automatically backup application files and configurations to local directories

Local Machine Backups (Tier 2)

Windows 11 development machine uses Task Scheduler to automatically download production backups from VPS

Home Server Backups (Tier 3)

Backups are automatically uploaded from Windows 11 machine to the home server with dual storage: always-connected external HDD and air-gapped external SSD (only connected during backup)

Healthchecks.io Monitoring

Each backup job reports to healthchecks.io, triggering Discord webhook alerts on success or failure for proactive monitoring

Backup Verification & Testing

Daily automated backup verification and periodic restore tests ensure zero errors and data integrity across all backup tiers

3-2-1-1-0 Backup Rule Compliance

3 copies (VPS, Win11, Home Server) • 2 media types (SSD, HDD) • 1 off-site (VPS cloud) • 1 offline (air-gapped SSD) • 0 errors (verified daily)

Git-Flow Deployment

Development server (dev.chua333.net) auto-deploys from develop branch, production (chua333.net) deploys from main after verification

Development Journey

Phase 1: Cloud Exploration

Started by experimenting with Azure due to its popularity in the cloud space. Also evaluated AWS and Google Cloud, but found AWS overly complex for my needs and Google Cloud didn't align with my preferences.

Phase 2: Home Server Setup

Repurposed an old ASUS VivoBook laptop, installed Ubuntu Linux, and began hosting services locally. This gave me hands-on experience with Linux server administration and full control over my infrastructure.

Phase 3: Hybrid Architecture

Migrated to a hybrid setup combining DigitalOcean VPS for public-facing services and home server for development and database workloads. This strategic move achieved 99.99% uptime while reducing costs by 52% compared to Azure.

Phase 4: Professional Deployment Pipeline

Implemented a complete DevOps workflow with Git-based version control and automated staging deployment. The development server (VPS #3) runs at dev.chua333.net, automatically pulling from the develop branch for live testing. Once verified, changes are merged to main and deployed to production. This git-flow strategy ensures thorough testing before production deployment, minimizing downtime and catching issues early.

Added a comprehensive enterprise-grade backup strategy following the 3-2-1-1-0 rule: VPS cron jobs create local backups (Tier 1), Windows 11 Task Scheduler downloads them (Tier 2), then uploads to home server with dual storage—always-connected HDD and air-gapped SSD (Tier 3). Daily verification and periodic restore tests ensure zero errors. All monitored via healthchecks.io with Discord notifications for complete data safety across cloud, local, and offline infrastructure.

Challenges & Solutions

Security Hardening

Challenge: Securing the infrastructure without exposing sensitive information, protecting against DDoS attacks, securing the database, and preventing bot spam.

Solution: Deep-dived into the OSI layers and network protocols, implemented Cloudflare's protection layer, configured firewall rules, used rate limiting, and set up monitoring to detect unusual patterns. Spent countless hours on forums and Stack Overflow learning security best practices.

Zero-Downtime Deployments

Challenge: How to push updates without taking the site offline.

Solution: Optimized the application to serve mostly dynamic content that loads quickly. Updates now cause only a few seconds of downtime during the Gunicorn restart process.

Cost Optimization

Challenge: Cloud costs were adding up quickly with traditional providers.

Solution: Hybrid approach using DigitalOcean's competitive pricing for VPS and leveraging existing hardware for the home server reduced monthly costs by 52% compared to Azure while maintaining reliability. Read the full cost breakdown →

What I Learned

What surprised me most was discovering how much I'm capable of building and how passionate developers invest in their skills every single day. The journey has been incredibly fulfilling — coming home tired but satisfied, excited about what I learned and built. It's far more rewarding than my previous routine of just gaming all day.

I learned to manage my own hardware, troubleshoot production issues at 2 AM, read through documentation for hours, and build something I'm genuinely proud of. This project taught me that infrastructure isn't just about code — it's about understanding systems, networks, security, and having the persistence to figure things out when nothing works.

Technology Stack

Backend & Application

Flask Gunicorn Python PostgreSQL SQLite

Infrastructure & DevOps

DigitalOcean Ubuntu Linux Nginx Docker Git/GitHub Cron Jobs Bash Scripting

Security & Networking

WireGuard VPN Cloudflare Tunnels SSL/TLS Let's Encrypt Firewall Configuration

Monitoring & Observability

Prometheus Grafana Node Exporter PostgreSQL Exporter Healthchecks.io Discord Webhooks

Explore More