Browse Source

fix(railway): use prisma db push instead of 108 migrations, extend healthcheck to 5min

prisma migrate deploy runs 108 sequential migrations on a fresh DB which
exceeds the healthcheck timeout. prisma db push applies the full schema in
one shot. Also remove set -e so failures are logged instead of silent exit.

Co-authored-by: Cursor <cursoragent@cursor.com>
pull/6386/head
Yash Kuceriya 1 month ago
parent
commit
d252810324
  1. 21
      docker/entrypoint.sh
  2. 4
      railway.toml

21
docker/entrypoint.sh

@ -1,13 +1,20 @@
#!/bin/sh #!/bin/sh
set -ex echo "=== Ghostfolio entrypoint ==="
echo "PORT=${PORT:-not set}"
echo "DATABASE_URL set: $([ -n \"$DATABASE_URL\" ] && echo yes || echo NO)"
echo "REDIS_HOST=${REDIS_HOST:-not set}"
echo "Entrypoint: PORT=${PORT:-not set}" echo "Applying database schema..."
echo "Running database migrations" # Use db push for speed (applies full schema in one shot).
npx prisma migrate deploy # migrate deploy runs 108 migrations sequentially which can exceed healthcheck timeout.
npx prisma db push --accept-data-loss 2>&1 || {
echo "ERROR: prisma db push failed (exit $?). Trying migrate deploy as fallback..."
npx prisma migrate deploy 2>&1 || echo "WARNING: migrate deploy also failed"
}
echo "Seeding the database" echo "Seeding the database..."
npx prisma db seed || echo "Seed failed (non-fatal), continuing..." npx prisma db seed 2>&1 || echo "Seed failed (non-fatal), continuing..."
echo "Starting the server on port ${PORT:-3000}" echo "Starting the server on port ${PORT:-3000}..."
exec node main exec node main

4
railway.toml

@ -3,7 +3,7 @@ dockerfilePath = "Dockerfile"
[deploy] [deploy]
healthcheckPath = "/api/v1/health" healthcheckPath = "/api/v1/health"
# Migrate + seed run before server start; allow 3 min for first deploy or slow DB # DB schema push + seed run before server start; allow 5 min for first deploy
healthcheckTimeout = 180 healthcheckTimeout = 300
restartPolicyType = "ON_FAILURE" restartPolicyType = "ON_FAILURE"
restartPolicyMaxRetries = 3 restartPolicyMaxRetries = 3

Loading…
Cancel
Save