M2c-dev: development compose stack, backup job, Firebase setup docs
infra/dev: compose stack on the Mac (server kvitt-server:dev, on-demand backup), .env.example, build/up/logs/backup/copy-google-services scripts. No Caddy, no TLS (debug builds accept http to private LAN addresses, AC-2.8). Bind-mounted data. infra/backup: alpine 3.24.2 image and backup.sh (SPEC 10.9; Drive upload skipped when RCLONE_FOLDER_ID is empty). infra/README.md for the dev stack and Firebase. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Executable
+20
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env bash
|
||||
# Runs the backup job once against the development data (SPEC §10.9 with RCLONE_FOLDER_ID empty: no Drive upload).
|
||||
# Writes kvitt-<UTC stamp>.sqlite.gz and pictures-<stamp>.tar.gz into the backups folder (default infra/dev/backups/)
|
||||
# and checks the newest snapshot with PRAGMA integrity_check, using the backup image's own sqlite3.
|
||||
set -euo pipefail
|
||||
# shellcheck source=lib.sh
|
||||
. "$(dirname "$0")/lib.sh"
|
||||
|
||||
backup_dir="$(dev_path "$(env_value KVITT_DEV_BACKUP_DIR)")"
|
||||
mkdir -p "$backup_dir"
|
||||
|
||||
compose --profile backup run --rm -T backup /backup.sh
|
||||
|
||||
latest="$(find "$backup_dir" -maxdepth 1 -name 'kvitt-*.sqlite.gz' | sort | tail -n 1)"
|
||||
[[ -n "$latest" ]] || { echo "backup.sh: no snapshot found in $backup_dir" >&2; exit 1; }
|
||||
name="$(basename "$latest")"
|
||||
result="$(compose --profile backup run --rm -T --entrypoint sh backup -c \
|
||||
"gunzip -c '/backups/$name' > /tmp/check.sqlite && sqlite3 -batch -noheader -list /tmp/check.sqlite 'PRAGMA integrity_check'")"
|
||||
echo "$name: integrity_check $result"
|
||||
[[ "$result" == "ok" ]]
|
||||
Reference in New Issue
Block a user