3 Configuration
jlightner edited this page 2026-04-04 10:31:50 -05:00

Configuration

Meta Value
Repo xpltdco/chrysopedia
Page Configuration
Audience developers, agents
Last Updated 2026-04-04
Status current

Overview

Configuration is managed via environment variables in two .env files loaded by Docker Compose. The backend parses settings via backend/config.py (Pydantic-style with LRU caching). Frontend build-time constants are injected via Docker build args.

Environment Files

File Purpose
.env Core app config (DB, Redis, LLM, auth, app settings)
.env.lightrag LightRAG service config (LLM model, embedding, Qdrant connection)

Core Application (.env)

Database

Variable Description
DATABASE_URL PostgreSQL connection string (postgresql+asyncpg://...)

Redis

Variable Description
REDIS_URL Redis connection string (redis://chrysopedia-redis:6379/0)

Authentication

Variable Description
APP_SECRET_KEY JWT signing key (HS256)

LLM Configuration

Variable Description
OPENAI_API_KEY API key for OpenAI-compatible endpoint
LLM_MODEL Primary LLM model name (DGX Sparks Qwen)
LLM_BASE_URL OpenAI-compatible API endpoint URL

Application

Variable Default Description
APP_VERSION 0.1.0 Version string (injected into frontend)
GIT_COMMIT unknown Git commit hash (injected into frontend)
DEBUG false Debug mode

MinIO Object Storage (M023/S01)

Variable Description
MINIO_ENDPOINT MinIO server endpoint (default: chrysopedia-minio:9000)
MINIO_ACCESS_KEY MinIO access key
MINIO_SECRET_KEY MinIO secret key
MINIO_BUCKET_NAME Bucket name for file uploads (default: chrysopedia)

Video Source (M023/S03)

Variable Default Description
VIDEO_SOURCE_PATH /videos Path to source video files for shorts generation

Watch Directory

Variable Description
WATCH_DIR Path to transcript JSON watch folder

LightRAG (.env.lightrag)

Variable Description
LLM_MODEL LLM model for LightRAG queries
EMBEDDING_MODEL Embedding model (nomic-embed-text)
QDRANT_URL Qdrant connection for LightRAG
WORKING_DIR LightRAG data directory

Frontend Build Args

Injected at Docker build time via docker-compose.yml build args:

Build Arg Becomes Purpose
VITE_APP_VERSION import.meta.env.VITE_APP_VERSION Version display in UI
VITE_GIT_COMMIT import.meta.env.VITE_GIT_COMMIT Commit hash in UI

Important: In Dockerfile.web, the order must be ARGENVRUN npm run build.

Docker Service Configuration

PostgreSQL

  • Port: 5433:5432 (host:container)
  • Volume: chrysopedia_postgres_data

Redis

  • Port: Internal only (6379)
  • Persistence: Default (RDB snapshots)

Qdrant

  • Port: Internal only (6333)
  • Volume: chrysopedia_qdrant_data

Ollama

  • Port: Internal only (11434)
  • Volume: chrysopedia_ollama_data
  • Model: nomic-embed-text (pulled on init)

LightRAG

  • Port: 9621 (localhost only on host)
  • Volume: chrysopedia_lightrag_data

MinIO (M023/S01)

  • Port: Internal only (9000 API, 9001 console)
  • Volume: chrysopedia_minio_data
  • Healthcheck: mc ready local
  • Access: API-generated presigned URLs only (no public port)

Web (nginx)

  • Port: 8096:80 (host:container)
  • Serves: Pre-built React SPA with fallback to index.html

Pipeline Configuration

LLM settings are configured per pipeline stage:

  • Stages 1-4: Chat model (faster, cheaper)
  • Stage 5 (synthesis): Thinking model (higher quality)
  • Stage 6 (embedding): Ollama local (nomic-embed-text)

Prompt templates are loaded from disk (prompts/ directory) at runtime. SHA-256 hashes are tracked for reproducibility.

SMTP / Email Notifications (M025/S01)

Variable Default Notes
smtp_host "" (empty) SMTP server hostname. Empty = email disabled (graceful no-op)
smtp_port 587 SMTP port (587 for STARTTLS)
smtp_user "" SMTP username
smtp_password "" SMTP password
smtp_from_email "" Sender email address
smtp_from_name "Chrysopedia" Sender display name

When smtp_host is empty, the digest task logs a warning and returns without sending. No emails are lost -- the next run picks up unsent content.

Rate Limiting (M025/S04)

Variable Default Notes
rate_limit_user_per_hour 30 Max chat requests per authenticated user per hour
rate_limit_ip_per_hour 10 Max chat requests per IP per hour (anonymous)
rate_limit_creator_per_hour 60 Max chat requests per creator scope per hour

Rate limiter uses Redis sorted sets (sliding window). Fails open on Redis errors -- logs WARNING, allows request.

LLM Fallback (M025/S08)

Variable Default Notes
LLM_FALLBACK_URL http://chrysopedia-ollama:11434/v1 Fallback LLM endpoint (Ollama)
LLM_FALLBACK_MODEL qwen2.5:7b Fallback model name

ChatService auto-falls back from primary to fallback on APIConnectionError, APITimeoutError, or InternalServerError. Fallback activation is logged at WARNING and tracked in SSE done event and ChatUsageLog.

Network

  • Compose subnet: 172.32.0.0/24
  • External access: nginx on nuc01 (10.0.0.9) → ub01:8096
  • DNS: AdGuard Home rewrites chrysopedia.com → 10.0.0.9

See also: Architecture, Deployment, Agent-Context