Self-hosting
Docker Compose
The straightforward way to run it.
The quickstart has a working compose file. This page covers what to change before other people use it.
Services
| Does | |
|---|---|
postgres | Stores everything |
migrate | Applies pending schema migrations, then exits. api and worker wait for it |
api | Serves the API and the agent endpoint |
web | The browser interface |
worker | Syncs connectors, indexes and classifies content, sweeps old logs |
embedding | Turns content into something searchable, locally |
embedding-code | The same for source code, with a code model |
Off until you start them:
| Profile | Does | |
|---|---|---|
appd | apps | Runs agent-deployed apps and their egress proxy (make up-apps) |
backup | backup | Takes a backup on a schedule |
restore | restore | Used by scripts/restore.sh; never started by hand |
Before anyone else connects
api:
environment:
BASE_URL: https://lenshub.example.com # the address people actually use
CORS_ORIGIN: https://lenshub.example.com
COOKIE_SECURE: "true"
LENSHUB_ENV: productionBASE_URL must be the public address, not the container port. Agent sign-in
depends on it.
Give PostgreSQL more memory
The defaults are tuned for very small machines. On a real server:
postgres:
shm_size: 3g # the compose default; parallel index builds need it
command:
- postgres
- -c
- shared_buffers=2GB
- -c
- work_mem=32MB
- -c
- maintenance_work_mem=512MBFaster indexing
More workers means more parallel syncing:
worker:
environment:
WORKER_CONCURRENCY: 8Persistence
Five named volumes: pgdata, uploads, attachments, git-clones and
embedding-models. pgdata is the critical one — it holds all your content —
with uploads and attachments next. The last two are caches that refill
themselves. See Backup.
Updating
./scripts/backup.sh
docker compose pull
docker compose up -dup runs migrate before the new api and worker start. Read
Upgrades for what that means on a large
database.