Skip to content

Configuration

The production Compose stack reads .env beside docker-compose.yml. Compose consumes image and port settings, then passes the supported runtime settings to the API, worker, migration, and tool containers.

After changing runtime configuration, reconcile the containers so they receive the new environment:

sh
docker compose up -d
docker compose ps

Editing .env alone does not modify an already-running container.

Images and public origin

VariableDefaultPurpose
LENS_VERSIONlatestTag used for both published Lens images. Pin a release in production.
LENS_PULL_POLICYalwaysCompose image pull behavior.
LENS_BACKEND_IMAGEghcr.io/anvia-hq/lensOptional backend image override.
LENS_WEB_IMAGEghcr.io/anvia-hq/lens-webOptional web image override.
PUBLIC_APP_URLRequiredAbsolute browser-facing origin used by authentication and generated URLs.
WEB_ORIGINRequiredOrigin allowed to make credentialed browser API requests.
WEB_PORT80Host binding for the web service, such as 80 or 127.0.0.1:8080.

Set both origin values to the exact public origin, including https and any non-default port:

dotenv
PUBLIC_APP_URL=https://lens.example.com
WEB_ORIGIN=https://lens.example.com
WEB_PORT=127.0.0.1:8080

Do not use http://api:3001, a Docker hostname, or a path such as /api. An origin mismatch commonly causes failed sign-in, rejected browser requests, incorrect redirects, or cookies that do not behave as expected.

Required secrets

VariableMinimum or role
POSTGRES_PASSWORDPassword for the Lens PostgreSQL user.
CLICKHOUSE_PASSWORDPassword for the Lens ClickHouse user.
REDIS_PASSWORDPassword required by the production Redis server.
BETTER_AUTH_SECRETIndependent authentication secret, at least 32 characters.
INGESTION_KEY_PEPPERIndependent secret used to HMAC project ingestion secrets, at least 16 characters.

Generate a unique value for each setting:

sh
openssl rand -hex 32

Store the environment file in a secret manager or encrypted operator backup. Restrict host access: anyone who can read these values may be able to authenticate internal services or affect account and ingestion security.

Rotation consequences

Do not rotate these values by editing .env casually:

  • Database and Redis passwords in .env are both service credentials and client connection credentials. Existing persistent databases do not automatically change their internal user password when an environment variable changes.
  • Changing BETTER_AUTH_SECRET can invalidate authentication material and force users to sign in again.
  • Changing INGESTION_KEY_PEPPER makes existing project secret-key hashes unverifiable. Create and deploy replacement ingestion keys as part of a deliberate rotation.

Plan credential rotation per subsystem, preserve a recovery path, and verify access before removing the old credential.

SMTP

VariableDefaultPurpose
SMTP_HOSTEmptySMTP hostname; empty disables email delivery.
SMTP_PORT587SMTP server port.
SMTP_SECUREfalseUse TLS from connection start.
SMTP_USEREmptyOptional SMTP username.
SMTP_PASSWORDEmptyOptional SMTP password.
SMTP_FROMAnvia Lens <lens@localhost>Sender for Lens email.

SMTP currently supports password-reset delivery. Invitations use links copied from the workspace UI and do not require email.

SMTP_USER and SMTP_PASSWORD must be configured together. Authenticated SMTP also requires SMTP_HOST. Use SMTP_SECURE=true when the provider expects TLS from connection start, commonly on port 465; follow the provider's instructions for STARTTLS connections.

Ingestion and logs

VariableDefaultPurpose
OTLP_MAX_BODY_BYTES10485760Maximum accepted OTLP body size in bytes.
OTLP_RATE_LIMIT_PER_MINUTE600Request limit per ingestion credential per minute.
LOG_LEVELinfotrace, debug, info, warn, error, or fatal.

Prefer smaller exporter batches to raising the body limit. The bundled web proxy also limits request bodies to 10m; an external proxy may impose another limit. Raising only OTLP_MAX_BODY_BYTES does not remove those proxy limits.

Rate limiting is applied per ingestion credential. When changing either limit, watch API rejection logs, Redis queue pressure, worker throughput, and ClickHouse load.

Use debug temporarily for investigation. Higher-volume logs may include operational identifiers, so route and retain them according to the same access policy as other Lens operational data.

Development-only ports

docker-compose.dev.yml additionally accepts API_PORT, POSTGRES_PORT, REDIS_PORT, CLICKHOUSE_HTTP_PORT, CLICKHOUSE_NATIVE_PORT, SMTP_PORT, and MAILPIT_UI_PORT. Those host exposures are for development on a trusted machine and should not be copied into production Compose.

Continue with HTTPS and networking for proxy configuration.

Built for Anvia.