ЛР 3 — БВТ-2302 — Сабитов — на 3

This commit is contained in:
2026-12-01 18:09:13 +03:00
parent 0ab3a341aa
commit d79bf5c481
36 changed files with 1944 additions and 36 deletions
+19
View File
@@ -0,0 +1,19 @@
$ErrorActionPreference = 'Stop'
if ($env:TARGET_INSTANCE_ID -notin @('api1', 'api2')) { throw 'Invalid target' }
$target = $env:TARGET_INSTANCE_ID
$id = docker compose --env-file .env ps -a -q $target
if ($LASTEXITCODE -ne 0 -or !$id) { throw 'Target container missing' }
$running = docker inspect --format '{{.State.Running}}' $id
if ($LASTEXITCODE -ne 0 -or $running -ne 'false') { throw 'Target must actually be stopped' }
foreach ($service in @('db', 'lb', 'api1', 'api2')) {
if ($service -eq $target) { continue }
$id = docker compose --env-file .env ps -q $service
if ($LASTEXITCODE -ne 0 -or !$id) { throw "$service must be running" }
$running = docker inspect --format '{{.State.Running}}' $id
if ($LASTEXITCODE -ne 0 -or $running -ne 'true') { throw "$service stopped unexpectedly" }
}
Write-Output "PASS: $target really stopped; the other API, LB and database stayed running"
docker compose --env-file .env up -d --wait --wait-timeout 60 $target
if ($LASTEXITCODE -ne 0) { throw 'Restore failed' }
python -X utf8 scripts/wait_replicas.py
if ($LASTEXITCODE -ne 0) { throw 'LB recovery failed' }