Self-hosting Lucida: Docker Compose, Helm and air-gapped
Run Lucida on one machine with Docker Compose, on Kubernetes with the Helm chart, or on a network with no internet access.
You can run all of Lucida yourself. There are two supported shapes: one machine with Docker Compose, and Kubernetes with the Helm chart. Both ship in the Lucida source tree under infra/. The guides below follow docs/guides/self-host.md, docs/guides/air-gapped.md and infra/helm/lucida/README.md in that tree.
Docker Compose (one machine)
infra/compose/compose.yml runs Postgres, ClickHouse, Redpanda (Kafka API), MinIO (replay blobs and exports), Redis, a migrate job and the Lucida services (gateway, worker, api, jobs, connectors, workflows, ai, mcp, web). From the source tree:
scripts/install.sh # asks for the domain, capture domain and release tag
scripts/install.sh --ci --domain lucida.example.com --capture-domain t.example.com --version v1.4.0 --email ops@example.comThe installer checks for docker, docker compose v2 and openssl, writes infra/compose/.env (mode 0600; on first run it generates LC_MASTER_KEY and the database and object-store passwords), pulls the images, starts the stack and waits until every service is healthy (--timeout, default 600 seconds). --dry-run writes .env and prints the commands only. It never prints secrets.
Back up infra/compose/.env. LC_MASTER_KEY decrypts stored connector credentials and is in no database backup. Losing it makes those credentials unrecoverable.
Without --domain the app is on http://localhost:3000 and capture on http://localhost:8080, with no TLS. Sign up in the web app to create the first organization and project. AI is bring-your-own-key: an organization admin connects a provider in Settings, AI.
TLS
With a domain, the installer starts Caddy (compose profile tls) and gets Let's Encrypt certificates for the app host and the capture host. Both DNS names must resolve to the machine, and ports 80 and 443 must be reachable. Behind your own load balancer pass --no-tls and terminate TLS there. Either way set LC_CSRF_ORIGINS=https://<app host> (the installer does when you pass --domain) and set LC_TRUSTED_PROXIES on the gateway to your proxy's network so client IPs come from X-Forwarded-For.
Trusted proxies
The gateway ignores X-Forwarded-For unless the immediate peer is a trusted proxy, so a client cannot spoof its address. On a self-hosted gateway set LC_TRUSTED_PROXIES (comma-separated CIDRs) to the proxy's egress network, for example LC_TRUSTED_PROXIES=10.0.0.0/8. These settings are self-host only; hosted Lucida does not use them.
Sizing (starting points, not measured guarantees)
Events per day | vCPU | RAM | Disk (SSD) |
|---|---|---|---|
Under 100k | 4 | 8 GB | 50 GB |
Under 1M | 4 | 16 GB | 200 GB |
Under 10M | 8 | 32 GB | 1 TB |
Over 10M | 16+ | 64 GB+ | 2 TB+ (use Helm with managed Postgres and separate ClickHouse nodes) |
Replay blobs go to MinIO or S3, not ClickHouse (roughly 50 to 200 KB per recorded minute). Keep at least 20 percent of the disk free: a full disk stops ingestion.
Helm (Kubernetes)
The chart is infra/helm/lucida. It deploys the gateway, api, worker, jobs, connectors, workflows, ai, mcp and the web build. It bundles nothing stateful: you point it at your own Postgres, ClickHouse, Kafka and S3 in values.yaml (endpoints).
kubectl create secret generic lucida-secrets \
--from-literal=LC_MASTER_KEY="$(openssl rand -base64 32)" --from-literal=LC_PG_URL=... \
--from-literal=LC_S3_ACCESS_KEY=... --from-literal=LC_S3_SECRET_KEY=... \
--from-literal=LC_AI_SERVICE_TOKEN="$(openssl rand -hex 32)"
helm install lucida infra/helm/lucida -f my-values.yamlSecrets are
existingSecretreferences undersecrets.*; the chart never renders a Secret.lucida migrate --pg --chruns as a pre-install and pre-upgrade hook Job.publicUrlis the web origin; OAuth redirect URIs derive from it.image.registryandimage.tagselect images; pin a release orsha-<commit>tag in production. UseimagePullSecretsfor a private registry.Overlays:
values-dev.yaml(throwaway Postgres, ClickHouse, Redpanda and MinIO for a dev cluster),values-cert-manager.yaml(annotate the ingress with yourClusterIssuerand setingress.tls),values-multiregion.yaml,ci/values-eu.yaml(EU endpoints and region label; one release per region).The worker's autoscaler maximum must not exceed the topic's partition count.
AI features stay off until
secrets.LC_AI_SERVICE_TOKEN.existingSecretis set.
Air-gapped
On a network with no route to the internet you move images and source across on removable media (or an internal registry) and turn off everything that calls out.
On a connected machine pin one release,
docker compose -f infra/compose/compose.yml config --images, pull,docker savethem all into one archive, and record a SHA-256 checksum. Copy the archive and a source tarball of the same tag to the target.On the isolated host verify the checksum,
docker load, extract the source and runscripts/install.sh --ci --domain lucida.internal --version <tag> --no-tls. Terminate TLS with your own certificate (put it ininfra/compose/certs/and point Caddy at it, or use an internal proxy). With an internal registry setLC_REGISTRY(Compose) orimage.registry(Helm). Migrations are applied from the source tree; nothing is downloaded.Turn off the outbound features:
Area | What to do |
|---|---|
Point | |
Social login, captcha, Stripe | Leave |
Connectors, Slack, webhooks | Do not enable connectors that call SaaS APIs. Webhooks and warehouse exports work against internal hosts. The Slack app cannot reach an air-gapped host |
AI | Serve a model inside the network and set its OpenAI-compatible base URL in the project's AI settings. Without a model, AI routes answer 503 |
Geo-IP and SDK release data | Both are bundled; no feed is fetched |
Browser SDK | Serve |
Verify:
curl -fsS https://lucida.internal/v1/health, thendocker compose -f infra/compose/compose.yml logs --since 5m | grep -i "dial tcp\|no such host"should print nothing. A match names a feature that still tries to call out.
Back up .env, Postgres, ClickHouse and MinIO, and copy the dumps to media that leaves the host.