Skip to content
anokha.space
Go back

my homelab is an m1 macbook air and a usb ssd

people show off homelabs with server racks and blinking lights. mine is an m1 macbook air with sleep turned off and a 1tb ssd hanging off a usb cable.

it works. mostly. here’s what’s on it.

the hardware

  • m1 macbook air. 8 cores, and docker desktop gets 4gb of ram
  • a 1tb external ssd split into two volumes. one for media, one called Dev where everything lives
  • pmset sleep set to 0, because a homelab that naps isn’t a homelab

the internal disk is basically just macos. everything stateful sits on the ssd, so if the laptop dies i move the cable to another mac and carry on. in theory. i haven’t tested it and i’m not going to volunteer.

how i reach it

everything lives at <thing>.home.anokha.space.

  • tailscale on every device. the dns record points at the laptop’s tailscale ip, so the urls resolve for anyone but only work on my tailnet
  • caddy, custom built with the cloudflare dns plugin, gets one wildcard cert with a dns-01 challenge. no ports open on the router, and still real https with a green lock
  • one *.home.anokha.space block in the caddyfile, with a handle per subdomain
*.home.anokha.space {
	import tls_cf

	@photos host photos.home.anokha.space
	handle @photos {
		reverse_proxy ente-web:3000
	}

	# ...20 more of these

	handle {
		redir https://home.anokha.space
	}
}

adding a new service is 4 lines and a caddy reload. that’s the whole appeal.

there’s also a whoami subdomain that just echoes back the host and my ip. it’s useless 99% of the time and lifesaving the other 1%.

what’s running

8 compose stacks, 15 containers, plus a few things running natively on macos.

  • ente for photos. my google photos replacement. end-to-end encrypted, and the face search runs on the phone, so the poor air doesn’t have to
  • jellyfin for movies and shows, plus the usual *arr gang (sonarr, radarr, prowlarr, seerr) to keep the library organised. transmission runs natively
  • copyparty for files. one python file that does way more than it should
  • papra for documents. receipts, ids, the boring stuff you suddenly need at 11pm
  • metube for youtube downloads, from a web ui
  • adguard home for dns-level ad blocking
  • desk, my own thing, packaged as a container
  • squoosh for image compression, served as static files
  • a couple of bun apps under launchd: a handbrake web ui i wrote (upload a video, pick a preset, get it back smaller), a drizzle gateway for poking at databases, and an artifacts server
  • syncthing, because it’s always syncthing

the watchdog

this is the part i’m actually proud of.

a laptop homelab has a fun failure chain. the ssd unplugs, then the Dev volume isn’t mounted, then docker is up but pointing at nothing, then the containers die, then caddy is serving 502s. and all of it happens silently while you’re out.

so there’s a bash script that a launchd agent runs every 60 seconds. it walks the chain in order:

ssd -> Dev volume -> docker -> compose stacks -> caddy -> host services

each link has to be healthy before it checks the next one, and it fixes what it safely can. a few things i learned the annoying way:

  • check mounts with df, not mount. a hung force-unmount can leave a stale line in mount, and then the script happily thinks everything is fine
  • if the volume is mounted but not writable, don’t touch it. log it and leave it for a human. auto-fixing a disk is how you lose a disk
  • macos has no timeout command, so every risky call goes through a tiny perl alarm wrapper
  • a lock directory, so two runs never fight each other
  • services are discovered, not listed: any folder in self-host/ with a docker-compose.yml, and any launch agent named self-host.*. new service, zero watchdog config
# run a command with a timeout (macOS has no `timeout`)
t() { local s=$1; shift; perl -e 'alarm shift; exec @ARGV' "$s" "$@"; }

# df, not mount: a hung force-unmount can leave a stale /Volumes/Dev line in `mount`
dev_mounted() { [ "$(t 10 df "$DEV" 2>/dev/null | awk 'NR==2{print $NF}')" = "$DEV" ]; }

on every exit it also writes a status.json, and the home.anokha.space page reads that. so i have a status dashboard without running a status dashboard.

the family problem

then i wanted to share photos with family, and they are not installing tailscale. fair.

the answer is a cloudflare tunnel (already running in a container) for the few things that need to be public, like ente’s shared album links. no open ports and no home ip in dns. everything else stays tailnet-only.

the catch is real though: if my laptop is asleep or the ssd is unplugged, the family photos are down. fine for sharing albums. not fine as anyone’s only backup.

would i recommend it

for a first homelab? honestly yes. you probably already own the hardware, and an m1 idling is way cheaper to run than an old tower.

just don’t pretend it’s a server. it’s a laptop that’s very committed to the bit.

tl;dr: tailscale + one wildcard cert + caddy + a paranoid bash script = a homelab that survives me unplugging things.



Previous Post
we acked every ble frame, then none, now every 32nd
Next Post
my water purifier thinks it's january 2025