Backup and restore: move between installs and database types (Postgres ↔ SQLite) #96

Closed
opened 2026-11-28 20:04:20 +00:00 by jfro · 0 comments
Owner

Jeremy (Nov 28): build a way to migrate between installs or database types. The most flexible way is a backup/restore covering everything in the database, done from the UI after the app has started.

What it does

  • Backup (Settings → Backup): download one file holding every table's rows (sources, agents, AI providers, notification channels/webhooks, trackers, dependencies, silences, reports + events/notes/ignores, signal states, chat, users, identities, API tokens). Not included: session tokens (users_tokens) — everyone signs in again after a restore.
  • Restore: upload that file to replace all data. Works across installs and across Postgres ↔ SQLite builds. Offered in Settings, and on the first-run screen of an empty install so a new install can start from a backup instead of setup.

Format

  • A .tar.gz (or zip) with manifest.json (app version, schema migration version, source adapter, created_at, table row counts) and one JSON(L) file per table. DB-agnostic JSON, not SQL dumps, so it loads into either adapter.
  • Restore refuses a backup from a newer schema than the running app; an older one is fine (migrate data forward where needed, or reject with a clear message).

Secrets

Stored secrets are encrypted with a key from this install's secret_key_base (Lamplighter.Vault), so they can't be copied as is. On backup, decrypt them and encrypt the backup's secrets with a passphrase the admin types (key from the passphrase, e.g. PBKDF2/Argon2 via stdlib/:crypto); on restore, decrypt with the passphrase and re-encrypt with the new install's Vault. A wrong passphrase fails cleanly and changes nothing.

Safety

  • Restore runs in one transaction: all or nothing. IDs are kept, and sequences are reset on Postgres.
  • Admin only. Large tables (report_events, chat_messages) stream rather than load all at once.

Done

  • A round trip test on each adapter (seed every table → backup → wipe → restore → same rows, secrets decrypt).
  • A cross-adapter test (backup from the Postgres build, restore into the SQLite build), plus a wrong-passphrase test and a newer-schema rejection test.
  • A UI PR: Nye's browser check at 390px and desktop.
Jeremy (Nov 28): build a way to migrate between installs or database types. The most flexible way is a backup/restore covering everything in the database, done from the UI after the app has started. ## What it does - **Backup** (Settings → Backup): download one file holding every table's rows (sources, agents, AI providers, notification channels/webhooks, trackers, dependencies, silences, reports + events/notes/ignores, signal states, chat, users, identities, API tokens). Not included: session tokens (`users_tokens`) — everyone signs in again after a restore. - **Restore**: upload that file to replace all data. Works across installs and across Postgres ↔ SQLite builds. Offered in Settings, and on the first-run screen of an empty install so a new install can start from a backup instead of setup. ## Format - A `.tar.gz` (or zip) with `manifest.json` (app version, schema migration version, source adapter, created_at, table row counts) and one JSON(L) file per table. DB-agnostic JSON, not SQL dumps, so it loads into either adapter. - Restore refuses a backup from a newer schema than the running app; an older one is fine (migrate data forward where needed, or reject with a clear message). ## Secrets Stored secrets are encrypted with a key from this install's `secret_key_base` (`Lamplighter.Vault`), so they can't be copied as is. On backup, decrypt them and encrypt the backup's secrets with a passphrase the admin types (key from the passphrase, e.g. PBKDF2/Argon2 via stdlib/`:crypto`); on restore, decrypt with the passphrase and re-encrypt with the new install's Vault. A wrong passphrase fails cleanly and changes nothing. ## Safety - Restore runs in one transaction: all or nothing. IDs are kept, and sequences are reset on Postgres. - Admin only. Large tables (report_events, chat_messages) stream rather than load all at once. ## Done - A round trip test on each adapter (seed every table → backup → wipe → restore → same rows, secrets decrypt). - A cross-adapter test (backup from the Postgres build, restore into the SQLite build), plus a wrong-passphrase test and a newer-schema rejection test. - A UI PR: Nye's browser check at 390px and desktop.
jfro added this to the v1.4 milestone 2026-11-28 20:04:20 +00:00
jfro closed this issue 2026-11-28 21:51:32 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
jfro/lamplighter#96
No description provided.