Hybrid Local-Cloud Infrastructure

Active Flagship July 2025 - Present

A hybrid multi-server infrastructure setup to achieve maximum uptime up to 99.99% (verified by 3rd party monitoring software UptimeRobot and self-hosted monitoring software Uptime Kuma)

Overview

Hybrid cloud-local infrastructure built from scratch which hosts my portfolio website, services and development environment across multiple servers. After experimenting with Cloud Providers (Azure, AWS, and Google Cloud), I designed a hybrid setup combining DigitalOcean VPS instances and a few home servers to achieve optimal performance, cost-efficiency, and full control over my stack. The infrastructure includes a dedicated staging server for testing updates before production deployment.

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

Infrastructure Architecture

DigitalOcean VPS #1 - Production Web Server

1GB RAM 1 vCPU 25GB SSD
  • Docker Containers for Managing Services
  • Flask Web Application (chua333.net)
  • Nginx Reverse Proxy
  • PostgreSQL Database
  • SSL/TLS (Let's Encrypt)
  • Automated Backup (Cron + Healthchecks.io)

A Simple $6 VPS

Home Server #1 - Development Lab #1

32GB RAM Ryzen 5 6600H 500GB SSD 4TB HDD Radeon 660M
  • Ubuntu 24.04
  • Cloudflare Tunnel Gateway
  • Prometheus Monitoring
  • VictoriaMetrics Monitoring
  • Grafana Dashboards
  • All Self-Hosted Services Runs Here

The Mini PC

Home Server #2 - Development Lab #2

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

Repurposed ASUS VivoBook

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/VictoriaMetrics and Grafana to track system health and performance metrics in real-time with automated Telegram alerts.

Node Exporter (Port 9100)

Tracks CPU usage, RAM consumption, storage capacity, and network traffic for Linux Machines

Windows Exporter (Port 9182)

Tracks CPU usage, RAM consumption, storage capacity, and network traffic for Windows Machines

PostgreSQL Exporter (Port 9187)

Monitors database performance including average CPU and memory usage

Automated Alerts

Telegram notifications such as 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, Mini PC, Win11) • 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 63% 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 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.

Phase 5: Backup Strategy

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: Optimised 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 63% 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 Python PostgreSQL

Infrastructure & DevOps

VPS Ubuntu Nginx Docker Git/GitHub Cron Jobs Bash Scripting

Security & Networking

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

Monitoring & Observability

Prometheus VictoriaMetrics Grafana Node Exporter Windows Exporter PostgreSQL Exporter Healthchecks.io Telegram UptimeRobot Uptime Kuma

Explore More