Files
mtusi2026lab7/scripts/restart.sh

25 lines
921 B
Bash
Executable File

#!/bin/sh
# Перезапуск API и всех используемых хранилищ с сохранением volumes.
# OpenBao после рестарта sealed — это штатное состояние любого не-dev
# storage (raft), оператор разблокирует его unseal-ключами (scripts/openbao-unseal.sh).
set -eu
cd "$(dirname "$0")/.."
COMPOSE="docker compose --env-file .env"
$COMPOSE stop
sleep 2
$COMPOSE up -d postgres minio minio-init rabbitmq openbao
sh scripts/openbao-unseal.sh
$COMPOSE up -d db-init migrate db-grants
$COMPOSE up -d api worker ingress otel-collector prometheus loki tempo grafana
for i in $(seq 1 90); do
if curl -fs --cacert pki/trust/public-ca.crt -o /dev/null https://localhost:8443/health/ready 2>/dev/null; then
echo "stack ready after ${i}s"
exit 0
fi
sleep 2
done
echo "stack not ready in 180s" >&2
exit 1