Files
tessera-ctl/docker-compose.prod.yml
T
schalli 7bda56d222 build: refuse to start without an encryption key
The base compose file carried a hardcoded fallback key, so a stack whose .env
never set the variable started anyway and encrypted every stored credential
(LDAP bind, calendar, SMTP, DKV and tender mailboxes) with a value that is
public in this repository. That is encryption which looks present and protects
nothing.

Both compose files now use the ${VAR:?message} form, so an unset or empty key
fails at compose level with a message naming the variable and how to generate
one, instead of starting with a known key or dying later inside the API with a
stack trace.

Verified both ways: without the variable `docker compose config` exits 1 and
prints the hint; with a key present it exits 0.

Consequence for a fresh clone: the local stack no longer comes up until
CALENDAR_ENCRYPTION_KEY is set in .env. That is the point.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-11 14:25:36 +02:00

83 lines
2.4 KiB
YAML

services:
web:
image: git.vicolab.de/schalli/tessera-ctl/web:latest
restart: unless-stopped
ports:
- "3000:3000"
environment:
HOSTNAME: "0.0.0.0"
NEXT_PUBLIC_API_URL: http://api:3001
API_INTERNAL_URL: "http://api:3001"
JWT_SECRET: ${JWT_SECRET}
networks:
- frontend-net
- backend-net
depends_on:
api:
condition: service_healthy
api:
image: git.vicolab.de/schalli/tessera-ctl/api:latest
restart: unless-stopped
ports:
- "3001:3001"
networks:
- backend-net
- data-net
depends_on:
db:
condition: service_healthy
environment:
DATABASE_URL: ${DATABASE_URL}
JWT_SECRET: ${JWT_SECRET}
TESSERA_ADMIN_USER: ${TESSERA_ADMIN_USER:-admin}
TESSERA_ADMIN_EMAIL: ${TESSERA_ADMIN_EMAIL}
TESSERA_ADMIN_PASSWORD: ${TESSERA_ADMIN_PASSWORD}
TESSERA_FORCE_CHANGE: ${TESSERA_FORCE_CHANGE:-false}
TESSERA_SMTP_HOST: ${TESSERA_SMTP_HOST:-}
TESSERA_SMTP_PORT: ${TESSERA_SMTP_PORT:-587}
TESSERA_SMTP_SECURE: ${TESSERA_SMTP_SECURE:-false}
TESSERA_SMTP_USER: ${TESSERA_SMTP_USER:-}
TESSERA_SMTP_PASSWORD: ${TESSERA_SMTP_PASSWORD:-}
TESSERA_SMTP_FROM: ${TESSERA_SMTP_FROM:-Tessera <noreply@tessera.local>}
TESSERA_APP_URL: ${APP_URL:-http://localhost:3000}
# Unset used to resolve to an empty value and only fail later, inside the
# API, with a stack trace. Fail at compose level with a usable message
# instead. Generate with: openssl rand -hex 32
CALENDAR_ENCRYPTION_KEY: "${CALENDAR_ENCRYPTION_KEY:?set CALENDAR_ENCRYPTION_KEY in .env, generate one with openssl rand -hex 32}"
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3001/health"]
interval: 10s
timeout: 5s
retries: 3
start_period: 20s
db:
image: postgres:16-alpine
restart: unless-stopped
networks:
- data-net
volumes:
- pgdata:/var/lib/postgresql/data
environment:
POSTGRES_USER: tessera
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_DB: tessera
healthcheck:
test: ["CMD-SHELL", "pg_isready -U tessera"]
interval: 5s
timeout: 3s
retries: 5
networks:
frontend-net:
driver: bridge
backend-net:
driver: bridge
data-net:
driver: bridge
internal: true
volumes:
pgdata: