Implement Lab 3 grade 4 messenger balancing

This commit is contained in:
2026-11-12 20:48:24 +03:00
parent 0ab3a341aa
commit db070826c0
52 changed files with 1967 additions and 50 deletions
+20
View File
@@ -0,0 +1,20 @@
#!/usr/bin/env sh
set -eu
cd "$(dirname "$0")/.."
# Stop the API before its state stores; named volumes are left intact.
docker compose stop api redis db
docker compose start db redis
attempt=0
until docker compose exec -T db pg_isready -U messenger -d messenger >/dev/null 2>&1 \
&& docker compose exec -T redis sh -ec 'REDISCLI_AUTH="$(cat /run/secrets/redis_password)" redis-cli ping | grep -q PONG' >/dev/null 2>&1; do
attempt=$((attempt + 1))
if [ "$attempt" -ge 60 ]; then
echo 'Database/cache did not become ready within 60 seconds.' >&2
exit 1
fi
sleep 1
done
docker compose start api