Backup & restore
A Nido backup is two things, and they are useless apart:
- The data volume —
registry.db,db/<familyId>.db,blobs/ - The
NIDO_MASTER_KEYthat keys it
The volume alone is ciphertext. The key alone is nothing. A backup of one without the other is not a backup.
1. Back up the master key
Section titled “1. Back up the master key”grep NIDO_MASTER_KEY /path/to/nido/.envCopy that value into a password manager, or somewhere with its own backup. Get it out of the server now, while you are still reading.
2. Back up the data volume
Section titled “2. Back up the data volume”Data lives at /data inside the API container. What follows depends on whether
you used a named volume or a host bind mount.
Named volume (deploy/docker-compose)
Section titled “Named volume (deploy/docker-compose)”docker run --rm \ -v nido-data:/data:ro \ -v "$PWD":/backup \ alpine tar czf /backup/nido-data-$(date +%F).tgz -C /data .The :ro read-only mount is deliberate — a backup tool should not be able to
write to the thing it is copying.
Bind mount (development stack, ./data)
Section titled “Bind mount (development stack, ./data)”tar czf ~/nido-data-$(date +%F).tgz -C ./data .Kubernetes
Section titled “Kubernetes”kubectl -n nido exec deploy/nido -- tar czf - -C /data . > nido-data-$(date +%F).tgz3. Back up blobs
Section titled “3. Back up blobs”Photos live in the same volume under /data/blobs, so the volume archive
already contains them. Know this, because it means blobs are usually the bulk
of the backup — a few years of daily blobs will dwarf every database Nido
writes.
Automate it
Section titled “Automate it”A daily cron entry beats remembering to do it. Back up both the volume and
the key on a schedule, and keep the key backup somewhere the volume backup
cannot reach.
#!/usr/bin/env bash# /opt/nido/backup.sh — run daily from cronset -euo pipefailDEST="${NIDO_BACKUP_DIR:-/var/backups/nido}"STAMP="$(date +%F)"mkdir -p "$DEST"
docker run --rm \ -v nido-data:/data:ro \ -v "$DEST":/backup \ alpine tar czf "/backup/nido-data-$STAMP.tgz" -C /data .
# prune anything older than 30 daysfind "$DEST" -name 'nido-data-*.tgz' -mtime +30 -delete17 4 * * * /opt/nido/backup.shRestore
Section titled “Restore”The whole volume
Section titled “The whole volume”# stop first, so nothing writes mid-restoredocker compose down
docker run --rm \ -v nido-data:/data \ -v "$PWD":/backup \ alpine sh -c 'rm -rf /data/* && tar xzf /backup/nido-data-2026-01-14.tgz -C /data'
docker compose up -dThe right key
Section titled “The right key”The API must be started with the same NIDO_MASTER_KEY that the backup was
taken under. Put it in .env before docker compose up -d, or every
family database will fail to open.
# sanity check the key format before starting: 64 hex charactersgrep -E '^NIDO_MASTER_KEY=[0-9a-f]{64}$' .envExport a single family
Section titled “Export a single family”Per-family JSON export is a separate mechanism from the volume backup, and it answers a different question: how do I move one family off this instance?
GET /families/:id/export and POST /families/:id/restore are owner- or
admin-gated. A family can also export from the UI.
Worth knowing: the JSON export is not the same protection as the encrypted volume. It is readable data. Treat it as a medical record — it is exactly the kind of file you would not paste into a chat window.
Start clean
Section titled “Start clean”To throw away all state and begin again, reset the storage layer. Swapping images alone never clears data — the volume is what holds it.
# named volumedocker compose down -v
# bind mountdocker compose down && rm -rf ./dataAlso consider
Section titled “Also consider”- Photos are not encrypted at rest. They are unencrypted files on disk, protected only by authenticated, family-scoped routes. Include them in encrypted-at-rest backups if the disk itself is not encrypted.
- Original EXIF is preserved, including GPS. Strip it before uploading anything you would rather not keep.