forked from mtusi2026/mtusi2026lab3
Implement lab3 load balancing and idempotent messaging
This commit is contained in:
Executable
+21
@@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
cd "$(dirname "$0")/.."
|
||||
# Preserve named volumes. Restart all state stores and both API processes.
|
||||
docker compose --env-file .env stop --timeout 5 lb api1 api2 redis postgres
|
||||
docker compose --env-file .env up -d --wait postgres redis
|
||||
docker compose --env-file .env up -d --no-deps api1 api2 lb
|
||||
python - <<'PY'
|
||||
import time, urllib.request
|
||||
for i 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')
|
||||
PY
|
||||
Reference in New Issue
Block a user