Why Self-Host?
Cloud platforms are convenient, but they come at a cost -- both financial and philosophical. When you self-host, you own your infrastructure. You understand every layer of the stack. You are not at the mercy of pricing changes or service deprecations.
For personal projects and small organizations, a $5/month VPS with Docker can do what a $200/month cloud setup does.
The Stack
Here's what I run on a single 2GB VPS:
- Traefik as a reverse proxy with automatic SSL
- Docker Compose for orchestration
- PostgreSQL in a container with mounted volumes
- Redis for caching and session management
- Watchtower for automatic container updates
Total cost: $6/month. Total control: 100%.
Key Principles
1. Everything in Containers
No installing packages directly on the host. Every service runs in its own container with defined resource limits. This makes the entire setup reproducible -- I can spin up an identical environment on any machine in minutes.
services:
app:
image: myapp:latest
deploy:
resources:
limits:
memory: 512M
cpus: '0.5'
restart: unless-stopped
2. Automated Backups
Data loss is not an option. I run a cron job that dumps PostgreSQL data and uploads encrypted backups to a separate storage location every 6 hours. The script is 30 lines of bash and has saved me twice.
3. Monitoring Without Overhead
Heavyweight monitoring stacks like Prometheus + Grafana are overkill for small setups. Instead, I use a lightweight Rust-based monitor that sends alerts to a webhook when thresholds are breached.
Simple. Effective. Uses 8MB of RAM.
Security Checklist
- SSH key-only authentication (no passwords)
- UFW firewall with only ports 80, 443, and a custom SSH port open
- Fail2ban for brute-force protection
- Docker socket not exposed to the network
- Regular
apt update && apt upgrade
The Philosophy
Self-hosting is not just a technical choice -- it's a mindset. It means taking responsibility for your infrastructure, understanding what runs beneath your application, and building resilience through knowledge.
In a world of abstraction layers, sometimes the most powerful thing you can do is go closer to the metal.