22 lines
576 B
Bash
22 lines
576 B
Bash
#!/bin/sh
|
|
set -eu
|
|
|
|
cd /home/mikail/dana-medical
|
|
test -s .env
|
|
grep -q '^POSTGRES_PASSWORD=.' .env
|
|
docker compose -p dana-medical -f docker-compose.prod.yml config --quiet
|
|
docker compose -p dana-medical -f docker-compose.prod.yml up -d db
|
|
|
|
db_id="$(docker compose -p dana-medical -f docker-compose.prod.yml ps -q db)"
|
|
test -n "$db_id"
|
|
i=0
|
|
status=starting
|
|
while [ "$i" -lt 30 ]; do
|
|
status="$(docker inspect --format '{{.State.Health.Status}}' "$db_id")"
|
|
[ "$status" = healthy ] && break
|
|
sleep 2
|
|
i=$((i + 1))
|
|
done
|
|
[ "$status" = healthy ]
|
|
printf 'db_health=%s\n' "$status"
|