backup: harden lifecycle fencing and skip near-empty archives

backup-node.sh now stops services, fences COMPOSE_FILE during backup, and
restores via EXIT trap; consumers skip <1MB .tar.zst artifacts so purged-
volume junk cannot shadow real backups.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-03 04:38:00 +00:00
parent 6c0df2bce5
commit 58adc446e2
6 changed files with 279 additions and 12 deletions

View File

@@ -12,6 +12,7 @@
# ./list-restorable.sh <network> --all <chain> # --all can be in any position
dir="$(dirname "$0")"
source "$dir/volume-utils.sh"
registry_file="${dir}/compose_registry.json"
backup_dir="/backup"
@@ -122,7 +123,7 @@ while IFS= read -r entry; do
while IFS= read -r volume; do
volume_name="rpc_${volume}"
# Look for backup files matching pattern: rpc_${volume}-[0-9]*G.tar.zst
backup_file=$(ls -1 "$backup_dir"/"${volume_name}"-[0-9]*G.tar.zst 2>/dev/null | sort | tail -n 1)
backup_file=$(select_newest_local_backup "$backup_dir" "$volume_name")
if [ -z "$backup_file" ]; then
all_backups_exist=false