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