Configuration
Configure your self-hosted Brainz Lab instance.Environment Variables
Required (per service)
| Variable | Description |
|---|---|
SECRET_KEY_BASE | Rails secret key (generate with openssl rand -hex 64) |
RAILS_MASTER_KEY | Rails master key for credentials |
DATABASE_URL | PostgreSQL connection string |
REDIS_URL | Redis connection string |
Optional
| Variable | Default | Description |
|---|---|---|
RAILS_ENV | production | Rails environment |
RAILS_LOG_LEVEL | info | Log level |
WEB_CONCURRENCY | 2 | Puma workers |
RAILS_MAX_THREADS | 5 | Threads per worker |
Traefik Configuration
Traefik provides subdomain-based routing for all services.Access Methods
| Service | Traefik Subdomain | Direct Port |
|---|---|---|
| Recall | recall.localhost | localhost:3001 |
| Reflex | reflex.localhost | localhost:3002 |
| Pulse | pulse.localhost | localhost:3003 |
| Traefik Dashboard | - | localhost:8080 |
Local Development
Add to/etc/hosts:
Production Domains
Updatetraefik/routes.yml for your domain:
Enable HTTPS
Add totraefik/traefik.yml:
Service Configuration
Recall (Logging)
| Variable | Default | Description |
|---|---|---|
RECALL_INGEST_KEY | - | API key for log ingestion |
RECALL_BUFFER_SIZE | 100 | Logs to buffer before flush |
RECALL_FLUSH_INTERVAL | 5 | Seconds between flushes |
Reflex (Errors)
| Variable | Default | Description |
|---|---|---|
REFLEX_INGEST_KEY | - | API key for error capture |
REFLEX_MAX_BREADCRUMBS | 100 | Breadcrumbs per error |
Pulse (APM)
| Variable | Default | Description |
|---|---|---|
PULSE_INGEST_KEY | - | API key for trace ingestion |
PULSE_SAMPLE_RATE | 1.0 | Trace sampling rate (0.0-1.0) |
Email Configuration
| Variable | Description |
|---|---|
SMTP_ADDRESS | SMTP server address |
SMTP_PORT | SMTP port (default: 587) |
SMTP_USERNAME | SMTP username |
SMTP_PASSWORD | SMTP password |
SMTP_FROM | From email address |
Retention Settings
| Variable | Default | Description |
|---|---|---|
LOG_RETENTION_DAYS | 30 | Days to keep logs |
ERROR_RETENTION_DAYS | 90 | Days to keep errors |
TRACE_RETENTION_DAYS | 14 | Days to keep traces |
Rate Limiting
| Variable | Default | Description |
|---|---|---|
RATE_LIMIT_ENABLED | true | Enable rate limiting |
RATE_LIMIT_REQUESTS | 1000 | Requests per minute |
RATE_LIMIT_BURST | 100 | Burst limit |
Example .env File
The setup script generates this automatically:Client SDK Configuration
Configure your Rails app to connect to your self-hosted instance:config/initializers/brainzlab.rb