fix sso healtcheck
This commit is contained in:
23
apps/sso-core/docker-entrypoint.sh
Normal file
23
apps/sso-core/docker-entrypoint.sh
Normal file
@@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
echo "[sso-core] Применение схемы БД (Prisma)..."
|
||||
attempt=0
|
||||
max_attempts=30
|
||||
|
||||
while [ "$attempt" -lt "$max_attempts" ]; do
|
||||
attempt=$((attempt + 1))
|
||||
if npm --workspace @lendry/sso-core run prisma:push; then
|
||||
echo "[sso-core] Схема БД синхронизирована"
|
||||
break
|
||||
fi
|
||||
if [ "$attempt" -ge "$max_attempts" ]; then
|
||||
echo "[sso-core] ОШИБКА: не удалось подключиться к PostgreSQL после ${max_attempts} попыток." >&2
|
||||
echo "[sso-core] Проверьте POSTGRES_* в .env и пароль существующего volume postgres_data." >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "[sso-core] PostgreSQL недоступен или неверный пароль, повтор ${attempt}/${max_attempts}..."
|
||||
sleep 3
|
||||
done
|
||||
|
||||
exec node apps/sso-core/dist/main.js
|
||||
Reference in New Issue
Block a user