Deployment
Deploy MikroRoom to various platforms and environments.
Pre-Deployment Checklist
Section titled “Pre-Deployment Checklist”Before deploying to production:
- Configure HTTPS/WSS
- Set up TURN server
- Update
mikroroom.config.jsonwith production URLs - Set strong TURN credentials
- Configure firewall rules
- Test from different networks
Deployment Methods
Section titled “Deployment Methods”Docker
Section titled “Docker”Note: Docker deployment requires building from source code. If you installed via the MikroRoom CLI (
mikroroom install), use the Linux Server (Systemd) method instead.
Basic Docker
Section titled “Basic Docker”For source code deployments:
# Clone the repositorygit clone https://github.com/mikaelvesavuori/mikroroom.gitcd mikroroom
# Build imagedocker build -t mikroroom .
# Run containerdocker run -d \ -p 3000:3000 \ --name mikroroom \ -e TURN_SERVER_URL=turn:turn.yourdomain.com:3478 \ -e TURN_SERVER_USERNAME=mikroroom \ -e TURN_SERVER_CREDENTIAL=your-password \ mikroroomLinux Server (Systemd)
Section titled “Linux Server (Systemd)”Recommended for: CLI installations and production deployments without Docker
Copy and edit the systemd service:
# Copy example service filesudo cp mikroroom.service.example /etc/systemd/system/mikroroom.service
# Edit paths and environmentsudo nano /etc/systemd/system/mikroroom.service
# Enable and startsudo systemctl daemon-reloadsudo systemctl enable mikroroomsudo systemctl start mikroroomsudo systemctl status mikroroomExample service file for CLI installation (mikroroom install):
[Unit]Description=MikroRoom ServerAfter=network.target
[Service]Type=simpleUser=mikroroomWorkingDirectory=/home/mikroroom/.mikroroomEnvironment="NODE_ENV=production"Environment="PORT=3000"Environment="TURN_SERVER_URL=turn:turn.yourdomain.com:3478"ExecStart=/usr/bin/node /home/mikroroom/.mikroroom/api/mikroroom.mjsRestart=on-failure
[Install]WantedBy=multi-user.targetExample service file for source code deployment:
[Unit]Description=MikroRoom ServerAfter=network.target
[Service]Type=simpleUser=mikroroomWorkingDirectory=/opt/mikroroomEnvironment="NODE_ENV=production"Environment="PORT=3000"Environment="TURN_SERVER_URL=turn:turn.yourdomain.com:3478"ExecStart=/usr/bin/node /opt/mikroroom/dist/api/mikroroom.mjsRestart=on-failure
[Install]WantedBy=multi-user.targetCloud Platforms
Section titled “Cloud Platforms”Heroku
Section titled “Heroku”# Create appheroku create your-app-name
# Set environment variablesheroku config:set NODE_ENV=productionheroku config:set TURN_SERVER_URL=turn:turn.yourdomain.com:3478heroku config:set TURN_SERVER_USERNAME=mikroroomheroku config:set TURN_SERVER_CREDENTIAL=your-password
# Deploygit push heroku mainFly.io
Section titled “Fly.io”# Install flyctlcurl -L https://fly.io/install.sh | sh
# Launch appfly launch
# Set secretsfly secrets set TURN_SERVER_URL=turn:turn.yourdomain.com:3478fly secrets set TURN_SERVER_USERNAME=mikroroomfly secrets set TURN_SERVER_CREDENTIAL=your-password
# Deployfly deployDigitalOcean App Platform
Section titled “DigitalOcean App Platform”- Connect your GitHub repository
- Configure build command:
npm run build - Configure run command:
npm start - Add environment variables in the dashboard
- Deploy!
Static Frontend Hosting
Section titled “Static Frontend Hosting”For separate frontend/backend deployment:
Cloudflare Pages
Section titled “Cloudflare Pages”npm run buildnpx wrangler pages deploy dist/app --project-name=mikroroomNetlify
Section titled “Netlify”npm run buildnpx netlify deploy --dir=dist/app --prodVercel
Section titled “Vercel”npm run buildnpx vercel --prod dist/appAWS S3 + CloudFront
Section titled “AWS S3 + CloudFront”# Build frontendnpm run build
# Upload to S3aws s3 sync dist/app/ s3://your-bucket-name/ --delete
# Invalidate CloudFront cacheaws cloudfront create-invalidation --distribution-id YOUR_ID --paths "/*"Reverse Proxy Setup
Section titled “Reverse Proxy Setup”Caddy auto-handles HTTPS:
yourdomain.com { # Serve static files root * /var/www/mikroroom file_server
# WebSocket proxy @websocket { path /ws } reverse_proxy @websocket localhost:3000
# API proxy reverse_proxy /api/* localhost:3000}Reload:
sudo systemctl reload caddyFull example with HTTPS:
# HTTP -> HTTPS redirectserver { listen 80; server_name yourdomain.com; return 301 https://$server_name$request_uri;}
# HTTPS serverserver { listen 443 ssl http2; server_name yourdomain.com;
# SSL certificates ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem; ssl_protocols TLSv1.2 TLSv1.3;
# WebSocket upgrade location /ws { proxy_pass http://localhost:3000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; }
# API endpoints location /api/ { proxy_pass http://localhost:3000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; }
# Static files (if serving frontend from Nginx) location / { root /var/www/mikroroom; try_files $uri $uri/ /index.html; }}Enable and reload:
sudo ln -s /etc/nginx/sites-available/mikroroom /etc/nginx/sites-enabled/sudo nginx -tsudo systemctl reload nginxMonitoring & Logs
Section titled “Monitoring & Logs”Health Checks
Section titled “Health Checks”MikroRoom exposes a health endpoint:
curl https://yourdomain.com/healthReturns:
{ "status": "ok", "totalRooms": 5, "totalParticipants": 12, "peakParticipants": 24, "uptime": 3600000, "version": "1.0.0"}Logging
Section titled “Logging”Systemd Logs
Section titled “Systemd Logs”# Follow logssudo journalctl -u mikroroom -f
# Last 100 linessudo journalctl -u mikroroom -n 100
# Logs since bootsudo journalctl -u mikroroom -bDocker Logs
Section titled “Docker Logs”# Follow logsdocker logs -f mikroroom
# Last 100 linesdocker logs --tail 100 mikroroomSecurity Hardening
Section titled “Security Hardening”Firewall Configuration
Section titled “Firewall Configuration”# Allow SSHsudo ufw allow 22/tcp
# Allow HTTP/HTTPSsudo ufw allow 80/tcpsudo ufw allow 443/tcp
# Allow TURN (if running Coturn)sudo ufw allow 3478/tcpsudo ufw allow 3478/udpsudo ufw allow 49152:65535/udp
# Enable firewallsudo ufw enableRate Limiting
Section titled “Rate Limiting”MikroRoom includes built-in rate limiting:
- 10 WebSocket connections per minute per IP
- 10 room creation requests per minute per IP
For additional protection, use Nginx rate limiting or Cloudflare.
Troubleshooting
Section titled “Troubleshooting”WebSocket Connection Fails
Section titled “WebSocket Connection Fails”- Verify
apiUrlmatches deployment protocol (ws/wss) - Check reverse proxy WebSocket headers
- Ensure firewall allows WebSocket traffic
Camera/Microphone Blocked
Section titled “Camera/Microphone Blocked”- HTTPS is required for camera/microphone access
- Check browser permissions
- Verify SSL certificate is valid
Users Can’t Connect
Section titled “Users Can’t Connect”- Add TURN server configuration
- Test TURN with Trickle ICE
- Verify firewall allows TURN ports
Next Steps
Section titled “Next Steps”- CLI & Server Options - Full configuration reference
- API Reference - HTTP and WebSocket API