forked from mtusi2026/mtusi2026lab5
RabbitMQ (quorum queue, publisher confirms, manual ack, DLX) + отдельный worker: staging в S3 + вложение/job/outbox одной транзакцией -> 202 queued; relay outbox, lease с heartbeat и fencing (worker_id, attempt), retry с backoff+jitter, failed-реестр, безопасный replay с audit; thumbnail/crop/WebP в изолированном процессе с лимитами. Тесты окон отказа (fault injection), трек 1 «Очередь под перегрузкой» с backpressure. Перенесено исправление замечания lab3 PR #99 (U+0000 в тексте). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
52 lines
2.7 KiB
Bash
Executable File
52 lines
2.7 KiB
Bash
Executable File
#!/bin/sh
|
|
# Повторяемый сбор доказательств уровней 3–4 lab5 в evidence/ (запуск на хосте из корня, стенд уже поднят).
|
|
# Токены/пароли/ключи S3 в вывод не попадают: тесты их не печатают, hook-вывод подавлен тестом.
|
|
set -eu
|
|
cd "$(dirname "$0")/.."
|
|
export MSYS_NO_PATHCONV=1 PYTHONUTF8=1
|
|
compose() { docker compose --env-file .env "$@"; }
|
|
tester() { compose --profile tools run --rm tester sh -c "$1" 2>&1 | grep -v '^ Container'; }
|
|
stamp() { echo "# $(date -u +%Y-%m-%dT%H:%M:%SZ), commit $(git rev-parse --short HEAD 2>/dev/null || echo uncommitted)"; }
|
|
mkdir -p evidence
|
|
: > evidence/stop-one.log
|
|
|
|
echo '== stand and S3 bootstrap'
|
|
{ stamp
|
|
compose ps -a --format 'table {{.Name}}\t{{.Image}}\t{{.Status}}\t{{.Ports}}'
|
|
echo; echo '# s3-init (idempotent bucket bootstrap + anonymous access check):'
|
|
compose logs --no-log-prefix s3-init
|
|
echo; echo '# repeated bootstrap run (must not touch existing bucket):'
|
|
compose run --rm -T s3-init 2>&1 | grep -v '^ Container'
|
|
echo; echo '# volumes:'
|
|
docker volume ls --filter label=com.docker.compose.project=mtusi-lab5 --format '{{.Name}}'
|
|
echo; echo '# RabbitMQ: очереди (quorum), consumers и prefetch:'
|
|
compose exec -T rabbitmq rabbitmqctl -q list_queues name type durable messages consumers
|
|
compose exec -T rabbitmq rabbitmqctl -q list_consumers queue_name prefetch_count ack_required
|
|
} | tee evidence/stand.txt
|
|
|
|
echo '== public checks'
|
|
{ stamp
|
|
tester 'pip install -q --disable-pip-version-check --root-user-action=ignore -r requirements-dev.txt && make check && make validate PYTHON=python3 && make test'
|
|
} | tee evidence/public-tests.txt
|
|
|
|
echo '== failover: stop-one for each replica (restore between runs)'
|
|
{ stamp
|
|
for i in 1 2 3 4; do
|
|
tester 'make test-failover ACTION_SCRIPT=scripts/stop-one.sh'
|
|
tester 'sh scripts/restore.sh && curl -s -o /dev/null http://lb:8080/health/live'
|
|
[ "$(cut -d' ' -f4 evidence/stop-one.log | sort -u | wc -l)" -ge 2 ] && break
|
|
done
|
|
echo; echo '# evidence/stop-one.log (what the hook really stopped):'; cat evidence/stop-one.log
|
|
} | tee evidence/failover-hook.txt
|
|
|
|
echo '== persistence: restart of lb, api, worker, postgres, s3, rabbitmq, valkey with volumes'
|
|
{ stamp
|
|
tester 'make test-persistence ACTION_SCRIPT=scripts/restart.sh'
|
|
echo; echo '# hook scope (StartedAt before/after of every process):'
|
|
sh scripts/restart.sh
|
|
tester 'until curl -fs http://lb:8080/health/ready >/dev/null; do sleep 0.5; done; echo ready'
|
|
} | tee evidence/persistence.txt
|
|
|
|
echo '== student tests (lab5 + lab4/lab3/lab2 regression)'
|
|
{ stamp; sh scripts/test-lab5.sh 2>&1 | grep -v '^ Container'; } | tee evidence/student-tests.txt
|