Include files in snapshots
snapshot captures only the database; uploaded files
(DOCUMENT_ROOT) are untouched, so a restore leaves the DB
pointing at files the snapshot never captured. Blocks the
scheduled-reset story for the public demo instances (image
uploads surviving every reset).
Work, all in scripts/data-ui (bash; no Lisp): a snapshot
becomes a pair — <name>.dump plus optional
<name>.files.tar.gz tarring the whole DOCUMENT_ROOT tree
(temp dir is a sibling, so nothing to exclude). save tars to a
temp file and mv=s it in beside the dump (same never-clobber
discipline). =restore restores the DB as today, then swaps
the files tree: untar to staging, mv the old tree aside as
files.pre-restore-<ts>, mv the fresh one in, delete the old
copy only on success (a failed untar never leaves the instance
fileless — same shape as the pre-restore safety dump). Old
snapshots without a tar restore DB-only, no error. drop
removes both; list annotates +files.
Plan: snapshot-files-plan.org.
Summary (2026-09-13): Implemented per the plan, no deviations.
scripts/data-ui: new snapshot_files_path helper;
snapshot_save now calls snapshot_save_files (tar
DOCUMENT_ROOT basename via -C dirname to a temp file, mv
in place; missing DOCUMENT_ROOT warns and saves DB-only; tar
failure after a successful dump is fatal with the DB-saved
message); snapshot_restore calls snapshot_restore_files
after the DB restore (untar to staging under the snapshot dir,
layout check — exactly one top-level entry named like
basename $DOCUMENT_ROOT —, swap the old tree aside as
<base>.pre-restore-<ts>, mv the fresh one in, delete the
old copy only on success; failed-second-mv puts the old tree
back; unreadable/wrong-layout tar dies with "database restored,
files left untouched"); snapshot_drop removes the pair;
snapshot_list appends , +files; usage and snapshot help
text mention the files side. Old dump-only snapshots restore
DB-only with a note. scripts/README.md: new "Files side"
paragraph in the snapshot section (pair naming, optional tar,
swap semantics, .pre-restore- recovery, non-atomic caveats,
FS_TEMP_DIRECTORY excluded by construction). Verified on the
dev path: save/list/restore round-trip (scratch file gone and
back, no residue), truncated tar and wrong-layout tar both die
correctly with files untouched, drop removes both, old snapshot
restores DB-only. Profile path (evo-x2 staging) untested —
deferred with the smoke; the env threading is the same
load_profile / export_repl_environment path the dev test
exercised. No Lisp changed.
- Slot
- 27600
- Status
- 60 Done
- Tags
- scripts
- Contributors
- Donnie