Root cause: sqlite_patch checked `if "sqlite" in db_url` but db_url
was empty string when DATABASE_URL env var not set. Patch was skipped,
then models used PostgreSQL types (JSONB/Vector) with SQLite compiler
causing crash: "can't render element of type JSONB".
Fix: `if not db_url or "sqlite" in db_url` — apply patch when URL
is empty (defaults to SQLite anyway in database.py).
Also:
- Dockerfile: add libxml2/libxslt1.1 for lxml runtime
- Dockerfile: increase healthcheck start-period to 120s
- start.sh: log DATABASE_URL prefix for debugging
https://claude.ai/code/session_01W1rJthWDkasijTdXCfxVHs
Railway build was failing with "Image of size 5.7 GB exceeded limit of
4.0 GB" because sentence-transformers pulled torch with full CUDA/NVIDIA
GPU packages (~3 GB).
Fix: multi-stage Dockerfile that:
1. Installs CPU-only torch first (--index-url pytorch.org/whl/cpu)
saving ~3 GB (200 MB CPU vs 3.2 GB CUDA)
2. Multi-stage build: builder + runtime (smaller final image)
3. Non-root user (app:1000)
4. tini init for proper signal handling
5. Built-in HEALTHCHECK with 60s start-period
6. railway.toml with healthcheck path and restart policy
Also fixes healthcheck failure: start-period=60s gives the app time
to initialize before Railway starts checking /health.
Expected image size: ~2 GB (down from 5.7 GB).
https://claude.ai/code/session_01W1rJthWDkasijTdXCfxVHs