Side LaneNotes and tools from the side of a full-time job

Library / Engineering

Home server brief

Brief for a coding agent

The home PC that runs my staging and CI, written as a brief for a coding agent: no open ports, two isolated VMs, a fresh container per CI job, deploys that are pulled.

The storyWhy setting up a home PC feels so liberating on Substack

My staging environment and CI run on a PC at home for €0 a month besides electricity. I did not type the commands. I described what I wanted, the AI connected to the machine and did the setup, and I read what it was doing and said yes or no.

This brief is that setup written down afterwards, with the traps I hit added at the end. It is not the exact text I typed at the time.

The same machine is where my AI sessions run. I connect over SSH, start a session and close the laptop lid. The session keeps going.

What you need

The brief

home-server-brief.md
Set up this machine as a home server for my side project. You have SSH access.

How to work
- Before each step, say what you are about to do and why, in two sentences.
- Ask me yes or no before anything that changes the firewall, the network, the boot process or a disk.
- Keep a runbook file: every command that changed something, in order, with the reason.
- If a step fails twice, stop and show me the log. Do not work around it.

What I want at the end

1. Nothing is reachable from outside
   - No ports forwarded on the router.
   - The host firewall denies all incoming traffic.
   - SSH listens only on the Tailscale interface, accepts keys only, refuses root.

2. Two virtual machines, managed with Incus, starting with the host
   - "staging": runs the app stack.
   - "ci": runs pull request checks, at lower CPU priority.
   - Size them for this machine. Mine: staging 4 vCPU and 12 GB, ci 8 vCPU and 28 GB.
   - Each on its own network bridge. Each can reach the internet.
   - Neither can reach the home router, the host's SSH, the Tailscale network or the other VM.
   - Prove that from inside each VM and show me the output.

3. Visitors reach staging without an open port
   - A Cloudflare Tunnel daemon inside the staging VM dials out.
   - Cloudflare Access sits in front, with a login and an allow-list of email addresses.

4. A fresh container for every CI job
   - A "golden" container holds the toolchain and warmed caches. A timer rebuilds it from the main branch every night.
   - Each job runs in a new unprivileged container cloned from a snapshot of the golden one.
   - The container registers as a runner for exactly one job, runs it, and deletes itself.

5. CI cannot deploy
   - When main is green, the last job moves a git tag.
   - A timer inside the staging VM checks that tag every two minutes with a read-only deploy key.
   - If it moved, the VM pulls the commit, builds the images and restarts the stack.

Traps I already know about
- VM images with cloud-init can reboot forever. If a VM does not stay up, read a verbose boot log before trying anything else, and try a plain image.
- An app behind the tunnel sees plain HTTP. It must trust the proxy's X-Forwarded-Proto header, or sign-in will refuse every request.
- AI (MCP) clients cannot pass the Cloudflare Access login. If one must reach the app, give that endpoint its own hostname that forwards only the paths it needs and returns 404 for the rest.
- A backup does not count until a restore has been rehearsed. Put the rehearsal in the runbook as an open item.

What it will not do

What to check yourself

My numbers

Weak spots

I am the operations team: when it breaks, I fix it, and it broke on day one. The PC is on Wi-Fi through a USB adapter and should be on a cable. A power cut takes staging, CI and my AI sessions down together.

Get the next note by email

Free. New notes and new library items go out through Substack.

Or read the notes first: sidelanenotes.substack.com