Bunqueue Environment Variables Reference
bunqueue can be configured through environment variables.
Server Configuration
Section titled “Server Configuration”TCP_PORT
Section titled “TCP_PORT”TCP server port for client connections.
| Type | Default | Example |
|---|---|---|
| number | 6789 | 6789 |
TCP_PORT=6789 bunqueue startHTTP_PORT
Section titled “HTTP_PORT”HTTP server port for REST API and metrics.
| Type | Default | Example |
|---|---|---|
| number | 6790 | 6790 |
HTTP_PORT=6790 bunqueue startHostname to bind servers to.
| Type | Default | Example |
|---|---|---|
| string | 0.0.0.0 | 127.0.0.1 |
# Bind to localhost onlyHOST=127.0.0.1 bunqueue start
# Bind to all interfaces (default)HOST=0.0.0.0 bunqueue startTCP_SOCKET_PATH
Section titled “TCP_SOCKET_PATH”Unix socket path for TCP server (alternative to TCP_PORT).
| Type | Default | Example |
|---|---|---|
| string | (none) | /var/run/bunqueue.sock |
TCP_SOCKET_PATH=/var/run/bunqueue.sock bunqueue startHTTP_SOCKET_PATH
Section titled “HTTP_SOCKET_PATH”Unix socket path for HTTP server (alternative to HTTP_PORT).
| Type | Default | Example |
|---|---|---|
| string | (none) | /var/run/bunqueue-http.sock |
HTTP_SOCKET_PATH=/var/run/bunqueue-http.sock bunqueue startDATA_PATH
Section titled “DATA_PATH”Path to SQLite database file.
| Type | Default | Example |
|---|---|---|
| string | in-memory | /var/lib/queue.db |
DATA_PATH=/var/lib/queue.db bunqueue startAUTH_TOKENS
Section titled “AUTH_TOKENS”Comma-separated list of authentication tokens.
| Type | Default | Example |
|---|---|---|
| string | (none) | token1,token2,token3 |
AUTH_TOKENS=secret-token-1,secret-token-2 bunqueue startWhen set, all TCP and HTTP requests must include a valid token:
# TCP clientbunqueue push emails '{"to":"test@example.com"}' --token secret-token-1
# HTTP APIcurl -H "Authorization: Bearer secret-token-1" http://localhost:6790/api/queuesBQ_TOKEN / BUNQUEUE_TOKEN
Section titled “BQ_TOKEN / BUNQUEUE_TOKEN”CLI auth token for client commands. Avoids repeating --token on every command.
| Variable | Type | Default |
|---|---|---|
BQ_TOKEN | string | (none) |
BUNQUEUE_TOKEN | string | (none) |
Priority: --token flag > BQ_TOKEN > BUNQUEUE_TOKEN.
export BQ_TOKEN=secret-token-1bunqueue stats # no --token neededbunqueue push emails '{}' # uses BQ_TOKEN automaticallyLogging
Section titled “Logging”LOG_LEVEL
Section titled “LOG_LEVEL”Minimum log level to output.
| Type | Default | Values |
|---|---|---|
| string | info | debug, info, warn, error |
LOG_LEVEL=debug bunqueue startLOG_FORMAT
Section titled “LOG_FORMAT”Log output format.
| Type | Default | Values |
|---|---|---|
| string | text | text, json |
LOG_FORMAT=json bunqueue startJSON format output:
{"level":"info","msg":"Server started","tcp":6789,"http":6790,"ts":"2024-01-15T10:30:00Z"}S3 Backup Configuration
Section titled “S3 Backup Configuration”S3_BACKUP_ENABLED
Section titled “S3_BACKUP_ENABLED”Enable automated S3 backups.
| Type | Default | Values |
|---|---|---|
| boolean | false | 0, 1, false, true |
S3_BACKUP_ENABLED=1 bunqueue startS3_ACCESS_KEY_ID
Section titled “S3_ACCESS_KEY_ID”S3 access key for authentication.
| Type | Default | Aliases |
|---|---|---|
| string | (none) | AWS_ACCESS_KEY_ID |
S3_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE bunqueue startS3_SECRET_ACCESS_KEY
Section titled “S3_SECRET_ACCESS_KEY”S3 secret key for authentication.
| Type | Default | Aliases |
|---|---|---|
| string | (none) | AWS_SECRET_ACCESS_KEY |
S3_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY bunqueue startS3_BUCKET
Section titled “S3_BUCKET”S3 bucket name for backups.
| Type | Default | Aliases |
|---|---|---|
| string | (none) | AWS_BUCKET |
S3_BUCKET=my-bunqueue-backups bunqueue startS3_REGION
Section titled “S3_REGION”AWS region for S3 bucket.
| Type | Default | Aliases |
|---|---|---|
| string | us-east-1 | AWS_REGION |
S3_REGION=eu-west-1 bunqueue startS3_ENDPOINT
Section titled “S3_ENDPOINT”Custom S3 endpoint for non-AWS providers.
| Type | Default | Example |
|---|---|---|
| string | (none) | https://account.r2.cloudflarestorage.com |
# Cloudflare R2S3_ENDPOINT=https://abc123.r2.cloudflarestorage.com bunqueue start
# MinIOS3_ENDPOINT=http://localhost:9000 bunqueue start
# DigitalOcean SpacesS3_ENDPOINT=https://nyc3.digitaloceanspaces.com bunqueue startS3_BACKUP_INTERVAL
Section titled “S3_BACKUP_INTERVAL”Interval between automated backups (milliseconds).
| Type | Default | Example |
|---|---|---|
| number | 21600000 (6 hours) | 3600000 (1 hour) |
S3_BACKUP_INTERVAL=3600000 bunqueue startS3_BACKUP_RETENTION
Section titled “S3_BACKUP_RETENTION”Number of backups to keep.
| Type | Default | Example |
|---|---|---|
| number | 7 | 30 |
S3_BACKUP_RETENTION=30 bunqueue startS3_BACKUP_PREFIX
Section titled “S3_BACKUP_PREFIX”Prefix for backup files in S3.
| Type | Default | Example |
|---|---|---|
| string | backups/ | bunqueue/prod/ |
S3_BACKUP_PREFIX=bunqueue/production/ bunqueue startTimeouts & Limits
Section titled “Timeouts & Limits”SHUTDOWN_TIMEOUT_MS
Section titled “SHUTDOWN_TIMEOUT_MS”Timeout for graceful shutdown in milliseconds.
| Type | Default | Example |
|---|---|---|
| number | 30000 | 60000 |
SHUTDOWN_TIMEOUT_MS=60000 bunqueue startSTATS_INTERVAL_MS
Section titled “STATS_INTERVAL_MS”Interval for stats logging in milliseconds.
| Type | Default | Example |
|---|---|---|
| number | 300000 (5 min) | 60000 |
STATS_INTERVAL_MS=60000 bunqueue startWORKER_TIMEOUT_MS
Section titled “WORKER_TIMEOUT_MS”Default timeout for job processing in milliseconds.
| Type | Default | Example |
|---|---|---|
| number | 30000 | 60000 |
WORKER_TIMEOUT_MS=60000 bunqueue startLOCK_TIMEOUT_MS
Section titled “LOCK_TIMEOUT_MS”Timeout for acquiring internal locks in milliseconds.
| Type | Default | Example |
|---|---|---|
| number | 5000 | 10000 |
LOCK_TIMEOUT_MS=10000 bunqueue startWORKER_CLEANUP_INTERVAL_MS
Section titled “WORKER_CLEANUP_INTERVAL_MS”Interval for cleaning up inactive worker registrations.
| Type | Default | Example |
|---|---|---|
| number | 60000 | 120000 |
WORKER_CLEANUP_INTERVAL_MS=120000 bunqueue startWebhooks
Section titled “Webhooks”WEBHOOK_MAX_RETRIES
Section titled “WEBHOOK_MAX_RETRIES”Maximum retry attempts for webhook deliveries.
| Type | Default | Example |
|---|---|---|
| number | 3 | 5 |
WEBHOOK_MAX_RETRIES=5 bunqueue startWEBHOOK_RETRY_DELAY_MS
Section titled “WEBHOOK_RETRY_DELAY_MS”Delay between webhook retry attempts in milliseconds.
| Type | Default | Example |
|---|---|---|
| number | 1000 | 5000 |
WEBHOOK_RETRY_DELAY_MS=5000 bunqueue startRate Limiting (Server)
Section titled “Rate Limiting (Server)”RATE_LIMIT_MAX_REQUESTS
Section titled “RATE_LIMIT_MAX_REQUESTS”Maximum TCP requests per client within the rate limit window. Disabled when not set.
| Type | Default | Example |
|---|---|---|
| number | (none) | 1000 |
RATE_LIMIT_MAX_REQUESTS=1000 bunqueue startRATE_LIMIT_WINDOW_MS
Section titled “RATE_LIMIT_WINDOW_MS”Time window for rate limiting in milliseconds.
| Type | Default | Example |
|---|---|---|
| number | 60000 | 30000 |
RATE_LIMIT_WINDOW_MS=30000 bunqueue startRATE_LIMIT_CLEANUP_MS
Section titled “RATE_LIMIT_CLEANUP_MS”Interval for cleaning up rate limit tracking data.
| Type | Default | Example |
|---|---|---|
| number | 60000 | 120000 |
RATE_LIMIT_CLEANUP_MS=120000 bunqueue startSecurity & Access
Section titled “Security & Access”METRICS_AUTH
Section titled “METRICS_AUTH”Require authentication for metrics endpoints.
| Type | Default | Values |
|---|---|---|
| boolean | false | true, false |
METRICS_AUTH=true bunqueue startCORS_ALLOW_ORIGIN
Section titled “CORS_ALLOW_ORIGIN”Comma-separated list of allowed CORS origins.
| Type | Default | Example |
|---|---|---|
| string | (none) | https://app.example.com |
CORS_ALLOW_ORIGIN=https://app.example.com,https://admin.example.com bunqueue startClient & CLI
Section titled “Client & CLI”BUNQUEUE_MODE
Section titled “BUNQUEUE_MODE”Connection mode for bunqueue client and MCP server.
| Type | Default | Values |
|---|---|---|
| string | embedded | embedded, tcp |
BUNQUEUE_MODE=tcp bun run worker.tsBUNQUEUE_HOST
Section titled “BUNQUEUE_HOST”Server host for TCP mode connections.
| Type | Default | Example |
|---|---|---|
| string | localhost | your-server.com |
BUNQUEUE_HOST=your-server.com bun run worker.tsBUNQUEUE_PORT
Section titled “BUNQUEUE_PORT”Server port for TCP mode connections.
| Type | Default | Example |
|---|---|---|
| number | 6789 | 7000 |
BUNQUEUE_PORT=7000 bun run worker.tsBUNQUEUE_EMBEDDED
Section titled “BUNQUEUE_EMBEDDED”Force embedded mode for client library.
| Type | Default | Values |
|---|---|---|
| string | (none) | 1 |
BUNQUEUE_EMBEDDED=1 bun run worker.tsSQLITE_PATH
Section titled “SQLITE_PATH”Legacy alias for DATA_PATH.
| Type | Default | Example |
|---|---|---|
| string | (none) | ./data/queue.db |
SQLITE_PATH=./data/queue.db bunqueue startNO_COLOR
Section titled “NO_COLOR”Disable colored output in CLI.
| Type | Default | Values |
|---|---|---|
| string | (none) | 1 |
NO_COLOR=1 bunqueue statsComplete Examples
Section titled “Complete Examples”Development
Section titled “Development”TCP_PORT=6789HTTP_PORT=6790DATA_PATH=./data/dev.dbLOG_LEVEL=debugLOG_FORMAT=textProduction
Section titled “Production”TCP_PORT=6789HTTP_PORT=6790DATA_PATH=/var/lib/production.dbLOG_LEVEL=infoLOG_FORMAT=jsonAUTH_TOKENS=prod-token-abc123,prod-token-xyz789
# S3 BackupS3_BACKUP_ENABLED=1S3_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLES3_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEYS3_BUCKET=company-bunqueue-backupsS3_REGION=us-east-1S3_BACKUP_INTERVAL=3600000S3_BACKUP_RETENTION=30S3_BACKUP_PREFIX=production/Docker Compose
Section titled “Docker Compose”version: '3.8'
services: bunqueue: image: bunqueue:latest ports: - "6789:6789" - "6790:6790" volumes: - bunqueue-data:/data environment: - TCP_PORT=6789 - HTTP_PORT=6790 - DATA_PATH=/data/queue.db - LOG_LEVEL=info - LOG_FORMAT=json - AUTH_TOKENS=${AUTH_TOKENS} - S3_BACKUP_ENABLED=1 - S3_ACCESS_KEY_ID=${S3_ACCESS_KEY_ID} - S3_SECRET_ACCESS_KEY=${S3_SECRET_ACCESS_KEY} - S3_BUCKET=${S3_BUCKET} - S3_REGION=${S3_REGION} - S3_BACKUP_INTERVAL=21600000 - S3_BACKUP_RETENTION=7
volumes: bunqueue-data:Kubernetes
Section titled “Kubernetes”apiVersion: v1kind: ConfigMapmetadata: name: bunqueue-configdata: TCP_PORT: "6789" HTTP_PORT: "6790" DATA_PATH: "/data/queue.db" LOG_LEVEL: "info" LOG_FORMAT: "json" S3_BACKUP_ENABLED: "1" S3_REGION: "us-east-1" S3_BACKUP_INTERVAL: "21600000" S3_BACKUP_RETENTION: "7" S3_BACKUP_PREFIX: "kubernetes/"
---apiVersion: v1kind: Secretmetadata: name: bunqueue-secretstype: OpaquestringData: AUTH_TOKENS: "your-production-token" S3_ACCESS_KEY_ID: "your-access-key" S3_SECRET_ACCESS_KEY: "your-secret-key" S3_BUCKET: "your-bucket"
---apiVersion: apps/v1kind: Deploymentmetadata: name: bunqueuespec: replicas: 1 selector: matchLabels: app: bunqueue template: metadata: labels: app: bunqueue spec: containers: - name: bunqueue image: bunqueue:latest ports: - containerPort: 6789 - containerPort: 6790 envFrom: - configMapRef: name: bunqueue-config - secretRef: name: bunqueue-secrets volumeMounts: - name: data mountPath: /data volumes: - name: data persistentVolumeClaim: claimName: bunqueue-pvcPrecedence
Section titled “Precedence”Environment variables take precedence in this order:
- Command-line arguments (highest)
- Environment variables
- Configuration file
- Default values (lowest)
# Command-line winsTCP_PORT=6789 bunqueue start --tcp-port 7000# Uses port 7000