Teable's Postgres needs a pg_dump entry before it holds data, because the namespace list alone gives it a torn copy #928
Labels
No labels
burndown-2026-06
burndown-2026-08
autonomy
async-consult
autonomy
epic
autonomy
headless
autonomy
live-collab
coherence-core
priority
P0
priority
P1
priority
P2
priority
P3
priority
P4
qa-fixture
role/advocate
role/director
role/exec
role/frontend
role/gamedev
role/human
role/platform
role/qa
role/science
role/sysadmin
state
ambient
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
coilyco-flight-deck/infrastructure#928
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Sysadmin prerequisite for
coilyco-bridge/deploy#794, which deploys Teable as the connections index. That issue's acceptance includes "backed up by the existing path", and the obvious one-word change does not deliver it.The trap
scripts/restic-backup.shdiscovers every Bound PVC inRESTIC_BACKUP_NAMESPACES, currentlyforgejo registry. So the obvious change is:That would correctly capture Teable's
teable-assetsPVC, which is an ordinary filesystem. It would also captureteable-db-data, which is a live Postgres data directory, as a raw file copy taken while the database is writing. Restic snapshots it happily and reports success.The script already knows this is wrong, and says so in its own words for Forgejo:
It fails hard on a failed or empty dump, which is the right severity for the only copy of something.
So adding the namespace without a dump entry produces a backup that looks complete and holds a database that may not restore. On an index whose whole justification is that rows are deletable and git is not the store, that is worse than knowing it is unprotected.
What it needs
create_forgejo_db_dumpis hardcoded to one namespace, target, user and database. Teable needs the same treatment againstdeployment/teable-db, userteable, databaseteable.Generalising is the right shape, roughly:
with the dump directory derived per entry rather than the single
RESTIC_BACKUP_FORGEJO_DB_DIR.Why I did not just do it
scripts/test-restic-backup.shdrives the script against a fakek3swhose command dispatch ends in*) exit 64. It asserts the exact stringexec statefulset/forgejo-db -- pg_dump -Fc -U forgejo -d forgejo. So generalising means changing the script and its harness together, or the default list and the tested default diverge, which is its own silent-drift hazard.That is careful surgery on the estate's only working backup path. It is also not on the critical path: Teable cannot start until its Tailscale authkey exists, which needs admin credentials
docs/tailscale.mddeliberately keeps out of SSM. So there is no data to protect yet, and the change deserves a fresh look rather than being appended to a long session.Order that matters
just test-restic-backupgreen.teabletoRESTIC_BACKUP_NAMESPACESso the assets PVC is captured.Doing 2 without 1 is the failure this issue exists to prevent.
Worth noting the whole thing lands on kai-server, so it needs the attended sudo run tracked in #923.
Done means
just test-restic-backuppasses with a teable dump entry, a real run produces a non-emptyteable.pgdump, andRESTIC_BACKUP_NAMESPACESincludesteable.Steps 1 and 2 done and merged, #959. Step 3 still needs an attended run.
Taken on now rather than later because Teable is running as of tonight (deploy#794), so the window before it holds real rows is the window this issue asked for.
The trap was already sprung
Worth recording: #951 added
teabletoRESTIC_BACKUP_NAMESPACESwithout a dump entry, which is the exact half-change this issue exists to prevent. Since then, PVC discovery would have handed Resticteable-db-dataas a raw copy of a live PostgreSQL data directory.teable-assetswas correctly captured. The database was not, and the snapshot would have reported success.What landed
create_forgejo_db_dumpis nowcreate_db_dumpover the shape this issue proposed:Staging is
<root>/<namespace>/<database>.pgdump, which is where forgejo's dump already lived, so the on-disk layout and existing snapshots are untouched. Nothing outside the script ever set the oldRESTIC_BACKUP_FORGEJO_DB_*variables, so there was no external consumer to break.Fail-closed on a failed or empty dump is preserved. New: a namespace that does not exist is skipped rather than failed, matching what PVC discovery already does, so an undeployed service cannot break Forgejo's backup.
teable's
deployment/teable-db, userteable, databaseteablewere read out ofservices/teable/deploy/teable-datastore.ymlrather than assumed.The harness, which is the part you flagged
You were right that this was the reason not to append it to a long session. The old harness asserted the literal string
exec statefulset/forgejo-db -- pg_dump -Fc -U forgejo -d forgejo, so generalising the script alone would have let the tested default and the real default drift apart silently.It now drives both namespaces through the script's own default list rather than a second copy of it, and adds the guard that makes the ordering enforceable instead of remembered: a namespace in the default backup set with no dump entry fails the test unless it is in
namespaces_without_databases, todayregistryalone.Both controls verified to fire
A guard that cannot fail is not a guard, so I checked rather than assumed:
namespace somedb is in the backup set with no dump entry.Restored and re-ran clean after each.
just restic-backup-testpasses,pre-commit runover the changed files is clean, and CI on #959 was green on both jobs.Small correction to this issue's text: the verb is
just restic-backup-test, notjust test-restic-backup.Still open, which is why this issue is not closed
Step 3, the real run.
just restic-backup-testis offline by construction and touches neither k3s nor restic, so the done-condition "a real run produces a non-emptyteable.pgdump" is unproven. That is the attended sudo run on kai-server tracked in #923. Until it happens, teable's Postgres has a correct dump path in the repository and no evidence it works against the live database.