Two Linux boxes kept in step
How I keep two Linux boxes level: code by git, working folders by Syncthing, packages checked daily, and tests and builds sent from the one I carry to the one at home.
I work on two Linux boxes. The one I sit at has a six-core i7-9750H and 32 GB, and it comes with me. The one that stays at home has an i9-13900HX, 24 cores and 64 GB, and a 12 GB RTX 4080. Both run Ubuntu 26.04.1 on the same kernel with the same packages, and either can do any job alone, because the one I carry travels and can’t count on reaching the house.
That rules out the usual arrangement of a big machine with a thin client in front of it. It also means there are two of everything to keep level.
What moves between them
Code moves by git and nothing else. Repos are cloned on both, and I push from one and pull on the other. A summary I can run from either box lists the repos that are at different commits, and as I write this it lists nine.
Everything that isn’t code and isn’t a database moves by Syncthing: eleven folders, each shared separately. Documents, downloads and media are three of them, and the rest are the working folders of my own tools.
documents: idle files=46456 need=0 needBytes=0 errors=0
downloads: idle files=7937 need=0 needBytes=0 errors=0
media: idle files=4189 need=0 needBytes=0 errors=0
It’s set up to be private. Global discovery, relays and NAT traversal are all off, and each box is told the other’s two addresses, one on the home network and one on the private network between them. Both sides keep staggered versions for 30 days, 7 for downloads, so a delete on one box can be undone on the other. Repos, worktrees, ~/.ssh, browser profiles, keyrings and /data are never shared, and a git repo that turns up inside a shared folder is ignored.
Databases don’t move at all. Each box has its own working copies for the local sites I develop, and they’re disposable. They aren’t backed up either. The box I carry backs up everything else with restic, over ssh, to a 20 TB drive on the home one. That runs every night, again the next day if the night’s run didn’t leave a good snapshot, and only on mains power.
Checking they still match
Packages drift the moment I apt install something on one box and forget the other. A daily check lists the manually installed packages and snaps that the box I carry has and the home one lacks:
parity OK no packages or snaps missing
syncthing peer connected, 11 of 11 folders idle and complete
When it does find something, the same script that built the home box installs it. I run that by hand, never on a timer.
Some of ~/.config is different on purpose: monitor layouts, remote desktop settings, anything tied to the hardware. Nothing syncs that folder, and the guide lists which parts are meant to differ.
Sending the heavy work home
The box I carry stays light. The rule is a hook in my coding-agent sessions: on that box it refuses test runners, builds, installs and heavy lints, and prints the command to use instead. That one runs the job on the home box over ssh, in the same repo at the same path.
The home box has four job slots. A job that asks for it gets a share of whatever cores are free at that moment, at most three quarters of them, in an environment variable:
pytest -n "$JOB_CORES"
If all four slots are taken, the job can wait in a queue for a number of seconds I give it. With nothing else running, the home box reports this:
30.8 of 32 cores free (load 1.16), 44.7 of 61.5 GB RAM free, 0 remote jobs
There’s one exception in each direction. When the home box is serving a local model its job slots are switched off, and tests may run on the box I carry. If the home box has been idle for three minutes, though, it’s switched back to taking jobs and the job goes there after all. And on the home box itself nothing is sent anywhere: its only listed worker is the box I carry, with one slot, and it runs its own tests in place.
Both are meant to be on when they’re at home. When one stops answering the other, the daily check fails for the first two days and after that drops to a single warning saying how long it’s been gone, so taking one box away for a week doesn’t fail the check every morning.
Featured projects
-
Apple News API
Publish articles and live coverage to Apple News from PHP, with the whole Apple News Format built from objects.
-
GitHub Auditor
Health, access and activity reports for more GitHub and Bitbucket repositories than you can keep in your head.
-
PrintMD
Markdown in, and a designed PDF, Word or PowerPoint file out. Its PDF service runs on your own computer.
-
Where Should I Live
Which city would leave you best off? Cities ranked by take-home pay, living costs, visas and the way you live.
-
Solar Calendar
Thirteen months of exactly four weeks, with the year starting on the first Monday on or after the spring equinox.
Latest writing
-
Many sessions at once, and what still needs me
Fifteen coding-agent sessions across two Linux boxes, one session that watches the rest, what it may answer for me, what it never may, and why a yes it passes on gets checked against what I typed.
-
61 public repos of agent tooling, none installed, six ideas kept
One author, 61 public repositories of coding-agent tooling: what I checked before any of it got near my Linux boxes, why none of it was installed, and the six ideas I built my own way.
-
Rules a coding agent cannot talk its way round
The hook that reads every command a coding agent wants to run on my Linux boxes: what it refuses, the 27 proofs that its tests fail when a rule is taken out, and the four lines every report opens with.
-
Dozens of repos, one person
46 repositories and two Linux boxes with nobody else on them: the diary, the decision table, the rebuild guide and the job that keeps both sets of clones in step.