host: rename the OS user and stored objects (legacy-rename role) #584

Stängd
öppnade 2026-10-08 14:53:02 +00:00 av supernaut · 3 kommentarer
Ägare

Part of bitborg/bitborg-docs#128 (ADR 0043).

Rename the OS user, its home and every stored object that carries the legacy name. Run after the Keycloak cutover in bitborg/bitborg-docs#127.

The user rename moves the home directory. The rootless graphroot lives under it and podman rejects a moved graphroot ("database configuration mismatch"). So the rename needs a fresh podman store. Volumes, secrets and networks are recreated in the new store and only volume data is copied.

Scope

  • legacy-rename role, first in both plays.
  • OS user and group to bitborg, uid 2000 kept. Linger, subuid, subgid, fstab updated.
  • Fresh podman store. Volumes, secrets, networks, images renamed. Volume data copied.
  • Postgres database and role rename in the web role.
  • Backup dump-member dual consumer, restic host name.
  • Identity-provider objects are out of scope: the old provider is removed at cutover.

Done when

On each host:

  • getent passwd gitborg is empty and id bitborg shows uid 2000.
  • grep -c gitborg /etc/passwd /etc/group /etc/shadow /etc/subuid /etc/subgid /etc/fstab is 0 everywhere.
  • As bitborg: podman volume ls, podman secret ls, podman images and systemctl --user list-units --all contain no gitborg. psql -c '\l' -c '\du' the same.
  • restic snapshots --host gitborg-prod is empty.
  • Repo count and portal row counts equal the preflight. A backup drill passes.

Rehearse on staging first. Take a backup and verify it before the window.

Part of bitborg/bitborg-docs#128 (ADR 0043). Rename the OS user, its home and every stored object that carries the legacy name. Run after the Keycloak cutover in bitborg/bitborg-docs#127. The user rename moves the home directory. The rootless graphroot lives under it and podman rejects a moved graphroot ("database configuration mismatch"). So the rename needs a fresh podman store. Volumes, secrets and networks are recreated in the new store and only volume data is copied. ## Scope - [ ] `legacy-rename` role, first in both plays. - [ ] OS user and group to `bitborg`, uid 2000 kept. Linger, subuid, subgid, fstab updated. - [ ] Fresh podman store. Volumes, secrets, networks, images renamed. Volume data copied. - [ ] Postgres database and role rename in the web role. - [ ] Backup dump-member dual consumer, restic host name. - [ ] Identity-provider objects are out of scope: the old provider is removed at cutover. ## Done when On each host: - `getent passwd gitborg` is empty and `id bitborg` shows uid 2000. - `grep -c gitborg /etc/passwd /etc/group /etc/shadow /etc/subuid /etc/subgid /etc/fstab` is 0 everywhere. - As `bitborg`: `podman volume ls`, `podman secret ls`, `podman images` and `systemctl --user list-units --all` contain no `gitborg`. `psql -c '\l' -c '\du'` the same. - `restic snapshots --host gitborg-prod` is empty. - Repo count and portal row counts equal the preflight. A backup drill passes. Rehearse on staging first. Take a backup and verify it before the window.
Upphovsperson
Ägare

Scope additions (2026-10-14):

  • The bitborg-id user (uid 2001) keeps its container store on /srv/gitborg-data/bitborg-id/containers, bind-mounted with x-systemd.requires-mounts-for=/srv/gitborg-data. The unmount step must stop user@2001 and rewrite that fstab bind line. The bind target inside /home/bitborg-id does not change, so that store needs no copy.
  • Keycloak already writes ~/.config/bitborg/keycloak under the old home. Moving ~/.config/gitborg to ~/.config/bitborg must not nest one inside the other: move entries one by one and fail on a name clash.
  • Order: Kanidm removal (#577), Forgejo v17 (#716), Keycloak isolation (#670), then the pre-window renames and the portal database rename, then this issue.
Scope additions (2026-10-14): - The `bitborg-id` user (uid 2001) keeps its container store on `/srv/gitborg-data/bitborg-id/containers`, bind-mounted with `x-systemd.requires-mounts-for=/srv/gitborg-data`. The unmount step must stop `user@2001` and rewrite that fstab bind line. The bind target inside `/home/bitborg-id` does not change, so that store needs no copy. - Keycloak already writes `~/.config/bitborg/keycloak` under the old home. Moving `~/.config/gitborg` to `~/.config/bitborg` must not nest one inside the other: move entries one by one and fail on a name clash. - Order: Kanidm removal (#577), Forgejo v17 (#716), Keycloak isolation (#670), then the pre-window renames and the portal database rename, then this issue.
Upphovsperson
Ägare

Staging rehearsal, 2026-10-14. Branch feat/legacy-rename-role.

  • Run 1 migrated, then stopped in the forgejo role. Its system-webhook GET goes through Caddy, which had not converged yet on the fresh store. It needed a --tags caddy pass and then a full pass. Every verify item passed. The counts diff was empty, git fsck was clean, and the invoices were intact.
  • Soft rollback: 36 s. Applying main afterwards hit the same webhook stop, with the same workaround. Staging served on the old names again.
  • Fixes: the webhook check is warn-only (separate PR to main, because a rollback applies main). The relabel also refreshes udev, so the old by-label device unit no longer lingers.
  • Run 2 with the fixes: one pass, 435 s, and --check showed changed=0 afterwards. Script phases: save 85 s (services up), stop/user/mounts 17 s, load 91 s, volume copy 4 s. Services were down about 6 min.
  • Window estimates are in the runbook: A about 15 min, B about 25 min, book 1 h each.

Staging now runs on the new names. Do not apply main to staging until this branch merges.

Staging rehearsal, 2026-10-14. Branch `feat/legacy-rename-role`. - Run 1 migrated, then stopped in the forgejo role. Its system-webhook GET goes through Caddy, which had not converged yet on the fresh store. It needed a `--tags caddy` pass and then a full pass. Every verify item passed. The counts diff was empty, `git fsck` was clean, and the invoices were intact. - Soft rollback: 36 s. Applying `main` afterwards hit the same webhook stop, with the same workaround. Staging served on the old names again. - Fixes: the webhook check is warn-only (separate PR to `main`, because a rollback applies `main`). The relabel also refreshes udev, so the old by-label device unit no longer lingers. - Run 2 with the fixes: one pass, 435 s, and `--check` showed `changed=0` afterwards. Script phases: save 85 s (services up), stop/user/mounts 17 s, load 91 s, volume copy 4 s. Services were down about 6 min. - Window estimates are in the runbook: A about 15 min, B about 25 min, book 1 h each. Staging now runs on the new names. Do not apply `main` to staging until this branch merges.
Upphovsperson
Ägare

Both windows ran on prod 2026-10-15 from feat/legacy-rename-role (#753). Window A (monitoring) stopped after the rename on a caddy.socket ordering bug, fixed on the branch, and finished on a plain re-run. Window B (services) took 15 min in one pass. After B: --check changed=0, no gitborg objects left, restic snapshots rewritten to bitborg-prod, backup, verify (pre-window and new archive), drill and sign-up drill passed. Closes when #753 merges. Purge follows in #585.

Both windows ran on prod 2026-10-15 from feat/legacy-rename-role (#753). Window A (monitoring) stopped after the rename on a caddy.socket ordering bug, fixed on the branch, and finished on a plain re-run. Window B (services) took 15 min in one pass. After B: --check changed=0, no gitborg objects left, restic snapshots rewritten to bitborg-prod, backup, verify (pre-window and new archive), drill and sign-up drill passed. Closes when #753 merges. Purge follows in #585.
Logga in för att delta i denna konversation.
Ingen milstolpe
Inga tilldelade
1 deltagare
Notiser
Förfallodatum
Förfallodatumet är ogiltigt eller utanför gränserna. Använd formatet "åååå-mm-dd".

Inget förfallodatum satt.

Beroenden

Inga beroenden satta

Referens
bitborg/bitborg-infra#584
Ingen beskrivning angiven.