Overview
This guide covers deploying Miku Miku Beam in production environments, including binary deployment, systemd services, reverse proxies, and security considerations.Prerequisites
Go 1.21+
Node.js 18+
npm
Make
Building for Production
Clone the repository
Install dependencies
go mod tidy- Downloads Go dependenciescd web-client && npm install- Installs Node.js dependencies
Build all components
bin/mmb-server- Web server binarybin/mmb-cli- CLI tool binarybin/web-client/- Built React frontend assets
Create required configuration files
Binary Deployment
Directory Structure
Recommended production directory structure:Installation Steps
Create application directory
Copy built files
Set proper permissions
Create configuration (optional)
Systemd Service
Create a systemd service for automatic startup and management.Create service file
Create service user
Create log directory
Enable and start service
Verify service status
Reverse Proxy Setup
Nginx Configuration
Recommended setup for production with SSL/TLS:Apache Configuration
Alternative configuration for Apache2:Environment Configuration
Configuration File (config.toml)
Environment Variables
json for structured JSON logging in production. Console format is human-readable with colors.true to allow running attacks without proxies. Required if data/proxies.txt is empty or missing.Port Configuration
The server listens on port 3000 by default (configurable viaconfig.toml):
Security Considerations
Use a reverse proxy
Use a reverse proxy
- SSL/TLS termination
- Rate limiting
- DDoS protection
- Better logging and monitoring
Restrict file permissions
Restrict file permissions
Configure CORS properly
Configure CORS properly
allowed_origin in config.toml to match your production domain:Use systemd security features
Use systemd security features
NoNewPrivileges=true- Prevents privilege escalationPrivateTmp=true- Isolated /tmp directoryProtectSystem=strict- Read-only system directoriesProtectHome=true- No access to home directories
Implement authentication
Implement authentication
Monitoring and Logging
Log Management
Log Rotation
Create a logrotate configuration:Performance Tuning
System Limits
Increase file descriptor limits for high-concurrency attacks:Go Runtime Settings
Control Go runtime behavior via environment variables:Upgrading
Stop the service
Backup configuration
Build new version
Deploy new binaries
Restart service
Troubleshooting
Service fails to start
Service fails to start
- Port 3000 already in use
- Missing data files (proxies.txt, uas.txt)
- Incorrect file permissions
- Invalid configuration
Web client not loading
Web client not loading
make all and ensure the web-client build completes successfully.No proxies available error
No proxies available error
- Add valid proxies to the file
- Set
ALLOW_NO_PROXY=truein systemd service - Use
--no-proxyflag with CLI
Socket.IO connection fails
Socket.IO connection fails
proxy_set_header Upgrade and Connection "upgrade"Apache: Enable proxy_wstunnel module and configure RewriteRule for WebSocket upgradeHigh memory usage
High memory usage