forked from mtusi2026/mtusi2026lab3
feat:report
This commit is contained in:
+19
-7
@@ -1,14 +1,26 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
# Перезапуск API + всех state stores, volumes сохраняются.
|
||||
docker compose restart postgres redis api1 api2 lb
|
||||
# Ждём готовности.
|
||||
for i in $(seq 1 60); do
|
||||
if docker compose exec -T lb wget -qO- http://127.0.0.1:8080/health/ready >/dev/null 2>&1; then
|
||||
echo "ready after ${i}s"
|
||||
|
||||
# ./scripts/restart.sh # 2 реплики (по умолчанию)
|
||||
# ./scripts/restart.sh 4 # 4 реплики
|
||||
REPLICAS="${1:-2}"
|
||||
|
||||
# Останов с сохранением volumes.
|
||||
docker compose down --remove-orphans
|
||||
|
||||
# Пересоздание сети + контейнеров с нужным числом реплик.
|
||||
API_REPLICAS="$REPLICAS" \
|
||||
docker compose --env-file .env -f compose.yaml up -d --build
|
||||
|
||||
# Ждём готовности с хоста.
|
||||
i=0
|
||||
while [ "$i" -lt 90 ]; do
|
||||
if curl -sf http://localhost:8080/health/ready >/dev/null 2>&1; then
|
||||
echo "ready after ${i}s (replicas=$REPLICAS)"
|
||||
exit 0
|
||||
fi
|
||||
i=$((i + 1))
|
||||
sleep 1
|
||||
done
|
||||
echo "stack did not become ready in 60s" >&2
|
||||
echo "stack did not become ready in 90s" >&2
|
||||
exit 1
|
||||
Reference in New Issue
Block a user