Skip to Content
ConfigurationEnvironment Variables

Environment Variables

All configuration options for the Rustrak server. None is needed to start it except SESSION_SECRET_KEY in production: the defaults run SQLite, serve the dashboard and listen on 8080.

Server

VariableDefaultDescription
HOST0.0.0.0TCP bind address
PORT8080Server port, for the API and the dashboard
RUST_LOGinfoLog level (trace, debug, info, warn, error)
RUSTRAK_LOG_TIMEZONEUTCIANA timezone name for log timestamp display (e.g. Asia/Shanghai)
PUBLIC_URL(none)Public-facing URL used in DSN strings and alert links

HOST

The network interface the server listens on. The default (0.0.0.0) means “all interfaces” and is correct for Docker, so you don’t need to set it.

Only change this if you want to restrict access to a specific interface:

HOST=127.0.0.1 # loopback only, e.g. for local dev behind a local proxy

Docker note: If you set HOST=127.0.0.1 inside a container, the port mapping won’t work and the server will be unreachable.

PUBLIC_URL

The address your SDKs and your team reach the server on. Rustrak writes it into every DSN and, unless DASHBOARD_URL says otherwise, into the issue links in alert notifications. Must include the scheme (http:// or https://). Trailing slashes are stripped automatically.

# Production (behind reverse proxy) PUBLIC_URL=https://rustrak.example.com # Self-hosted with custom port PUBLIC_URL=http://192.168.1.10:9090

Why this matters: HOST=0.0.0.0 is the TCP bind address. It means “listen on all interfaces” and is not a routable address. Without PUBLIC_URL, the DSN shown in the dashboard contains http://0.0.0.0:8080/..., which your SDK cannot reach. Set it even locally, e.g. PUBLIC_URL=http://localhost:8080.

RUSTRAK_LOG_TIMEZONE

Converts the timestamps in the server’s process logs (stdout: HTTP requests, background workers, event digestion, everything under RUST_LOG) to a specific IANA timezone for easier correlation with logs from other systems.

RUSTRAK_LOG_TIMEZONE=Asia/Shanghai

Use an IANA zone name (e.g. Asia/Shanghai, America/New_York, Europe/Madrid), not a fixed UTC offset, so daylight saving time is handled correctly. If unset, or set to a name that isn’t a recognized IANA zone, logs fall back to UTC and the server still starts normally (a warning is logged when the value is invalid).

Scope: this only affects how log lines are displayed. Event and issue timestamps are always stored and returned as UTC.

Dashboard

The dashboard is on by default, served from / on the same port and origin as the API. Nothing here needs setting for that.

VariableDefaultDescription
RUSTRAK_DASHBOARDonWhether to serve the dashboard at all. off keeps the server API-only
DASHBOARD_URLPUBLIC_URLBase URL for the issue links in notifications
RUSTRAK_DASHBOARD_DIR./staticWhere the compiled dashboard lives, relative to the working directory or absolute

RUSTRAK_DASHBOARD

off keeps the dashboard unmounted even though the image carries a build. Use it for a server that should answer the API only, or when the dashboard runs from another host.

RUSTRAK_DASHBOARD=off

on, off, true, false, 1 and 0 are accepted. Anything else refuses to start, deliberately: a typo that silently left the dashboard on would expose a UI you meant to keep off the box.

DASHBOARD_URL

The issue links in alert notifications follow PUBLIC_URL, because the server serves the dashboard itself. Set DASHBOARD_URL only when people open the dashboard on a different host than PUBLIC_URL: a separate ingestion hostname, or a rustrak-ui container. With neither set, the links use the server’s bind address.

RUSTRAK_DASHBOARD_DIR

The image already puts the dashboard at /app/static, which is what the default resolves to, so you do not normally set this. The dashboard is mounted when the directory holds an index.html and skipped when it does not.

# Serve a dashboard you built and mounted yourself RUSTRAK_DASHBOARD_DIR=/srv/rustrak-dashboard

RUSTRAK_API_URL is not a server variable. It belongs to the optional rustrak/rustrak-ui image, for a dashboard on its own host, and names the server that image proxies the API to.

The update check

The dashboard compares the running server’s version against the release feed published on GitHub Pages, and shows a notice when a newer one exists. The request is made by each reader’s browser. Nothing about the instance is sent: it is a plain GET for a public JSON file, and a blocked or unreachable feed means no notice appears.

Security

VariableDefaultDescription
SSL_PROXYfalseSet to true when behind HTTPS proxy (nginx, Cloudflare)
SESSION_SECRET_KEY(random)64-character key for session encryption

SSL_PROXY

Set to true when running behind a reverse proxy that terminates SSL (nginx, Cloudflare, etc.). This enables secure cookies.

SSL_PROXY=true

When SSL_PROXY=true:

  • Cookies are sent only over HTTPS (Secure flag enabled)
  • SESSION_SECRET_KEY becomes required

SESSION_SECRET_KEY

Generate with:

openssl rand -hex 32
  • Development: Optional (a random key is used, sessions don’t persist across restarts)
  • Production with SSL_PROXY=true: Required

The key must be at least 64 characters, which is what openssl rand -hex 32 produces: the cookie key is a 256-bit signing key followed by a 256-bit encryption key. Anything shorter is refused at startup with the length it received, so openssl rand -base64 32 (44 characters) will not do. Changing the key invalidates every existing session.

OpenID Connect SSO

Optional sign-in through Pocket ID, Authentik, Keycloak, Google or any other OpenID Connect provider. SSO is off unless OIDC_ISSUER_URL is set. See Single Sign-On for how it works, a step-by-step setup and troubleshooting.

VariableDefaultDescription
OIDC_ISSUER_URL(disabled)Provider issuer URL used for discovery
OIDC_CLIENT_ID(required)Client ID issued to Rustrak
OIDC_CLIENT_SECRET(required)Client secret issued to Rustrak
OIDC_REDIRECT_URL(required)Exact callback URL, ending in /auth/sso/callback
OIDC_PROVIDER_NAMESSOLabel on the login button
OIDC_SCOPESopenid email profileSpace-separated scopes
OIDC_AUTO_PROVISIONfalseCreate an account for someone whose email has none
OIDC_LINK_EXISTING_ACCOUNTSfalseLink to an existing account without asking for its password
OIDC_REQUIRE_EMAIL_VERIFIEDtrueRefuse identities whose email the provider has not verified
OIDC_ALLOWED_DOMAINS(all)Comma-separated email domains allowed to use SSO
OIDC_GROUPS_CLAIMgroupsClaim that carries the identity’s groups
OIDC_ADMIN_GROUPS(none)Comma-separated groups that make someone an owner (admin in the API)
OIDC_GROUP_ROLES(none);-separated <group>=<role>[@<project slug>] entries that give roles from groups. See Project roles from provider groups
OIDC_ADDITIONAL_TRUSTED_AUDIENCES(none)Comma-separated audiences an ID token may carry besides the client ID
OIDC_DISABLE_PASSWORD_LOGINfalseRefuse password sign-in, leaving SSO as the only way in

Database

VariableDefaultDescription
DATABASE_URLsqlite:///data/rustrak.dbDatabase connection string. Required only for PostgreSQL
DATABASE_MAX_CONNECTIONS10Maximum pool connections
DATABASE_MIN_CONNECTIONS1Minimum pool connections
DATABASE_ACQUIRE_TIMEOUT_SECS5How long a request waits for a free connection before failing
DATABASE_IDLE_TIMEOUT_SECS600How long an unused connection stays open
DATABASE_MAX_LIFETIME_SECS1800How long a connection lives before it is replaced

DATABASE_URL

The backend is chosen by the image: latest is SQLite, postgres is PostgreSQL. See Database backends.

SQLite (optional, the default above is right for Docker):

# Absolute path DATABASE_URL=sqlite:///var/lib/rustrak/rustrak.db # In-memory (for testing only, data lost on restart) DATABASE_URL=sqlite::memory:

PostgreSQL (required with the postgres image):

# Format postgres://username:password@host:port/database # Examples DATABASE_URL=postgres://rustrak:rustrak@postgres:5432/rustrak # Docker DATABASE_URL=postgres://user:pass@host:5432/rustrak?sslmode=require # With SSL

Rate Limiting

VariableDefaultDescription
MAX_EVENTS_PER_MINUTE60000Max events/minute (global)
MAX_EVENTS_PER_HOUR1000000Max events/hour (global)
MAX_EVENTS_PER_PROJECT_PER_MINUTE20000Max events/minute per project
MAX_EVENTS_PER_PROJECT_PER_HOUR300000Max events/hour per project

The defaults are a brake for a runaway loop that would fill the disk, not a cap on ordinary spikes. Windows are fixed minutes and hours, and the limit is exact: once a window is full, ingest answers 429 with Retry-After and X-Sentry-Rate-Limits, and the SDK waits before sending again. An event that was already accepted when its window filled is dropped rather than stored, and counted in the project’s rate_limited_event_count.

Load shedding

VariableDefaultDescription
INGEST_MAX_PENDING_EVENTS100000Events waiting in INGEST_DIR for the digest before ingest refuses new ones. 0 turns the check off
INGEST_MIN_FREE_DISK_MB64Free space on the volume holding INGEST_DIR below which ingest refuses new events. On SQLite the server adds the ~40 MiB its write-ahead log can still grow by, so ingest stops before the database fills the disk. 0 turns the check off

Ingest stores each event in INGEST_DIR and answers before the digest groups it. When the digest falls far behind, or the disk is nearly full, ingest answers 503 instead, as Sentry’s Relay does when its own buffer is full. The SDK drops that event: Sentry SDKs do not send an envelope again once the server has answered it. The response carries Retry-After and X-Sentry-Rate-Limits for 10 seconds, so the SDK stops sending (and drops what it would have sent) for that long instead of adding to the load. Free space is read every five seconds, not on each request, and a volume already under the floor at startup is reported in the log. The same 503 is the answer while the server is shutting down, when too many large uploads (over 1 MiB) are already being read and no slot frees up within 30 seconds of waiting, and when the database is down, read-only, busy or out of connections.

Digest

The digest takes whatever accepted events are ready and writes them as one transaction (up to 256 events), so a single event is stored a moment after its 200 and a burst is stored in batches. Each event’s file in INGEST_DIR is deleted only after the transaction that stored it is durable on disk (on PostgreSQL the digest’s own connection commits with synchronous_commit=on); alert rows written through other connections are covered the same way before the file goes. If the server is set to synchronous_commit=off, an alert evaluation can be lost on a power cut after its event’s file is gone.

If every event fails on its own, with nothing stored in between (a broken schema, a missing grant), the digest halts instead of moving the backlog to INGEST_DIR/dead/ one event at a time: GET /health/ready adds "digest": "halted" and still answers 200, so the dashboard stays up, rustrak_digest_halted is 1, and one event is tried again every minute. The first one that is stored resumes the digest.

A number that does not parse, in any of the variables on this page, stops the server at startup with a message that names the variable. Unset or empty keeps the default.

Stopping the server

On SIGTERM or SIGINT the server writes its release health counts, refuses new events with 503, gives the digests already running up to 5 seconds to finish, then stops. Events still waiting for a digest stay in INGEST_DIR and are digested on the next start, so nothing acknowledged is lost. A second signal exits at once (after one more try, of at most a second, at the session counts). That fits in Docker’s default 10 second stop grace; give it 30 seconds anyway, so a slow final write is not cut off:

services: server: stop_grace_period: 30s

With docker run, the same is --stop-timeout 30; in Kubernetes, terminationGracePeriodSeconds: 30.

Storage

VariableDefaultDescription
INGEST_DIR/tmp/rustrak/ingestTemporary event storage
SOURCEMAP_STORAGE_PATH/data/sourcemapsDirectory for source map chunk storage
SOURCEMAP_CACHE_MB64Memory kept for parsed source maps across events
MAX_CHUNK_SIZE_BYTES10485760 (10 MiB)Largest single chunk a source map or debug file upload may send
SESSION_FLUSH_INTERVAL_SECS30How often release health counts are written to the database
SESSION_CARDINALITY_CAP10000Release and environment pairs tracked per project; more are counted together as <overflow>

INGEST_DIR

Each accepted event waits here as one file until its digest stores it. An event whose digest fails is retried. If it fails the same way five times in a row, or its file cannot be read as an event at all, the file is moved to INGEST_DIR/dead/ and an error is logged. Nothing reads dead/: inspect a file there, and move it back to INGEST_DIR to try it again. Only a failure caused by the event’s own data counts toward the five: the database rejecting it (a constraint, a value out of range, a value too big). Anything else (a busy, unreachable or read-only database, a full disk, a file that cannot be read right now, a missing table or permission) is retried for as long as it takes, so neither an outage nor a broken upgrade moves the backlog. A file whose record was written by another Rustrak version, or that the server is not allowed to open, is left where it is, logged once and no longer counted as waiting. The count is kept in memory, so a restart gives each file five more tries.

Not every event that leaves INGEST_DIR is stored or moved to dead/. An event the digest finds invalid (not JSON, a timestamp before 1970, a feedback the project turned off) is deleted and logged, as Sentry drops it; so is an event over the rate limit, counted in the project’s rate_limited_event_count.

SOURCEMAP_STORAGE_PATH

Where Rustrak stores source map chunks uploaded by Sentry SDKs. The default is inside the /data volume, so with -v rustrak_data:/data they persist with no setting. Chunks are stored in a content-addressable layout: a SHA-1 hash like abc123... is written to {SOURCEMAP_STORAGE_PATH}/ab/c123....map.

SOURCEMAP_STORAGE_PATH=/var/lib/rustrak/sourcemaps

SOURCEMAP_CACHE_MB

Once a source map has been read and parsed for one event, Rustrak keeps the parsed form in memory so the next event that hits the same file skips both steps. This budget caps that memory, measured as the size of the source map files it holds, and the least recently used map is dropped first. A map larger than the whole budget is never kept.

SOURCEMAP_CACHE_MB=64

The cache only saves the file read and the parse. Which file a debug_id points to is looked up in the database on every event, so a deleted or re-uploaded source map takes effect immediately. Size it to hold the maps your errors actually hit: a handful of large Next.js server bundles is usually enough, and the default covers a 15 MB map four times over.

Email Alerts (SMTP)

Global SMTP settings for email notifications and team invitations. Alert channels can override these.

VariableDefaultDescription
SMTP_HOST-SMTP server hostname
SMTP_PORT587SMTP port (587 for STARTTLS, 465 for SSL)
SMTP_TLSby portstarttls, tls (SSL) or none. Unset: tls on port 465, starttls elsewhere. none is for a relay on a trusted network or a local test server
SMTP_USERNAME-SMTP username
SMTP_PASSWORD-SMTP password
SMTP_FROM[email protected]Default sender address

Bootstrap

VariableDescription
CREATE_SUPERUSERCreate admin user on startup (email:password)
RUSTRAK_BOOTSTRAP_TOKENSet to anything to create an API token on startup
RUSTRAK_CONFIGPath of rustrak.toml, which declares the first owner, projects with fixed DSNs and API tokens. See Bootstrap file
CREATE_SUPERUSER="[email protected]:secure-password"

Only creates the user if the database has no users yet. After that it is ignored.

RUSTRAK_BOOTSTRAP_TOKEN creates one API token when the instance has none, for automation that needs the API before anyone signs in. The token is printed once to the server’s standard error, not to the log, so copy it from the first start’s output.

Prometheus metrics

VariableDefaultDescription
RUSTRAK_METRICSoffon serves Prometheus metrics on /metrics

RUSTRAK_METRICS=on enables GET /metrics on the server’s existing port. It is off by default (the route returns 404); only on and off are accepted. This is independent of anonymous telemetry and does not send data anywhere.

The scrape reports ingest totals and latency, digest outcomes, 5xx responses by matched route, and failed alerts by provider. For incidents it adds requests shed by load shedding by reason (rustrak_ingest_shed_total{reason="backlog"|"disk"}), 503s from a briefly unavailable database (rustrak_db_unavailable_total), files moved to INGEST_DIR/dead/ (rustrak_spool_dead_lettered_total), stored events whose alert step failed for good and was skipped (rustrak_digest_post_commit_dropped_total) and background workers restarted after a panic (rustrak_worker_restarts_total). rustrak_spool_pending is the number of events waiting for their digest, kept in memory and always current. The spool’s bytes and oldest-file age come from a walk of INGEST_DIR once a minute, so they can be a minute old and are missing until the first walk. The database size is read at most once every 15 seconds. Counters reset on restart, not when anonymous telemetry sends a report. Labels never contain project IDs, user details or event contents.

/metrics has no application authentication. Keep it on a trusted network or restrict it at the reverse proxy. The standalone dashboard image does not forward it, so point Prometheus at the server.

RUSTRAK_METRICS=on curl http://localhost:8080/metrics

Alerts

VariableDefaultDescription
RUSTRAK_ALERTS_ALLOW_PRIVATE_NETWORKSoffon lets alerts reach loopback and private addresses

Webhook and Slack alerts only go to addresses on the public internet. A URL that is, or resolves to, a loopback, private, link-local (cloud metadata) or reserved address fails with “Destination not allowed”, and redirects are not followed. Alerts connect directly and ignore HTTP_PROXY, HTTPS_PROXY and ALL_PROXY, since a proxy would resolve the host where Rustrak cannot check it. Whoever configures an integration picks the URL the server calls, so without this check they could reach services on the server’s own network.

If your chat server or automation tool runs on your own network, for example an internal Mattermost or n8n, turn this on:

RUSTRAK_ALERTS_ALLOW_PRIVATE_NETWORKS=on

Telemetry

VariableDefaultDescription
RUSTRAK_TELEMETRYonAnonymous usage report every 6 hours. off sends nothing
DO_NOT_TRACKunset1 sends nothing either; the cross-tool convention

Either variable on its own is enough to turn it off. What the report contains, field by field, is on the Telemetry page.

Complete Example

SQLite (image tag latest)

SESSION_SECRET_KEY=generate-your-own-with-openssl-rand-hex-32 PUBLIC_URL=https://rustrak.example.com SSL_PROXY=true

That is the whole configuration. The database defaults to /data/rustrak.db and the dashboard is served from /.

PostgreSQL (image tag postgres)

DATABASE_URL=postgres://rustrak:password@postgres:5432/rustrak # Security (required behind an HTTPS proxy) SSL_PROXY=true SESSION_SECRET_KEY=generate-your-own-with-openssl-rand-hex-32 # Server: SDKs, the dashboard and alert links all use this address PUBLIC_URL=https://rustrak.example.com RUST_LOG=info # Database Pool DATABASE_MAX_CONNECTIONS=20 # Rate Limiting (only to lower the defaults on small hardware) MAX_EVENTS_PER_MINUTE=10000 MAX_EVENTS_PER_HOUR=200000 # Email Alerts (optional, can also be set per channel) SMTP_HOST=smtp.example.com SMTP_PORT=587 SMTP_USERNAME=[email protected] SMTP_PASSWORD=your-smtp-password SMTP_FROM=[email protected]
Last updated on