Files
loki/.env.example
T
g-butandClaude Sonnet 4.6 70d1d6def4 feat(packaging): self-hosted distribution foundation
First-run flow:
- /setup page + /api/setup: creates first user with hashed password
  (Node crypto scrypt, no new deps). POST rejects if users already exist.
- Landing page redirects to /setup when DB has no users
- middleware.ts: protects app routes, passes public pages through

Auth:
- passwordHash column added to users schema (drizzle-kit push applied)
- src/lib/password.ts: hashPassword/verifyPassword via Node scrypt
- auth.ts Credentials: env var takes priority, falls back to DB hash
  so packaged installs work without LOCAL_AUTH_PASSWORD

Multi-tenancy groundwork:
- Replaced DEFAULT_USER_ID with getCurrentUserId() across all 12 API
  route files (people, subscriptions, events, goals, projects, commitments)

Docker:
- Dockerfile: multi-stage Node 22 alpine, standalone output
- docker-compose.yml: postgres + migrate + app services
- .dockerignore, .env.example with documented required vars
- next.config.ts: output: standalone
- package.json: added migrate script (drizzle-kit push)
- tsconfig.json: scope to src/ only, exclude .next generated files

Install: clone → cp .env.example .env.local → docker-compose up
First visit → /setup → create account → sign in → done.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-03 13:46:07 +02:00

22 lines
1.2 KiB
Bash

# ── Required ────────────────────────────────────────────────────────────────
# PostgreSQL connection string
DATABASE_URL=postgresql://cockpit:changeme@localhost:5432/cockpit
# Random secret for signing sessions — generate with: openssl rand -base64 32
AUTH_SECRET=
# ── Authentication ───────────────────────────────────────────────────────────
# Local password (quick dev) — leave empty to use the /setup wizard on first run
LOCAL_AUTH_PASSWORD=
# GitHub OAuth (optional — get at github.com/settings/developers)
GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
# ── Optional ─────────────────────────────────────────────────────────────────
# Timezone for cron jobs and schedule display (e.g. America/New_York)
COCKPIT_DEFAULT_TIMEZONE=Europe/Zurich
# Docker only — Postgres password (must match DATABASE_URL above)
POSTGRES_PASSWORD=changeme