vibescoder

Migrating Coder Off the RTX 5090, Part 2: Backup, Cruft, Auth, and the Cutover

·7 min read

Part 1 covered the origin and the plan. Part 2 is the execution, and it’s where the gotchas lived. The order mattered. A few traps came from choices I had made two steps earlier.

PostgreSQL 13 Could Not Read the Newer Dump Format

Every migration should start with a backup. The reason I was so insistent here is the same reason I care about chat history. I cannot regenerate that state. So before changing the deployment, I took a full pg_dump of the production Coder database and made three checksummed copies of it, one of them on the machine I was about to modify.

Then I hit the trap. The production Coder server runs against a PostgreSQL 13.21 instance. But the machine where I took the dump had a much newer system tool. When I tried to restore that dump into a PostgreSQL 13.21 container on the Strix, it refused:

unsupported version (1.15)

This is the kind of error that looks like a data problem but isn’t. The dump was fine. The host’s PostgreSQL 16.15 pg_dump wrote custom-format version 1.15, and the older pg_restore on the target could only read 1.14. Same data, incompatible envelope.

For this same-version migration, I used a PostgreSQL 13.21 container to produce a dump its matching restore tool could read. The pg_dump compatibility rules matter when choosing tools, especially if source and target versions differ.

The Template Cleanup Left the Inference Stack Alone

Here’s where the “clean production install” preference did real work. Before re-pushing anything, I inventoried the template repo for cruft. The goal wasn’t just to shave bytes. It was to figure out what was load-bearing and what was an artifact of incremental change.

I removedWhy
A dead locals blockNothing referenced it
An unused docker_socket var + provider host blockLooked like configuration, did nothing
5 skills baked into the startup scriptStale copies of database skills
A broken submoduleA nested directory was a gitlink with no .gitmodules entry
One-time sed/rm cleanup linesMeant to run once, ran on every start
An entire undeployed templateNo workspaces referenced it
Scattered SSH aliasesConsolidated into one block with the missing Chromebox alias

The baked skills were the big one. Those five were stale duplicates of skills that now live in the Coder database, and they’d drifted from the real versions. Baking them into every workspace on every start was redundant at best, actively misleading at worst.

I kept separate systems out of that cleanup.

I left aloneWhy
The inference stack (embed, generation, firewall)A separate concern from Coder
A model sharing a name with a deleted templateSeparate inference infrastructure, unrelated to the template
The live RTX 5090 deploymentThe source had to stay available during the migration
A local-host session tokenLeft on the old host; not copied to Strix
Dead experiment env flagsExcluded from the new deployment

Removing cruft is easy when it’s obviously dead. The skill is recognizing the thing that looks like cruft but is actually a different concern, and leaving it alone.

The database restore initially preserved 924 chats and 92,597 messages, along with 180 workspace records. I re-pushed templates from the repo and rebuilt provisioners on Strix. I left workspace home volumes behind. Chat history lived in PostgreSQL and remained accessible independently of the workspace volumes. After pruning restored workspaces, 13 remained live. Those are counts at different stages of the migration, not a frozen final total.

Two GitHub Providers Needed the Same App Credentials

GitHub auth was the part that took the most back-and-forth, mostly because I insisted on keeping the flow I already knew. My setup used two GitHub integrations. External authentication provides workspace credentials for Git and the gh CLI. GitHub login authenticates users to Coder. Both had been disabled in the initial Strix setup.

I created a GitHub OAuth app for the Strix hostname through GitHub’s developer settings and wired both integrations to it.

I hit two failures with distinct causes.

FailureRoot causeFix
Login refused to startNo allowed organizations configuredAllow existing users without an organization restriction; keep new signups blocked
incorrect_client_credentialsDifferent app secrets across the two integrationsUse the same app credentials for both

The second one was the nasty one. incorrect_client_credentials usually means the secret is wrong, but the secret was right. The actual problem was that the external-auth provider had one secret value and the login provider had a different one, because of a copy-paste during setup. Both integrations used the same app. Once their secrets matched, login worked.

A migration is a chance to get auth config right, not just copy it. The old deployment’s GitHub links had expired tokens and no refresh tokens. That may have contributed to the credential trouble in workspaces, but I did not isolate it as the cause. The new deployment, with a fresh app and correctly wired providers, gave me working auth from the start.

Renaming the PostgreSQL Role Cleared Its MD5 Password

The instance refused to stay “staging” in spirit, so I renamed it. The Compose project, the database, the environment file, all of it. This is the kind of cleanup that feels cosmetic until it isn’t.

The gotcha was in the database rename. When I renamed the PostgreSQL role, the rename succeeded, but it silently cleared the role’s password. The Coder container then retried the connection forever, failing with password authentication failed for the renamed user. PostgreSQL’s ALTER ROLE documentation for version 13 explains the condition I had missed. Renaming a role clears an MD5-encrypted password because the role name is part of its salt. This is not a rule for every password format. I restored the password from the environment file after this rename.

I Disabled Boot Hooks While the Source Stayed Live

The last part was making the RTX 5090 a clean slate rather than a half-retired control plane. I reviewed its boot services and decided what should survive the next restart.

  • The Coder service and its Cloudflare tunnel → disabled. The box no longer owns the deployment.
  • An orphaned agent deployment I’d since moved to another machine → disabled, config archived, removed.
  • A dead hardware-monitoring cron that only made sense on an NVIDIA box → removed.
  • The old inference stack → config backed up, boot-persistence disabled.

The constraint was that I did all of this without stopping anything. The RTX 5090 was still the machine powering the very workspace doing the work. So I only stripped the boot hooks. Disabling their boot hooks did not stop the running source services. Their retirement would take effect at the next restart, leaving the machine ready for its next inference workload.

By the Numbers

  • 3 checksummed copies — Copies of the production database backup
  • 1.15 versus 1.14 — The incompatible dump format and the format accepted by the target restore tool
  • 5 baked skills — Stale startup-script copies removed in favor of database-managed skills
  • 924 chats and 92,597 messages — Counts verified at the initial database restore
  • 180 workspace records — Restored initially, with 13 live workspaces after later pruning
  • 2 GitHub auth failures — An empty allowed-org list and mismatched app secrets
  • 1 MD5 role password — Cleared by the role rename and then restored
  • 0 source services stopped — Only their boot hooks were disabled during retirement

Comments