mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-04 20:48:18 +01:00
* feat(sites): give a site its own domain — evig.orangecat.ch → evig.ch A site starts on <slug>.orangecat.ch. When its owner buys a domain, Loki can now make that domain the site's address: the domain (and www. when it points here) is served, the free address answers with a 308 to it, and the project's live URL, production URL and widget origin list follow. Nothing the visitor sees says where the site is hosted, and the site stays one repo, one Loki project, on the same box. - lib.sh caddy_vhost: the one rule for what a row's domains field means. A row mixing an own domain with its free host serves the own domain and 308s the free one. sync-infra now calls it; every existing row's vhost is byte-identical (pinned against the real register in test-custom-domain.sh). - attach-domain.sh <slug> <domain> | --detach: checks DNS first (A to the box, no stray AAAA) and refuses with the exact records when it is not set — Caddy would otherwise retry a failing certificate for hours while the free address already redirects there. Edits the row, publishes it to main via the shared publish_register_row (moved out of register-site.sh), syncs, waits for HTTPS. Refuses the handcrafted 4001-4004 services (evig among them) whose Caddy blocks are hand-written. - GET/POST/DELETE /api/projects/[id]/domain + an "Own domain" panel next to the live link: type the domain, see the records and whether they are set, connect, or go back to the free address. Studio-box gating is the same as site registration; everyone else gets the command. Docs: docs/infrastructure/custom-domains.md, including why sites are not hosted inside OrangeCat (removed 2026-08-27) and the two things a site's own code may still need after a move (metadataBase, OrangeCat OAuth redirect URIs). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0191FbipnTCBDKHiKftp9W7B * fix(env): document LOKI_SITES_IP / LOKI_SITES_IPV6 in .env.example env-example-covers-src requires every variable src/ reads to be named there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0191FbipnTCBDKHiKftp9W7B --------- Co-authored-by: Claude <noreply@anthropic.com>
257 lines
15 KiB
Bash
257 lines
15 KiB
Bash
# ── Required ────────────────────────────────────────────────────────────────
|
|
# PostgreSQL — see docs/infrastructure/postgres-portability.md
|
|
#
|
|
# Local dev (Docker): direct URL only
|
|
DATABASE_URL=postgresql://loki:changeme@localhost:5432/loki
|
|
#
|
|
# Production (self-hosted Hetzner): set BOTH on the host — not in .env.local
|
|
# DATABASE_URL — direct (:5432) for migrations + LISTEN/NOTIFY
|
|
# DATABASE_POOL_URL — pooled (:6432 / PgBouncer) for app queries
|
|
|
|
# ── Agent runs Loki starts on its own (optional) ─────────────────────────────
|
|
# Every automatic re-dispatch (a refused feedback run, a refused project run,
|
|
# a queued Implement no builder claimed) is OFF unless this is exactly "1".
|
|
# Each of those spends the account's provider quota — Claude, Codex, Gemini —
|
|
# without anyone tapping a button. Runs a person starts are never affected.
|
|
# LOKI_AUTO_DISPATCH=
|
|
|
|
# ── Smoke / QA (optional, never commit real values) ─────────────────────────
|
|
# Authenticated probe suite: npm run test:authenticated-smoke
|
|
# LOKI_SESSION_TOKEN= # raw Auth.js session cookie (COCKPIT_SESSION_TOKEN legacy)
|
|
# SMOKE_EMAIL= # credentials sign-in for smoke
|
|
# SMOKE_PASSWORD=
|
|
# SMOKE_PRIVATE_PIN= # unlock private-zone probes; pre-push prod dogfood (auto-read from .env.local)
|
|
# DOGFOOD_LOKI_ON_PUSH= # set 1 to force Loki UI dogfood even when no builder is connected
|
|
# UI_FLOW_FULL_DISPATCH= # set 0 to skip the G07 harmless full-dispatch smoke prompt
|
|
# DOGFOOD_MACHINE_FORCE= # set 1 to fail machine dogfood when no local Fleet Runner
|
|
|
|
# Login email used by scripts/seed.ts for the default user; keep out of git.
|
|
SEED_OWNER_EMAIL=
|
|
|
|
# Random secret for signing sessions — generate with: openssl rand -base64 32
|
|
AUTH_SECRET=
|
|
# REQUIRED for every deployment that is not behind Auth.js's own host detection
|
|
# — which includes plain `pnpm run dev` on localhost. Without it `src/auth.ts`
|
|
# leaves `trustHost` false, and Auth.js answers EVERY /api/auth/session request
|
|
# with 500 UntrustedHost: the app renders but no page can read a session, and
|
|
# the browser console fills with ClientFetchError. The value is compared as the
|
|
# exact string "true" (see src/auth.ts), so `AUTH_TRUST_HOST=1` does NOT work.
|
|
# scripts/hetzner/gen-env.sh already writes this on the box; local dev and
|
|
# docker-compose did not, which is why a clean checkout looked broken.
|
|
AUTH_TRUST_HOST=true
|
|
|
|
# ── Authentication ───────────────────────────────────────────────────────────
|
|
# Local password (quick dev) — leave empty to use the /setup wizard on first run.
|
|
# IMPORTANT: setting this alone does NOT enable the "Owner key" sign-in tab —
|
|
# you must also set ENABLE_OWNER_KEY=1 below. The hosted production deployment
|
|
# keeps LOCAL_AUTH_PASSWORD set for legacy reasons, but the tab stays hidden
|
|
# there because ENABLE_OWNER_KEY is unset.
|
|
LOCAL_AUTH_PASSWORD=
|
|
|
|
# Set to 1 only on local installs (loki-app systemd, dev machines). When
|
|
# unset, the Owner-key sign-in tab is hidden AND the "local" credentials
|
|
# provider rejects every authorize() call — structural defense in depth so a
|
|
# stray LOCAL_AUTH_PASSWORD on a public deployment can't be brute-forced.
|
|
ENABLE_OWNER_KEY=
|
|
|
|
# GitHub OAuth (optional — get at github.com/settings/developers)
|
|
GITHUB_CLIENT_ID=
|
|
GITHUB_CLIENT_SECRET=
|
|
# Optional. Org admin token (repo + workflow) used for every write into the fleet
|
|
# organisation: create/seed/wire/delete repos. Without it those writes use the
|
|
# person's OAuth token, which an org with OAuth-app restrictions refuses (403).
|
|
# GITHUB_ORG_TOKEN=
|
|
|
|
# ── Optional ─────────────────────────────────────────────────────────────────
|
|
# Timezone for cron jobs and schedule display (e.g. America/New_York).
|
|
# Reads APP_DEFAULT_TIMEZONE first, then COCKPIT_DEFAULT_TIMEZONE (legacy).
|
|
APP_DEFAULT_TIMEZONE=Europe/Zurich
|
|
|
|
# Locale for date/time formatting. APP_LOCALE preferred, COCKPIT_LOCALE accepted.
|
|
APP_LOCALE=de-CH
|
|
|
|
# Docker only — Postgres password (must match DATABASE_URL above)
|
|
POSTGRES_PASSWORD=changeme
|
|
|
|
# "Power Loki with your own model" (Settings → AI). Seals each user's API key
|
|
# at rest (@bitbaum/ai-kit/seal, AES-256-GCM). Without it the feature says it
|
|
# is not switched on and chat keeps using the free chain. Generate once with
|
|
# `openssl rand -base64 32`; ROTATING it makes every stored key unreadable
|
|
# (users are then asked to paste their key again).
|
|
BYOK_SEAL_SECRET=
|
|
|
|
# ── Brand alias scheme ───────────────────────────────────────────────────────
|
|
# Every env var below is read as APP_<KEY> first, then COCKPIT_<KEY> as a
|
|
# legacy fallback (mirror of scripts/_brand.sh:_brand_env). Set whichever
|
|
# prefix matches your environment — both work, APP_* takes precedence.
|
|
|
|
# ── Daemon ⇄ Cloud bridge ────────────────────────────────────────────────────
|
|
# When the local daemon talks to a remote app instance, it authenticates with
|
|
# a bearer token. Two paths exist:
|
|
#
|
|
# 1. Mint a per-user ck_* token from /settings (preferred, multi-tenant safe).
|
|
# 2. Use APP_DAEMON_TOKEN as a shared bearer — single-tenant only.
|
|
#
|
|
# To enable path (2), set BOTH of these on the *server*. The flag is required
|
|
# because the token maps to the "default" user and must not be on by accident
|
|
# in multi-tenant deployments.
|
|
APP_DAEMON_TOKEN=
|
|
APP_ALLOW_LEGACY_DAEMON_TOKEN=
|
|
|
|
# Set to 1 in the local daemon's environment when a local Next.js dev server
|
|
# is running alongside a different cloud deployment. Without this, the daemon
|
|
# prefers localhost:3000 (the local server's DB) and the cloud control
|
|
# panel's runtime state goes stale.
|
|
APP_DAEMON_FORCE_REMOTE=
|
|
|
|
# Override the daemon's remote base URL (defaults to APP_DOMAIN from brand.ts).
|
|
APP_BASE_URL=
|
|
|
|
# ── Web Push (optional — ambient agent-ready notifications) ─────────────────
|
|
# Generate keys: npx web-push generate-vapid-keys
|
|
# Server-side (host env): VAPID_PUBLIC_KEY, VAPID_PRIVATE_KEY, VAPID_SUBJECT (mailto: or https: URL)
|
|
# Client-side (browser subscribe): NEXT_PUBLIC_VAPID_PUBLIC_KEY must match VAPID_PUBLIC_KEY
|
|
VAPID_PUBLIC_KEY=
|
|
VAPID_PRIVATE_KEY=
|
|
VAPID_SUBJECT=mailto:you@example.com
|
|
NEXT_PUBLIC_VAPID_PUBLIC_KEY=
|
|
|
|
# ── OrangeCat integration (Loop A: mirror subscriptions to the economic layer)
|
|
# Mint at https://orangecat.ch/settings/integrations, choose the Loki
|
|
# group actor at mint time. Format: ock_<48-hex>. Treat like a password — the
|
|
# plaintext is shown once and stored as a sha256 hash on OrangeCat's side.
|
|
# When unset, the integration no-ops (subscriptions are still saved locally).
|
|
ORANGECAT_API_KEY=
|
|
ORANGECAT_API_BASE=https://orangecat.ch
|
|
|
|
# ── "Login with OrangeCat" (cross-product identity bridge, Part A)
|
|
# OIDC relying-party credentials for the orangecat.ch authorization server.
|
|
# The client is registered on OrangeCat's side via scripts/oauth/register-client.ts
|
|
# (OC repo) with redirect https://loki.orangecat.ch/api/auth/callback/orangecat.
|
|
# When unset, the "Continue with OrangeCat" button is not mounted.
|
|
ORANGECAT_OAUTH_CLIENT_ID=
|
|
ORANGECAT_OAUTH_CLIENT_SECRET=
|
|
# Override only for local testing against a non-prod OrangeCat:
|
|
# ORANGECAT_OAUTH_ISSUER=https://orangecat.ch
|
|
|
|
# Same 32+ character random value on OrangeCat and Loki. Signs
|
|
# ten-minute, one-use entity → build handoffs.
|
|
LOKI_BUILD_INTENT_SECRET=
|
|
# Same value on both products. Authenticates confirmed-payment activity events.
|
|
ORANGECAT_WEBHOOK_SECRET=
|
|
NEXT_PUBLIC_ORANGECAT_URL=https://www.orangecat.ch
|
|
NEXT_PUBLIC_LOKI_URL=https://loki.orangecat.ch
|
|
NEXT_PUBLIC_ORANGECAT_PROJECT_ID=cb093f00-8745-4579-98df-050ebfb37181
|
|
NEXT_PUBLIC_LOKI_ORANGECAT_PROJECT_ID=8130c927-114a-45b7-8cc2-99efd5224025
|
|
|
|
# ── Solon (governance pillar, solon.orangecat.ch) ───────────────────────────
|
|
# HMAC secret shared with the Solon deployment; verifies decision.finalized
|
|
# webhooks at /api/solon/events. Without it that route answers 503.
|
|
SOLON_WEBHOOK_SECRET=
|
|
# Base URL for Solon API calls (scripts/solon/cast-vote.ts). Public link
|
|
# override for nav/footer is NEXT_PUBLIC_SOLON_URL.
|
|
SOLON_BASE_URL=https://solon.orangecat.ch
|
|
NEXT_PUBLIC_SOLON_URL=https://solon.orangecat.ch
|
|
# Loki's Bitcoin signing key for Solon votes. Set ONLY on the box Loki runs
|
|
# on — the key never leaves that environment; Solon only ever sees signatures.
|
|
LOKI_SOLON_PRIVKEY=
|
|
|
|
# ── Observability (optional — Sentry error tracking) ────────────────────────
|
|
# Leave empty to disable (SDK silently no-ops without a DSN).
|
|
# Enable: create a Next.js project at sentry.io and paste its DSN here.
|
|
NEXT_PUBLIC_SENTRY_DSN=
|
|
# Only needed for sourcemap upload at build time:
|
|
# SENTRY_ORG= / SENTRY_PROJECT= / SENTRY_AUTH_TOKEN=
|
|
|
|
# ── Public demo access (optional) ────────────────────────────────────────────
|
|
# Set to 1 ONLY on an instance that should host the shared "explore without an
|
|
# account" demo. It gates three things at once: the sign-in button appears, the
|
|
# sandbox policy in src/config/demo.ts is enforced, and the nightly reset
|
|
# (which DELETES the demo user and everything it owns) is allowed to run at all.
|
|
# An instance that never sets this cannot be reset even with a valid CRON_SECRET.
|
|
#
|
|
# After setting it, seed the tenant once:
|
|
# DEMO_ACCESS_ENABLED=1 DATABASE_URL=... npx tsx scripts/seed-demo.ts
|
|
DEMO_ACCESS_ENABLED=
|
|
|
|
# Owner for scripts that act on behalf of a person (scripts/provision-widget.ts).
|
|
# NOT a secret — an identifier. Without it, provisioning refuses to guess when
|
|
# the database holds more than one user, because guessing wrong sends a client's
|
|
# site feedback to a stranger.
|
|
LOKI_OWNER_EMAIL=you@example.com
|
|
|
|
# ── Everything else src/ reads (optional — a feature is off until its key is set) ──
|
|
# Generated contract, enforced by scripts/test/env-example-covers-src.ts: a
|
|
# variable the code reads must be named here, with the file that reads it, so a
|
|
# copy of this repo never discovers a switch by grepping. Leave unset to keep
|
|
# the feature off; read the named file for what the value means.
|
|
# AGENT_PROJECTS_CONF= # src/lib/agent-config.ts
|
|
# AGENT_PROMPTS_FILE= # src/lib/agent-config.ts
|
|
# APP_SCRIPTS_DIR= # src/app/api/beacon/transcribe/route.ts
|
|
# APP_SESSIONS_DIR= # src/lib/session-paths.ts
|
|
# APP_URL= # src/lib/email.ts
|
|
# COCKPIT_ALLOW_LEGACY_DAEMON_TOKEN= # src/auth.config.ts
|
|
# COCKPIT_DAEMON_TOKEN= # src/auth.config.ts
|
|
# COCKPIT_SCRIPTS_DIR= # src/app/api/beacon/transcribe/route.ts
|
|
# CRON_SECRET= # src/app/api/health/route.ts
|
|
# DATABASE_POOL_URL= # src/lib/db-url.ts
|
|
# DEPLOY_KEY_PATH= # src/lib/site-cd-local.ts
|
|
# DEV_ROOT= # src/lib/site-cd-local.ts
|
|
# EMBEDDINGS_API_KEY= # src/lib/rag/embeddings.ts
|
|
# EMBEDDINGS_BASE_URL= # src/lib/rag/embeddings.ts
|
|
# EMBEDDINGS_DIM= # src/lib/rag/embeddings.ts
|
|
# EMBEDDINGS_MODEL= # src/lib/rag/embeddings.ts
|
|
# FEEDBACK_WIDGET_TOKEN= # src/app/layout.tsx
|
|
# GITHUB_REPO_OWNER= # src/config/github-owner.ts
|
|
# GITHUB_TOKEN= # src/lib/agent-execution/box-workspace.ts
|
|
# GOG_BIN= # src/lib/actions/calendar-event.ts
|
|
# GOOGLE_CLIENT_ID= # src/auth.ts
|
|
# GOOGLE_CLIENT_SECRET= # src/auth.ts
|
|
# GROQ_API_KEY= # src/lib/actions/calendar-event.ts
|
|
# GROQ_VISION_MODEL= # src/config/vision-models.ts
|
|
# HETZNER_STATE_FILE= # src/config/hetzner.ts
|
|
# HOSTED_RUNNER_DRAIN_MS= # src/lib/orchestration/settle-background-work.ts
|
|
# LOKI_ALLOW_LEGACY_DAEMON_TOKEN= # src/auth.config.ts
|
|
# LOKI_BOX_DEV_ROOT= # src/app/api/projects/[id]/route.ts
|
|
# LOKI_CLOUD_BUILDER_USER_IDS= # src/lib/execution-access.ts
|
|
# LOKI_DAEMON_TOKEN= # src/auth.config.ts
|
|
# LOKI_EXECUTOR= # src/lib/agent-execution/index.ts
|
|
# LOKI_GATEWAY_DEVICE_KEY_B64= # src/lib/openclaw-gateway.ts
|
|
# LOKI_MCP_RESOURCE= # src/config/mcp.ts
|
|
# LOKI_MODEL= # src/lib/agent/llm.ts
|
|
# LOKI_PARALLEL_DISPATCH= # src/lib/orchestration/parallel-run.ts
|
|
# LOKI_PERSONAL_SESSION_KEY= # src/app/api/loki/route.ts
|
|
# LOKI_REGISTER_SITE_SCRIPT= # src/lib/site-cd-local.ts
|
|
# LOKI_REPO_ROOT= # src/lib/site-cd-local.ts
|
|
# LOKI_SANDBOX_DOCKER_ARGS= # src/lib/agent-execution/sandbox.ts
|
|
# LOKI_SITES_BASE_DOMAIN= # src/lib/site-cd.ts
|
|
# LOKI_SITES_IP= # src/lib/site-domain.ts
|
|
# LOKI_SITES_IPV6= # src/lib/site-domain.ts
|
|
# LOKI_SITE_CD_AUTO= # src/lib/site-cd-local.ts
|
|
# LOKI_TOOL_LOOP= # src/lib/loki-core.ts
|
|
# LOKI_WORKFLOW_OWNER= # src/lib/site-cd.ts
|
|
# LOKI_WORKTREES_ROOT= # src/lib/agent-execution/worktree-workspace.ts
|
|
# LOKI_WORKTREE_DISPATCH= # src/lib/agent-execution/worktree-workspace.ts
|
|
# NEXTAUTH_SECRET= # src/lib/actions/action-link.ts
|
|
# NEXTAUTH_URL= # src/lib/email.ts
|
|
# NEXT_PUBLIC_APP_DOMAIN= # src/config/brand.ts
|
|
# NEXT_PUBLIC_BUILD_SHA= # src/components/shell/AppFooter.tsx
|
|
# NEXT_PUBLIC_ECOSYSTEM_BITCOIN_ADDRESS= # src/config/ecosystem.ts
|
|
# NEXT_PUBLIC_ECOSYSTEM_LIGHTNING_ADDRESS= # src/config/ecosystem.ts
|
|
# NEXT_PUBLIC_LOKI_BRIDGE_URL= # src/lib/event-stream.ts
|
|
# OPENCLAW_CONTACTS_PATH= # src/app/api/people/sync/openclaw/route.ts
|
|
# OPENCLAW_GATEWAY_TOKEN= # src/lib/openclaw-gateway.ts
|
|
# OPENCLAW_GATEWAY_URL= # src/lib/constants.ts
|
|
# OPENCLAW_KNOWLEDGE_JSON= # src/app/api/people/sync/openclaw/route.ts
|
|
# OPENROUTER_API_KEY= # src/lib/loki-core.ts
|
|
# ORANGECAT_BASE_URL= # src/lib/register/orangecat.ts
|
|
# ORANGECAT_PAY_URL_PERSONAL= # src/lib/oc-pay.ts
|
|
# ORANGECAT_PAY_URL_PRO= # src/lib/oc-pay.ts
|
|
# ORANGECAT_PAY_URL_TEAM= # src/lib/oc-pay.ts
|
|
# PRIVATE_ZONE_PIN_HASH= # src/lib/private-zone.ts
|
|
# RUNTIME_AVAILABLE= # src/instrumentation.ts
|
|
# TELEGRAM_BOT_TOKEN= # src/lib/actions/telegram-send.ts
|
|
# TRANSCRIBE_LOCAL_AVAILABLE= # src/app/api/beacon/transcribe/route.ts
|
|
# X1_CONSUMER_KEY= # src/lib/auth-providers.ts
|
|
# X1_CONSUMER_SECRET= # src/lib/auth-providers.ts
|