This commit is contained in:
Getlles
2026-11-09 17:34:11 +03:00
parent ec540a1a72
commit a592b519ee
13 changed files with 1042 additions and 2 deletions
+3
View File
@@ -0,0 +1,3 @@
@echo off
docker compose restart
exit /b %ERRORLEVEL%
+3
View File
@@ -0,0 +1,3 @@
#!/bin/sh
set -eu
docker compose restart
+35
View File
@@ -0,0 +1,35 @@
#!/bin/sh
set -eu
wait_ready() {
svc=$1
timeout=60
echo "Waiting for $svc readiness (up to ${timeout}s)..."
while [ "$timeout" -gt 0 ]; do
if docker compose exec -T "$svc" python -c \
"import urllib.request; urllib.request.urlopen('http://localhost:8080/health/ready')" 2>/dev/null; then
echo "$svc is ready!"
return 0
fi
sleep 1
timeout=$((timeout - 1))
done
echo "$svc failed to become ready" >&2
return 1
}
echo "Starting Rolling Update"
echo "1. Rebuilding and replacing api-1..."
docker compose up -d --no-deps --build --force-recreate api-1
wait_ready api-1
echo "Reloading nginx to pick up new api-1 IP..."
docker compose exec -T nginx nginx -s reload
echo "2. Rebuilding and replacing api-2..."
docker compose up -d --no-deps --build --force-recreate api-2
wait_ready api-2
echo "Reloading nginx to pick up new api-2 IP..."
docker compose exec -T nginx nginx -s reload
echo "Rolling Update Completed Successfully"
+12
View File
@@ -0,0 +1,12 @@
#!/bin/sh
set -eu
: "${TARGET_INSTANCE_ID:?test provides target API instance alias}"
if [ "$TARGET_INSTANCE_ID" = "api-replica-1" ]; then
docker compose stop -t 3 api-1
elif [ "$TARGET_INSTANCE_ID" = "api-replica-2" ]; then
docker compose stop -t 3 api-2
else
echo "Unknown target instance: $TARGET_INSTANCE_ID" >&2
exit 1
fi