homelab-codex-ws/services/ha-diag-agent/tests/integration/scripts/snapshot.sh
Oskar Kapala 07bd498fd6 feat(ha-diag-agent): test environment with dual HA Docker instances
- dockerized ken + chelsty HA test instances with template fixtures
- snapshot/reset/wait scripts for fixture management
- integration test infrastructure with separate marker
- location_tag promoted from metadata to event payload (Phase 1 flag #3)
- chelsty-infra target_url points to chelsty-ha via tailnet (Phase 1 flag #1)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-29 12:56:13 +02:00

22 lines
624 B
Bash
Executable file

#!/bin/sh
# Snapshot the current state of an HA Docker volume.
# Usage: snapshot.sh <volume_name> [output_dir]
#
# Saves a tar.gz of the entire volume to output_dir (default: ./snapshots/).
# Use reset.sh to restore.
VOLUME="${1:?Usage: snapshot.sh <volume_name> [output_dir]}"
OUTPUT_DIR="${2:-./snapshots}"
SNAPSHOT_FILE="$OUTPUT_DIR/$VOLUME-$(date +%Y%m%d-%H%M%S).tar.gz"
mkdir -p "$OUTPUT_DIR"
printf 'Snapshotting volume %s -> %s\n' "$VOLUME" "$SNAPSHOT_FILE"
docker run --rm \
-v "$VOLUME":/data:ro \
alpine \
tar czf - -C / data \
> "$SNAPSHOT_FILE"
printf 'Snapshot saved: %s\n' "$SNAPSHOT_FILE"