Files
mtusi2026lab3/scripts/restart.sh
T
ricoromaandClaude Opus 5.5 ab71c3b51e feat: put API replicas behind HAProxy
HAProxy 3.4 is the only published entry point; api runs as
API_REPLICAS replicas without ports, found through Docker DNS and
checked on /health/ready. Retries only on connection failure, LB errors
in the contract error format, resource limits and per-service secrets.
Adds scripts/stop-one.sh, LB-aware restart.sh, make replicas /
instances / lb_stats and replica tests driven by EXPECT_REPLICAS.

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

21 lines
1.4 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) с сохранением volume, схемы и данных: без down -v,
# FLUSHALL и повторного наполнения. Кэш Valkey после рестарта пуст:
# persistence у него выключен, данные — в Postgres.
# LB гасится первым и поднимается последним. start поднимает те же
# контейнеры всех реплик: число реплик не меняется (реплика, остановленная
# stop-one.sh, тоже запускается). start api запускает и его зависимость
# migrate: повторный прогон миграций ничего не меняет.
# Готовность через LB ждёт сам тест. Секреты не печатает.
cd "$(dirname "$0")/.."
docker compose stop haproxy api
docker compose restart postgres valkey
# те же контейнеры: --wait только дожидается их healthcheck
docker compose up -d --wait postgres valkey
docker compose start api haproxy