выполненная лаб3
This commit is contained in:
Executable
+18
@@ -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
|
||||
Reference in New Issue
Block a user