Files
mtusi2026lab4/scripts/restart.sh
T
ricoromaandClaude Opus 5.5 5e791a6fea fix: keep the same storage containers in the restart hook
- scripts/restart.sh waits for postgres, valkey and s3 with
  up --wait --no-recreate: Compose 5.4 recreated containers whose image
  was pulled by the first up (index digest in the label, platform
  manifest digest on the check), s3-bootstrap could not join the new s3
  network namespace (exit 128) and make test-persistence failed on a
  clean host; found by the CI job on the Gitea runner
- record the runner failure, the repro across Compose 5.4.0 and 5.6.1
  and the fixed and control runs on a fresh Docker daemon in
  evidence/tests/ci-application.md, REPORT.md and the docker rule

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 18:41:31 +03:00

27 lines
2.0 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/sh
set -eu
# Restart hook для make test-persistence (tests/README.md) по образцу
# scripts/restart.example.sh; правила — .claude/rules/docker.md.
# Перезапускает балансировщик, все реплики API и все хранилища стенда
# (Postgres, Valkey и S3) с сохранением volumes, схемы и данных: без
# down -v, FLUSHALL и повторного наполнения. Кэш Valkey после рестарта
# пуст: persistence у него выключен, данные — в Postgres. Bucket, учётные
# записи и объекты S3 лежат в его volume.
# LB гасится первым и поднимается последним. start поднимает те же
# контейнеры всех реплик: число реплик не меняется (реплика, остановленная
# stop-one.sh, тоже запускается). start api запускает и его зависимости
# migrate и s3-bootstrap: повторные миграции и bootstrap ничего не меняют.
# S3 останавливается плавно ~15 с (stop_grace_period 20 с): hook занимает
# ~30–35 с. Готовность через LB ждёт сам тест. Секреты не печатает.
cd "$(dirname "$0")/.."
docker compose stop haproxy api
docker compose restart postgres valkey s3
# те же контейнеры: --wait только дожидается их healthcheck.
# --no-recreate обязателен: Compose 5.4 пересоздаёт контейнер, если его
# образ скачивался при первом up (в метке — digest индекса, при сверке —
# манифеста платформы), и s3-bootstrap (network_mode: service:s3) после
# пересоздания s3 не стартует — код 128, start api падает
docker compose up -d --wait --no-recreate postgres valkey s3
docker compose start api haproxy