forked from mtusi2026/mtusi2026lab5
Implement lab5 async image processing with RabbitMQ and outbox
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
@echo off
|
||||
setlocal
|
||||
cd /d "%~dp0.."
|
||||
docker compose --env-file .env stop --timeout 5 lb api1 api2 worker dispatcher broker s3 redis postgres
|
||||
if errorlevel 1 exit /b 1
|
||||
docker compose --env-file .env up -d --wait postgres redis broker s3 s3-bootstrap
|
||||
if errorlevel 1 exit /b 1
|
||||
docker compose --env-file .env up -d --no-deps api1 api2 lb dispatcher worker
|
||||
if errorlevel 1 exit /b 1
|
||||
python scripts\wait_ready.py
|
||||
exit /b %ERRORLEVEL%
|
||||
@@ -0,0 +1,10 @@
|
||||
@echo off
|
||||
setlocal
|
||||
cd /d "%~dp0.."
|
||||
if "%TARGET_INSTANCE_ID%"=="api1" goto stop
|
||||
if "%TARGET_INSTANCE_ID%"=="api2" goto stop
|
||||
echo Unexpected TARGET_INSTANCE_ID 1>&2
|
||||
exit /b 2
|
||||
:stop
|
||||
docker compose --env-file .env stop --timeout 1 %TARGET_INSTANCE_ID%
|
||||
exit /b %ERRORLEVEL%
|
||||
@@ -0,0 +1,14 @@
|
||||
"""Operator-facing readiness wait after container replacement."""
|
||||
import time
|
||||
import urllib.request
|
||||
for _ in range(120):
|
||||
try:
|
||||
with urllib.request.urlopen("http://localhost:8080/health/ready", timeout=2) as response:
|
||||
if response.status == 200:
|
||||
print("[restart] all services ready")
|
||||
break
|
||||
except Exception:
|
||||
pass
|
||||
time.sleep(.5)
|
||||
else:
|
||||
raise SystemExit("[restart] health timeout")
|
||||
Reference in New Issue
Block a user