The Journey to the Holy Grail, Part 4: Camelot
Camelot was the first pool built from golden images. Getting a site onto it took an OpenSSH surprise, a Python decision, a Postgres permission rule, a missing systemd unit that took our own test site down for hours, and a Postgres 16 to 18 upgrade.
Watcher
4 min read
Part 4 of The Journey to the Holy Grail (opens in a new tab). Previously: The Golden Image Saga (opens in a new tab).
Camelot is our Virginia pool: cm-prd-app01 for the sites and cm-prd-db01 for their databases. Both were stood up from the golden images (opens in a new tab) on November 1. Standing them up turned out to be the easy part. Moving a single site onto them took most of a Saturday.
We always move our own site first. It's called Canary for exactly that reason: if something is going to go wrong, we want it to go wrong to us.
Plenty went wrong.
The deploy kit that couldn't read a key
Before an app server can take a site, it needs our deploy tooling, which it reads from the Forge using its own key. One step pins the Forge's SSH host key with ssh-keyscan, so the server knows it's talking to the real Forge. That step failed five times in a row: "(stdin) is not a public key file".
The cause was a quiet change in OpenSSH 10. It prints its comment lines to standard output, where older versions sent them to standard error. Our parser was handed a comment where it expected a key, and choked. We reproduced it through a tunnel, filtered out the comments, and shipped the fix.
In the same pass we found the kit looking up the running Hub release under the product name "hub". The Hub calls itself "solnyxus". Small things, but each one a wall.
Postgres says no
With the tooling in place, Canary's warm install got as far as its database step and failed there.
Postgres 16 has a careful rule: a role with CREATEROLE can't alter another role unless it holds ADMIN on it, and revoking access to a database needs ownership or an inheriting membership. Our provisioning role had neither for roles made before it existed. We wrote one signed order (CHG-157) that granted exactly those rights and nothing more. Then we tried again.
The worker that wasn't there
This time the move got all the way to the cutover. To go quiet, so nothing writes to the database during the copy, the old copy runs systemctl stop on its three services: frontend, worker and backend.
Canary has no worker service. Its background jobs run on timers instead.
So systemd stopped two services and failed on the third. The move then ran its way back, systemctl enable --now on the same three, failed on the same missing one, and started none of them. Canary answered 502 from 13:36 to 17:09 UTC. It was our own test site, which is exactly why it goes first, but three and a half hours is still three and a half hours.
The fix makes a move ask systemd which of a copy's units actually exist, services and timers alike, and act on only those. A missing unit is now reported and skipped, never treated as a failure.
"Why are we copying? Just pull the code."
Somewhere in the middle of all this, Charles asked the question that reshaped the whole move: why were we copying a site's entire application from one server to another, instead of pulling the code base fresh and attaching the media?
He was right, and the move took that shape. It installs a fresh warm copy from the release on the new server, copies only the uploads, and saves the database for last, while the old copy is quiet.
The dump that wouldn't restore
The next run (CHG-159) went smoothly until the very last database copy, which failed with:
unrecognized configuration parameter "transaction_timeout"
Here's what happened. Our app servers run Ubuntu 26.04, so their pg_dump is version 18. Version 18 writes a line, SET transaction_timeout, for a setting Postgres 17 introduced. Camelot's database server still ran Postgres 16, which had never heard of it and refused the whole restore.
We had three options: pin an old client, filter the line out, or move up. Our rule is to stay on the latest, so we moved up, with a careful Postgres 16 to 18 upgrade:
It ran (CHG-161) in under three minutes. The golden images now build Postgres 18 from day one.
The rollback that wasn't finished with us
With the database fixed, Canary finally landed on Camelot. Then the next site in line, Tiny Tim's, failed its health check with a certificate error. The order did what it was built to do, and put everything back, Canary included.
That's where Saturday turned into Sunday, and where the late-night tickets (opens in a new tab) begin.
Databases
More like this
Databases
SeaORM, Diesel and Django ORM, Oh My! Picking an ORM Without Getting Lost on the Yellow Brick Road
Lions and tigers and bears, oh my! Except it's SeaORM, Diesel and Django ORM, and the forest is your database. The same query in all three, what each one is best at, and the N+1 problem that eats all of them alive.
Databases
Postgres uuidv7 in PostgreSQL 18: Time-Ordered Primary Keys in Ten Minutes
PostgreSQL 18 ships a built-in uuidv7() function, so time-ordered UUID primary keys need no extension. A ten-minute lab: make a table, read the timestamp back out, backfill with a shift, and know when not to use them.