Files
StageAI/docker-compose.yml
CTO (LegalAI) b22bdd8425 fix: API key save network error — add ENCRYPTION_KEY env and auto-migrate
The "Netzwerkfehler beim Speichern des Schlüssels" was caused by two issues:
1. ENCRYPTION_KEY env var was not passed to the Docker container, so
   AES-256-GCM encrypt() threw at runtime on every POST/PATCH.
2. The 0003_tenant_api_keys migration was not in the drizzle journal
   and no migration runner existed in the Docker image.

Changes:
- docker-compose.yml: pass ENCRYPTION_KEY to app container
- .env.example: document ENCRYPTION_KEY with generation command
- .gitignore: allow .env.example to be tracked
- Dockerfile: include drizzle/ migrations and entrypoint script
- entrypoint.sh: run migrations before starting the app
- migrate.mjs: runtime migration script using drizzle-orm migrator
- drizzle journal: register 0003_tenant_api_keys migration

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-04-09 14:28:19 +00:00

51 lines
1.3 KiB
YAML

services:
app:
build: .
ports:
- "3002:3000"
environment:
- DATABASE_URL=postgresql://legalai:legalai@postgres:5432/legalai
- MEILISEARCH_URL=http://meilisearch:7700
- MEILISEARCH_API_KEY=${MEILISEARCH_API_KEY:-masterKey}
- NEXTAUTH_URL=http://100.81.230.53:3002
- NEXTAUTH_SECRET=${NEXTAUTH_SECRET}
- AI_PROVIDER=${AI_PROVIDER:-anthropic}
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
- OPENAI_API_KEY=${OPENAI_API_KEY}
- ENCRYPTION_KEY=${ENCRYPTION_KEY}
depends_on:
postgres:
condition: service_healthy
meilisearch:
condition: service_started
postgres:
image: postgres:16-alpine
environment:
POSTGRES_USER: legalai
POSTGRES_PASSWORD: legalai
POSTGRES_DB: legalai
ports:
- "5434:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U legalai"]
interval: 5s
timeout: 5s
retries: 5
meilisearch:
image: getmeili/meilisearch:v1.11
environment:
- MEILI_MASTER_KEY=${MEILISEARCH_API_KEY:-masterKey}
- MEILI_ENV=development
ports:
- "7700:7700"
volumes:
- meilisearch_data:/meili_data
volumes:
postgres_data:
meilisearch_data: