You are viewing docs for v0.23.
The latest release is v0.25.0.

Operator settings

The settings an operator changes on a self-hosted Cohorly: the variables with their defaults and effects, how to set the ones the compose file does not pass through, retention, and single sign-on, e-mail, blob storage and two-factor.

Where settings go

There are two places, depending on the variable.

.env, next to docker-compose.yml. The compose file reads these and passes them to the containers. Every variable of this kind is already listed, empty, in the env.example file you copied.

docker-compose.override.yml, for a variable the compose file does not pass through. Docker Compose reads this file next to docker-compose.yml without a flag. List the variable under environment of the service that needs it. The API (server) and the error worker (error-worker) are two containers of the same image, so a setting that both read must be given to both:

yaml
services:
server:
environment:
COHORLY_SELF_HOST_RETENTION_MONTHS: "24"
error-worker:
environment:
COHORLY_SELF_HOST_RETENTION_MONTHS: "24"

After any change, run docker compose up -d: it recreates the containers whose settings changed.

A self-hosted instance runs with COHORLY_DEPLOYMENT_MODE=self-host, which the compose file fixes. In that mode no plan quota applies: events, exceptions, projects, symbol storage, session replays and AI credits are unlimited, and the dashboard shows consumption without limits or an upgrade prompt. The per-IP and per-project rate limits are not quotas and still apply.

Settings in .env

VariableDefaultEffect
COHORLY_DOMAINnone, requiredThe domain Caddy serves and gets a certificate for.
COHORLY_HTTP_PORT, COHORLY_HTTPS_PORT80, 443Host ports Caddy publishes.
COHORLY_PUBLIC_PORTemptySet it only when the public HTTPS port is not 443: it is the port in the public URL. The redirect from HTTP to HTTPS does not carry a custom port, so open the https address directly.
POSTGRES_PASSWORDnone, requiredPassword of the bundled PostgreSQL superuser. Without the two URLs below it also builds the API's connection string.
COHORLY_DATABASE_MIGRATION_URL, COHORLY_DATABASE_URLemptyRecommended. Splits the database access in two roles: cohorly_owner (from the first URL) owns the schema and runs migrations, cohorly_app (from the second) is what the API and the worker connect as, and it cannot change the schema, create roles or run programs on the database server. The db-roles service creates both before every start, with the name and password of each URL: postgres://<role>:<password>@postgres:5432/cohorly, the role being cohorly_owner or cohorly_app. Empty: the superuser does everything.
COHORLY_PG_MONITOR_DSNemptyMonitoring profile only: the PostgreSQL exporter connects as cohorly_monitor (pg_monitor only, created by db-roles) instead of the superuser. End it with ?sslmode=disable.
COHORLY_API_KEYnone, requiredThe admin key of the instance, at least 32 bytes. Used for /admin and /api calls and by the import tools.
BETTER_AUTH_SECRETnone, requiredSigns account sessions and encrypts the key that signs account tokens. Changing it later means clearing the auth_jwks table.
COHORLY_MCP_JWT_SECRETnone, requiredSigns the access tokens of the MCP server's OAuth flow, at least 32 bytes (a shorter value stops a production boot).
COHORLY_MCP_JWT_SECRET_PREVIOUSemptyThe previous signing secret, still accepted while you rotate COHORLY_MCP_JWT_SECRET. When set, at least 32 bytes too.
COHORLY_LICENSE_KEY, COHORLY_LICENSE_KEY_FILEnone, one requiredYour license key.
COHORLY_SERVER_IMAGE, COHORLY_DASHBOARD_IMAGE, COHORLY_IMAGE_TAGnone, set from your contractWhich images run. See Getting the images.
COHORLY_BOOTSTRAP_ADMIN_EMAILemptyRestricts who can create the first account. See First access.
COHORLY_TZempty, the container's zone (UTC)Default IANA time zone for date bucketing in queries. Each project can set its own.
COHORLY_HEAP_MBemptyCap, in megabytes, of the Node.js memory (V8 old space) of the API and the worker. Empty lets Node choose from the container's memory. Set it on small hosts. An explicit NODE_OPTIONS wins.
LOG_LEVELinfoLog level of the API and the worker.
PG_SHARED_BUFFERS, PG_EFFECTIVE_CACHE_SIZE, PG_WORK_MEM, PG_MAX_CONNECTIONS, PG_SHM_SIZE512MB, 1536MB, 8MB, 50, 256mbPostgreSQL settings. See PostgreSQL settings.
COHORLY_PG_POOL_MAX15Connections in the API's pool.
COHORLY_PG_CONNECT_TIMEOUT_MS10000How long, in milliseconds, a request waits for a free pool connection (or a new one) before it fails. 0 waits forever.
COHORLY_ERROR_WORKER_PG_POOL_MAX3Connections in the error worker's pool.
COHORLY_SMTP_URL, COHORLY_MAIL_FROMemptyE-mail delivery. See E-mail.
COHORLY_BLOB_DRIVER and the COHORLY_S3_* valuesdiskWhere symbol uploads and session replays are stored. See Blob storage.
GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRETemptyGoogle sign-in, on only when both are set.
OPENROUTER_API_KEY, COHORLY_AI_MODELSemptyThe AI chat agent. See What leaves your network.
SENTRY_DSNemptySends the API's errors to your own Sentry project.

Settings through an override

The compose file does not pass these to the containers. Set them in docker-compose.override.yml, as shown above, on server and on error-worker unless the table says one is enough.

VariableDefaultEffect
COHORLY_SELF_HOST_RETENTION_MONTHSempty, keep data foreverMonths events are kept. See Retention.
COHORLY_QUERY_TIMEOUT_MS30000Time limit, in milliseconds, of one analysis query in the database. 0 removes the limit. A query over the limit is cancelled and the API answers 504 with the code query_timeout. Only server runs queries.
COHORLY_QUERY_MAX_ROWS100000Most rows one analysis query statement may return. 0 removes the limit; an invalid value uses the default. A query over the limit is stopped before it fills the server's memory and the API answers 422 with the code query_too_large. Only server runs queries.
COHORLY_PG_OPTIONS-c parallel_setup_cost=50 -c parallel_tuple_cost=0.02 -c cpu_index_tuple_cost=0.01Options sent when each database connection starts. They steer wide time-range scans toward parallel plans. A value replaces the whole set; an empty string sends none. Behind a connection pooler such as PgBouncer, which may reject them, set it to an empty string.
COHORLY_GEOIP_DISABLEDempty1 or true never opens the geolocation database: events and profiles get no location.
COHORLY_SESSION_TIMEOUT_MS1800000Inactivity that ends a session in session queries.
COHORLY_IP_RATE_CAPACITY, COHORLY_IP_RATE_WINDOW_MS100, 10000Per-IP limit on /track and /engage: requests per window.
COHORLY_PROJECT_RATE_CAPACITY, COHORLY_PROJECT_RATE_WINDOW_MS1000, 10000Per-project limit on /track and /engage.
COHORLY_ANALYTICS_RATE_CAPACITY, COHORLY_ANALYTICS_RATE_WINDOW_MS30, 60000Limit on the query endpoints, per signed-in user.
COHORLY_ORG_API_KEY_RATE_CAPACITY, COHORLY_ORG_API_KEY_RATE_WINDOW_MS120, 60000Limit on each organization API key.
COHORLY_EXCEPTION_RATE_CAPACITY, COHORLY_EXCEPTION_RATE_WINDOW_MS1000, 60000Exceptions accepted per project per window. Over it, the exception is refused, never the whole batch.
COHORLY_ALERT_WEBHOOK_ALLOW_PRIVATEempty1 lets alert webhooks use http and private addresses. It also lets a single sign-on identity provider resolve to a private address, still never over http.
COHORLY_EXPORT_LINK_SECRETempty, derived from BETTER_AUTH_SECRETSigns the download links of event exports. server only. When set, at least 32 bytes (a shorter value stops a production boot).

A window variable is in milliseconds. See Rate limits for what a client sees when it is limited.

Retention

By default a self-hosted instance keeps events forever. Set COHORLY_SELF_HOST_RETENTION_MONTHS to a whole number of months from 1 to 1200 to delete older data. It applies to every organization on the instance, and exception payloads and session replays follow it (30 days per month).

  • Unset, empty or 0 keeps data forever.
  • A value that is not a whole number from 1 to 1200 also keeps data forever and logs a warning when the server starts. A typo never deletes data.
  • A background job removes whole monthly partitions once they are expired, and deletes rows only at the edge. It first runs one minute after the server starts, then every six hours.

GET /api/usage reports the value as retentionMonths.

Single sign-on

An organization owner connects the organization to one identity provider, over OpenID Connect or SAML 2.0, such as Okta, Microsoft Entra ID, Google Workspace or Keycloak. People with an e-mail address on a listed domain are sent to the provider to sign in. The Single sign-on guide walks through the setup; this section covers what an operator needs for OpenID Connect.

An owner sets it up in Settings, or through PUT /api/orgs/current/sso:

  • Register the redirect address https://cohorly.example.com/api/auth/sso/callback at the provider, with your own domain.
  • Give Cohorly the issuer, the client ID, the client secret and the e-mail domains (1 to 20 per organization). The issuer must serve its /.well-known/openid-configuration document, which Cohorly fetches before it saves.
  • Domains of the large public webmail providers are refused.
  • An owner who signs in with a password needs two-factor authentication turned on for their own account before they can save the provider (409 two_factor_not_enabled otherwise).
  • An existing account with two-factor authentication is not linked to the provider automatically. Its holder links it in Settings, or an owner resets their two-factor authentication.
  • An owner can then require single sign-on, so that members sign in only that way. Owners keep every sign-in method.

The API fetches the provider over https and refuses addresses that resolve to a private network. If your identity provider is inside your network, set COHORLY_ALERT_WEBHOOK_ALLOW_PRIVATE=1 through an override. The client secret is stored encrypted, with a key derived from BETTER_AUTH_SECRET, and is never returned.

If the provider's certificate is signed by a private certificate authority, the API does not trust it by default. Mount the authority's root certificate into server and point Node.js at it, in docker-compose.override.yml:

yaml
services:
server:
environment:
NODE_EXTRA_CA_CERTS: /run/secrets/idp-ca.pem
volumes:
- ./idp-ca.pem:/run/secrets/idp-ca.pem:ro

E-mail (SMTP)

Set COHORLY_SMTP_URL and COHORLY_MAIL_FROM to deliver the e-mails the server sends: account verification, password reset, invitations, alerts and usage notices:

COHORLY_SMTP_URL=smtps://<user>:<password>@smtp.example.com:465
COHORLY_MAIL_FROM=Cohorly <no-reply@example.com>

Without SMTP, e-mail verification is not required. Verification and password-reset links are written to the server log only (docker compose logs server). With SMTP set, an account must verify its address before it can onboard or accept an invitation.

Setting COHORLY_REQUIRE_EMAIL_VERIFICATION=1 through an override requires verification without SMTP. The links are then read from the log.

A failed send is logged with the recipient masked and never fails the request. The SMTP address and the delivered links are never logged.

Blob storage

Symbol uploads (source maps, native mappings) and session replay chunks are stored as blobs. COHORLY_BLOB_DRIVER chooses where:

  • disk (default): the selfhost-blobs Docker volume, mounted into the API and the error worker.
  • s3: any S3-compatible bucket, addressed path-style. Set COHORLY_S3_ENDPOINT, COHORLY_S3_BUCKET, COHORLY_S3_ACCESS_KEY_ID, COHORLY_S3_SECRET_ACCESS_KEY and optionally COHORLY_S3_REGION (default auto).

An unknown driver or an incomplete S3 configuration stops the start; it never falls back to disk. Blobs are never stored in PostgreSQL. Whichever driver you use, back up the blobs too.

Two-factor authentication

People can turn on a TOTP authenticator app in Settings. An owner can then require it for the organization: a member with a password and no factor gets two_factor_required on every API call, and their MCP tokens stop working, until they set up a factor. Google sign-in does not ask for a second factor.

An owner can turn the requirement on only after they have set up their own factor, unless they sign in with Google only. While an organization requires it, its members cannot turn their factor off.

PreviousInstall
NextUpgrade