выполненная лаб3

This commit is contained in:
2026-10-23 18:29:24 +03:00
parent 0ab3a341aa
commit f026c27938
57 changed files with 32952 additions and 33 deletions
+18
View File
@@ -0,0 +1,18 @@
#!/bin/sh
set -eu
cd "$(dirname "$0")/.."
# First build the new image and apply compatible migrations once:
# docker compose build api; docker compose run --rm migrate
# One surge container, wait readiness, remove one old container, repeat.
# The old IDs are captured before creating replacements.
old_ids=$(docker compose ps -q api)
count=$(printf '%s\n' "$old_ids" | wc -l | tr -d ' ')
[ "$count" -ge 2 ] || { echo 'At least two APIs required' >&2; exit 1; }
for old in $old_ids; do
docker compose up -d --no-build --pull never --no-deps --no-recreate --scale "api=$((count + 1))" api
for id in $(docker compose ps -q api); do
python3 scripts/wait-container.py "$id"
done
docker stop --time 5 "$old"
docker rm "$old"
done