Ramblings of an aging IT geek
← Ramblings of an aging IT geek
homelab

one compose file to run the whole house

Consolidating a sprawl of homelab services into a single Docker Compose stack, and why one file you can read beats a dozen you can't.

A small server rack with neat cabling

For a while my homelab grew the way these things do: a container here when I needed DNS, another there when I wanted to self-host the photos, each one started by hand with a docker run line I'd pasted from a forum and then promptly lost. It worked, right up until the box rebooted and I had to remember what half of it was and in what order it came up.

So one wet Sunday I sat down and consolidated the lot into a single docker-compose.yml. Not because anyone made me, but because I was tired of the house's services living in my head.

A tidy homelab rack with labelled cables

the shape of it

The whole thing is one file now. DNS, the reverse proxy, the bits that run the smart-home side, the photo library, the odds and ends. Each service is a dozen lines and they all share a couple of networks. Here's the texture of it, trimmed right down:

services:
  dns:
    image: pihole/pihole:latest
    restart: unless-stopped
    networks: [edge]
    volumes:
      - ./dns/etc:/etc/pihole
    environment:
      TZ: "Europe/London"

  proxy:
    image: traefik:v2.8
    restart: unless-stopped
    networks: [edge, internal]
    ports: ["80:80", "443:443"]
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - ./proxy:/etc/traefik

networks:
  edge:
  internal:

The two things I'd point at. First, restart: unless-stopped on everything. That single line is the difference between "the house comes back after a power cut" and "I get a text from someone in the house asking why the lights app is broken." Second, the reverse proxy reads the Docker socket and works out routing from labels on the other services, so adding something new is a matter of a few labels rather than editing a config in three places.

why one file is the point

The temptation is to split it up, a compose file per service, all very tidy and modular. I tried that. It's worse. The whole value here is that I can open one file and see the entire house: what's running, what talks to what, where the data lives. When something misbehaves I'm reading one document, not chasing a thread through a directory tree at half eleven at night.

docker compose up -d        # the whole house
docker compose ps           # what's actually running
docker compose logs -f dns  # why the internet "is broken"

It's not clever. There's no orchestrator, no Kubernetes, no clustering, because there is exactly one machine and that is by design. For a house, one box and one file you can hold in your head beats anything more sophisticated.

The real win came the week after, when the box did reboot, unplanned, during a power blip. Everything came back on its own and I found out only because I happened to check. That's the whole goal of a homelab, really: that the people you live with never have to know it exists.