Configuration
Cake has two layers of environment configuration:
/var/lib/cake-harness/.envsupplies installation-specific values to Docker Compose. The installer creates it with mode0600and preserves its secrets.- The backend process reads and validates its environment at startup. An invalid value stops the process with
Invalid environment configuration:and one line per problem.
The installer rewrites the channel, version, and three image values whenever it runs. Other values, including passwords and keys, are generated once and left alone.
Installation .env
Section titled “Installation .env”| Key | Default or generated value | Purpose |
|---|---|---|
INSTALL_DIR |
/opt/cake-harness |
Deployment files; replaced by upgrades |
STATE_DIR |
/var/lib/cake-harness |
Mutable state; preserved by upgrades |
DOMAIN |
Required on first install | Hostname in Traefik’s routing rule and certificate |
CAKE_SSH_HOST |
DOMAIN |
Public hostname clients use to SSH into workspace containers |
CAKE_SSH_PORT_RANGE |
22000-22999 |
Inclusive TCP host-port range allocated to workspace SSH |
ACME_EMAIL |
admin@$DOMAIN |
Let’s Encrypt contact |
POSTGRES_DB |
cake |
Database name |
POSTGRES_USER |
cake |
Database user |
POSTGRES_PASSWORD |
Generated with openssl rand -hex 32 |
Database password; never regenerated by the installer |
CAKE_CHANNEL |
production |
production or staging; rewritten by the installer |
CAKE_VERSION |
Concrete release, empty on staging | Version used for update comparison; rewritten by the installer |
CAKE_IMAGE |
ghcr.io/tctcl/cake-harness:<tag> |
Product image; rewritten by the installer |
CAKE_WORKSPACE_IMAGE |
ghcr.io/tctcl/cake-harness/workspace:<tag> |
Workspace image; rewritten by the installer |
CAKE_CIPHERGATE_IMAGE |
ghcr.io/tctcl/cake-harness/ciphergate:<tag> |
Secrets-store image; rewritten by the installer |
UPDATE_CHECK_INTERVAL_MS |
900000 |
Release-check interval; 0 disables it |
CIPHERGATE_TOKEN |
Generated for consumer cake-backend |
Backend’s reader key into the secrets store |
SECRET_KEY |
Generated with openssl rand -hex 32 |
Seals TOTP secrets and stored provider keys |
Compose supplies TRUST_PROXY=true because Traefik terminates TLS. It also sets CIPHERGATE_URL=http://ciphergate:8400, DOCKER_HOST=tcp://socket-proxy-rw:2375, WORKSPACE_BACKEND_URL=http://app:8080, and WORKSPACE_NETWORK=cake-workspaces.
The product image supplies NODE_ENV=production, HOST=0.0.0.0, PORT=8080, and FRONTEND_DIR=/app/public.
Application settings
Section titled “Application settings”The shared System prompt is edited in Settings → Application settings, not in the installation .env. Cake sends it first for every conversation, followed by that agent’s system prompt append and instructions. The settings response also includes the built-in default for Reset to default.
Backend environment reference
Section titled “Backend environment reference”| Variable | Default | Validation and meaning |
|---|---|---|
NODE_ENV |
development |
development, test, or production |
HOST |
127.0.0.1 |
Listen address; the product image uses 0.0.0.0 |
PORT |
8080 |
Integer from 1 through 65535 |
LOG_LEVEL |
info |
fatal, error, warn, info, debug, trace, or silent |
DATABASE_URL |
Required | postgres:// or postgresql:// URL; Cake has no durable storage without it |
DATABASE_POOL_SIZE |
10 |
Integer from 1 through 100 |
DOCKER_HOST |
unix:///var/run/docker.sock |
unix:///path or tcp://host:port; Compose uses the read-write socket proxy |
WORKSPACE_IMAGE |
cake/dev-env:dev |
Image used for new workspace containers unless one records another |
WORKSPACE_BACKEND_URL |
Unset | HTTP(S) URL a workspace uses to reach the backend; trailing slashes are stripped |
WORKSPACE_NETWORK |
Unset | Docker network a workspace joins; set both this and WORKSPACE_BACKEND_URL, or neither |
CAKE_SSH_HOST |
DOMAIN, then the Docker host |
Public hostname clients use for workspace SSH |
CAKE_SSH_PORT_RANGE |
22000-22999 |
Inclusive FIRST-LAST range of host ports published for SSH; must fit within 1–65535 |
CAKE_CHANNEL |
production |
production or staging; staging has no fixed version to compare |
CAKE_VERSION |
Unset | X.Y.Z; an empty string is treated as unset |
UPDATE_CHECK_INTERVAL_MS |
900000 |
Non-negative integer milliseconds; 0 disables release checks |
FRONTEND_DIR |
Unset | Compiled browser application to serve; unset in development |
TERMINAL_MAX_SESSIONS |
8 |
1–32 sessions per workspace container |
TERMINAL_SCROLLBACK_BYTES |
262144 |
0–4194304 bytes replayed on terminal reattach, per session |
TERMINAL_IDLE_TIMEOUT_MS |
1800000 |
Reap an unattached terminal after this many milliseconds; 0 disables reaping |
CIPHERGATE_URL |
Unset | HTTP(S) secrets-store URL; set both this and CIPHERGATE_TOKEN, or neither |
CIPHERGATE_TOKEN |
Unset | Reader consumer key; a half-configured secrets store is a startup error |
SECRET_KEY |
Unset | At least 16 characters; required in production and stable across restarts |
TRUST_PROXY |
false |
Literal true or false; trusts forwarded headers and enables secure cookies behind HTTPS |
Outside production, leaving SECRET_KEY unset derives a development-only key from DATABASE_URL and emits a CAKE_DERIVED_SECRET warning. Production refuses that fallback.
Apply a change
Section titled “Apply a change”Edit /var/lib/cake-harness/.env, then recreate the affected services:
docker compose --env-file /var/lib/cake-harness/.env \ -f /opt/cake-harness/compose.yaml up -dDo not regenerate SECRET_KEY: existing TOTP enrolments and provider keys would become unreadable. Do not change POSTGRES_PASSWORD without changing the database password at the same time. The installer deliberately automates neither operation.
For local development, a checkout .env fills variables that are not already present in the process environment. Existing process values take precedence; a missing file is normal in a container.