feat(backup): back up and restore everything, across installs and databases (#96) #97
No reviewers
Labels
No labels
bug
docs
duplicate
enhancement
help wanted
invalid
nice-to-have
pre-1.0
question
security
wontfix
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
jfro/lamplighter!97
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/96-backup-restore"
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?
What changed
PR #97 at
39a2eb0is unchanged since the last Prover found nothing wrong (C52) but ended stuck; CI is green on all 4 jobs. Repro: in /home/peak/work/lamplighter-v1-4/wt-96 runenv -u FORGEJO_TOKEN MIX_TEST_PARTITION=_prover mix testafter mise activate, then again with LAMPLIGHTER_DB=sqlite MIX_BUILD_ROOT=_build_sqlite.Fixes #96
Red, then green
bash -c 'source ~/.rmenv; export PATH=$HOME/.local/bin:$PATH; eval "$(mise activate bash --shims)"; T="test/lamplighter/backup_test.exs test/lamplighter_web/live/backup_settings_live_test.exs"; env -u FORGEJO_TOKEN MIX_TEST_PARTITION=_96p mix test $T && env -u FORGEJO_TOKEN LAMPLIGHTER_DB=sqlite MIX_BUILD_ROOT=_build_sqlite MIX_TEST_PARTITION=_96p mix test $T'448212f): exit 11233c18): exit 0Checks
56b5c48has green CI: tests on Postgres and SQLite plus both images. (Upper Wolfjaw):test "$(curl -s https://git.knope.dev/api/v1/repos/jfro/lamplighter/commits/56b5c48/status | jq -r .state)" = success, exit 01233c18: a Postgres backup restored through /restore on an empty SQLite build (different secret_key_base), then a SQLite backup restored through Settings → Backup on Postgres. All 17 tables, users and every sealed secret came through, and Postgres handed out id 14 after the restore, so its sequence was moved past the restored rows. (Nye):/home/peak/work/lamplighter-v1-4/nye-checks/l97/xdb_verify.sh, exit 01233c18: 1335 tests on Postgres and 1335 on SQLite. (Nye):git -C /home/peak/work/lamplighter-v1-4/lamplighter stash -u -q 2>/dev/null; git -C /home/peak/work/lamplighter-v1-4/lamplighter checkout -q --detach 1233c18 && /home/peak/work/lamplighter-v1-4/nye-checks/l97/suites.sh; rc=$?; git -C /home/peak/work/lamplighter-v1-4/lamplighter checkout -q nye/97-review; git -C /home/peak/work/lamplighter-v1-4/lamplighter stash pop -q 2>/dev/null; exit $rc, exit 0/home/peak/work/lamplighter-v1-4/nye-checks/l97/gates.sh, exit 0bash -c 'source ~/.rmenv; eval "$(mise activate bash --shims)"; env -u FORGEJO_TOKEN MIX_TEST_PARTITION=_96 mix test test/lamplighter/backup_test.exs', exit 0343b6a3, separate from Upper Wolfjaw's test. (Nye):bash /home/peak/work/lamplighter-v1-4/nye-checks/l97/kdf_test.sh, exit 0343b6a3works in WebKit at 390px and 1440px: the passphrase rules keep the button disabled, the page stays live after a download, the re-auth gate works, and /restore is closed. 27 screenshots, no overflow. (Nye):bash /home/peak/work/lamplighter-v1-4/nye-checks/l97/wk_check.sh, exit 0343b6a3plus my F2 test: 1338/1338 each. (Nye):bash /home/peak/work/lamplighter-v1-4/nye-checks/l97/suites.sh, exit 039a2eb0: my own test (a restore whose manifest asks for a huge PBKDF2 count is refused quickly) passes on the new head. (Nye):bash /home/peak/work/lamplighter-v1-4/nye-checks/l97/kdf_test.sh, exit 039a2eb0the real /restore page with no accounts refuses a 9.4 MB upload that unpacks to 9 GiB in about 20 s and writes nothing, on Postgres at 390px and SQLite at 1440px. The seed fixture then restores across databases, and /settings/ai renders the restored "claude" provider. (Nye):bash /home/peak/work/lamplighter-v1-4/nye-checks/l97/recheck.sh, exit 039a2eb0plus my F2 test: 1339/1339 on Postgres and on SQLite. (Nye):bash /home/peak/work/lamplighter-v1-4/nye-checks/l97/suites.sh, exit 039a2eb0I read the backup, restore and /restore code and ran both full suites 13 times each, 1338 passing, with one unexplained failure in the first run that never came back. Not tried: a real production restore. (Prover):bash -c 'source ~/.rmenv; export PATH=$HOME/.local/bin:$PATH; eval "$(mise activate bash --shims)"; T="test/lamplighter/backup_test.exs test/lamplighter_web/live/backup_settings_live_test.exs"; env -u FORGEJO_TOKEN MIX_TEST_PARTITION=_prv96 mix test $T && env -u FORGEJO_TOKEN LAMPLIGHTER_DB=sqlite MIX_BUILD_ROOT=_build_sqlite MIX_TEST_PARTITION=_prv96 mix test $T', exit 039a2eb0I read the backup/restore diff (PBKDF2 cap 10x, 8 GiB unpack cap) and ran both full suites, 1338 passing on Postgres and SQLite, clean. Not tried: a real production-size restore, or the over-8 GiB tar entry edge. (Prover):bash -c 'source ~/.rmenv; export PATH=$HOME/.local/bin:$PATH; eval "$(mise activate bash --shims)"; cd /home/peak/scratch/prove96 && T="test/lamplighter/backup_test.exs test/lamplighter_web/live/backup_settings_live_test.exs"; env -u FORGEJO_TOKEN MIX_TEST_PARTITION=_prv96c mix test $T && env -u FORGEJO_TOKEN LAMPLIGHTER_DB=sqlite MIX_BUILD_ROOT=_build_sqlite MIX_TEST_PARTITION=_prv96c mix test $T', exit 0Found and fixed
343b6a3), restore unpacks a 200 MB gzip bomb in full instead of refusing it, so an upload to the no-sign-in /restore page can fill the disk. (fixed)Shipping it
Prover
Passed (Sonnet): At
39a2eb0I read the backup/restore diff (PBKDF2 cap 10x, 8 GiB unpack cap) and ran both full suites, 1338 passing on Postgres and SQLite, clean. Not tried: a real production-size restore, or the over-8 GiB tar entry edge.Every command above was run by Fortysix's Basecamp itself, on the branch named.
Screenshots (Chromium) at
56b5c48, with the example data in the dev database (3 sources, 30 reports, 105 events, 5 notification channels, 2 users, a chat).The walkthrough was a real move from Postgres to SQLite: I downloaded a backup from the Postgres dev server and restored it on an empty SQLite dev server through its first-run screen. Then I signed in there with the same account. Every table's row count matched, and the source and notification secrets opened under the SQLite install's Vault.
Settings → Backup (desktop, 390px)


Passphrase checks as you type (download stays disabled)

Wrong passphrase on restore: nothing changed

Empty install (SQLite build): the log-in screen offers a restore, then the restore form, then back at log-in after it's done



SQLite dashboard after the restore, signed in with the restored account
