complete level 5 track 1

This commit is contained in:
2026-10-15 13:04:16 +03:00
parent 9d0080db10
commit 4918969c6b
40 changed files with 877 additions and 53 deletions
+3
View File
@@ -0,0 +1,3 @@
@echo off
powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0restart.ps1"
exit /b %ERRORLEVEL%
+3
View File
@@ -0,0 +1,3 @@
$ErrorActionPreference = 'Stop'
docker compose --env-file .env restart db redis api lb
+7
View File
@@ -0,0 +1,7 @@
#!/bin/sh
set -eu
# Restart API and state stores. Volumes are untouched -> data, sessions
# and idempotency keys survive.
# migrate is one-shot (exited 0) and is intentionally not restarted here.
docker compose --env-file .env restart db redis api lb
+3
View File
@@ -0,0 +1,3 @@
@echo off
powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0stop-one.ps1"
exit /b %ERRORLEVEL%
+14
View File
@@ -0,0 +1,14 @@
$ErrorActionPreference = 'Stop'
if (-not $env:TARGET_INSTANCE_ID) {
Write-Error "TARGET_INSTANCE_ID is not set"
exit 2
}
$id = $env:TARGET_INSTANCE_ID
$logDir = "evidence\lab3"
New-Item -ItemType Directory -Force -Path $logDir | Out-Null
docker stop $id | Out-Null
docker logs $id 2>&1 | Out-File -Encoding utf8 "$logDir\api-$id.log"
Write-Host "saved $logDir\api-$id.log"
+8
View File
@@ -0,0 +1,8 @@
#!/bin/sh
set -eu
: "${TARGET_INSTANCE_ID:?test provides target API instance alias}"
# X-Instance-Id = short container ID (lab3 implementation detail).
# docker stop resolves short IDs natively.
docker stop "$TARGET_INSTANCE_ID"