Archive the whole data volume in Backups, not just the database
Settings > Backups gains a whole-data archive beside the database snapshots, and both lists now fully work from the page. - Data archives: `write-data-backup-archive.ts` tars all of DATA_DIR into BACKUP_ARCHIVE_DIR as cobble-data-<epoch-ms>.tar.gz, every entry under one root folder named after the archive, writing a .part name and renaming on success so a cut-off run is never listed. The newest AppData.DataBackupsKept are kept; db/.backups is left as it is. - Restore: `restore-data-backup.ts` extracts to a temp dir, requires one root folder holding a db folder, takes a safety archive first, then replaces DATA_DIR (the database snapshots included) and `restart-app.ts` restarts the process through the docker socket, since the open SQLite handle points at the replaced file. - Upload and restore: a modal over each list (database file or data archive), replacing the old /admin/settings/backups/restore page. - Delete for both kinds, icon-only row actions shared through RowIconButton, and restore on every row. - One backup or restore of either kind at a time (with-backup-run-lock). - BACKUP_ARCHIVE_DIR is a start-up path (ProcessOnlyEnvKeys); the installer mounts $COBBLE_HOME/backups-archives at /backups-archives and recreates a container that lacks it. The image installs tar and gzip.
This commit is contained in:
@@ -195,6 +195,7 @@ Everything that must survive an update lives under the install directory:
|
||||
.env # generated once, mode 600
|
||||
install.conf # installer state
|
||||
backups/ # pre-update database snapshots
|
||||
backups-archives/ # whole-data archives, from Settings > Backups
|
||||
data/
|
||||
db/cobble
|
||||
db/.backups/
|
||||
@@ -213,6 +214,16 @@ Edit `.env` and run `docker restart cobble` to apply changes. The installer
|
||||
only appends missing values and keeps what is already there, apart from the
|
||||
port it manages.
|
||||
|
||||
Settings > Backups makes two kinds of copy. Database snapshots (bun-sqlite's
|
||||
`backup` command) stay in `data/db/.backups` and can be restored from the
|
||||
app. Whole-data archives are a `tar.gz` of the entire `data/` directory,
|
||||
written to `backups-archives/` (mounted at `/backups-archives`, the
|
||||
`BACKUP_ARCHIVE_DIR` setting); every entry sits under one folder named after
|
||||
the archive, so extracting one by hand drops a single folder. Each group
|
||||
can create a copy, restore from one (a listed row, or a file uploaded from
|
||||
the button beside Create), download it and delete it; the newest five
|
||||
archives are kept.
|
||||
|
||||
The app container is started with the Docker socket mounted and
|
||||
`MAIN_SERVER=1`, so it can create computer containers and run cron, the
|
||||
queue and Web Push.
|
||||
|
||||
Reference in New Issue
Block a user