2476667510
The owner copies infra/pi/ to the Kvitt Pi and runs it there (D-100); nothing
on the Mac connects to the Pis. compose stack of SPEC §10.2 with images
${KVITT_REGISTRY}/kvitt-{server,cert-sync,backup}, Caddyfile §10.5.2 verbatim,
.env.example with the OQ-3 values as CHANGE_ME placeholders, install.sh,
deploy.sh (backup before every deploy), bootstrap.sh, backup-now.sh,
install-apk.sh. cert-sync image and sync.sh (§10.5.1, tar stream for both
authorized_keys variants); backup.sh uploads with rclone copy --immutable and
deletes local files once both are confirmed on Drive (D-002); both sidecars
schedule with supercronic because busybox crond runs no jobs as non-root;
backup runs as uid 10001. .gitea/workflows/build-images.yaml from the owner's
example (not yet run); infra/build-images.sh and infra/publish-apk.sh (R8
mapping kept, version per §10.6) on the Mac; README checklist and RESTORE.md.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TQd3pEP9UeN2uifbHknQ7B
20 lines
1.3 KiB
Bash
Executable File
20 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Run the backup once on the Kvitt Pi (SPEC §10.9) and wait for it: /opt/kvitt/backup-now.sh
|
|
# Succeeds only when backup.sh succeeded and /backups/last-success changed: the snapshot passed integrity_check,
|
|
# both files are confirmed on Drive and their local copies are deleted (D-002). Lists the newest files on Drive.
|
|
set -euo pipefail
|
|
here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
# shellcheck source=lib.sh
|
|
. "$here/lib.sh"
|
|
|
|
before=$(compose exec -T backup cat /backups/last-success 2>/dev/null || true)
|
|
compose exec -T backup /backup.sh || die "backup.sh failed (lines above)"
|
|
after=$(compose exec -T backup cat /backups/last-success 2>/dev/null || true)
|
|
[[ -n "$after" && "$after" != "$before" ]] || die "last-success did not change (was '${before:-none}', is '${after:-none}')"
|
|
say "last-success: $after"
|
|
remote=$(env_value RCLONE_REMOTE); folder=$(env_value RCLONE_FOLDER_ID)
|
|
say "Newest files in the Drive folder:"
|
|
# shellcheck disable=SC2016 # the script runs inside the backup container, with its own \$1 and \$2
|
|
compose exec -T backup sh -c 'c=$(mktemp); cp /config/rclone/rclone.conf "$c"; RCLONE_CONFIG=$c rclone lsf "$1" --drive-root-folder-id "$2" --files-only --log-level ERROR; s=$?; rm -f "$c"; exit $s' \
|
|
sh "${remote:-gdrive:}" "$folder" | sort | tail -n 4
|