The Journey to the Holy Grail, Part 3: The Golden Image Saga

To make servers the Hub can trust, we bake golden images. It took a dozen builds, one bug that bought eight identical servers, a mirror that kept returning 503, and a console we could only read through a browser.

Watcher

4 min read

Part 3 of The Journey to the Holy Grail (opens in a new tab). Previously: Leaving Google, Finding OVH (opens in a new tab).

By the end of Part 2 (opens in a new tab) we knew what we wanted: the Hub making, moving and replacing servers by itself, without a person carrying a checklist in their head. For that to be safe, every server has to start from the same known place.

That place is a golden image: a server built once, checked, powered off and photographed, so every box made from it starts identical. We bake two. gold-app is for app servers and gold-db is for database servers, both on Ubuntu 26.04.

Ubuntu 26.04 brought the newest of everything with it: Python 3.14, Node 24 and, by the end of this story, Postgres 18. The old app server ran Python 3.12. Every client copy built from the new images runs 3.14. That's our "stay on the latest" rule showing up in the actual servers, not just in a memo.

The recipe for a golden image is short. The saga of getting one was not.

Build one: nothing happened

The first golden image run sheet (CHG-117) stopped at step one without making anything at all. The Hub was trying to read the build recipe from GitHub. Our code lives on the Forge.

That was a one-line fix and a new release. It was also an early hint that every assumption we'd carried over from the old way of doing things was about to be tested.

Build two: eight servers

The second run (CHG-118) got further. It rendered the recipe, asked OVH for a server, and then failed with "quota exceeded". That was strange, because it should have made exactly one server.

It had made eight.

The culprit was one line of Go: defer keepMade(l, st.ID, made). A defer evaluates its arguments when it's declared, not when it finally runs. So the Hub's note to itself, "I made this server", was captured empty, before the server existed. Every 15 seconds the run sheet checked its notes, saw nothing made, and politely made another, until OVH's quota stopped it at ten.

The lesson is now pinned above the code: never defer f(x) when x changes later. Use a closure. We deleted seven servers, kept one, asked OVH nicely about the bill, and taught the Hub two new habits:

  • Before creating anything, look for what you already made, by name, and adopt it.
  • When the provider says "quota", say "quota", not "your key can't do that".

Build three: the box that never powered off

A golden build ends with the server powering itself off. That's the signal that it's ready to be photographed. The app image did it in eight minutes, exactly as planned.

The database image never powered off. We waited two hours, rebuilt, and waited two more.

We couldn't see why, because OVH's US API has no way to read a server's console log. So in the end we did it the old-fashioned way: we opened OVH's web console in a browser at midnight and read the server's screen.

There it was. Ubuntu's package mirror had answered 503 for one small package, a dependency of Redis. apt gave up with exit code 100, and the build stopped quietly, with nobody watching.

The fix was humble and lasting:

  • apt now retries five times, with back-off.
  • Every build prints its output, with a big FAIL banner on error, to every screen the server has.

Next time something breaks at midnight, the screen will say why.

Build four: the check that counted wrong

The next database build passed everything except one of our own checks: "only one Postgres major installed". It was counting packages that dpkg merely remembered, plus extensions, as if they were servers. We taught it to count installed server packages only.

At 23:54 UTC on October 31, both golden images were finally done.

Then the stand-ups wouldn't enroll

A golden image becomes a real server at stand-up. It gets its own WireGuard key, joins our private network, starts its Linexus agent and enrolls with the Hub, so the Hub knows it exists and can file it in the right pool.

Our first two stand-ups did everything right. They booted, joined the network and enrolled. Then the Hub never noticed them. The agents sat in an inbox, because the enrollment never wrote the one record the Hub uses to file new machines. One more fix and one more release later, on November 1, Camelot's two servers were placed and live.

What we kept from the saga

  • Build output on the console, always. A server that fails silently costs hours.
  • Retries for the outside world. Mirrors return 503. Plan for it.
  • Adopt, don't duplicate. Anything that creates must first look for what it already made.

With trustworthy servers in hand, it was time to actually move a site onto them. We started with our own, and found out exactly how many things a "simple move" depends on. That's Camelot (opens in a new tab).