Files
cozystack/examples/backups/nats/run-all.sh
T
Timofei Larkin 727343d259 docs(backups): add NATS Job-strategy example
Add examples/backups/nats/, the first worked example of the generic Job
backup strategy. It backs up a NATS JetStream stream that has no dedicated
driver, using a stock natsio/nats-box image: 'nats stream backup' -> tar ->
curl --aws-sigv4 PUT to the COSI/seaweedfs S3 endpoint, and the reverse for
restore. One PodTemplateSpec serves both directions, branching at runtime on
{{ .Mode }} (the engine templates each string leaf independently and cannot
restructure the Pod per mode).

Mirrors the clickhouse example's structure: numbered scripts (bucket -> NATS
src + seeded stream -> strategy -> BackupClass -> BackupJob -> in-place and
to-copy RestoreJob), shared helpers, run-all.sh, README, and scenario docs.
Like every examples/backups/* dir it is a runnable demo, not CI-gated.

Signed-off-by: Timofei Larkin <lllamnyp@gmail.com>
2026-05-26 18:06:37 +03:00

19 lines
658 B
Bash
Executable File

#!/bin/bash
# Run every numbered step in order. Stops on the first failure.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
for step in 01 02 03 04 05 06 07; do
# find is glob-safe under set -euo pipefail and degrades to empty output
# when no file matches, unlike `ls glob | head` which mixes shell
# expansion semantics with `ls` exit codes.
script="$(find "$SCRIPT_DIR" -maxdepth 1 -type f -name "${step}-*.sh" | sort | head -n1)"
if [[ -z "$script" ]]; then
echo "no script found for step $step" >&2
exit 1
fi
echo "=== Running $(basename "$script") ==="
bash "$script"
done