- Docs
- Self-host and operate
- Backup, restore and upgrade
Backup, restore and upgrade
For whoever runs a NuraMesh server. There is no built-in backup command, schedule or point-in-time restore: you use
pg_dump (or a file copy for SQLite) and the commands below.
Prerequisites
Section titled “Prerequisites”- Shell access to the host that runs NuraMesh, and the PostgreSQL client tools (
pg_dump,pg_restore) for a PostgreSQL store. - The database address (
NURAMESH_DATABASE_URL) and the key folder (NURAMESH_KEY_DIR, default~/.nuramesh/keys). - Encrypted storage apart from the live host for the copies.
- An erasure register kept outside the backups (see below).
- Copy the store and the key folder close together: What a backup contains.
- Prove the copy can be restored: Check the copy.
- When you need it, follow Restore in order. The erasures are re-applied before any service starts.
- Finish with Check it worked.
What a backup contains
Section titled “What a backup contains”A backup is the store and the key folder together. One without the other is not a backup: content is encrypted for each organization, so a store restored without its keys cannot be read.
| Part | Where | How to copy it |
|---|---|---|
| PostgreSQL store (ledger, budgets, approvals, content, people, sessions, tokens) | the database in NURAMESH_DATABASE_URL |
pg_dump -Fc |
| SQLite store (a single-user local install) | <team>/.nuramesh/runs.db, or the file given by --store |
stop the process, then copy the file and its -wal and -shm files if present |
| Organization keys | the folder in NURAMESH_KEY_DIR (default ~/.nuramesh/keys) |
copy the whole folder and keep its file modes (0600 files in a 0700 folder) |
| Team configuration | the team folder | it is in Git |
Take the database copy and the key copy close together. Store them encrypted and apart from the live host. Keep each backup for 30 days and no longer: a backup still holds erased data and keys until it expires.
Keep an erasure register outside the backups: the date of every organization you shredded or closed and every person you erased (ids and dates, no content). You need it after a restore.
Durable-run history held by a Temporal server is not in the backup. After a restore treat a durable run that was in flight as lost; the ledger and the store are the record.
Check the copy
Section titled “Check the copy”Restore the dump into a scratch database and compare row counts with the live one. Reading the table of contents
(pg_restore --list) proves little. Drop the scratch database afterward: it holds real data.
Restore
Section titled “Restore”Re-apply every erasure before any service starts. If you restore the store and the keys to a point before an erasure, nothing in them knows the organization was erased, so it would be live again as soon as a service starts.
- Stop every process that uses the database. Never restore under a running server.
- Restore into an empty database:
pg_restore -d <database> --clean --if-exists <dump>. The ledger tables refuse updates and deletes by design, so do not restore over a database in use. On a new machine create the rolesnuramesh_ownerandnuramesh_appfirst; a dump does not carry roles. - Restore the key folder from the matching backup, keeping its modes.
- Run
nuramesh db migrate --team <team>as the table owner. It applies only what the restored database lacks. The old code refuses a newer schema, so restore with the same version or a newer one, never an older one. - Re-apply the erasures from your register, with the services still stopped.
- Start the services.
- Verify.
Check it worked
Section titled “Check it worked”nuramesh ledger verify --team <team>nuramesh keys status --org <org> --team <team>ledger verify checks every stream’s hash chain and exits 0 when it is intact. It exits 1 on a broken chain, and on an
empty ledger unless you pass --allow-empty. Exit 0 does not prove the newest events are all there: without an anchor
repository (--anchors REPO) or a head kept elsewhere it cannot see events cut off the end of a chain, which is the
risk of restoring an old backup. If you export anchors to Git, compare them with the
restored ledger.
nuramesh keys status prints the key folder in use and the state of the key of the organization you name with --org;
without --org it covers every organization that has a tombstone, and says so when there is none. If an organization’s
content is unreadable, the key folder is missing or is not the one that matches the store.
Upgrade
Section titled “Upgrade”Take a backup first, run nuramesh ledger verify, then follow Upgrade notes: stop every process
that uses the database before a migration that is not additive, apply the migrations, and verify again. Rolling back
is restoring the backup. Downgrade is not supported.
What is not available
Section titled “What is not available”- Point-in-time recovery, continuous archiving and a backup schedule. Use your PostgreSQL provider’s tools.
- Downgrade.
- A built-in restore drill. Restore the latest backup into a scratch database and key folder at least once a quarter, run the verify step and note how long it took. A backup you have not restored is a guess.
Troubleshooting
Section titled “Troubleshooting”| You see | Do this |
|---|---|
| An organization’s content is unreadable after a restore | The key folder is missing or is not the one that matches the store. Restore the key folder from the same backup, keeping its modes |
ledger verify exits 1 on a fresh database |
The ledger is empty. Pass --allow-empty only when empty is what you expect |
| The old version refuses to start after a restore | The restored database has a newer schema. Restore with the same version or a newer one, never an older one |
| Errors while restoring over a database in use | The ledger tables refuse updates and deletes by design. Restore into an empty database with every process stopped |
| The roles are missing on a new machine | A dump does not carry roles. Create nuramesh_owner and nuramesh_app first |
Next steps
Section titled “Next steps”- Upgrade: take a backup first, then follow the notes.
- Store maintenance: migrations and content expiry.
- Anchor the ledger to Git: the check that sees events cut off the end of a chain.
Was this page helpful?