Server Mode
Run bunqueue as a standalone server with HTTP and TCP APIs.
Starting the Server
# Default ports (TCP: 6789, HTTP: 6790)bunqueue
# With custom configurationbunqueue start \ --tcp-port 6789 \ --http-port 6790 \ --data-path ./data/queue.db
# With authenticationAUTH_TOKENS=secret1,secret2 bunqueueEnvironment Variables
| Variable | Default | Description |
|---|---|---|
TCP_PORT | 6789 | TCP server port |
HTTP_PORT | 6790 | HTTP server port |
HOST | 0.0.0.0 | Server hostname |
DATA_PATH | (memory) | SQLite database path |
AUTH_TOKENS | (none) | Comma-separated auth tokens |
CORS_ALLOW_ORIGIN | * | CORS allowed origins |
LOG_FORMAT | text | Log format (text/json) |
Docker
FROM oven/bun:latestWORKDIR /appCOPY package.json bun.lockb ./RUN bun install --productionCOPY . .EXPOSE 6789 6790CMD ["bun", "run", "src/main.ts"]docker build -t bunqueue .docker run -p 6789:6789 -p 6790:6790 \ -v ./data:/app/data \ -e DATA_PATH=/app/data/queue.db \ bunqueueGraceful Shutdown
The server handles SIGINT and SIGTERM:
- Stops accepting new connections
- Waits for active jobs to complete (30s timeout)
- Flushes data to disk
- Exits cleanly