Configuration¶
.env (intentionally small)¶
LLARS uses an intentionally small .env:
- Secrets + infrastructure stay in .env (DB passwords, Authentik/Matomo secrets, API keys).
- App settings are configurable in the DB (e.g., analytics/tracking in the admin panel).
Setup:
Database (MariaDB)¶
Connections
- Internal: Host db-maria-service, Port 3306
- External (debug only): Port 55306
Authentik (OIDC)¶
AUTHENTIK_SECRET_KEY=... # at least 50 characters
AUTHENTIK_DB_NAME=authentik_dev
AUTHENTIK_DB_USER=authentik_dev
AUTHENTIK_DB_PASSWORD=...
AUTHENTIK_PUBLIC_URL=http://localhost:55095
AUTHENTIK_BOOTSTRAP_EMAIL=admin@example.com
AUTHENTIK_BOOTSTRAP_PASSWORD=admin123
# Backend OAuth client secret (Client ID is invariant: llars-backend)
AUTHENTIK_BACKEND_CLIENT_SECRET=llars-backend-secret-change-in-production
AUTHENTIK_EXTERNAL_PORT=55095
Analytics (Matomo)¶
- UI:
${PROJECT_URL}/analytics/ - Tracking (first-party):
${PROJECT_URL}/metrics.jsand${PROJECT_URL}/metrics.php - Runtime settings: Admin -> Analytics (DB-based, not
.env)
Docs (MkDocs)¶
- Dev via nginx:
${PROJECT_URL}/mkdocs/ - Prod via nginx:
${PROJECT_URL}/mkdocs/ - Direct (host port):
http://localhost:${MKDOCS_EXTERNAL_PORT:-55800}
Privacy Check (current implementation, not legal advice)¶
- Captured: pageviews (route URL + title), link tracking, click events, optional hover events, heartbeat/time-on-page, optional user ID (Authentik
preferred_username/sub) - Defaults: cookies on, user ID on, consent off -> in EU contexts usually requires consent or another legal basis
- Consent flags exist (
require_consent/require_cookie_consent), but there is currently no consent UI/setConsentGivenintegration - Route URLs include dynamic IDs (e.g.,
/Rater/123) -> potentially personal data; consider anonymizing or tracking only route names - Event labels come from UI text/ARIA/
data-*(emails/URLs/4+ digits are sanitized, but user content may still appear) -> exclude sensitive areas withdata-matomo-ignore - Server-side privacy settings (IP anonymization, DNT, retention) must be configured in Matomo itself
Port Mapping¶
# External (host)
NGINX_EXTERNAL_PORT=55080 # Main entry (Frontend + API + Matomo + Docs Proxy)
AUTHENTIK_EXTERNAL_PORT=55095 # Optional direct; also via nginx `/authentik/`
DB_EXTERNAL_PORT=55306 # Optional direct (debug only)
MKDOCS_EXTERNAL_PORT=55800 # Optional direct; via nginx `/mkdocs/` (Dev) / `/mkdocs/` (Prod)
CORS¶
# Usually not needed:
# ALLOWED_ORIGINS is derived from PROJECT_URL + localhost defaults.
ALLOWED_ORIGINS=http://localhost:55080,http://127.0.0.1:55080
Separate multiple entries with commas.
LLM Configuration¶
Default models are loaded from the DB (llm_models) and seeded on startup (see app/db/models/llm_model.py).
RAG Pipeline¶
- Embeddings: default from
llm_models(shippedllamaindex/vdr-2b-multi-v1, switchable withLLARS_EMBEDDING_MODEL, see below), fallbacksentence-transformers/all-MiniLM-L6-v2 - Vector store: ChromaDB
- Chunking:
app/rag_pipeline.pyuses 1500/300,app/services/rag/embedding/collection_embedding_service.pyuses default 1000/200 (per collection configurable) - Storage path:
/app/storage/vectorstore
Settings: app/rag_pipeline.py and app/services/rag/embedding/collection_embedding_service.py
Switching the embedding model (LLARS_EMBEDDING_MODEL)¶
One line in the .env decides which model LLARS uses to embed new content:
- Value: The model id exactly as the KIZ LiteLLM proxy expects it in
POST <LITELLM_BASE_URL>/embeddings, without akiz/prefix. If the line is missing or empty, everything stays onllamaindex/vdr-2b-multi-v1. - Effect after a restart: On startup LLARS creates the model in
llm_modelsif it is missing and makes it the default embedding model. New collections, the chatbot wizard, crawls and the RAG seeder embed with it; text goes through the same direct proxy call as VDR-2B. Restart means recreating the containers (docker compose up -d), becausedocker restartdoes not re-read the.env. - Existing data: Existing collections keep their model (the collection's
embedding_model) and are still embedded and queried with it; nothing is re-embedded automatically. The proxy therefore has to serve both models. - Images: VDR-2B embeds images as before. For the new model LLARS checks once per process with a test image whether the proxy accepts images; otherwise image chunks are skipped (log line
Image embeddings SKIPPED). - No local fallback: The configured model runs on the proxy only. If the proxy is unreachable on the first call, the model counts as unavailable; LLARS does not download it locally.
- Do not change:
CHROMA_PERSIST_MODEL_DIR. All collections of all models live in the same Chroma database (collection names carry the model as a suffix); a different value creates an empty store. - Going back: Set the line to
llamaindex/vdr-2b-multi-v1and restart. Only deleting the line does not restore the default (same asLLARS_DEFAULT_LLM_MODEL_ID); alternatively change the default in the admin area.
Moving an existing collection to the new model. There is no dedicated tool for this; two ways work with what exists:
- Recommended: Create a new collection (it gets the new default model) and load the content again, by upload, by a crawl in the chatbot wizard or with
scripts/rag/import_publications.pyand a new--collection-name(the script takesLLARS_EMBEDDING_MODELfrom its environment or--embedding-model). Then assign the new collection to the chatbot and remove the old one. - In place (admins only, directly in the database): Set the collection's
rag_collections.embedding_modelto the new model, delete the old model's row incollection_embeddings(otherwise search keeps querying the old Chroma collection through that row) and callPOST /api/rag/collections/<id>/reindex. Until all documents are re-indexed, the collection returns incomplete results.
Analysis service (Communication Analysis)¶
The Communication Analysis tool needs its own service that keeps SaT and OnCoCo warm on the CPU. It is optional and runs only with the Compose profile analysis; without it the tool shows "not available". The container gets no .env, only the Redis credentials — the Compose file passes the variables below to it. The web process additionally reads ANALYSIS_REQUEST_TIMEOUT from the .env (API time limit).
COMPOSE_PROFILES=analysis # several profiles separated by commas, e.g. whisper,analysis
ANALYSIS_SAT_MODEL=sat-12l-sm # SaT model, only from the local cache (HF_HOME)
ANALYSIS_ONCOCO_MODEL_PATH=/app/models/oncoco # OnCoCo weights in the container (host: ./app/models/oncoco)
ANALYSIS_HEARTBEAT_TTL=30 # lifetime of heartbeat and capabilities (s)
ANALYSIS_REQUEST_TIMEOUT=60 # caller time limit (s)
ANALYSIS_TORCH_THREADS= # empty = all visible cores
ANALYSIS_MEMORY_LIMIT=6g # container memory limit
ANALYSIS_LOG_LEVEL=INFO # logs never contain text
Placing the weights, preloading SaT, starting and checking: German runbook Production Deployment, section "Analyse-Dienst (Kommunikationsanalyse)".
Volumes¶
REMOVE_LLARS_VOLUMES=True removes all volumes with the llars_ prefix, e.g.:
llars_llarsdb- MariaDB datallars_rag_storage/llars_rag_docs- RAG datallars_authentikdb/llars_authentik_media- Authentikllars_matomo_data/llars_matomodb- Analyticsllars_redis_data- Redis
Development vs Production¶
PROJECT_STATE=development # or production
FLASK_ENV=development # optional; usually set automatically
Development - Hot reload (frontend + backend) - Verbose logging - Source code mounted as volumes
Production - Optimized builds, no hot reload - Reduced logging - Frontend served statically via nginx
Security¶
Change default passwords¶
MYSQL_ROOT_PASSWORD=<strong>
MYSQL_PASSWORD=<strong>
AUTHENTIK_DB_PASSWORD=<strong>
AUTHENTIK_BOOTSTRAP_PASSWORD=<strong>
AUTHENTIK_BACKEND_CLIENT_SECRET=<strong>
SYSTEM_ADMIN_API_KEY=<strong>
ADMIN_REGISTRATION_KEY=<uuid>
Enable SSL/TLS¶
- Place certificates under
docker/nginx/certs/ - Adjust nginx configuration
- Switch
PROJECT_URL/AUTHENTIK_PUBLIC_URLto HTTPS (e.g.,https://llars.example.de)
External Port Exposure¶
In production, consider:
- Exposing only NGINX_EXTERNAL_PORT=80/443
- Removing direct database/backend port mappings
- Using Docker networks for internal communication
Advanced Configuration¶
Custom Docker Compose¶
Create docker-compose.override.yml for local customizations:
Authentik Theme/Branding¶
Authentik themes can be configured via the admin UI (flows/branding). Custom logos/colors can be set there; no separate theme directory is required.
Nginx Custom Configuration¶
Edit docker/nginx/nginx.conf for:
- Custom routing rules
- Rate limiting
- Additional proxy settings