ЛР5 - БВТ2302 - Зюлина - на 3

This commit is contained in:
2026-11-23 18:11:01 +03:00
parent 276dbdad8a
commit 69c62d13d3
37 changed files with 1914 additions and 57 deletions
+21
View File
@@ -0,0 +1,21 @@
$ErrorActionPreference = 'Stop'
Set-Location (Join-Path $PSScriptRoot '..')
function Get-ContainerState($phase) {
foreach ($service in @('db', 'redis', 'redis-broker', 'minio', 'api1', 'api2', 'worker', 'lb')) {
$containers = docker compose --env-file .env ps -q $service
if ($LASTEXITCODE -ne 0) { throw "Cannot list $service containers" }
foreach ($container in $containers) {
$name = docker inspect --format '{{.Name}}' $container
$started = docker inspect --format '{{.State.StartedAt}}' $container
"$phase service=$service container=$name started_at=$started"
}
}
}
$before = @(Get-ContainerState 'before')
docker compose --env-file .env restart db redis redis-broker minio api1 api2 worker lb | Out-Null
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
$after = @(Get-ContainerState 'after')
$stamp = Get-Date -Format 'yyyy-MM-dd HH:mm:ss K'
Add-Content -Path (Join-Path $PSScriptRoot '..\evidence\persistence-actions.txt') -Value "[$stamp]"
Add-Content -Path (Join-Path $PSScriptRoot '..\evidence\persistence-actions.txt') -Value $before
Add-Content -Path (Join-Path $PSScriptRoot '..\evidence\persistence-actions.txt') -Value $after