forked from mtusi2026/mtusi2026lab4
Добавить приватное S3-хранилище, вложения, presigned upload, reconciler и доказательства.
22 lines
755 B
PowerShell
22 lines
755 B
PowerShell
$ErrorActionPreference = 'Stop'
|
|
$root = Split-Path -Parent $PSScriptRoot
|
|
Set-Location $root
|
|
|
|
$target = $env:TARGET_INSTANCE_ID
|
|
if ([string]::IsNullOrWhiteSpace($target)) { exit 2 }
|
|
|
|
$ids = @(docker compose --env-file .env ps -q api)
|
|
foreach ($id in $ids) {
|
|
if ([string]::IsNullOrWhiteSpace($id)) { continue }
|
|
$hostName = (docker inspect --format '{{.Config.Hostname}}' $id).Trim()
|
|
$containerName = (docker inspect --format '{{.Name}}' $id).Trim().TrimStart('/')
|
|
if ($hostName -eq $target -or $hostName.StartsWith($target) -or
|
|
$target.StartsWith($hostName) -or $containerName -eq $target) {
|
|
docker stop --time 5 $id | Out-Null
|
|
exit 0
|
|
}
|
|
}
|
|
|
|
Write-Error 'stop-one: no API replica matches TARGET_INSTANCE_ID'
|
|
exit 3
|