this post was submitted on 06 May 2025
1 points (100.0% liked)

Technikraum

41 readers
1 users here now

founded 1 year ago
MODERATORS
 

LiveKit JWT-Service installieren

  1. Wechseln Sie in das Verzeichnis /opt:
cd /opt
  1. Klonen Sie das Repository:
git clone https://github.com/element-hq/lk-jwt-service.git
cd lk-jwt-service
  1. Erstellen Sie die ausführbare Datei:
go build -o lk-jwt-service .
/usr/local/go/bin/go build -o lk-jwt-service .
  1. Installieren Sie das LiveKit-CLI-Tool:
curl -sSL https://get.livekit.io/ | bash

JWT-Service installieren und konfigurieren

  1. Erstellen Sie die Datei /etc/systemd/system/lk-jwt-service.service mit folgendem Inhalt:
[Unit]
Description=LiveKit JWT Service
After=network.target
Requires=livekit-server.service

[Service]
Restart=always
WorkingDirectory=/opt/lk-jwt-service
Environment="LIVEKIT_URL=wss://rtc.domain.com/"
Environment="LIVEKIT_KEY=xxx"
Environment="LIVEKIT_SECRET=xxx"
Environment="LIVEKIT_JWT_PORT=8080"
ExecStart=/opt/lk-jwt-service/lk-jwt-service

[Install]
WantedBy=multi-user.target
  1. Stellen Sie sicher, dass die ausführbare Datei im richtigen Verzeichnis liegt:
cp lk-jwt-service /opt/lk-jwt-service/

LiveKit-Server installieren und konfigurieren

  1. Erstellen Sie die Datei /etc/systemd/system/livekit-server.service mit folgendem Inhalt:
[Unit]
Description=LiveKit Server Container
After=network.target

[Service]
LimitNOFILE=500000
Restart=always
WorkingDirectory=/opt/livekit
ExecStart=livekit-server --config /etc/livekit/livekit.yaml

[Install]
WantedBy=multi-user.target
  1. Erstellen Sie das Verzeichnis /opt/livekit und kopieren Sie die LiveKit-Server-Binärdatei dorthin:
mkdir -p /opt/livekit
cp livekit-server /opt/livekit/
  1. Erstellen Sie die Konfigurationsdatei /etc/livekit/livekit.yaml mit folgendem Inhalt:
port: 7880
bind_addresses:
  - ""
rtc:
  tcp_port: 7881
  port_range_start: 50000
  port_range_end: 50200
  use_external_ip: true
  ips:
    includes:
      - 162.55.131.56/26
      - 192.168.100.39/32
  enable_loopback_candidate: false
turn:
  enabled: false
  domain: rtc-turn.domain.com
  tls_port: 5349
  udp_port: 3478
  external_tls: true
keys:
  xxx: xxx

Systemd-Dienste aktivieren und starten

  1. Laden Sie die Systemd-Daemon-Konfiguration neu:
systemctl daemon-reload
  1. Aktivieren und starten Sie die Dienste:
systemctl enable --now lk-jwt-service.service livekit-server.service

NGINX als Reverse Proxy konfigurieren

  1. Öffnen Sie Ihre NGINX-Konfigurationsdatei und fügen Sie die folgenden Abschnitte hinzu:
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;

  # JWT-Service läuft auf Port 8080
  proxy_pass http://localhost:8080/;
}

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_send_timeout 120;
  proxy_read_timeout 120;
  proxy_buffering off;

  proxy_set_header Accept-Encoding gzip;
  proxy_set_header Upgrade $http_upgrade;
  proxy_set_header Connection "upgrade";

  # LiveKit SFU WebSocket-Verbindung läuft auf Port 7880
  proxy_pass http://localhost:7880/;
}
  1. Testen Sie die NGINX-Konfiguration:
nginx -t
  1. Laden Sie die NGINX-Konfiguration neu:
systemctl reload nginx

Überprüfung

  • Stellen Sie sicher, dass die Dienste laufen:
systemctl status lk-jwt-service.service livekit-server.service
  • Testen Sie die Endpunkte:
    • JWT-Service: http://<your-domain>/livekit/jwt/
    • LiveKit SFU: http://<your-domain>/livekit/sfu/
no comments (yet)
sorted by: hot top controversial new old
there doesn't seem to be anything here