feat(deploy): add LiveKit and Caddy configuration files, init script, and Docker Compose setup for server deployment
This commit is contained in:
parent
08aca81ab1
commit
2a242b35f2
38
livekit-server.bfzqqk.easypanel.host/caddy.yaml
Normal file
38
livekit-server.bfzqqk.easypanel.host/caddy.yaml
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
logging:
|
||||||
|
logs:
|
||||||
|
default:
|
||||||
|
level: INFO
|
||||||
|
storage:
|
||||||
|
"module": "file_system"
|
||||||
|
"root": "/data"
|
||||||
|
apps:
|
||||||
|
tls:
|
||||||
|
certificates:
|
||||||
|
automate:
|
||||||
|
- livekit-server.bfzqqk.easypanel.host
|
||||||
|
- nextream.sytes.net
|
||||||
|
layer4:
|
||||||
|
servers:
|
||||||
|
main:
|
||||||
|
listen: [":443"]
|
||||||
|
routes:
|
||||||
|
- match:
|
||||||
|
- tls:
|
||||||
|
sni:
|
||||||
|
- "nextream.sytes.net"
|
||||||
|
handle:
|
||||||
|
- handler: tls
|
||||||
|
- handler: proxy
|
||||||
|
upstreams:
|
||||||
|
- dial: ["localhost:5349"]
|
||||||
|
- match:
|
||||||
|
- tls:
|
||||||
|
sni:
|
||||||
|
- "livekit-server.bfzqqk.easypanel.host"
|
||||||
|
handle:
|
||||||
|
- handler: tls
|
||||||
|
connection_policies:
|
||||||
|
- alpn: ["http/1.1"]
|
||||||
|
- handler: proxy
|
||||||
|
upstreams:
|
||||||
|
- dial: ["localhost:7880"]
|
||||||
18
livekit-server.bfzqqk.easypanel.host/docker-compose.yaml
Normal file
18
livekit-server.bfzqqk.easypanel.host/docker-compose.yaml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
version: '3.9'
|
||||||
|
services:
|
||||||
|
livekit:
|
||||||
|
image: livekit/livekit-server:latest
|
||||||
|
container_name: livekit-server
|
||||||
|
restart: always
|
||||||
|
volumes:
|
||||||
|
# Monta tu archivo de configuración
|
||||||
|
- ./livekit.yaml:/etc/livekit/livekit.yaml
|
||||||
|
command:
|
||||||
|
# Asegura que LiveKit use el archivo de configuración montado
|
||||||
|
- --config
|
||||||
|
- /etc/livekit/livekit.yaml
|
||||||
|
ports:
|
||||||
|
# Mapeo del puerto TCP para la señalización (Proxy <-- Docker)
|
||||||
|
- "7880:7880"
|
||||||
|
# Mapeo del rango de puertos UDP para el tráfico de medios (¡CRUCIAL!)
|
||||||
|
- "40000-40200:40000-40200/udp"
|
||||||
18
livekit-server.bfzqqk.easypanel.host/docker-compose.yaml_bak
Normal file
18
livekit-server.bfzqqk.easypanel.host/docker-compose.yaml_bak
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# This docker-compose requires host networking, which is only available on Linux
|
||||||
|
# This compose will not function correctly on Mac or Windows
|
||||||
|
services:
|
||||||
|
# caddy:
|
||||||
|
# image: livekit/caddyl4
|
||||||
|
# command: run --config /etc/caddy.yaml --adapter yaml
|
||||||
|
# restart: unless-stopped
|
||||||
|
# network_mode: "host"
|
||||||
|
# volumes:
|
||||||
|
# - ./caddy.yaml:/etc/caddy.yaml
|
||||||
|
# - ./caddy_data:/data
|
||||||
|
livekit:
|
||||||
|
image: livekit/livekit-server:latest
|
||||||
|
command: --config /etc/livekit.yaml
|
||||||
|
restart: unless-stopped
|
||||||
|
network_mode: "host"
|
||||||
|
volumes:
|
||||||
|
- ./livekit.yaml:/etc/livekit.yaml
|
||||||
156
livekit-server.bfzqqk.easypanel.host/init_script.sh
Normal file
156
livekit-server.bfzqqk.easypanel.host/init_script.sh
Normal file
@ -0,0 +1,156 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# This script will write all of your configurations to /opt/livekit.
|
||||||
|
# It'll also install LiveKit as a systemd service that will run at startup
|
||||||
|
# LiveKit will be started automatically at machine startup.
|
||||||
|
|
||||||
|
# create directories for LiveKit
|
||||||
|
mkdir -p /opt/livekit/caddy_data
|
||||||
|
mkdir -p /usr/local/bin
|
||||||
|
|
||||||
|
# Docker & Docker Compose will need to be installed on the machine
|
||||||
|
curl -fsSL https://get.docker.com -o /tmp/get-docker.sh
|
||||||
|
sh /tmp/get-docker.sh
|
||||||
|
curl -L "https://github.com/docker/compose/releases/download/v2.20.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
|
||||||
|
chmod 755 /usr/local/bin/docker-compose
|
||||||
|
|
||||||
|
sudo systemctl enable docker
|
||||||
|
|
||||||
|
# livekit config
|
||||||
|
cat << EOF > /opt/livekit/livekit.yaml
|
||||||
|
port: 7880
|
||||||
|
bind_addresses:
|
||||||
|
- ""
|
||||||
|
rtc:
|
||||||
|
tcp_port: 7881
|
||||||
|
port_range_start: 50000
|
||||||
|
port_range_end: 60000
|
||||||
|
use_external_ip: true
|
||||||
|
enable_loopback_candidate: false
|
||||||
|
redis:
|
||||||
|
address: <redis-host>:6379
|
||||||
|
username: ""
|
||||||
|
password: ""
|
||||||
|
db: 0
|
||||||
|
use_tls: false
|
||||||
|
sentinel_master_name: ""
|
||||||
|
sentinel_username: ""
|
||||||
|
sentinel_password: ""
|
||||||
|
sentinel_addresses: []
|
||||||
|
cluster_addresses: []
|
||||||
|
max_redirects: null
|
||||||
|
turn:
|
||||||
|
enabled: true
|
||||||
|
domain: nextream.sytes.net
|
||||||
|
tls_port: 5349
|
||||||
|
udp_port: 3478
|
||||||
|
external_tls: true
|
||||||
|
keys:
|
||||||
|
APIBTqTGxf9htMK: 0dOHWPffwneaPg7OYpe4PeAes21zLJfeYJB9cKzSTtXW
|
||||||
|
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# caddy config
|
||||||
|
cat << EOF > /opt/livekit/caddy.yaml
|
||||||
|
logging:
|
||||||
|
logs:
|
||||||
|
default:
|
||||||
|
level: INFO
|
||||||
|
storage:
|
||||||
|
"module": "file_system"
|
||||||
|
"root": "/data"
|
||||||
|
apps:
|
||||||
|
tls:
|
||||||
|
certificates:
|
||||||
|
automate:
|
||||||
|
- livekit-server.bfzqqk.easypanel.host
|
||||||
|
- nextream.sytes.net
|
||||||
|
layer4:
|
||||||
|
servers:
|
||||||
|
main:
|
||||||
|
listen: [":443"]
|
||||||
|
routes:
|
||||||
|
- match:
|
||||||
|
- tls:
|
||||||
|
sni:
|
||||||
|
- "nextream.sytes.net"
|
||||||
|
handle:
|
||||||
|
- handler: tls
|
||||||
|
- handler: proxy
|
||||||
|
upstreams:
|
||||||
|
- dial: ["localhost:5349"]
|
||||||
|
- match:
|
||||||
|
- tls:
|
||||||
|
sni:
|
||||||
|
- "livekit-server.bfzqqk.easypanel.host"
|
||||||
|
handle:
|
||||||
|
- handler: tls
|
||||||
|
connection_policies:
|
||||||
|
- alpn: ["http/1.1"]
|
||||||
|
- handler: proxy
|
||||||
|
upstreams:
|
||||||
|
- dial: ["localhost:7880"]
|
||||||
|
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# update ip script
|
||||||
|
cat << "EOF" > /opt/livekit/update_ip.sh
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
ip=`ip addr show |grep "inet " |grep -v 127.0.0. |head -1|cut -d" " -f6|cut -d/ -f1`
|
||||||
|
sed -i.orig -r "s/\\\"(.+)(\:5349)/\\\"$ip\2/" /opt/livekit/caddy.yaml
|
||||||
|
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# docker compose
|
||||||
|
cat << EOF > /opt/livekit/docker-compose.yaml
|
||||||
|
# This docker-compose requires host networking, which is only available on Linux
|
||||||
|
# This compose will not function correctly on Mac or Windows
|
||||||
|
services:
|
||||||
|
caddy:
|
||||||
|
image: livekit/caddyl4
|
||||||
|
command: run --config /etc/caddy.yaml --adapter yaml
|
||||||
|
restart: unless-stopped
|
||||||
|
network_mode: "host"
|
||||||
|
volumes:
|
||||||
|
- ./caddy.yaml:/etc/caddy.yaml
|
||||||
|
- ./caddy_data:/data
|
||||||
|
livekit:
|
||||||
|
image: livekit/livekit-server:latest
|
||||||
|
command: --config /etc/livekit.yaml
|
||||||
|
restart: unless-stopped
|
||||||
|
network_mode: "host"
|
||||||
|
volumes:
|
||||||
|
- ./livekit.yaml:/etc/livekit.yaml
|
||||||
|
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# systemd file
|
||||||
|
cat << EOF > /etc/systemd/system/livekit-docker.service
|
||||||
|
[Unit]
|
||||||
|
Description=LiveKit Server Container
|
||||||
|
After=docker.service
|
||||||
|
Requires=docker.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
LimitNOFILE=500000
|
||||||
|
Restart=always
|
||||||
|
WorkingDirectory=/opt/livekit
|
||||||
|
# Shutdown container (if running) when unit is started
|
||||||
|
ExecStartPre=/usr/local/bin/docker-compose -f docker-compose.yaml down
|
||||||
|
ExecStart=/usr/local/bin/docker-compose -f docker-compose.yaml up
|
||||||
|
ExecStop=/usr/local/bin/docker-compose -f docker-compose.yaml down
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
chmod 755 /opt/livekit/update_ip.sh
|
||||||
|
/opt/livekit/update_ip.sh
|
||||||
|
|
||||||
|
systemctl enable livekit-docker
|
||||||
|
systemctl start livekit-docker
|
||||||
29
livekit-server.bfzqqk.easypanel.host/livekit.yaml
Normal file
29
livekit-server.bfzqqk.easypanel.host/livekit.yaml
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
port: 7880
|
||||||
|
bind_addresses:
|
||||||
|
- ""
|
||||||
|
rtc:
|
||||||
|
tcp_port: 7881
|
||||||
|
port_range_start: 40000
|
||||||
|
port_range_end: 40200
|
||||||
|
use_external_ip: true
|
||||||
|
enable_loopback_candidate: false
|
||||||
|
redis:
|
||||||
|
address: 192.168.1.20:6380
|
||||||
|
username: "default"
|
||||||
|
password: "52a4a5b5efdd2ac4a8fd"
|
||||||
|
db: 0
|
||||||
|
use_tls: false
|
||||||
|
sentinel_master_name: ""
|
||||||
|
sentinel_username: ""
|
||||||
|
sentinel_password: ""
|
||||||
|
sentinel_addresses: []
|
||||||
|
cluster_addresses: []
|
||||||
|
max_redirects: null
|
||||||
|
turn:
|
||||||
|
enabled: true
|
||||||
|
domain: nextream.sytes.net
|
||||||
|
tls_port: 5349
|
||||||
|
udp_port: 3478
|
||||||
|
external_tls: true
|
||||||
|
keys:
|
||||||
|
APIBTqTGxf9htMK: 0dOHWPffwneaPg7OYpe4PeAes21zLJfeYJB9cKzSTtXW
|
||||||
22
livekit-server.bfzqqk.easypanel.host/livekit.yaml_bak2
Normal file
22
livekit-server.bfzqqk.easypanel.host/livekit.yaml_bak2
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
# 1. Configuración de API Key/Secret
|
||||||
|
api:
|
||||||
|
key: "APIBTqTGxf9htMK"
|
||||||
|
secret: "0dOHWPffwneaPg7OYpe4PeAes21zLJfeYJB9cKzSTtXW"
|
||||||
|
|
||||||
|
# 2. Configuración RTC y Medios (¡Crucial!)
|
||||||
|
rtc:
|
||||||
|
# La URL que el cliente usará para conectarse (a través de tu proxy)
|
||||||
|
# Debe ser ws:// o wss:// dependiendo de tu proxy
|
||||||
|
url: "wss://livekit-server.bfzqqk.easypanel.host"
|
||||||
|
|
||||||
|
# La IP interna en la que LiveKit escuchará el tráfico de medios (ICE/TURN)
|
||||||
|
# Usa 0.0.0.0 para escuchar en todas las interfaces del contenedor
|
||||||
|
rtc_ip: "0.0.0.0"
|
||||||
|
|
||||||
|
# El rango de puertos UDP que LiveKit usará. ¡Debes mapear estos puertos en Docker!
|
||||||
|
port_range:
|
||||||
|
start: 40000
|
||||||
|
end: 40200
|
||||||
|
|
||||||
|
# 3. Configuración de HTTP/Websocket (Señalización)
|
||||||
|
port: 7880 # El puerto interno de LiveKit que expondremos al proxy
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 5.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 8.9 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
Loading…
x
Reference in New Issue
Block a user