TgoRTC Deployment
This document describes how to deploy the TgoRTC master server with one click.
Architecture Overview
The TgoRTC master server includes a complete service stack:
┌─────────────────────────────────────────────────────────────┐
│ Master Server │
│ TgoRTC Server + MySQL + Redis + LiveKit + Nginx │
└─────────────────────────────────────────────────────────────┘
System Requirements
- Operating System: Linux (Ubuntu 20.04+ recommended)
- Docker 20.10+
- Docker Compose 2.0+
- Server Configuration: Minimum 2 cores, 4GB RAM
One-Click Deployment
# China servers (recommended, uses mirror acceleration)
curl -fsSL https://gitee.com/No8blackball/tgo-rtcserver/raw/main/scripts/deploy.sh | sudo bash -s -- --cn
# Overseas servers
curl -fsSL https://raw.githubusercontent.com/TgoRTC/TgoRTCServer/main/scripts/deploy.sh | sudo bash
After Deployment
After deployment, the configuration will be automatically generated and the service will start. Please record the following key information (needed for LiveKit node configuration):
# View generated configuration
cat ~/tgortc/.env
Information to record:
REDIS_PASSWORD- Redis passwordLIVEKIT_API_KEY- LiveKit API KeyLIVEKIT_API_SECRET- LiveKit API Secret
Service Management
cd ~/tgortc
# Check service status
sudo docker compose ps
# View logs
sudo docker compose logs -f
# Configure firewall
./deploy.sh firewall
# Update service
./deploy.sh update
# View version info
./deploy.sh version
Access URLs
| Service | URL |
|---|---|
| TgoRTC API | http://<SERVER_IP>:8080 |
| API Docs | http://<SERVER_IP>:8080/swagger/index.html |
| LiveKit | ws://<SERVER_IP>:80 |
| Database Admin | http://<SERVER_IP>:8081 |
Port Reference
| Port | Protocol | Purpose | Access Scope |
|---|---|---|---|
| 80 | TCP | Nginx load balancer (LiveKit entry) | Public |
| 8080 | TCP | TgoRTC API | Public |
| 8081 | TCP | Adminer database admin | Internal only |
| 3307 | TCP | MySQL | Internal only |
| 6380 | TCP | Redis | LiveKit nodes |
| 7880 | TCP | LiveKit HTTP | Public |
| 7881 | TCP | LiveKit RTC TCP | Public |
| 3478 | UDP | TURN UDP | Public |
| 5349 | TCP | TURN TLS | Public |
| 50000-50100 | UDP | WebRTC media | Public |
Common Commands
cd ~/tgortc
# Check status
./deploy.sh status
# View logs
sudo docker compose logs -f
# Update services (interactive menu: quick update / full update / specific version)
./deploy.sh update
# Rollback to previous version
./deploy.sh rollback
# Configure firewall
./deploy.sh firewall
# Reload Nginx (after adding nodes)
./deploy.sh reload-nginx
# Restart services
sudo docker compose restart
# Stop services
sudo docker compose down
# Clean all data (dangerous!)
./deploy.sh clean
Configuration Files
.env File
# MySQL configuration
DB_USER=root
DB_PASSWORD=<auto-generated>
DB_NAME=tgo_rtc
# Redis configuration
REDIS_PASSWORD=<auto-generated>
# LiveKit configuration
LIVEKIT_API_KEY=<auto-generated>
LIVEKIT_API_SECRET=<auto-generated>
# Docker image (modify for custom development)
DOCKER_IMAGE=your-registry.com/your-namespace/tgortc:latest
# LiveKit cluster nodes (configure after adding nodes)
LIVEKIT_NODES=192.168.1.101:7880,192.168.1.102:7880
# Business Webhook (optional)
BUSINESS_WEBHOOK_ENDPOINTS='[{"url":"https://your-api.com/webhook","secret":"xxx"}]'
FAQ
Q1: Docker image pull failed?
# Use --cn parameter to enable China mirror acceleration
curl -fsSL ... | sudo bash -s -- --cn
Q2: Port already in use?
# Check port usage
lsof -i :80
lsof -i :8080
# Stop the process or modify the port
Q3: Database connection failed?
# May be residual old data, clean and redeploy
./deploy.sh clean
./deploy.sh
Q4: How to view generated passwords?
cat ~/tgortc/.env | grep PASSWORD
cat ~/tgortc/.env | grep SECRET