Deployment
This guide covers deploying Beam in various environments, from simple single-machine setups to distributed production deployments. Beam's architecture is designed for resilience — most configurations require minimal setup.
Quick Start
For most users, Beam runs directly from npm with no additional deployment needed:
# Install globallynpm install -g @byronwade/beam# Run a tunnelbeam 3000
The CLI handles everything: spawning the tunnel daemon, connecting to Tor, and creating your hidden service. For personal development use, this is all you need.
Docker Deployment
For containerized environments, Beam provides Docker images that include all dependencies.
Basic Docker Run
1234567# Run Beam in a containerdocker run -d \--name beam \-p 3000:3000 \-v beam-data:/app/data \byronwade/beam:latest \beam 3000
The volume mount persists your .onion address between container restarts.
Docker Compose
For running Beam alongside your application:
12345678910111213141516171819# docker-compose.ymlversion: '3.8'services:app:build: .ports:- "3000:3000"beam:image: byronwade/beam:latestcommand: beam 3000 --target app:3000volumes:- beam-data:/app/datadepends_on:- appvolumes:beam-data:
The --target flag tells Beam to forward traffic to the app container instead of localhost.
Self-Hosting on a Server
Running Beam on a VPS or dedicated server gives you a persistent tunnel that stays up even when your local machine is off.
Prerequisites
- A Linux server (Ubuntu/Debian recommended)
- Node.js 18+ installed
- At least 512MB RAM
- Outbound network access (Beam doesn't require open inbound ports)
Installation
123456789# Install Node.js (if not already installed)curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -sudo apt-get install -y nodejs# Install Beamnpm install -g @byronwade/beam# Verify installationbeam --version
Running as a Systemd Service
Create a systemd service for automatic startup and restart:
123456789101112131415# /etc/systemd/system/beam.service[Unit]Description=Beam TunnelAfter=network.target[Service]Type=simpleUser=beamWorkingDirectory=/home/beamExecStart=/usr/bin/beam 3000Restart=alwaysRestartSec=10[Install]WantedBy=multi-user.target
123456789101112# Create a dedicated usersudo useradd -r -s /bin/false beamsudo mkdir -p /home/beamsudo chown beam:beam /home/beam# Enable and start the servicesudo systemctl daemon-reloadsudo systemctl enable beamsudo systemctl start beam# Check statussudo systemctl status beam
Kubernetes Deployment
For Kubernetes environments, deploy Beam as a sidecar or standalone pod.
Sidecar Pattern
Run Beam alongside your application pod:
12345678910111213141516171819202122232425262728293031apiVersion: apps/v1kind: Deploymentmetadata:name: myappspec:replicas: 1selector:matchLabels:app: myapptemplate:metadata:labels:app: myappspec:containers:- name: appimage: myapp:latestports:- containerPort: 3000- name: beamimage: byronwade/beam:latestcommand: ["beam", "3000", "--target", "localhost:3000"]volumeMounts:- name: beam-datamountPath: /app/datavolumes:- name: beam-datapersistentVolumeClaim:claimName: beam-pvc
Persistent Volume
To keep the same .onion address across pod restarts:
12345678910apiVersion: v1kind: PersistentVolumeClaimmetadata:name: beam-pvcspec:accessModes:- ReadWriteOnceresources:requests:storage: 100Mi
The persistent volume stores your hidden service keys, ensuring your .onion address remains stable.
Configuration
Beam can be configured via command-line flags or environment variables.
Environment Variables
1234567891011121314# Target portBEAM_PORT=3000# Target host (for forwarding to another service)BEAM_TARGET=localhost:3000# Data directory (where keys are stored)BEAM_DATA_DIR=/var/lib/beam# Enable verbose loggingBEAM_VERBOSE=true# Custom domain (for local DNS)BEAM_DOMAIN=myapp.local
Data Directory
By default, Beam stores data in ~/.beam/. This includes:
keys/— Hidden service private keys (keep these safe!)certs/— Generated TLS certificates for HTTPStor/— Tor data directory
Back up the keys/ directory if you need to preserve your .onion address when migrating to a new server.
Production Considerations
Resource Requirements
Beam is lightweight, but Tor circuit building and traffic forwarding do consume resources:
- Memory: ~100-200MB under normal load
- CPU: Minimal, mostly idle. Spikes during circuit building
- Disk: ~50MB for Tor data, plus your key storage
- Network: All traffic goes through Tor, so no inbound ports needed
Security
In production deployments:
- Run Beam as a non-root user
- Protect the
keys/directory — these are your hidden service private keys - Use firewall rules to restrict which services Beam can forward to
- Consider using read-only root filesystem in containers
Monitoring
Monitor your Beam deployment:
12345678# Check if the process is runningpgrep -f beam-tunnel-daemon# View logs (when running as systemd service)journalctl -u beam -f# Check Tor circuit status (verbose mode)beam 3000 --verbose
High Availability
Each Beam instance gets its own .onion address. For high availability, you can run multiple instances behind a load balancer on the regular network, then expose that load balancer through Beam. Alternatively, use DNS-based failover at the application level if your clients can handle multiple .onion addresses.
Deployment Troubleshooting
Container Networking Issues
If Beam can't reach your application in Docker:
123456789# Make sure containers are on the same networkdocker network lsdocker network inspect bridge# Use service names instead of localhostbeam 3000 --target myapp:3000# Or use host networking (less isolated)docker run --network host byronwade/beam:latest beam 3000
Tor Connection Fails in Container
Some container environments block Tor traffic or don't allow the embedded Tor client to function properly:
- Verify outbound network access from the container
- Check if your cloud provider blocks Tor exit nodes
- Try a different region if running in cloud infrastructure
Permission Denied
If you see permission errors:
# Make sure the data directory is writablechown -R beam:beam /var/lib/beam# In Docker, check volume permissionsdocker run -v beam-data:/app/data --user 1000:1000 ...
Related Documentation
- Getting Started — basic usage and first tunnel
- CLI Reference — all command-line options
- Architecture — how the components work together
- Troubleshooting — diagnose and fix common issues