Environment Variables
bunqueue can be configured through environment variables.
Server Configuration
TCP_PORT
TCP server port for client connections.
| Type | Default | Example |
|---|---|---|
| number | 6789 | 6789 |
TCP_PORT=6789 bunqueue startHTTP_PORT
HTTP server port for REST API and metrics.
| Type | Default | Example |
|---|---|---|
| number | 6790 | 6790 |
HTTP_PORT=6790 bunqueue startHOST
Hostname 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
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
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
Path to SQLite database file.
| Type | Default | Example |
|---|---|---|
| string | ./data/bunq.db | /var/lib/queue.db |
DATA_PATH=/var/lib/queue.db bunqueue startAUTH_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/queuesLogging
LOG_LEVEL
Minimum log level to output.
| Type | Default | Values |
|---|---|---|
| string | info | debug, info, warn, error |
LOG_LEVEL=debug bunqueue startLOG_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
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
S3 access key for authentication.
| Type | Default | Aliases |
|---|---|---|
| string | (none) | AWS_ACCESS_KEY_ID |
S3_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE bunqueue startS3_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
S3 bucket name for backups.
| Type | Default | Aliases |
|---|---|---|
| string | (none) | AWS_BUCKET |
S3_BUCKET=my-bunqueue-backups bunqueue startS3_REGION
AWS region for S3 bucket.
| Type | Default | Aliases |
|---|---|---|
| string | us-east-1 | AWS_REGION |
S3_REGION=eu-west-1 bunqueue startS3_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
Interval between automated backups (milliseconds).
| Type | Default | Example |
|---|---|---|
| number | 21600000 (6 hours) | 3600000 (1 hour) |
S3_BACKUP_INTERVAL=3600000 bunqueue startS3_BACKUP_RETENTION
Number of backups to keep.
| Type | Default | Example |
|---|---|---|
| number | 7 | 30 |
S3_BACKUP_RETENTION=30 bunqueue startS3_BACKUP_PREFIX
Prefix for backup files in S3.
| Type | Default | Example |
|---|---|---|
| string | backups/ | bunqueue/prod/ |
S3_BACKUP_PREFIX=bunqueue/production/ bunqueue startTimeouts & Limits
SHUTDOWN_TIMEOUT_MS
Timeout for graceful shutdown in milliseconds.
| Type | Default | Example |
|---|---|---|
| number | 30000 | 60000 |
SHUTDOWN_TIMEOUT_MS=60000 bunqueue startSTATS_INTERVAL_MS
Interval for stats logging in milliseconds.
| Type | Default | Example |
|---|---|---|
| number | 300000 (5 min) | 60000 |
STATS_INTERVAL_MS=60000 bunqueue startWORKER_TIMEOUT_MS
Default timeout for job processing in milliseconds.
| Type | Default | Example |
|---|---|---|
| number | 30000 | 60000 |
WORKER_TIMEOUT_MS=60000 bunqueue startLOCK_TIMEOUT_MS
Timeout for acquiring internal locks in milliseconds.
| Type | Default | Example |
|---|---|---|
| number | 5000 | 10000 |
LOCK_TIMEOUT_MS=10000 bunqueue startWORKER_CLEANUP_INTERVAL_MS
Interval for cleaning up inactive worker registrations.
| Type | Default | Example |
|---|---|---|
| number | 60000 | 120000 |
WORKER_CLEANUP_INTERVAL_MS=120000 bunqueue startWebhooks
WEBHOOK_MAX_RETRIES
Maximum retry attempts for webhook deliveries.
| Type | Default | Example |
|---|---|---|
| number | 3 | 5 |
WEBHOOK_MAX_RETRIES=5 bunqueue startWEBHOOK_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)
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
Time window for rate limiting in milliseconds.
| Type | Default | Example |
|---|---|---|
| number | 60000 | 30000 |
RATE_LIMIT_WINDOW_MS=30000 bunqueue startRATE_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
METRICS_AUTH
Require authentication for metrics endpoints.
| Type | Default | Values |
|---|---|---|
| boolean | false | true, false |
METRICS_AUTH=true bunqueue startCORS_ALLOW_ORIGIN
Comma-separated list of allowed CORS origins.
| Type | Default | Example |
|---|---|---|
| string | * | https://app.example.com |
CORS_ALLOW_ORIGIN=https://app.example.com,https://admin.example.com bunqueue startClient & CLI
BUNQUEUE_EMBEDDED
Force embedded mode for client library.
| Type | Default | Values |
|---|---|---|
| string | (none) | 1 |
BUNQUEUE_EMBEDDED=1 bun run worker.tsSQLITE_PATH
Legacy alias for DATA_PATH.
| Type | Default | Example |
|---|---|---|
| string | (none) | ./data/queue.db |
SQLITE_PATH=./data/queue.db bunqueue startNO_COLOR
Disable colored output in CLI.
| Type | Default | Values |
|---|---|---|
| string | (none) | 1 |
NO_COLOR=1 bunqueue statsComplete Examples
Development
TCP_PORT=6789HTTP_PORT=6790DATA_PATH=./data/dev.dbLOG_LEVEL=debugLOG_FORMAT=textProduction
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
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
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
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