forked from mtusi2026/mtusi2026lab7
Закрывает обязательный минимум и трек 1: ротация leaf и секрета, sealed OpenBao и сохранность queued-задачи.
31 lines
827 B
Bash
31 lines
827 B
Bash
#!/bin/sh
|
|
# Restart user-data stores and the application. OpenBao stays up: restarting it seals the vault.
|
|
set -eu
|
|
cd "$(dirname "$0")/.."
|
|
|
|
wait_healthy() {
|
|
i=0
|
|
while [ "$i" -lt 40 ]; do
|
|
ok=1
|
|
for svc in "$@"; do
|
|
health=$(docker compose --env-file .env ps --format '{{.Service}} {{.Health}}' "$svc" | awk 'NR==1 {print $2}')
|
|
if [ "$health" != "healthy" ]; then
|
|
ok=0
|
|
fi
|
|
done
|
|
if [ "$ok" -eq 1 ]; then
|
|
return 0
|
|
fi
|
|
i=$((i + 1))
|
|
sleep 2
|
|
done
|
|
echo "timed out waiting for healthy: $*" >&2
|
|
return 1
|
|
}
|
|
|
|
docker compose --env-file .env restart -t 8 postgres minio rabbitmq valkey
|
|
wait_healthy postgres minio rabbitmq valkey
|
|
docker compose --env-file .env restart -t 8 api-1 api-2 worker
|
|
wait_healthy api-1 api-2 worker
|
|
docker compose --env-file .env restart -t 3 nginx
|