forked from mtusi2026/mtusi2026lab3
feat(infra): add replicated API and readiness-aware load balancing
Provide resource profiles, persistent storage, parallel Nginx health checks and graceful restart hooks.
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
@echo off
|
||||
setlocal
|
||||
cd /d "%~dp0.."
|
||||
if not defined TARGET_INSTANCE_ID (
|
||||
echo TARGET_INSTANCE_ID is required 1>&2
|
||||
exit /b 2
|
||||
)
|
||||
for /f "delims=" %%I in ('docker compose ps --all --quiet api') do (
|
||||
for /f "delims=" %%H in ('docker inspect --format "{{.Config.Hostname}}" %%I') do (
|
||||
if "%%H"=="%TARGET_INSTANCE_ID%" (
|
||||
docker stop --time 2 %%I >nul
|
||||
if errorlevel 1 exit /b 1
|
||||
exit /b 0
|
||||
)
|
||||
)
|
||||
)
|
||||
echo No API container matches X-Instance-Id 1>&2
|
||||
exit /b 2
|
||||
Reference in New Issue
Block a user