Files
rack-planner/.env.example
jason 128b43e43d Fix database not initializing in Docker (no db file created)
Root cause: DATABASE_URL used a relative path (file:./data/rackmapper.db).
Prisma CLI (migrate deploy) resolves relative SQLite paths from the
prisma/ schema directory -> /app/prisma/data/rackmapper.db, while the
Prisma Client at runtime resolves from CWD -> /app/data/rackmapper.db.
The migration ran against a different path than the bind mount, so no
database file ever appeared in /app/data (the mounted volume).

Fixes:
- Change DATABASE_URL to absolute path: file:/app/data/rackmapper.db
  everywhere (docker-compose, .env.example, UNRAID.md)
- Replace inline CMD with docker-entrypoint.sh:
    mkdir -p /app/data before migrating (safety net)
    npx prisma migrate deploy with set -e so failures are visible
    exec node dist/server/index.js
  This surfaces migration errors in docker logs instead of silently
  exiting, and ensures the data dir always exists before SQLite opens it
- Update .env.example to reflect plain ADMIN_PASSWORD and COOKIE_SECURE

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-21 22:52:16 -05:00

22 lines
653 B
Plaintext

# Copy this file to .env and fill in values before running locally
# In Docker/Unraid, set these as container environment variables instead
# Admin credentials
ADMIN_USERNAME=admin
ADMIN_PASSWORD= # Plain-text password
# JWT
JWT_SECRET= # Min 32 random chars — generate with: openssl rand -hex 32
JWT_EXPIRY=8h
# Cookie security — set to true only if behind an HTTPS reverse proxy
COOKIE_SECURE=false
# Database — absolute path avoids Prisma CLI vs runtime resolution mismatch
# In Docker this maps to the bind-mounted /app/data volume
DATABASE_URL=file:/app/data/rackmapper.db
# Server
PORT=3001
NODE_ENV=development