Files
mtusi2026lab7/scripts/restart.cmd
T

20 lines
1.4 KiB
Batchfile

@echo off
rem Restart hook for tests/resilience.py on Windows (same as scripts/restart.sh), lab7.
rem Python on Windows cannot start .sh files directly (WinError 193), a .cmd file works.
rem Stores first (PostgreSQL, Redis, SeaweedFS S3, RabbitMQ, OpenBao, Prometheus, Loki, Tempo), then the operator
rem unseals OpenBao (scripts\bao.py unseal, shares from secrets\operator, nothing is printed), then the
rem collector gate, the application and the balancer. Volumes are kept.
cd /d "%~dp0.."
rem OpenBao first and alone, unsealed right away: while "restart" waits for the slow stores, a sealed OpenBao
rem fails 3 health checks, becomes "unhealthy" and "up --wait" aborts although it is unsealed a moment later.
docker compose restart openbao || exit /b 1
python scripts\bao.py unseal >nul || exit /b 1
docker compose restart postgres redis s3 rabbitmq prometheus loki tempo || exit /b 1
docker compose up -d --wait --no-recreate --no-build --no-deps postgres redis s3 rabbitmq openbao prometheus loki tempo || exit /b 1
rem otel-gate alone first: otel-collector lives in its network namespace and cannot start while the gate is stopped
docker compose restart otel-gate || exit /b 1
docker compose restart otel-collector api janitor dispatcher worker grafana || exit /b 1
docker compose restart lb || exit /b 1
docker compose up -d --wait --no-recreate --no-build --no-deps otel-gate api lb dispatcher worker grafana || exit /b 1
exit /b 0