fix(infra): wait for postgres readiness before running migrations on container start
Installs postgresql-client in the dev image so pg_isready is available. The startup script now polls until postgres accepts connections, preventing the P1001 "can't reach database" crash when the app container starts before postgres is fully ready. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,13 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
# Wait for postgres to be ready before running migrations
|
||||
echo "Waiting for postgres..."
|
||||
until pg_isready -h "${POSTGRES_HOST:-postgres}" -p "${POSTGRES_PORT:-5432}" -q; do
|
||||
sleep 1
|
||||
done
|
||||
echo "Postgres is ready."
|
||||
|
||||
# Regenerate Prisma client (needed after bind-mount overlays the image layer)
|
||||
pnpm --filter @capakraken/db db:generate
|
||||
|
||||
|
||||
Reference in New Issue
Block a user