forked from mtusi2026/mtusi2026lab4
reconcile-inject.sh wrote an orphan under a key whose uuid differed from the id it printed, so the demo could only compare counts; it now uses one uuid for both, and the dry-run check compares the found and the injected sets per class. The heal step returns the original bytes under one quarantined key and random bytes of the same length under another, and checks that only the first leaves the quarantine. The load phase sums rechecked over its passes, and a new step stops a pass hanging on a paused S3 with docker stop and checks exit code 143 within seconds and a free lock afterwards. reconcile_track.py cost clears the run files of the previous series and measures 1k, 10k, 30k and 100k with --deep everywhere. The scenarios record date, commit and docker inspect of the replicas or of S3 at the moment they are down. make load-evidence and make clean-clone-evidence rerun the message load and the clean clone block with raw output, and make upload-memory passes ARGS to reproduce the run directories. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V1d3RLHNBBMA6UqBLLJv27
56 lines
3.0 KiB
Bash
Executable File
56 lines
3.0 KiB
Bash
Executable File
#!/bin/sh
|
|
set -u
|
|
cd "$(dirname "$0")/.."
|
|
repo=$PWD
|
|
dir="${CLONE_DIR:-$(dirname "$repo")/mtusi2026lab4-clean}"
|
|
out="$repo/evidence/clean-clone.txt"
|
|
branch=$(git rev-parse --abbrev-ref HEAD)
|
|
project=$(basename "$dir")
|
|
[ -e "$dir" ] && { echo "$dir уже существует" >&2; exit 2; }
|
|
step() {
|
|
echo "\$ $*"
|
|
sh -c "$*" 2>&1 | sed "s#$dir#<clone>#g"
|
|
}
|
|
look() {
|
|
echo "\$ $* # наблюдение, не шаг инструкции"
|
|
sh -c "$*" 2>&1 | sed "s#$dir#<clone>#g"
|
|
}
|
|
{
|
|
echo "date: $(date -u +%FT%TZ) commit: $(git rev-parse --short HEAD) dir: $project (свой compose-проект и volumes)"
|
|
echo "# make clean-clone-evidence (scripts/clean-clone.sh): команды блока «Запуск из чистого clone» REPORT.md по очереди"
|
|
echo "# с сырым выводом; строки «наблюдение» — проверки между шагами"
|
|
echo "\$ git clone <repo> $project && cd $project && git checkout $branch"
|
|
git clone -q "$repo" "$dir" && cd "$dir" && git checkout -q "$branch" && git log -1 --format='HEAD %h %s'
|
|
look "docker volume ls -q --filter label=com.docker.compose.project=$project | wc -l | tr -d ' '"
|
|
step "make secrets"
|
|
if [ -n "${LB_HTTP_PORT:-}" ]; then
|
|
echo "\$ sed LB_HTTP_PORT=$LB_HTTP_PORT LB_STATS_PORT=${LB_STATS_PORT:-8404} .env # отступление: 8080 занят стендами других лаб"
|
|
sed -i.bak "s/^LB_HTTP_PORT=.*/LB_HTTP_PORT=$LB_HTTP_PORT/; s/^LB_STATS_PORT=.*/LB_STATS_PORT=${LB_STATS_PORT:-8404}/" .env && rm -f .env.bak
|
|
fi
|
|
look "git status --short --ignored secrets .env"
|
|
step "docker compose --env-file .env config --quiet && echo valid"
|
|
started=$(date +%s)
|
|
step "make up"
|
|
echo "make up: $(( $(date +%s) - started )) s"
|
|
look "docker compose ps -a --format '{{.Service}} {{.State}} {{.Status}} {{.Ports}}'"
|
|
look "docker compose logs --no-log-prefix migrate s3-init | grep -v '^\$' | tail -6"
|
|
look "curl -s \"http://\$(docker compose port lb 8404)/stats;csv\" | awk -F, '\$1 == \"api\" && \$2 != \"BACKEND\" {print \$2, \$18}' | grep -v MAINT"
|
|
step "make test"
|
|
step "make test-persistence ACTION_SCRIPT=scripts/restart.sh"
|
|
look "docker compose ps -a --format '{{.Service}} {{.State}} {{.RunningFor}} {{.Status}}'"
|
|
step "make test-failover ACTION_SCRIPT=scripts/stop-one.sh"
|
|
look "docker compose ps -a --format '{{.Service}} {{.Name}} {{.State}} {{.Status}}' api"
|
|
step "make restore"
|
|
step "make scenario SCENARIO=failover-upload"
|
|
step "make scenario SCENARIO=s3-outage"
|
|
step "make s3-check"
|
|
step "make reconcile"
|
|
step "make migrate"
|
|
look "docker volume ls --format '{{.Name}}' --filter label=com.docker.compose.project=$project"
|
|
step "make down"
|
|
look "docker volume ls --format '{{.Name}}' --filter label=com.docker.compose.project=$project"
|
|
step "make reset-data"
|
|
look "docker volume ls -q --filter label=com.docker.compose.project=$project | wc -l | tr -d ' '"
|
|
} > "$out"
|
|
cat "$out"
|