forked from mtusi2026/mtusi2026lab2
18 lines
423 B
Bash
18 lines
423 B
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
cd "$(dirname "$0")/.."
|
|
|
|
docker compose --env-file .env restart api postgres redis
|
|
|
|
for i in $(seq 1 60); do
|
|
status=$(docker inspect --format='{{.State.Health.Status}}' mtusi2026lab2-api-1 2>/dev/null || echo "unknown")
|
|
if [ "$status" = "healthy" ]; then
|
|
echo "api is healthy after ${i}s"
|
|
exit 0
|
|
fi
|
|
sleep 1
|
|
done
|
|
|
|
echo "api did not become healthy within 60s" >&2
|
|
exit 1 |