#!/bin/sh set -eu echo "[api] starting entrypoint at $(date -u +%Y-%m-%dT%H:%M:%SZ)" echo "[api] node=$(node -v) cwd=$(pwd)" echo "[api] release check: app.js=$(test -f app.js && echo yes || echo NO) prisma=$(test -f node_modules/prisma/build/index.js && echo yes || echo NO)" if [ ! -f app.js ]; then echo "[api] FATAL: app.js missing — release copy failed" >&2 exit 1 fi if [ ! -f node_modules/prisma/build/index.js ]; then echo "[api] FATAL: prisma CLI missing — commit apps/api/release/node_modules" >&2 ls -la node_modules 2>&1 || true exit 1 fi echo "[api] REDIS_HOST=${REDIS_HOST:-unset} REDIS_PORT=${REDIS_PORT:-unset}" echo "[api] running prisma migrate deploy..." node node_modules/prisma/build/index.js migrate deploy --schema=./prisma/schema.prisma echo "[api] migrate done" echo "[api] launching app.js on 0.0.0.0:${PORT:-3000}" exec node app.js