Backup and restore
Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.
The use-case owns the goal and the failure modes
(uc.admin.back-up-and-restore-instance);
ADR 0056 owns the decisions. This
page owns the commands. On Docker Compose they are veyqctl backup, veyqctl restore and veyqctl rollback, which run the running
release’s own instance_backup.py — an asset of the release, checked against its manifest before it runs, whose
module docstring carries the tool’s reference. Each block below also shows what veyqctl runs, so it can be done by
hand.
An instance’s durable state is exactly three legs: (a) the database, (b) the object store’s contents,
(c) the config-secret key file. The database leg holds every table but the rows of one: the guest-write record
(a guest’s address, port and time, kept at most 30 days as evidence) travels as its schema only, so a restored instance
has it empty (Moderation). A backup made any other way holds those
rows; the same section says how long to keep it. Two legs produce an instance that boots, serves content, and refuses member
invites and password resets with 503 mail_unavailable — the leg that gets forgotten is the one whose absence
looks like health.
The capture is cold, and cold means the writer is stopped — not the stores. Stop the application; leave
MariaDB and Garage (where the recipe runs it) running, because the capture reads through their own interfaces. That single act is the whole
consistency argument: with the app down the database gains no rows, so a row whose object was never captured is
structurally impossible and there is no ordering to remember. instance_backup.py cannot check this and does not
pretend to; veyqctl stops the application itself, so a step by hand is the only place it can be forgotten.
Capture
Section titled “Capture”cd /opt/veyq./veyqctl backup --key-into /media/usb-stick/veyq-<stamp>.keyIt stops the application, captures the database and the store’s index into backups/<UTC stamp>/ and leg (c)
to the file --key-into names, checks the capture, deletes every capture older than B (below),
starts the application again — also when the capture failed — and prints the downtime. upgrade takes the same capture
first.
A capture holds the database and the store’s index, not the objects (ADR 0056 §3). The index — every object’s key,
size and MD5 — is what lets a restore check the objects before it writes anything; the objects themselves stay in the
store, and keeping them is the store’s job: its versioning, replication or snapshots. The bundled Garage keeps no
object versions (measured on the pinned v2.0.0: rclone backend versioning answers Unversioned, and turning it on
answers 501 NotImplemented), so on the bundled store a lost store volume loses every photo and file, whatever
backups/ holds — and veyqctl status says so until you name an object pool:
# .env — a directory on ANOTHER disk (a pool on the store's own disk dies with it)VEYQ_BACKUP_OBJECTS_TO=/mnt/backup-disk/veyq-objects# …or a bucket of any S3-compatible store; its key pair stays here and in the tool's environment, never in a capture# VEYQ_BACKUP_POOL_ENDPOINT=https://s3.example.org# VEYQ_BACKUP_POOL_ACCESS_KEY=…# VEYQ_BACKUP_POOL_SECRET_KEY=…With a pool, backup and upgrade first copy the store’s objects into it while the application still runs, then the
capture tops it up with whatever arrived since — objects are immutable, so the early copy cannot go stale, and the
downtime grows by the new uploads only. Every copy is rclone copy --immutable: a key the pool holds is not copied
again, and one whose bytes differ fails the capture instead of replacing the pool’s copy. The capture records the pool
in its manifest (store.pool.target), and a restore onto a fresh instance names it (below). The pool keeps what its
newest captures need, and nothing more: each capture writes its index’s keys into the pool’s ledger
(veyq-pool/captures/), the newest VEYQ_BACKUP_POOL_KEEP (default 3) younger than B are kept, and every object none
of them names is deleted from the pool — so an object erased on the instance leaves the pool within that many captures, and one a
kept capture needs is never deleted. A pool serves one instance; --objects-to names another one for a single run. A
directory pool is created 0700, its files are yours. Without a pool, and with a store of your own, the objects stay
where they are, and the store’s own durability is what keeps them. The other way to keep the bundled store’s objects
is a copy of its volumes (the fast path) — opaque, and bound to one
Garage version.
By hand, what veyqctl backup runs:
cd /opt/veyqrelease=<running release> # state.json's "release"recipe="releases/${release}/docker-compose.prod.yml" # add -f compose.override.yml below if you have one
# 1. STOP the application, and only it. MariaDB and Garage keep running.docker compose -f "$recipe" --env-file .env stop app
# 2. Credentials, under the names the tool reads: the two values come from .env. The endpoint is the one the# rclone container sees on the store's network, not a published port. The bundled store: its admin token; the# tool derives the S3 key pair from it, so nothing else is typed. COMPOSE_ENV_FILES hands the tool's own# `docker compose exec` this instance's .env.read -rs VEYQ_BACKUP_DB_PASSWORD && export VEYQ_BACKUP_DB_PASSWORD # = MARIADB_ROOT_PASSWORDread -rs VEYQ_BUNDLED_STORE_ADMIN_TOKEN && export VEYQ_BUNDLED_STORE_ADMIN_TOKEN # = GARAGE_ADMIN_TOKENexport VEYQ_BUNDLED_STORE_ENDPOINT=http://garage:3900export COMPOSE_ENV_FILES=/opt/veyq/.env
# 3. Leg (c) out of the stopped app container, into a directory only you can read.(umask 077; mkdir .key)docker cp "$(docker compose -f "$recipe" --env-file .env ps -aq app)":/var/lib/veyq/config-secret.key \ .key/config-secret.key
# 4. Capture the database and the store's index into backups/<stamp>/ — with a pool, add --objects-to <pool># (and, before step 1, `instance_backup.py copy-objects --objects-to <pool> --docker-network veyq_edge` while the# app still runs) — and leg (c) to a medium of its own; then drop the copy.python3 "releases/${release}/instance_backup.py" capture --compose-file "$recipe" \ --docker-network veyq_edge --config-secret-file .key/config-secret.key \ --key-into /media/usb-stick/veyq-<stamp>.key --into backups/<stamp>rm -r .key
# 5. CHECK both — the store leg is captured logically precisely so this is possible at all.python3 "releases/${release}/instance_backup.py" verify backups/<stamp> --key-from /media/usb-stick/veyq-<stamp>.key
# 6. Start the application again.docker compose -f "$recipe" --env-file .env start appHow long a backup is kept — B
Section titled “How long a backup is kept — B”Every backup veyq’s tools took is deleted once it is older than B days, the newest one too
(ADR 0056
decision 8). Backups are not exempt from erasure: what a member erased, or a guest’s address past its days, must not
live on in them (GDPR Art. 17 and 5(1)(e)). B is an instance setting, Server → Moderation → Backups in the admin
console or veyq-admin backup-retention set <days>: 7 to 365, 30 until you set one. Thirty is what this area
recommends; above it, write the reason into your record of processing. The tools read B from the database they back up,
and use 30 when they cannot.
-
Compose.
veyqctl backup,upgradeandstartdelete every capture underbackups/older than B;veyqctl backup prunedoes only that. Run it daily, so an instance that is rarely restarted keeps nothing past B — and take a backup daily too, because the newest is deleted at B as well: an instance not backed up for B days has none, andveyqctl statuswarns while no capture is younger than B. With systemd:# /etc/systemd/system/veyq-backup.service — a backup, which prunes as it goes (a key file per day: name a new one)[Service]Type=oneshotExecStart=/bin/sh -c '/opt/veyq/veyqctl backup --key-into /media/usb-stick/veyq-$(date -u +%%Y%%m%%d).key'# /etc/systemd/system/veyq-backup.timer[Timer]OnCalendar=dailyPersistent=true[Install]WantedBy=timers.targetA day you cannot take one,
veyqctl backup prunealone keeps the bound. -
Kubernetes. The gate deletes every capture on its claim older than B at every start, and the chart’s CronJob
veyq-backup-prunedoes the same daily (backup.prune.schedule,17 3 * * *) on the gate’s image and claim; it reads B from the database and writes nothing but that claim — never the key’s. -
An object pool drops its captures older than B too, whatever
VEYQ_BACKUP_POOL_KEEPsays, and the objects only they named with them. -
A copy you moved off the host — an encrypted archive, a second disk — is yours to delete by B. Open it only to restore from it.
The erasure ledger — carried with leg (c)
Section titled “The erasure ledger — carried with leg (c)”A restore of a capture brings back what was erased after it: an account, a tenant, a space, a link, a photo. So the
instance keeps an erasure ledger, erasures.log, beside the config-secret key in the app’s volume
(/var/lib/veyq/), which no restore and no rollback touches: one line per such erasure, and per moderation block, lift,
case and ended hold — kinds, ids and times, never content or a name. At every start, before it answers a request,
the application reads it and erases again every listed thing a restore brought back, blocks again what a moderator or an
authority’s order blocked since (and lifts again what was lifted since), ends again a hold that ended since — a
dismissal’s, a handover’s — so a held copy is not kept again, moves a case on to the state it had (closed where it was
closed), and brings back a case the capture lacked as a stub — restored, with no report and nothing sealed: a case’s
sealed parts are lost with a capture older than them. A line it cannot apply stops the start: the instance does not
serve with an erasure undone. The start’s log line says what it did
(./veyqctl logs app | grep 'erasure ledger'). Lines older than B are dropped, at every start and hourly while it runs, since no backup is older.
veyqctl restore and rollback read the ledger out of the app’s volume and hand it to the tool, so an object erased
after the capture is reported as erased, not missing. On a new host the instance re-applies only the ledger you bring:
keep erasures.log with leg (c), copied the same way and as often as you take a backup:
docker cp "$(docker compose -f "$recipe" --env-file .env ps -aq app)":/var/lib/veyq/erasures.log \ /media/usb-stick/veyq-erasures.logand put it back beside the key on the new install before its first start after the restore (as step 3 below puts the
key, with erasures.log for the file name). Erasures of the last minute before a crash that also lost the file are not
in it.
A store of your own. The store is a setting in the admin console, not an environment variable, and the capture is
cold — no app is running to sign for the tool — so you give the tool the store’s credentials for this run, the ones you
entered in the console (the console never shows them again, and neither can the tool read them back): export
VEYQ_BACKUP_STORE_ENDPOINT, VEYQ_BACKUP_STORE_ACCESS_KEY and VEYQ_BACKUP_STORE_SECRET_KEY instead of the
bundled pair, plus VEYQ_BACKUP_STORE_BUCKET and VEYQ_BACKUP_STORE_REGION when they are not blobs and
us-east-1. Keep them in a password manager: after a lost config-secret key the console asks for the same
credentials again. veyqctl passes the same variables from its shell through to the tool. Where your
compose.override.yml leaves the bundled store out (Set up a new instance), they are
the only pair: veyqctl then runs the tool’s rclone container on Docker’s default network, where it reaches your store
like any other host, and refuses backup, upgrade and restore before anything stops while one of the three is not
exported, naming it. Its prune and status read only the database and need none.
The network is veyq_edge, the one the store is on: the production compose file declares name: veyq, so that is
the project. Leg (c) lives on a volume, under Docker’s data root, which a host cannot always read (Docker Desktop
keeps it in a VM) and which only root can read where it can; docker cp takes it out of the stopped container
instead, so no step needs root — a user who may use Docker runs all of it. The key is copied to a destination of
its own, never into the capture.
How far this is proven. veyqctl backup and upgrade ran live (2026-10-17) on an instance the stack lane had
installed and filled through the browser: the capture into a directory pool with the early copy before the stop, an
object the store lost kept in the pool while a retained capture named it, the prune deleting what no kept capture
named, and the capture restored from the pool onto a second fresh install. src/tools/instance_backup_selftest.py holds
the pool’s builder (copied into with --immutable, deleted from only by the prune), the prune and every refusal without Docker. Every scripts/run_web_e2e.py run captures a
live instance into a pool, destroys it, restores it from the pool and runs a suite against the result, and holds the
production capture to resolving the production project rather than whatever else runs. Since 2026-11-27 every release’s
own veyqctl backup --objects-to <directory> --key-into <file> runs once on GitHub on an instance its own test code
filled, for the backup archive (archive.yml; all eighteen releases then), and stack lane L3 restores such backups with
the candidate’s veyqctl restore --objects-from <directory> --key-from <file> onto a fresh install on every push
(scripts/run_stack_restore.py; locally green for the five it selects, 2026-11-28; on Docker Desktop for macOS the
backup into a directory pool is refused by rclone, inbox #870, while the restore from one is not).
Leg (c) never goes beside the dump. The dump plus the key opens every tenant’s SMTP password, so a capture
directory holding both is exactly the leaked backup the key exists to defend against (ADR 0056 §1). capture
therefore refuses a --key-into inside the capture directory, refuses to run with a key found and no destination
for it, and never overwrites an existing file there. --key-beside-dump puts it in the capture anyway — knowingly,
and the manifest records that it did. Everything the tool writes is owner-only (0700 directories, 0600 files),
and verify checks it.
Before a capture leaves this host, encrypt it, and keep the key on another medium. The tool encrypts nothing:
the dump holds the members’ emails and the password wraps an attacker can grind offline even without the key.
Pack the capture directory and encrypt the archive for a recipient whose private key is not on this host — for
example tar -C /opt/veyq/backups -c <stamp> | age -r <recipient> > veyq-<stamp>.tar.age — and carry the
--key-into file on a different medium from that archive.
--docker-network is the network the pinned rclone container joins, and it must be one the store is on; list
them with docker network ls. An operator with their own rclone install can pass --rclone-binary rclone instead, and
one whose database is not this compose service passes --db-host/--db-port (the client then runs from PATH
if installed, else in the pinned mariadb:12.3 image on --docker-network).
No credential ever reaches argv: the store remote is defined entirely through RCLONE_CONFIG_* and the
database password through MYSQL_PWD, both handed to the child as bare -e NAME. rclone logs
NOTICE: Config file … not found - using defaults on every call — that is normal, not an error, and no config
file is written.
What verify tells you, and its one deliberate asymmetry. An object with no row is an ordinary steady
state, and since ADR 0062 for a better reason: the row delete and the reclaim entry share one transaction, and a
single sweep drains that list, so a capture taken between the two legitimately holds objects whose rows are gone
— a reclaim pending, not a deletion that failed unnoticed. Orphans are therefore still counted and tolerated,
and the instance itself counts the rest: Server → Object store shows the objects waiting on the deletion list,
the ones it gave up on, and every object no record claims at all
(Operations). (Abandoned upload sessions
themselves are reclaimed, by UploadSessionPurge.) A row with no object is fatal (A4): it
restores as a Memory whose picture yields a valid presigned URL and a 404, with no server-side error anywhere
— so verify names every missing object and exits non-zero. It exits 2, with a different headline, when the
backup is structurally intact but carries no leg (c). A key kept apart is checked only when --key-from names it,
and verify says so when it did not.
Restore — onto a freshly installed instance
Section titled “Restore — onto a freshly installed instance”A restore targets the same domain (ADR 0056 §4); --domain is required and the tool refuses anything the
backup did not hold. It also refuses a target whose database already holds data — the restore is defined onto an
empty instance and nothing reconciles two populated ones (A5).
It checks the objects before it writes anything, and it writes objects only into an empty store (ADR 0056 §7). Two forms:
- Without a source — the objects are already in the store the capture indexed (a rollback, Upgrade): every object the dump’s rows require must be there with the indexed size and MD5, or the restore refuses naming each, and nothing is written to the store. Onto a fresh install, whose store holds nothing, this form refuses and names the pool the capture recorded.
- With
--objects-from <pool>— onto a fresh instance: its store must hold no object (the store check’s probe aside), every required object must be in the pool as indexed, then exactly the index’s keys are copied in and the store is checked once more — all before the dump is loaded. A capture of the older layout, which holds its objects inobjects/, restores the same way from that directory, without the flag.
Required is what the dump’s blob rows name; the index’s other keys — orphans waiting to be reclaimed, the chunks of
an unfinished upload — are reported and tolerated. --accept-missing-objects restores knowingly without the named
ones, each a Memory whose picture yields a 404.
Every restore restarts the store’s grace periods. After the dump is loaded the tool empties the record the instance keeps of objects no record claims, so every such object’s 30-day grace starts again, and your confirmation that the bucket is this server’s alone is gone with it: nothing is deleted until you confirm again under Server → Object store — after a restore of the wrong backup, those objects are exactly what the right one needs (Operations).
It compares the backup’s schema with the target’s before it writes anything (ADR 0056 §7), in Flyway’s version order. A backup newer than the target is refused, and the message names the release it came from: install that release (or a newer one) and restore onto it. A backup at the target’s schema or an older one is accepted: the restore first drops every table of the target — safe only because the gate above proved it holds no data, and needed because the dump recreates only the tables it names — then loads the dump, and the application migrates the data up at its next start, the same forward migration every upgrade runs. So “install the backup’s release, restore, upgrade” is “restore, start”. When the backup is older the restore says so, because that is an upgrade — and if you meant a rollback, it is not one (Upgrade).
Watch the log line, not GET /api/instance/store-provisioning: ./veyqctl logs app shows
Object store provisioned once the store is usable. The endpoint answers the Server Owner only.
A restore target has no Server Owner, and it must not get one: setup writes rows, and the emptiness gate then
refuses the target.
Empty means holding no data, not holding nothing. The target is a normally installed instance —
veyqctl install of the release the capture came from (or a newer one), with no first-run setup: it brings the
stack up and waits until the app is healthy, and that one start migrates the schema and provisions the store. There is
no shorter path and there is no manual CREATE DATABASE step — since ADR 0067 the app is the only thing that can make
the store usable, and the same start migrates the schema, so the two go together by construction.
cd /opt/veyq./veyqctl restore /media/restore/<stamp> --domain <the tenant's domain> --key-from /media/usb-stick/veyq-<stamp>.key \ --objects-from /mnt/backup-disk/veyq-objects--objects-from is never implied by .env: a restore writes objects only when you say where from. It stops the
application, reads the erasure ledger from the app’s volume, loads all three legs with the running release’s tool, puts leg (c) into the app’s volume as
the application’s own user, and starts the application again. --domain is required and never defaulted: the
capture holds its tenants’ domains, and .env’s VEYQ_DOMAIN is the instance’s bootstrap domain, not one of
them. A restore the tool refuses at its gates wrote nothing, and the application stays stopped until veyqctl start.
By hand, after the capture’s steps 2 and the recipe line above:
# 1. STOP the application of the freshly installed instance.docker compose -f "$recipe" --env-file .env stop app
# 2. Load all three legs; the tool writes leg (c) to a file you own. The erasure ledger out of the app's volume# first (absent on a fresh host: leave --erasures out, or name the copy you carried).(umask 077; mkdir .key)docker compose -f "$recipe" --env-file .env run --rm --no-deps -T --entrypoint java app \ -jar /opt/veyq/image-commands.jar read-file /var/lib/veyq/erasures.log > .key/erasures.logpython3 "releases/${release}/instance_backup.py" restore /media/restore/<stamp> \ --domain <the tenant's domain> --compose-file "$recipe" --docker-network veyq_edge \ --config-secret-file .key/config-secret.key --key-from /media/usb-stick/veyq-<stamp>.key \ --objects-from /mnt/backup-disk/veyq-objects --erasures .key/erasures.log
# 3. Leg (c) into the app's volume, written by the image's own user, the key on stdin; then drop the copy.docker compose -f "$recipe" --env-file .env run --rm --no-deps -T --entrypoint java app \ -jar /opt/veyq/image-commands.jar place-key /var/lib/veyq/config-secret.key < .key/config-secret.keyrm -r .key
# 4. Start the application, then VERIFY — this is the step that separates a restore from a hope.docker compose -f "$recipe" --env-file .env up -d --waitThe restore takes the key from where the capture’s manifest says it went. A capture that kept it apart is
refused without --key-from, before anything is written: restoring without leg (c) is A2 — an instance that
boots and refuses invites and password resets — and it happens only when you pass --without-key on purpose.
The key must end up readable by the application, which runs as uid 10001 (the image’s USER). A key born
root:root 0600 in the app’s volume is one the app cannot read, so it reports ABSENT and refuses invites and
resets with the key right there. Step 3 writes it through a one-off container of the app service, which runs as the
image’s own user, so the key is born 10001:10001 0600 without root and without a path into Docker’s data root. (The
tool, given a --config-secret-file inside the volume itself, gives the key the owner of the directory it lands in
and refuses a run that cannot — the route for an operator who mounts the volume as root.) How far this is proven:
veyqctl restore ran once, live, putting an upgrade’s capture onto a fresh install: 46 tables dropped, the dump and
4 objects loaded, the key in the app’s volume as 10001:10001 600, and a Memory opened there. The tool’s owner rule
is held by src/tools/instance_backup_selftest.py, without Docker or root. A restore from a pool ran live
(2026-10-17): refused onto the fresh install without --objects-from, naming the pool; refused while its bucket held
one object; then 6 objects copied, the config-secret state OK, and the bucket equal to the capture’s index.
The store’s setting now travels with the database: it is a row (veyq_store_setting, a table the
emptiness gate ignores), its secrets sealed under the config-secret key, so with leg (c) restored they open again.
A bundled setting is a reference to the hint of the install it runs on, so it works on the new install
whatever that install’s Garage secrets are. The bundled store’s own bucket, access key and single-node layout are
still not restored, because they were never state: the app recreates them idempotently on every start. This has no
“fresh node only” limit — the layout step is satisfied by a node already carrying a role at any version, and
applies current + 1 where it has work to do. A store of your own is the same store after the restore (its
endpoint and bucket are in the restored setting, and they cannot be changed once blobs exist): restored without a
source it checks the objects still there; from a pool it refuses a bucket that still holds objects, so empty it first
if it outlived the instance. If the store’s credentials were rotated since the capture, re-enter them in Server → Object store.
The final step is not “it started”. Open Server → Object store and run Check store (or veyq-admin store check): it
proves the restored setting reaches its store before anyone relies on it. Then read the instance’s config-secret state as the Server Owner, on the admin
channel — the admin console’s Server → Config-secret key, or veyq-admin config-secret — and expect OK. This
read changes nothing on the instance. A tenant’s mail settings carry the same state, but only that tenant’s owner may
read them. Then have a person sign in and open a Memory that contains media. That is the only assertion that
touches all three legs at once: the row, the object and the key are three different failures with the same symptom
of “it looked fine”.
Under Kubernetes
Section titled “Under Kubernetes”On a cluster the chart’s backup gate captures before every release change, in the app pod before the container that migrates (Upgrade, ADR 0098). Your part:
- The claim.
backup.existingClaimnames a PersistentVolumeClaim you create in the release’s namespace (ReadWriteOnceis enough). The chart creates none, sohelm uninstallleaves the captures behind, and its size, class and encryption at rest are yours. The gate writescaptures/<UTC>/there, beside its recordstate.json; a capture interrupted midway stays ascaptures/<UTC>.partial/until the next complete one removes it. At mostbackup.keep(3) complete captures are kept, and none older than B: the gate deletes those at every start and the CronJobveyq-backup-prunedaily, the newest too (above) — it runs on the app pod’s node, so the claim must beReadWriteOnce, notReadWriteOncePod. A full claim fails the gate and keeps the app down; it is never pruned to make room. - A capture without a release change is a commit: change
backup.requestto any new value. That is a new revision of the pod, so the old pod stops first and the capture is cold. The gate never captures because one is “due”. - What a capture holds: the database dump and the store’s index — every object’s key, size and MD5 — never
the objects and never the key. Two things are therefore yours:
-
The store keeps its objects. Turn on its versioning, replication or snapshots (for the bundled Garage,
garage.enabled, of its data claim — it has nothing else). A restore checks that every object the database needs is still in the store and refuses otherwise, but it cannot bring back one the store lost. Deleting the claims Garage left behind deletes the objects: they outlivegarage.enabled: falseandhelm uninstallalike, andgarage.enabled: trueagain restores an instance whose store was the bundled one. -
The key, exported once, after the first start, onto a medium of its own. It does not change between upgrades, and the gate never reads it. With
app.configSecret.existingSecretit is your Secret, which you made from a file: keep that file. Otherwise the app generated it onto its claim, and the image’s ownread-filereads it out (the image is distroless: no shell, and notarforkubectl cp):Terminal window (umask 077; kubectl -n veyq exec deploy/veyq-app -c app -- \java -jar /opt/veyq/image-commands.jar read-file /var/lib/veyq/config-secret.key > ./veyq-config-secret.key)# move it to its medium, then delete ./veyq-config-secret.key
-
- A store of your own — the default here, since the bundled Garage is opt-in. The gate cannot open its secret key (that would need the key above), so name a Secret
with
endpoint,bucket,accessKeyandsecretKey(optionallyregion) inbackup.store.existingSecret; a key pair that can list the bucket is enough. The gate refuses when the instance uses its own store and none is named, or when the Secret’s endpoint or bucket is not the store in use. - The downtime. Every release change is longer by the capture: one dump and one listing of the bucket, whatever the store holds.
- No object pool. The gate names none (ADR 0098 decision 4): a copy in the init container would lengthen every
release change, and a pool outside the cluster would be a new egress peer for the NetworkPolicy set. A restore Job
may still name
--objects-from, like any restore — then only into an empty store.
With backup.enabled: false none of this runs, and the capture before an upgrade is yours, by hand
(Upgrade, Kubernetes).
Restore under Helm
Section titled “Restore under Helm”Never automatic and never a hook: a one-off Job, run with the tools image of the release that wrote the
capture — its manifest.json names it as capture.tool; the gate writes a capture when the new release starts, so
that is the one image certain to read it. A capture of the gate leaves the objects in the store, so the Job writes
nothing there: before it loads anything it checks that every object the database needs is in the store with the
size it had, and refuses naming the ones that are missing. Bring those back from the store’s versioning and run it
again — or add --accept-missing-objects to restore knowingly without them, each a Memory whose picture no longer
loads.
The Job’s pod carries the app pod’s labels, because the NetworkPolicy set admits the app alone to the database and
the store; the app is scaled to zero meanwhile. It runs as the app’s uid and writes the key as that uid
(--key-as-runtime-user: a claim’s directory is root-owned, fsGroup only gives it a group). The key reaches it
from your medium through a Secret that exists for the Job’s lifetime only — it is in the cluster’s store while it
exists, so create it just before and delete it just after. To roll back to <release> from the capture <capture>
the gate took when that release was left:
# 0. Argo CD: pause the automated sync first (spec.syncPolicy.automated.enabled: false) — with self-heal on it# puts the app back while you work. Flux: suspend the HelmRelease.kubectl -n veyq scale deploy/veyq-app --replicas=0 # 1. stop the applicationkubectl -n veyq exec veyq-mariadb-0 -- sh -c \ 'mariadb -uroot -p"$MARIADB_ROOT_PASSWORD" -e "DROP DATABASE veyq; CREATE DATABASE veyq; GRANT ALL PRIVILEGES ON veyq.* TO '"'"'veyq'"'"'@'"'"'%'"'"';"'# 2. the database emptied (your own database: empty it your way) — a restore is defined onto no datahelm upgrade veyq "oci://ghcr.io/raddatzk/charts/veyq@${chart_digest}" -n veyq -f my-values.yaml \ --set image.digest="${app_digest}" --set admin.image.digest="${admin_digest}" \ --set backup.image.digest="${tools_digest}" --wait --timeout 15m# 3. <release> started once, by its own chart and digests: the gate finds no data and records it, the app# migrates the empty schema and provisions the storekubectl -n veyq scale deploy/veyq-app --replicas=0 # 4. stopped againkubectl -n veyq create secret generic veyq-restore-key \ --from-file=config-secret.key=/media/usb-stick/veyq-<stamp>.key # 5. the key, for the Job's lifetimekubectl -n veyq apply -f veyq-restore.yaml # 6. the Job belowkubectl -n veyq wait --for=condition=complete job/veyq-restore --timeout=15mkubectl -n veyq logs job/veyq-restorekubectl -n veyq delete job veyq-restore; kubectl -n veyq delete secret veyq-restore-key # 7. both gonekubectl -n veyq scale deploy/veyq-app --replicas=1 # 8. the gate finds <release> in its record and passes# 9. resume the sync; verify as Restore says: veyq-admin config-secret reads OK, the store check passes, and a# person opens a Memory with mediaveyq-restore.yaml — the release name veyq, the chart’s Secret veyq (or yours, secrets.existingSecret), the
bundled store (garage.enabled) and database; for a store of your own, the four VEYQ_BACKUP_STORE_* variables
from your Secret instead of the two VEYQ_BUNDLED_STORE_* lines:
apiVersion: batch/v1kind: Jobmetadata: name: veyq-restore namespace: veyqspec: backoffLimit: 0 template: metadata: labels: # the app pod's, for the NetworkPolicy set; the Job owns the pod app.kubernetes.io/name: veyq app.kubernetes.io/instance: veyq app.kubernetes.io/component: app spec: restartPolicy: Never securityContext: runAsUser: 10001 runAsGroup: 10001 fsGroup: 10001 runAsNonRoot: true seccompProfile: {type: RuntimeDefault} containers: - name: restore image: ghcr.io/raddatzk/veyq-tools:<capture.tool>@<its verified digest> args: ["restore", "/backup/captures/<capture>", "--domain", "<your domain>", "--key-from", "/restore-key/config-secret.key", "--config-secret-file", "/var/lib/veyq/config-secret.key", "--key-as-runtime-user", "--erasures", "/var/lib/veyq/erasures.log", "--record", "/backup"] env: - {name: VEYQ_BACKUP_DB_URL, value: "jdbc:mariadb://veyq-mariadb:3306/veyq"} - {name: VEYQ_BACKUP_DB_USER, value: veyq} - name: VEYQ_BACKUP_DB_PASSWORD valueFrom: {secretKeyRef: {name: veyq, key: mariadbPassword}} - {name: VEYQ_BUNDLED_STORE_ENDPOINT, value: "http://veyq-garage:3900"} - name: VEYQ_BUNDLED_STORE_ADMIN_TOKEN valueFrom: {secretKeyRef: {name: veyq, key: garageAdminToken}} securityContext: allowPrivilegeEscalation: false capabilities: {drop: ["ALL"]} readOnlyRootFilesystem: true volumeMounts: - {name: backup, mountPath: /backup} - {name: config-secret, mountPath: /var/lib/veyq} - {name: restore-key, mountPath: /restore-key, readOnly: true} - {name: tmp, mountPath: /tmp} volumes: - name: backup persistentVolumeClaim: {claimName: <backup.existingClaim>} - name: config-secret persistentVolumeClaim: {claimName: veyq-config-secret} - name: restore-key secret: {secretName: veyq-restore-key, defaultMode: 0440} - name: tmp emptyDir: {}With app.configSecret.existingSecret leg (c) is that Secret, not a file on the claim: make sure it holds the
capture’s key before step 3 (kubectl create secret generic from your medium, as in the hand
restore), and give the Job --without-key in place of --key-from, --config-secret-file
and --key-as-runtime-user, and no restore-key volume — what it would write there the app never reads.
--erasures reads the erasure ledger from the config-secret claim the Job mounts anyway, so an object erased after
the capture is reported as erased, not missing; on a claim that holds none yet (a new cluster), leave it out. The app’s
next start re-applies the ledger itself. --record /backup is the Job’s last step: it writes the backup’s release into the gate’s record, so the next start
of that release passes instead of capturing the restored database again or refusing it as a downgrade. The config
secret is read last, as on Compose. Run once on a kind cluster (2026-10-17): this Job, this order and these
commands, with the images loaded by tag rather than pulled by digest; the database and the store were the chart’s
own.
A capture taken by hand
Section titled “A capture taken by hand”A capture taken by hand with backup.enabled: false is the database and the store’s index, like every capture —
name a pool with --objects-to to keep the objects too — and restores through port-forwards: onto a freshly installed
release, whose store is empty, from that pool (--objects-from). The tool reaches MariaDB and Garage through
port-forwards and cannot reach the app’s claim, so it writes leg (c) to a local file of your own, and the key goes into
the pod as a Secret the chart mounts (app.configSecret.existingSecret): the app image is distroless, with no
shell and no tar, so kubectl cp cannot put a file into it. The Secret’s file is read-only and the app only reads it;
the erasure ledger stays on the claim. Onto a freshly installed release, exactly as Restore requires:
kubectl -n veyq scale deploy/veyq-app --replicas=0 # 1. stop the application# 2. port-forward MariaDB and Garage as for the capture; export VEYQ_BACKUP_DB_PASSWORD# (= secrets.mariadbRootPassword) and VEYQ_BUNDLED_STORE_ADMIN_TOKEN (= secrets.garageAdminToken), and point# VEYQ_BUNDLED_STORE_ENDPOINT at the forwarded Garage S3 port; then the Restore command, with# --config-secret-file ./veyq-config-secret.key --key-from /media/usb-stick/veyq-<stamp>.key# (a file you own, so the tool writes it 0600 as you)kubectl -n veyq create secret generic veyq-config-secret-key \ --from-file=config-secret.key=./veyq-config-secret.key # 3. leg (c) as the Secret the app readsrm ./veyq-config-secret.key# 4. name it in your values (app.configSecret.existingSecret: veyq-config-secret-key) and apply them with the# installed release's chart and digests (Verify a release); then start the app on the restored keyhelm upgrade veyq "oci://ghcr.io/raddatzk/charts/veyq@${chart_digest}" -n veyq -f my-values.yaml \ --set image.digest="${app_digest}" --set admin.image.digest="${admin_digest}"kubectl -n veyq scale deploy/veyq-app --replicas=1kubectl -n veyq rollout status deploy/veyq-app# 5. verify as Restore says: veyq-admin config-secret reads OK, then a person opens a Memory with mediaStep 4 starts a pod that has never held another key, so nothing has to be restarted after it. From then on the key is
that Secret — keep it in your values (or your GitOps tool’s), and keep the key file on its medium: the claim still
holds the key the fresh install generated, which nothing reads any more. An instance that already names a Secret
replaces its content instead (kubectl create secret generic … --dry-run=client -o yaml | kubectl apply -f -) and
restarts the app (kubectl -n veyq rollout restart deploy/veyq-app). Derived, not rehearsed: no cluster has run
it; the chart’s half — the Secret mounted read-only, the key path on it, the ledger on the claim — is
scripts/chart_meta_check.py’s (ii), on rendered manifests.
The volume-copy fast path — and what it is not
Section titled “The volume-copy fast path — and what it is not”For a same-host, same-version rollback you can stop everything and copy the named volumes
(veyq_veyq-mariadb-data, veyq_veyq-garage-meta, veyq_veyq-garage-data) plus the config-secret key file.
It is faster and needs no credentials. It is not the procedure the durability bar is measured against: a
volume copy is opaque, so a complete one and a truncated one look identical until you restore them, and it binds
the backup to one store’s on-disk format and version.
Garage can snapshot its metadata database consistently while running:
docker compose -f "releases/<release>/docker-compose.prod.yml" --env-file .env exec garage /garage meta snapshotThere is no equivalent for its data blocks (garage block --help offers info | list-errors | purge | retry-now and no snapshot), which is the second reason this path is a rollback aid and not the procedure.
garage.toml sets metadata_snapshots_dir to its own named volume (veyq_veyq-garage-snapshots) because the
default writes snapshots inside metadata_dir — i.e. into the very volume the fast path copies, so each
snapshot grows the thing being snapshotted. An instance created before that setting still carries the old
snapshots under meta/snapshots/; they are safe to delete once. No rehearsal of this path is recorded.