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:
@@ -294,11 +294,12 @@ transfer_backup() {
|
||||
local key=$1
|
||||
local volume_name="rpc_$key"
|
||||
|
||||
# Find the newest backup file
|
||||
local backup_file=$(ls -1 "$backup_dir"/"${volume_name}"-[0-9]*G.tar.zst 2>/dev/null | sort | tail -n 1)
|
||||
# Find the newest restorable backup file (skip near-empty artifacts)
|
||||
local backup_file
|
||||
backup_file=$(select_newest_local_backup "$backup_dir" "$volume_name")
|
||||
|
||||
if [[ -z "$backup_file" ]] || [[ ! -f "$backup_file" ]]; then
|
||||
echo "Warning: No backup file found for $volume_name, skipping"
|
||||
echo "Warning: No restorable backup file found for $volume_name, skipping"
|
||||
return 1
|
||||
fi
|
||||
|
||||
@@ -482,11 +483,12 @@ transfer_backup_ssh() {
|
||||
local key=$1
|
||||
local volume_name="rpc_$key"
|
||||
|
||||
# Find the newest backup file
|
||||
local backup_file=$(ls -1 "$backup_dir"/"${volume_name}"-[0-9]*G.tar.zst 2>/dev/null | sort | tail -n 1)
|
||||
# Find the newest restorable backup file (skip near-empty artifacts)
|
||||
local backup_file
|
||||
backup_file=$(select_newest_local_backup "$backup_dir" "$volume_name")
|
||||
|
||||
if [[ -z "$backup_file" ]] || [[ ! -f "$backup_file" ]]; then
|
||||
echo "Warning: No backup file found for $volume_name, skipping"
|
||||
echo "Warning: No restorable backup file found for $volume_name, skipping"
|
||||
return 1
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user