Overview
livekitctl is a purpose-built CLI tool that automates the installation and configuration of a complete LiveKit media server stack for Fluxer’s real-time voice and video communication.livekitctl is designed for production deployments on Linux servers and handles TLS certificate provisioning, firewall configuration, and service orchestration automatically.
Stack Components
The tool deploys and configures:LiveKit
WebRTC Selective Forwarding Unit (SFU) for scalable voice and video
Caddy
Reverse proxy with automatic TLS certificate management (built with L4 module)
coturn
TURN/STUN server for NAT traversal and firewall penetration
KV Store
Redis-compatible key-value store for LiveKit state management
Installation
Install livekitctl on your Linux server:- Downloads the appropriate binary for your architecture
- Installs to
/usr/local/bin/livekitctl - Sets executable permissions
- Verifies installation with version check
Prerequisites
Root Access
Bootstrap requires root privileges for:
- systemd service installation
- Firewall configuration (optional)
- Binary installation to
/opt/livekit
Commands
bootstrap
Install and configure the complete LiveKit stack.Required Flags
Fully qualified domain name for LiveKit WebSocket/HTTP connections. Must have valid DNS A/AAAA records.
Fully qualified domain name for TURN relay server. Should be different from LiveKit domain.
Email address for ACME TLS certificate registration (Let’s Encrypt notifications).
Optional Flags
LiveKit server version to install. See LiveKit releases.
Caddy version to build with xcaddy.
Caddy Layer 4 module version for TCP/UDP proxying.
xcaddy build tool version.
Custom installation directory for LiveKit binaries.
Automatically configure detected firewall (ufw, firewalld, or iptables) to allow required ports.
Port for the KV store (Redis-compatible). Binds to localhost only.
Automatically select an available port from 6379-6382.
LiveKit webhook URL for room events. Can be specified multiple times.
File containing webhook URLs (one per line).
Allow insecure HTTP webhook URLs (not recommended for production).
Maximum seconds to wait for DNS propagation before failing.
Seconds between DNS propagation checks.
Print generated API keys and secrets as JSON to stdout after bootstrap.
status
Display systemd service status for all managed services.- Service name and unit file
- Active/inactive state
- Running/failed status
- Memory and CPU usage
- Recent log entries
logs
View systemd journal logs for a specific service.systemd unit name:
livekit-kv.service- KV storelivekit-coturn.service- TURN serverlivekit.service- LiveKit SFUcaddy.service- Reverse proxy
Number of log lines to display.
restart
Restart one or more services.Restart order is automatically determined based on service dependencies. The KV store starts first, followed by coturn, LiveKit, and finally Caddy.
webhook
Manage LiveKit webhook URLs for room events.Port Configuration
Default port allocations:| Port | Protocol | Service | Firewall |
|---|---|---|---|
| 7880 | TCP | LiveKit HTTP (internal, proxied by Caddy) | ❌ |
| 7881 | TCP | LiveKit RTC signaling | ✅ |
| 50000-60000 | UDP | LiveKit RTC media | ✅ |
| 3478 | UDP | TURN/STUN listen | ✅ |
| 40000-49999 | UDP | TURN relay ports | ✅ |
| 6379 | TCP | KV store (localhost only) | ❌ |
| 80 | TCP | Caddy HTTP (ACME challenge) | ✅ |
| 443 | TCP | Caddy HTTPS | ✅ |
State and Configuration Files
livekitctl stores state and configuration in/etc/livekit/:
Secrets File Format
Thesecrets.json file contains:
Global Flags
Path to state file. Use a custom path for multiple LiveKit deployments on the same server.
Troubleshooting
DNS propagation timeout
DNS propagation timeout
Problem: Bootstrap fails with “DNS records not found”Solution:
- Verify DNS records with
dig: - Increase timeout:
- Wait for global DNS propagation (can take hours)
Port already in use
Port already in use
Problem: “bind: address already in use”Solution:
- Check what’s using the port:
- Use auto port selection:
- Specify custom port:
TLS certificate failure
TLS certificate failure
Problem: Caddy fails to obtain TLS certificateSolution:
- Verify DNS points to server:
- Check firewall allows port 80:
- Review Caddy logs:
Service won't start
Service won't start
Problem: Service remains inactive after restartSolution:
- Check service status:
- View full logs:
- Verify configuration:
- Test binary manually:
Best Practices
Use Separate Domains
Keep LiveKit and TURN on different subdomains for better routing and debugging.✅
livekit.fluxer.app + turn.fluxer.app❌ livekit.fluxer.app for bothMonitor Webhooks
Configure webhooks to track room events, participant joins/leaves, and detect issues.
Regular Updates
Keep LiveKit and Caddy updated for security patches and performance improvements.
Backup Secrets
Store
/etc/livekit/secrets.json in a secure location (password manager, vault).Integration with Fluxer
After bootstrap, configure Fluxer to use your LiveKit server:config/config.json
- Accept WebRTC connections from Fluxer clients
- Send room events to configured webhook URLs
- Handle voice/video routing with automatic quality adaptation
- Provide TURN relay for clients behind restrictive NAT
See Also
- LiveKit Documentation
- Caddy Documentation
- coturn Configuration
- Monitoring - Track LiveKit metrics with SigNoz