Files
qrtx dc46ac213d feat(storage): add RustFS attachments and presigned uploads
Add two API replicas, safe object reconciliation, upload validation, regression tests and documented load experiments.
2026-11-12 10:16:39 +03:00

34 lines
1.1 KiB
Batchfile

@echo off
setlocal EnableDelayedExpansion
cd /d "%~dp0.."
if not defined TARGET_INSTANCE_ID (
echo TARGET_INSTANCE_ID is required 1>&2
exit /b 2
)
set "containers="
for /f "delims=" %%C in ('docker compose ps --all --quiet api') do (
set "containers=!containers! %%C"
set "candidate=%%C"
rem This Compose uses Docker's default hostname: the first 12 container-ID characters.
if "!candidate:~0,12!"=="%TARGET_INSTANCE_ID%" (
docker stop --time 0 %%C >nul
if errorlevel 1 exit /b 1
exit /b 0
)
)
if not defined containers (
echo No API containers found 1>&2
exit /b 2
)
rem Fallback for explicitly configured hostnames, still scoped to this project's API containers.
for /f "tokens=1,2 delims=:" %%H in ('docker inspect --format "{{.Config.Hostname}}:{{.Id}}" !containers!') do (
if "%%H"=="%TARGET_INSTANCE_ID%" (
rem Failure injection: stop immediately, leaving time for recovery within the 10-second test budget.
docker stop --time 0 %%I >nul
if errorlevel 1 exit /b 1
exit /b 0
)
)
echo No API container matches X-Instance-Id 1>&2
exit /b 2