This commit is contained in:
EgorAnti
2026-11-18 20:33:27 +03:00
parent 276dbdad8a
commit 77a43fa9cf
114 changed files with 6271 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
#!/bin/sh
set -eu
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
PROJECT_DIR=$(dirname -- "$SCRIPT_DIR")
cd "$PROJECT_DIR"
original_ids=$(docker compose --env-file .env ps -q api)
count=$(printf '%s\n' "$original_ids" | sed '/^$/d' | wc -l | tr -d ' ')
if [ "$count" -lt 2 ]; then
printf '%s\n' 'Rolling update requires at least two API replicas' >&2
exit 2
fi
for container_id in $original_ids; do
# Replace exactly one original replica and wait for the replacement before
# touching the next one. Named volumes and state stores are not changed.
docker stop --time 10 "$container_id" >/dev/null
docker rm "$container_id" >/dev/null
docker compose --env-file .env up -d --wait --wait-timeout 90 \
--no-deps --scale api=2 api >/dev/null
done