I Built a CDN for My House and I Have No Regrets

March 14, 2024

It started innocently enough. I wanted to load a photo of my cat from my phone without waiting a whole 0.3 seconds.

Three months, fourteen configuration files, and one existential crisis later, I had a multi-region CDN distributed across three Raspberry Pis, a retired laptop running Proxmox, and a VPS in a datacenter that I pay for but definitely dont need.

The photo of my cat loads in 47 milliseconds now.

She didnt even appreciate it. The cat, I mean. My girlfriend was… actually I haven’t seen her in a few days. Pretty sure she said something about milk.

Anyway heres the architecture:

Internet
  ↓
Cloudflare (free tier, because I have principles)
  ↓
VPS in some basement in Finland (I think?)
  ↓
Load balancer (it's just nginx with anxiety)
  ↓
  ├── Pi 4 in the closet (primary)
  ├── Pi 3 in the laundry room (failover)
  ├── Laptop under the couch (warm spare)
  └── My phone when I'm home (experimental edge node)

Does it work? Yes.

Is it maintainable? Absolutely not.

Would I do it again? I already ordered another Pi.

The best part is I’m the only one who uses this network. My cat doesnt even browse the web. She just sits there. Judging me. Plotting.

If I die and someone finds this setup, I want them to know: I had reasons. They were not good reasons, but they were mine.

Moral of the story: If you’re gonna be stupid, be stupid with cache headers.