Deployment
This page covers best practices and recommendations for deploying your Base Worker in production environments.
Reverse Proxy & HTTPS
Never expose your Worker directly to the public internet.
- Use a reverse proxy (Nginx, Traefik, Caddy, Apache) to:
- Terminate SSL/TLS (HTTPS)
- Forward requests securely to your Worker
Example Nginx config:
server {
listen 443 ssl;
server_name your-worker.example.com;
ssl_certificate /etc/ssl/certs/your-cert.pem;
ssl_certificate_key /etc/ssl/private/your-key.pem;
location / {
proxy_pass http://localhost:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Authorization $http_authorization;
proxy_read_timeout 310s;
proxy_buffering off;
client_max_body_size 10m;
}
}
Docker as a Service
The supplied Docker image builds on node:24.22.1-bookworm and runs on node:24.22.1-bookworm-slim. The application runs as the non-root node user and cannot modify its own files, including dist: write any runtime data to a mounted volume or a temporary directory.
In production, we recommend using Docker and configuring it as a service. Here's how to configure your Worker container as a service with systemd (compatible with Debian, Ubuntu, Fedora, CentOS 7+, RHEL 7+, Rocky, AlmaLinux, Arch Linux, etc.).
-
Stop the Docker container if it was launched.
-
Create a service:
touch /etc/systemd/system/andera-worker.service -
Complete it with your service configuration:
[Unit]Description=Andera WorkerRequires=docker.serviceAfter=docker.service[Service]Type=oneshotWorkingDirectory=/var/www/andera-workerExecStart=/usr/bin/docker compose up -dExecStop=/usr/bin/docker compose downRemainAfterExit=yes[Install]WantedBy=multi-user.target -
Activate the service:
sudo systemctl daemon-reexecsudo systemctl enable andera-workersudo systemctl start andera-worker
Authentication and Secure Communication
- REST task and maintenance endpoints require
AUTH_KEY; MCP requires the separateMCP_AUTH_KEY. Health has a minimal public response, while detailed health and logs accept eitherAuthorization: <AUTH_KEY>orx-lb-auth: <LB_AUTH_KEY>. OpenAPI pages (/docsand/openapi) are unauthenticated whenOPENAPI_ENABLED=true; keep them disabled in production or restrict access to them. - When the Load Balancer communicates with a Worker (for
/task), it provides:Authorization: <AUTH_KEY>(the Worker's AUTH_KEY)x-lb-auth: <LB_AUTH_KEY>(the Load Balancer's LB_AUTH_KEY)
LB_AUTH_KEYmust be identical on the Load Balancer and every Worker. The Load Balancer discovers Workers through authenticated/healthand the WebSocket connection; with a different key it never discovers the Worker. Use a hexadecimal value, for exampleopenssl rand -hex 32.- For direct client calls to
/task, onlyAuthorization: <AUTH_KEY>(the Worker's AUTH_KEY) is required. - Sensitive endpoints like
/logsand authenticated/health(which displays more information than the unauthenticated public version) require valid authentication headers. - The Load Balancer connects to the Worker WebSocket port:
ws://for an HTTP Worker URL,wss://for HTTPS. Worker Core itself serves plain WebSockets, so HTTPS deployments must also terminate TLS for the advertised WebSocket port. Publishing only the HTTP port is insufficient for cross-host WebSocket access.
Secrets
- Never commit secrets to git.
- Use environment variables for all sensitive config (keys, passwords, etc.).
- Rotate keys regularly.
- Do not put secrets in
WEBHOOK_HEADERSthat API callers must not learn: these headers are sent to whatever webhook URL an authenticated caller supplies.
Network Security
- Restrict access to Worker ports using firewalls or security groups.
- Only allow trusted sources (Load Balancer, internal services) to connect.
- The supplied
docker-compose.ymlpublishes the API port on127.0.0.1only, for a reverse proxy on the same host. A Load Balancer on theandera-netDocker network reaches the Worker by its service name (http://andera-base-worker:3000) and its WebSocket port directly. - Webhook destinations are chosen by authenticated callers and are not filtered; restrict outbound network access when callers are not fully trusted.
Checklist for Production
- Use HTTPS via a reverse proxy
- Set strong, distinct
AUTH_KEYandLB_AUTH_KEY, withLB_AUTH_KEYidentical to the Load Balancer's - Keep
OPENAPI_ENABLED=falseunless the documentation pages are restricted - Use environment variables for secrets
- Monitor logs and health endpoints
- Restrict network access
- Regularly update dependencies and images
Tip: For cloud deployments, use managed SSL, secrets managers, and autoscaling as provided by your platform.
Enable MCP in Docker
Use the optional docker-compose.mcp.yml override. It loads MCP_AUTH_KEY and mounts a configuration directory read-only. See MCP Docker setup. Expose /mcp over HTTPS and forward its Authorization header.