Complete lab2 grade 4 implementation and report
Application checks / application (pull_request) Canceled after 0s
Skeleton contracts / contracts (pull_request) Canceled after 0s

This commit is contained in:
Daria0w0
2026-10-10 00:28:43 +03:00
parent 83e3810d33
commit c0ca56f208
24 changed files with 1107 additions and 137 deletions
+5 -5
View File
@@ -3,7 +3,7 @@ Set-Location (Split-Path -Parent $PSScriptRoot)
function Read-Containers {
$result = @()
foreach ($service in @('api', 'postgres')) {
foreach ($service in @('api', 'postgres', 'redis')) {
$containerID = docker compose ps -q $service
if ($LASTEXITCODE -ne 0 -or -not $containerID) { throw "Cannot find $service container" }
$json = docker inspect --format '{{json .}}' $containerID
@@ -22,9 +22,9 @@ function Read-Containers {
}
$before = @(Read-Containers)
docker compose stop api postgres
docker compose stop api postgres redis
if ($LASTEXITCODE -ne 0) { throw 'Stop failed' }
docker compose up -d --wait postgres
docker compose up -d --wait postgres redis
if ($LASTEXITCODE -ne 0) { throw 'PostgreSQL restart failed' }
docker compose up -d --wait api
if ($LASTEXITCODE -ne 0) { throw 'API restart failed' }
@@ -39,6 +39,6 @@ foreach ($old in $before) {
}
}
$evidence = [ordered]@{ before = $before; after = $after; volumes_preserved = $true }
$path = Join-Path $PWD 'evidence/restart-containers.json'
$path = Join-Path $PWD 'evidence/restart-all-containers.json'
[System.IO.File]::WriteAllText($path, ($evidence | ConvertTo-Json -Depth 5), [System.Text.UTF8Encoding]::new($false))
Write-Output 'PASS: API and PostgreSQL restarted; named volumes preserved.'
Write-Output 'PASS: API, PostgreSQL and Redis restarted; named volumes preserved.'