Environment variables
This page lists every setting a self-hosted SREInsights control plane reads from its environment. You need it when you deploy your own instance (see Self-hosting overview) or change how one behaves. Runner settings are on a page of their own: Runner settings.
The server checks its environment once, at start. A missing or invalid setting stops it with a list of what to fix, for example:
Invalid configuration: SREINSIGHTS_MASTER_KEY: must be 32 random bytes, base64-encoded (openssl rand -base64 32)An empty value (VAR=) counts as not set. Compose files and hosting dashboards often pass unset variables that way.
In the tables, Secret means the value must stay private: keep it in a .env file with mode 600, or in a secret manager, never in git. Serverless marks settings that only apply when the control plane runs as AWS Lambda functions (SREINSIGHTS_SERVERLESS=true, see Serverless on AWS).
Required settings
Section titled “Required settings”An instance does not start without these five (six for the migrate step).
| Variable | Secret | What it is |
|---|---|---|
DATABASE_URL |
Yes | Connection string for the sreinsights_app role |
SYSTEM_DATABASE_URL |
Yes | Connection string for the sreinsights_system role |
DATABASE_OWNER_URL |
Yes | Connection string for the sreinsights_owner role. Only the migrate step needs it |
SREINSIGHTS_BASE_URL |
No | The URL people open SREInsights at |
SREINSIGHTS_SESSION_SECRET |
Yes | Signs sign-in sessions. At least 32 characters |
SREINSIGHTS_MASTER_KEY |
Yes | Wraps each organization’s data key. 32 random bytes, base64 |
Generate the two secrets with:
openssl rand -base64 48 # SREINSIGHTS_SESSION_SECRETopenssl rand -base64 32 # SREINSIGHTS_MASTER_KEYDatabase
Section titled “Database”SREInsights connects to Postgres as three roles. deploy/postgres/setup.sql creates them (see Docker Compose). Percent-encode special characters in passwords inside these URLs.
| Variable | Default | Secret | What it does |
|---|---|---|---|
DATABASE_URL |
None (required) | Yes | postgresql://sreinsights_app:…@<host>:5432/sreinsights. Every API request connects as this role, so row-level security applies to it |
SYSTEM_DATABASE_URL |
None (required) | Yes | postgresql://sreinsights_system:…@<host>:5432/sreinsights. Sign-in before an organization is chosen, scheduler claims, retention, seeds and the operator commands. This role bypasses row-level security |
DATABASE_OWNER_URL |
None | Yes | postgresql://sreinsights_owner:…@<host>:5432/sreinsights. The schema owner, used only to apply migrations |
SREINSIGHTS_DB_POOL_SIZE |
Prisma’s own (two per CPU, plus one); 2 when serverless |
No | Connections per database role, from 1 to 100, unless the URL sets its own connection_limit |
URLs and web app
Section titled “URLs and web app”| Variable | Default | Secret | What it does |
|---|---|---|---|
SREINSIGHTS_BASE_URL |
None (required) | No | Where people reach SREInsights, for example https://sreinsights.example.com, with no trailing slash. Used for the links in notifications, reports and invitations, and for the store sign-in callbacks. With an https:// address, session cookies are marked secure |
SREINSIGHTS_API_URL |
SREINSIGHTS_BASE_URL |
No | Where runners reach SREInsights, when it differs from the base URL. The install commands on the Runners page use it |
SREINSIGHTS_WEB_DIR |
Not set (the server image sets /app/web) |
No | The built web app. When set, the api role serves it at every path outside /api and /runner, so the UI and the API share one origin |
SREINSIGHTS_RUNNER_IMAGE |
ghcr.io/bintree-softwares/sreinsights-runner:latest |
No | The runner image the Runners page tells people to run |
PORT |
8080 |
No | The port the HTTP server listens on |
Secrets and sessions
Section titled “Secrets and sessions”| Variable | Default | Secret | What it does |
|---|---|---|---|
SREINSIGHTS_SESSION_SECRET |
None (required) | Yes | Signs sessions. At least 32 characters |
SREINSIGHTS_MASTER_KEY |
None (required) | Yes | Wraps each organization’s data key, which encrypts stored connection secrets. Must decode to exactly 32 bytes |
SREINSIGHTS_ACCESS_TOKEN_TTL_S |
900 |
No | How long an access token lasts, in seconds |
SREINSIGHTS_REFRESH_TOKEN_TTL_DAYS |
30 |
No | How long a refresh token lasts, in days |
Server role
Section titled “Server role”| Variable | Default | What it does |
|---|---|---|
SREINSIGHTS_ROLE |
all |
What this server process does: api, scheduler, processor, worker or all |
| Value | What runs |
|---|---|
api |
HTTP only: the API, the runner protocol and (with SREINSIGHTS_WEB_DIR) the web app |
scheduler |
Run queue maintenance, and the dispatcher that invokes the functions of Lambda runner groups |
processor |
Alert evaluation and notification delivery |
worker |
scheduler and processor together, as one background service |
all |
Every role. The default, for local development |
The server image sets the role from its first argument (api, worker, scheduler, processor or all), so you rarely set this variable yourself. See Server roles.
Runners and Lambda
Section titled “Runners and Lambda”| Variable | Default | Secret | What it does |
|---|---|---|---|
SREINSIGHTS_LAMBDA_RUNNERS |
false |
No | true lets organizations create Lambda runner groups and starts the dispatcher that invokes their functions with this server’s AWS credentials. Turn it on only on an instance whose organizations you all trust with those credentials, because any organization can then have the server invoke any function the credentials allow |
SREINSIGHTS_HOSTED_LAMBDA_RUNNERS |
false |
No | true dispatches only hosted Lambda groups, the ones an operator makes with sreinsights runners add … --lambda. No organization’s own Lambda group is dispatched, so it is safe on a shared instance. See Hosted runner groups |
SREINSIGHTS_LAMBDA_FUNCTION_PREFIXES |
Not set (any function) | No | Comma-separated prefixes, for example sreinsights-runner-. The dispatcher only invokes functions whose names start with one of them. A run on any other function ends as error/dispatch_failed with the reason. Each prefix is 1 to 64 letters, digits, _ or - |
SREINSIGHTS_LEASE_MAX_WAIT_MS |
25000; 0 when serverless |
No | The longest a runner’s lease poll is held open when there is no work, from 0 to 25000. When serverless, at most 20000 |
AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN |
Not set | Yes | The server’s own AWS credentials, where Lambda and ECS put a role’s credentials. Used to invoke runner functions (lambda:InvokeFunction), publish to SNS topics (sns:Publish), read SREINSIGHTS_CONFIG_SECRETS, write store tokens and run sreinsights connections import |
AWS_REGION, AWS_DEFAULT_REGION |
Not set | No | The region for Secrets Manager calls when a secret is given by name instead of ARN |
See Lambda runner groups for what a Lambda group is.
Serverless
Section titled “Serverless”These settings only apply when the control plane runs as AWS Lambda functions. The Lambda image sets SREINSIGHTS_SERVERLESS=true. The Lambda handlers refuse to start without it, and the server process refuses to start with it.
| Variable | Default | Serverless only | What it does |
|---|---|---|---|
SREINSIGHTS_SERVERLESS |
false |
Yes | Switches the control plane to run as functions. Changes the defaults of SREINSIGHTS_LEASE_MAX_WAIT_MS (to 0) and SREINSIGHTS_DB_POOL_SIZE (to 2), and holds schedules to the tick interval |
SREINSIGHTS_CONFIG_SECRETS |
Not set | Yes | Names or ARNs of AWS Secrets Manager secrets, comma-separated. Each holds a JSON object of settings, such as { "DATABASE_URL": "…", "SREINSIGHTS_SESSION_SECRET": "…" }. Read once, when a function instance starts, with the function’s own role. A setting in the environment wins over one in a secret, and an earlier secret wins over a later one |
SREINSIGHTS_TICK_INTERVAL_S |
60 |
Yes | How often the tick function is invoked, from 60 to 3600 seconds. No monitor or report may run more often than this |
SREINSIGHTS_TICK_BUDGET_MS |
50000 |
Yes | No round of background work starts later than this into a tick invocation, from 1000 to 840000. Keep it under the tick function’s timeout |
The secret named in SREINSIGHTS_CONFIG_SECRETS keeps database URLs, the session secret and the master key out of the function’s configuration and out of the infrastructure tool’s state file. A running function instance keeps the values it read: after you change a secret, update the functions (or wait for AWS to recycle them).
Alerting and notifications
Section titled “Alerting and notifications”| Variable | Default | What it does |
|---|---|---|
SREINSIGHTS_ALERT_STORM_THRESHOLD |
100 |
When one organization gets more new alerts than this within 5 minutes, they fold into a single “alert storm” notification. At least 2. See Flapping and alert storms |
SREINSIGHTS_EGRESS_ALLOW_PRIVATE |
false |
true lets notifications reach private addresses, for example a test service on localhost. Leave it off on any instance others use |
ADAM (AI)
Section titled “ADAM (AI)”ADAM drafts flows and analyses incidents through the Anthropic API. Without a key, the features are off. See ADAM.
| Variable | Default | Secret | What it does |
|---|---|---|---|
ADAM_API_KEY |
Not set | Yes | Anthropic API key. Unset: ADAM is off |
ADAM_MODEL |
claude-opus-5 |
No | The model ADAM uses |
SREINSIGHTS_AI_API_KEY |
Not set | Yes | Older name for ADAM_API_KEY, still read. ADAM_API_KEY wins when both are set |
SREINSIGHTS_AI_MODEL |
Not set | No | Older name for ADAM_MODEL, still read. When set, it wins over ADAM_MODEL |
Stores
Section titled “Stores”| Variable | Default | Secret | What it does |
|---|---|---|---|
SREINSIGHTS_STORE_CONNECT |
Not set (off) | No | Lets the named organizations connect Etsy and eBay stores by signing in on the Stores page. JSON naming the organizations and where the tokens go in AWS Secrets Manager, written with this server’s own AWS credentials. Only for an instance of your own, whose listed organizations you trust with that |
The value is JSON. No field in it is a secret:
{ "orgIds": ["<org id>"], "etsy": { "region": "us-east-1", "secretPrefix": "acme/etsy/", "lockBucket": "acme-locks", "lockPrefix": "locks/etsy/" }, "ebay": { "region": "us-east-1", "secretPrefix": "acme/ebay/", "appSecret": "acme/ebay/app" }}| Field | Required | Default | What it does |
|---|---|---|---|
orgIds |
Yes | Organization ids (UUIDs) that may connect stores. At least one | |
etsy.region |
With etsy |
AWS region of the store secrets | |
etsy.secretPrefix |
With etsy |
Secret name prefix, ending in / |
|
etsy.lockBucket |
With etsy |
S3 bucket for the token lock taken while writing a store’s secret | |
etsy.lockPrefix |
No | locks/etsy/ |
Key prefix for the lock |
ebay.region |
With ebay |
AWS region of the store secrets | |
ebay.secretPrefix |
With ebay |
Secret name prefix, ending in / |
|
ebay.appSecret |
With ebay |
Name or ARN of the secret holding the developer keyset (client_id, client_secret, ru_name) |
|
ebay.ruName |
No | The keyset’s ru_name |
The RuName whose accepted URL is SREInsights’ callback |
ebay.sandbox |
No | false |
Use eBay’s sandbox |
ebay.lockBucket, ebay.lockPrefix |
No | Not set, locks/ebay/ |
Take a lock for eBay writes too |
Leave out etsy or ebay to offer only the other. See Stores.
Intervals
Section titled “Intervals”How often each background loop runs. The defaults suit almost every instance.
| Variable | Default | Minimum | What it does |
|---|---|---|---|
SREINSIGHTS_SCHEDULER_INTERVAL_MS |
1000 |
100 |
How often the scheduler queues due runs and maintains the run queue |
SREINSIGHTS_PROCESSOR_INTERVAL_MS |
1000 |
100 |
How often new results are evaluated against alert rules |
SREINSIGHTS_DELIVERY_INTERVAL_MS |
1000 |
100 |
How often queued notifications are sent |
SREINSIGHTS_RUNNER_WATCH_INTERVAL_MS |
10000 |
1000 |
How often runner groups are checked for having gone quiet |
SREINSIGHTS_JOB_WATCH_INTERVAL_MS |
5000 |
1000 |
How often data jobs are checked for failed runs and missing data |
SREINSIGHTS_DISPATCH_INTERVAL_MS |
1000 |
100 |
How often queued runs of Lambda runner groups are looked for and their functions invoked |
SREINSIGHTS_REPORT_INTERVAL_MS |
15000 |
1000 |
How often due reports are queued and queued ones sent |
On a serverless instance these loops run once per tick instead (see SREINSIGHTS_TICK_INTERVAL_S).
Logging and runtime
Section titled “Logging and runtime”| Variable | Default | What it does |
|---|---|---|
LOG_LEVEL |
info |
fatal, error, warn, info, debug, trace or silent |
NODE_ENV |
development (the server image sets production) |
development, test or production |