-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvps-setup.sh
More file actions
executable file
·83 lines (67 loc) · 2.04 KB
/
vps-setup.sh
File metadata and controls
executable file
·83 lines (67 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/bash
# VPS Setup Script for MediaMTX with Tailscale
# Run this on your DigitalOcean/Linode VPS
echo "=== MediaMTX VPS Setup with Tailscale ==="
# Update system
echo "Updating system..."
apt update && apt upgrade -y
# Install Tailscale
echo "Installing Tailscale..."
curl -fsSL https://tailscale.com/install.sh | sh
# Connect to Tailscale (you'll need to authorize this)
echo "Connecting to Tailscale..."
tailscale up
echo "Go to the URL above to authorize this VPS"
echo "Press Enter when done..."
read
# Install MediaMTX
echo "Installing MediaMTX..."
wget https://github.com/bluenviron/mediamtx/releases/download/v1.14.0/mediamtx_v1.14.0_linux_amd64.tar.gz
tar -xzf mediamtx_v1.14.0_linux_amd64.tar.gz
# Create MediaMTX config with Tailscale IPs
cat > mediamtx.yml << 'EOF'
paths:
robot:
source: rtsp://admin:Password@100.126.251.43:554/cam/realmonitor?channel=1&subtype=0
table:
source: rtsp://admin:Password@100.126.251.43:554/cam/realmonitor?channel=1&subtype=0
ceiling:
source: rtsp://admin:Password@100.126.251.43:554/cam/realmonitor?channel=1&subtype=0
webrtc: yes
hls: yes
# Allow external connections
webrtcAddress: 0.0.0.0:8889
hlsAddress: 0.0.0.0:8888
EOF
# Create systemd service for MediaMTX
cat > /etc/systemd/system/mediamtx.service << 'EOF'
[Unit]
Description=MediaMTX
After=network.target
[Service]
Type=simple
User=root
WorkingDirectory=/root
ExecStart=/root/mediamtx /root/mediamtx.yml
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
EOF
# Enable and start service
systemctl enable mediamtx
systemctl start mediamtx
# Open firewall ports
ufw allow 8888
ufw allow 8889
ufw --force enable
echo "✅ MediaMTX VPS setup complete!"
echo "Your VPS Tailscale IP: $(tailscale ip -4)"
echo "Test MediaMTX: http://$(tailscale ip -4):8888"
echo ""
echo "🔧 Update Vercel environment variables:"
echo "MEDIAMTX_HTTP=https://$(curl -s ifconfig.me):8888"
echo "MEDIAMTX_WHEP=https://$(curl -s ifconfig.me):8889"
echo "ROBOT_CAM_IP=100.126.251.43"
echo "TABLE_CAM_IP=100.126.251.43"
echo "CEILING_CAM_IP=100.126.251.43"