Поставить несколько реплик API за общий балансировщик.

Сессия и ключ идемпотентности общие для реплик, миграция выполняется один раз, остановка одной реплики не теряет подтверждённые сообщения.
This commit is contained in:
2026-10-30 01:15:28 +03:00
parent 0ab3a341aa
commit 59f8c55f93
45 changed files with 3367 additions and 36 deletions
+18
View File
@@ -0,0 +1,18 @@
#!/bin/sh
# Restart the API and every store it uses. Volumes stay in place.
# Does not seed, flush, or run compose down -v.
set -eu
ROOT=$(CDPATH= cd -- "$(dirname "$0")/.." && pwd)
cd "$ROOT"
docker compose --env-file .env restart postgres redis
i=0
while [ "$i" -lt 60 ]; do
status=$(docker compose --env-file .env ps --format '{{.Service}} {{.Health}}')
if printf '%s\n' "$status" | grep -q 'postgres healthy' && printf '%s\n' "$status" | grep -q 'redis healthy'; then
break
fi
i=$((i + 1))
sleep 1
done
docker compose --env-file .env restart api
docker compose --env-file .env restart lb