Реализовать балансировку и отказ API-реплик
This commit is contained in:
Executable
+16
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
for service in api-1 api-2 api-3 api-4; do
|
||||
docker compose up -d --no-deps --force-recreate "$service"
|
||||
container=$(docker compose ps -q "$service")
|
||||
deadline=$(( $(date +%s) + 30 ))
|
||||
while [ "$(date +%s)" -lt "$deadline" ]; do
|
||||
status=$(docker inspect --format '{{.State.Health.Status}}' "$container" 2>/dev/null || true)
|
||||
[ "$status" = healthy ] && break
|
||||
sleep 1
|
||||
done
|
||||
[ "$(docker inspect --format '{{.State.Health.Status}}' "$container")" = healthy ]
|
||||
done
|
||||
|
||||
docker compose ps
|
||||
Reference in New Issue
Block a user