livekit añadido

This commit is contained in:
2025-11-10 16:16:34 +01:00
parent d13ab16256
commit 20501ab8bc
12 changed files with 446 additions and 18 deletions
+34
View File
@@ -0,0 +1,34 @@
# LiveKit configuration example for Element Call.
# Copy this file to configs/livekit/livekit.yaml and replace the placeholder
# values before starting the stack.
port: 7880
bind_addresses:
- "0.0.0.0"
log_level: info
region: "us-east-1"
rtc:
tcp_port: 7881
port_range_start: 50000
port_range_end: 50200
use_external_ip: true
force_tcp: false
# Optional TURN forwarding. Enable only if you already operate a TURN server.
turn:
enabled: false
domain: ""
cert_file: ""
key_file: ""
tls_port: 5349
udp_port: 443
external_tls: true
# The keys map controls which API key/secret pairs are valid.
# Generate your own pair with: openssl rand -hex 32
# Secrets must be at least 32 characters long.
keys:
LIVEKIT_API_KEY_PLACEHOLDER: LIVEKIT_API_SECRET_PLACEHOLDER
room:
auto_create: false
+54
View File
@@ -0,0 +1,54 @@
server {
listen 80;
listen 443 ssl;
server_name localhost;
ssl_certificate /etc/nginx/certs/localhost.crt;
ssl_certificate_key /etc/nginx/certs/localhost.key;
add_header Access-Control-Allow-Origin $http_origin always;
add_header Access-Control-Allow-Credentials "true" always;
add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS" always;
add_header Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept, Authorization" always;
# Handle preflight requests generically
if ($request_method = OPTIONS) {
return 204;
}
# Serve Matrix client well-known metadata
location /.well-known/matrix/client {
default_type application/json;
add_header Access-Control-Allow-Origin $http_origin always;
add_header Access-Control-Allow-Credentials "true" always;
add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS" always;
add_header Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept, Authorization" always;
alias /var/www/well-known/matrix-client.json;
}
# Optional Matrix server discovery stub (useful for federation later)
location /.well-known/matrix/server {
default_type application/json;
return 200 '{"m.server":"localhost:8008"}';
}
# Proxy Matrix Client/Server and Synapse admin APIs to the Synapse container
location / {
proxy_pass http://synapse:8008;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
client_max_body_size 50m;
# Hide upstream CORS headers and set our own
proxy_hide_header Access-Control-Allow-Origin;
proxy_hide_header Access-Control-Allow-Methods;
proxy_hide_header Access-Control-Allow-Headers;
proxy_hide_header Access-Control-Expose-Headers;
add_header Access-Control-Allow-Origin $http_origin always;
add_header Access-Control-Allow-Credentials "true" always;
add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS" always;
add_header Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept, Authorization" always;
}
}
+31
View File
@@ -0,0 +1,31 @@
server {
listen 80;
server_name matrix-rtc.localhost;
# MatrixRTC Authorization Service (lk-jwt-service)
location ^~ /livekit/jwt/ {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://livekit-jwt:6080/;
}
# LiveKit SFU Websocket (signalling)
location ^~ /livekit/sfu/ {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Accept-Encoding gzip;
proxy_send_timeout 120;
proxy_read_timeout 120;
proxy_buffering off;
proxy_pass http://livekit:7880/;
}
}
@@ -0,0 +1,12 @@
{
"m.homeserver": {
"base_url": "https://matrix.example.com",
"server_name": "matrix.example.com"
},
"org.matrix.msc4143.rtc_foci": [
{
"type": "livekit",
"livekit_service_url": "https://matrix-rtc.example.com/livekit/jwt"
}
]
}