Back up and drill-restore the Keycloak database #572
Etiketter
Inga etiketter
area/backups
area/ci
area/control-panel
area/identity
area/infra
area/observability
area/payments
area/security
area/storage
area/web
blocked
needs-info
needs-triage
priority
high
priority
low
priority
medium
ready-for-implementation
type
bug
type
chore
type
docs
type
epic
type
feature
type
task
wontfix
Ingen milstolpe
Inget projekt
Inga tilldelade
1 deltagare
Notiser
Förfallodatum
Inget förfallodatum satt.
Beroenden
Inga beroenden satta
Referens
bitborg/bitborg-infra#572
Läser in…
Hänvisa till i nytt ärende
Ingen beskrivning angiven.
Ta bort grenen "%!s()"
Borttagning av en gren är permanent. Även om den borttagna grenen kan fortsätta existera en kort tid innan den faktiskt tas bort, kan det INTE ångras i de flesta fall. Vill du fortsätta?
Cover the
keycloakdatabase in backups and the restore drill.pg_dumpofkeycloaktobitborg-backup.sh.j2and the hot job, beside the other databases./health/ready, count users, groups and clients.bitborg_backup_drill_keycloak_{users,groups,clients}. Replace the Kanidm metrics and alert.kanidmd database backupsteps after cutover.Done when: a drill restores Keycloak from backup and the metrics report non-zero counts.
Depends on: #570
Epic: bitborg/bitborg-docs#127
Staging check, 2026-10-09. The full drill does not run on staging:
site.ymllimits thebackupandbackup-drillroles to prod, and staging has no backup bucket or drill credentials.Replayed the Keycloak steps of
bitborg-backup.sh.j2andrestore-on-scratch.sh.j2by hand on staging, in a throwaway pod:pg_dump --format=customofkeycloak: 281029 bytes.postgres:17.11-trixie, startedbitborg-keycloak:26.8.0-1 start --optimizedon it./health/readyUP. Counts with the drill's SQL: users 9, groups 7, clients 21.Not yet proven: off-site fetch and decrypt for the Keycloak dump, and the
bitborg_backup_drill_keycloak_*metrics. Deferred to the first prod drill at cutover (#575). Also check there that the soundness check rejectsgroups=0.Decision 2026-10-10: the code part is done, and the live proof waits for the first prod drill after cutover.
Already on
main:keycloak.dumpin the full backup, the hot backup and backup verify. All are gated bykeycloak_enabled.bitborg_backup_drill_keycloak_{users,groups,clients}. A failed Keycloak check fails the whole drill, soBackupDrillFailedcovers it.Staging cannot run the drill: it has no backup volume and no off-site destination.
Left for after cutover:
BackupDrillFailed, and thekanidmdbackup steps.Staging drill, 2026-10-11.
The backup role does not apply to staging:
backup_enabled: falseingroup_vars/staging/vars.yml, and thebitborg_env == 'prod'guard onbackupandbackup-drillinsite.yml. Staging has no backup volume.I ran the dump and restore by hand with the role's
pg_dump --format=customflags. The dump was 334 KiB and took under 1 s. The restore into a scratch DB took 2 s. The scratch DB was dropped afterwards.#652 makes the drill script also count realm roles and credentials and export them as metrics.
Not yet proven: the scripted drill end to end, with image start and
/health/ready, and non-zero metrics from a real run. Both come from the first prod weekly drill after cutover.Decision 2026-10-11: no staging backup volume. This issue closes when the first prod weekly drill after cutover reports non-zero Keycloak counts (users, groups, clients, realm roles, credentials) and passes the image start and
/health/readycheck.First prod restore drill after the Keycloak cutover, 2026-10-11, archive
bitborg-20261011T120407Z: passed.keycloak.dumprestored withpg_restoreon the scratch VM.bitborg-keycloak:26.8.0-5started against it.forgejo doctor: no errors. No Kanidm leg.The close condition from the 2026-10-11 comment is met. Closing.