From d252810324f5e56f7bf1678a303354c6d19910b4 Mon Sep 17 00:00:00 2001 From: Yash Kuceriya Date: Mon, 23 Feb 2026 18:03:58 -0700 Subject: [PATCH] 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 --- docker/entrypoint.sh | 21 ++++++++++++++------- railway.toml | 4 ++-- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 019abefb8..b8dc1d425 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -1,13 +1,20 @@ #!/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 "Running database migrations" -npx prisma migrate deploy +echo "Applying database schema..." +# Use db push for speed (applies full schema in one shot). +# 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" -npx prisma db seed || echo "Seed failed (non-fatal), continuing..." +echo "Seeding the database..." +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 diff --git a/railway.toml b/railway.toml index df3178eb7..a6f2f3e73 100644 --- a/railway.toml +++ b/railway.toml @@ -3,7 +3,7 @@ dockerfilePath = "Dockerfile" [deploy] healthcheckPath = "/api/v1/health" -# Migrate + seed run before server start; allow 3 min for first deploy or slow DB -healthcheckTimeout = 180 +# DB schema push + seed run before server start; allow 5 min for first deploy +healthcheckTimeout = 300 restartPolicyType = "ON_FAILURE" restartPolicyMaxRetries = 3