forked from mtusi2026/mtusi2026lab3
lab3: 2 API replicas behind nginx LB, idempotency, X-Instance-Id
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
@echo off
|
||||
docker compose --env-file .env restart postgres api-1 api-2 lb
|
||||
:wait
|
||||
curl.exe -fsS http://localhost:8080/health/ready >nul 2>&1
|
||||
if %errorlevel% neq 0 (
|
||||
timeout /t 1 /nobreak >nul
|
||||
goto wait
|
||||
)
|
||||
exit /b 0
|
||||
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
docker compose --env-file .env restart postgres api-1 api-2 lb
|
||||
i=0
|
||||
while [ "$i" -lt 90 ]; do
|
||||
if curl -fsS http://localhost:8080/health/ready >/dev/null 2>&1; then
|
||||
exit 0
|
||||
fi
|
||||
i=$((i + 1))
|
||||
sleep 1
|
||||
done
|
||||
exit 1
|
||||
@@ -0,0 +1,7 @@
|
||||
@echo off
|
||||
if "%TARGET_INSTANCE_ID%"=="" (
|
||||
echo TARGET_INSTANCE_ID is not set 1>&2
|
||||
exit /b 2
|
||||
)
|
||||
docker compose --env-file .env stop %TARGET_INSTANCE_ID%
|
||||
exit /b %errorlevel%
|
||||
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
: "${TARGET_INSTANCE_ID:?test provides target API instance alias}"
|
||||
exec docker compose --env-file .env stop "$TARGET_INSTANCE_ID"
|
||||
Reference in New Issue
Block a user