Environment Variables
All configuration options for the Rustrak server.
Required
| Variable | Description |
|---|---|
DATABASE_URL | Database connection string. Optional for SQLite (defaults to sqlite:///data/rustrak.db). Required for PostgreSQL. |
DATABASE_URL
Rustrak supports two database backends selected at compile time.
SQLite:
# Relative file path
DATABASE_URL=sqlite://./rustrak.db
# Absolute path
DATABASE_URL=sqlite:///var/lib/rustrak/rustrak.db
# In-memory (for testing only — data lost on restart)
DATABASE_URL=sqlite::memory:PostgreSQL:
# Format
postgres://username:password@host:port/database
# Examples
DATABASE_URL=postgres://rustrak:rustrak@localhost:5432/rustrak
DATABASE_URL=postgres://rustrak:rustrak@postgres:5432/rustrak # Docker
DATABASE_URL=postgres://user:pass@host:5432/rustrak?sslmode=require # With SSLSecurity
| Variable | Default | Description |
|---|---|---|
SSL_PROXY | false | Set to true when behind HTTPS proxy (nginx, Cloudflare) |
SESSION_SECRET_KEY | (random) | 64-character hex string 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=trueWhen SSL_PROXY=true:
- Cookies are sent only over HTTPS (
Secureflag enabled) SESSION_SECRET_KEYbecomes 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
Server
| Variable | Default | Description |
|---|---|---|
HOST | 0.0.0.0 | TCP bind address |
PORT | 8080 | Server port |
RUST_LOG | info | Log level (trace, debug, info, warn, error) |
PUBLIC_URL | (none) | Public-facing URL used in DSN strings shown to users |
HOST
The network interface the server listens on. The default (0.0.0.0) means “all interfaces” and is correct for Docker — you don’t need to set it explicitly.
Only change this if you want to restrict access to a specific interface:
HOST=127.0.0.1 # loopback only — useful for local dev behind a local proxyDocker note:
HOST=0.0.0.0is already the default. You don’t need to include it in yourdocker-compose.ymlor.env. If you setHOST=127.0.0.1inside a container, the port mapping won’t work and the server will be unreachable.
PUBLIC_URL
The URL that Rustrak embeds in DSN strings. Must include the scheme (http:// or https://). Trailing slashes are stripped automatically.
# Production (behind reverse proxy)
PUBLIC_URL=https://api.yourcompany.com
# Self-hosted with custom port
PUBLIC_URL=http://192.168.1.10:9090Why this matters: HOST=0.0.0.0 is the TCP bind address — it means “listen on all interfaces.” It is not a routable address. Without PUBLIC_URL, the DSN shown in the dashboard will contain http://0.0.0.0:8080/..., which your SDK cannot reach.
When unset, Rustrak falls back to http://{HOST}:{PORT} — fine for local development where HOST is localhost or 127.0.0.1.
Database Pool
| Variable | Default | Description |
|---|---|---|
DATABASE_MAX_CONNECTIONS | 10 | Maximum pool connections |
DATABASE_MIN_CONNECTIONS | 1 | Minimum pool connections |
Rate Limiting
| Variable | Default | Description |
|---|---|---|
MAX_EVENTS_PER_MINUTE | 1000 | Max events/minute (global) |
MAX_EVENTS_PER_HOUR | 10000 | Max events/hour (global) |
MAX_EVENTS_PER_PROJECT_PER_MINUTE | 500 | Max events/minute per project |
MAX_EVENTS_PER_PROJECT_PER_HOUR | 5000 | Max events/hour per project |
Storage
| Variable | Default | Description |
|---|---|---|
INGEST_DIR | /tmp/rustrak/ingest | Temporary event storage |
SOURCEMAP_STORAGE_PATH | /data/sourcemaps | Directory for source map chunk storage |
SOURCEMAP_STORAGE_PATH
Where Rustrak stores source map chunks uploaded by Sentry SDKs. 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/sourcemapsStorage sizing: Each source map chunk is typically around 2MB. Multiply by the number of distinct source files across all your deployments. A typical JavaScript app with 50 source files uses around 100MB.
Production / multi-server deployments: All server instances must read and write from the same SOURCEMAP_STORAGE_PATH. Mount a shared volume (NFS, EFS, a network filesystem) and point every instance at it. Without this, chunks uploaded to one instance won’t be visible to others during bundle assembly.
Email Alerts (SMTP)
Global SMTP settings for email notifications. Channels can override these.
| Variable | Default | Description |
|---|---|---|
SMTP_HOST | - | SMTP server hostname |
SMTP_PORT | 587 | SMTP port (587 for STARTTLS, 465 for SSL) |
SMTP_USERNAME | - | SMTP username |
SMTP_PASSWORD | - | SMTP password |
SMTP_FROM | alerts@rustrak.local | Default sender address |
Dashboard URL
| Variable | Default | Description |
|---|---|---|
DASHBOARD_URL | http://localhost:3000 | URL for issue links in notifications |
Bootstrap
| Variable | Description |
|---|---|
CREATE_SUPERUSER | Create admin user on startup (email:password) |
CREATE_SUPERUSER="admin@example.com:secure-password"Only creates user if database is empty.
Dashboard (Next.js)
| Variable | Default | Description |
|---|---|---|
RUSTRAK_API_URL | http://localhost:8080 | Backend API URL |
Complete Example
SQLite (development / personal)
# .env file (SQLite — image tag: latest)
# Required
DATABASE_URL=sqlite:///data/rustrak.db
# Server
PORT=8080
RUST_LOG=info
# Dashboard
RUSTRAK_API_URL=http://localhost:8080PostgreSQL (production)
# .env file (PostgreSQL — image tag: postgres)
# Required
DATABASE_URL=postgres://rustrak:password@postgres:5432/rustrak
# Security (required for production behind HTTPS proxy)
SSL_PROXY=true
SESSION_SECRET_KEY=a1b2c3d4e5f67890a1b2c3d4e5f67890a1b2c3d4e5f67890a1b2c3d4e5f67890
# Server
PORT=8080
RUST_LOG=info
PUBLIC_URL=https://api.yourcompany.com
# Database Pool
DATABASE_MAX_CONNECTIONS=20
# Rate Limiting
MAX_EVENTS_PER_MINUTE=1000
MAX_EVENTS_PER_HOUR=10000
# Dashboard
RUSTRAK_API_URL=https://rustrak.yourcompany.com
DASHBOARD_URL=https://rustrak.yourcompany.com
# Email Alerts (optional - can also configure per-channel)
SMTP_HOST=smtp.yourcompany.com
SMTP_PORT=587
SMTP_USERNAME=alerts@yourcompany.com
SMTP_PASSWORD=your-smtp-password
SMTP_FROM=alerts@yourcompany.com