Spaces:
Runtime error
Runtime error
BIM Query Deploy Claude Opus 4.7 (1M context) commited on
Commit ·
035fe5e
1
Parent(s): a0e11c0
fix(deploy): make alembic failure fatal so the error stops being silent
Browse filesThe 'alembic upgrade head || { WARNING; continue }' pattern hid the
real migration failure behind a healthy-looking app that then 500'd
on the first request with 'relation projects does not exist'. Now
the container refuses to start without a clean migration, and the
postgres.log tail is dumped to stderr to make the cause visible
in the HF Space build log.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- entrypoint.sh +8 -3
entrypoint.sh
CHANGED
|
@@ -83,9 +83,14 @@ psql -h /tmp -U postgres -d "${POSTGRES_DB}" -c "CREATE EXTENSION IF NOT EXISTS
|
|
| 83 |
# --- 4. Run alembic migrations ---------------------------------------------
|
| 84 |
echo "[entrypoint] alembic upgrade head"
|
| 85 |
cd /app
|
| 86 |
-
alembic upgrade head
|
| 87 |
-
echo "[entrypoint]
|
| 88 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
|
| 90 |
# --- 5. Hand off to the original CMD (supervisord) -------------------------
|
| 91 |
echo "[entrypoint] handing off to: $*"
|
|
|
|
| 83 |
# --- 4. Run alembic migrations ---------------------------------------------
|
| 84 |
echo "[entrypoint] alembic upgrade head"
|
| 85 |
cd /app
|
| 86 |
+
if ! alembic upgrade head; then
|
| 87 |
+
echo "[entrypoint] FATAL: alembic upgrade failed."
|
| 88 |
+
echo "[entrypoint] Refusing to start uvicorn/celery against an unmigrated database."
|
| 89 |
+
echo "[entrypoint] postgres.log tail:"
|
| 90 |
+
tail -n 50 "$PG_LOG" >&2 || true
|
| 91 |
+
exit 1
|
| 92 |
+
fi
|
| 93 |
+
echo "[entrypoint] alembic OK"
|
| 94 |
|
| 95 |
# --- 5. Hand off to the original CMD (supervisord) -------------------------
|
| 96 |
echo "[entrypoint] handing off to: $*"
|