Add Livekit package

For now, we will not rebuild livekit, but rather use the precompiled
project binaries.

As per BBB convention, this package provides an immutable default
configuration file which gets merged with a user-modifiable file
in /etc/bigbluebutton.
This commit is contained in:
Daniel Molkentin 2023-11-27 17:49:05 +01:00
parent 396d71b35f
commit 6799809b6b
12 changed files with 151 additions and 1 deletions

View File

@ -73,7 +73,7 @@ jobs:
build-list: bbb-webrtc-sfu bbb-webrtc-recorder
cache-files-list: bbb-webrtc-sfu.placeholder.sh bbb-webrtc-recorder.placeholder.sh
- package: others
build-list: bbb-mkclean bbb-pads bbb-libreoffice-docker bbb-transcription-controller bigbluebutton
build-list: bbb-mkclean bbb-pads bbb-libreoffice-docker bbb-transcription-controller bigbluebutton bbb-livekit
steps:
- uses: actions/checkout@v3
- name: Merge branches

View File

@ -182,6 +182,11 @@ bbb-webrtc-recorder-build:
script:
- build/setup-inside-docker.sh bbb-webrtc-recorder
bbb-livekit:
extends: .build_job
script:
- build/setup-inside-docker.sh bbb-livekit
bbb-transcription-controller-build:
extends: .build_job
script:

0
bbb-livekit/.gitkeep Normal file
View File

View File

@ -0,0 +1,24 @@
#!/bin/bash -e
if [ ! -f /etc/bigbluebutton/livekit.yaml ]; then
keys="$(livekit-server generate-keys|awk 'BEGIN { ORS=": "} { print $3 }')"
(umask 007; cat << EOT
# This file will be merged with /usr/share/livekit-server/livekit.yaml
# on startup. Settings specified here will take precedence.
logging:
level: debug
keys:
$keys
cat << EOT > /etc/bigbluebutton/livekit.yaml
chown bigbluebutton:bigbluebutton /etc/bigbluebutton/livekit.yaml
fi
if [ ! -f /.dockerenv ]; then
systemctl enable livekit-server.service
systemctl daemon-reload
startService livekit-server.service || echo "livekit-server service could not be registered or started"
fi
EOT
)
fi

View File

@ -0,0 +1,12 @@
#!/bin/bash -e
case "$1" in
remove|purge)
systemctl daemon-reload
;;
failed-upgrade|abort-upgrade|abort-install|disappear)
;;
*)
echo "postinst called with unknown argument \`\$1'" >&2
;;
esac

View File

@ -0,0 +1,14 @@
#!/bin/bash -e
case "$1" in
install|upgrade|1|2)
;;
abort-upgrade)
;;
*)
echo "## preinst called with unknown argument \`$1'" >&2
;;
esac

View File

@ -0,0 +1,4 @@
#!/bin/bash -e
stopService livekit-server || echo "livekit-server could not be unregistered or stopped"

View File

@ -0,0 +1,45 @@
#!/bin/bash -ex
TARGET=`basename $(pwd)`
SERVER_VERSION=1.5.1
CLI_VERSION=1.3.0
PACKAGE=$(echo $TARGET | cut -d'_' -f1)
VERSION=$(echo $TARGET | cut -d'_' -f2)
DISTRO=$(echo $TARGET | cut -d'_' -f3)
BUILDDIR=$PWD
DESTDIR=$BUILDDIR/staging
#
# Clear staging directory for build
rm -rf $DESTDIR
mkdir -p $DESTDIR
. ./opts-$DISTRO.sh
mkdir -p $DESTDIR/usr/share/bigbluebutton/nginx
cp livekit.nginx $DESTDIR/usr/share/bigbluebutton/nginx
mkdir -p $DESTDIR/lib/systemd/system/
cp livekit-server.service $DESTDIR/lib/systemd/system
mkdir -p $DESTDIR/usr/share/livekit-server
cp livekit.yaml $DESTDIR/usr/share/livekit-server
mkdir -p $DESTDIR/usr/bin
curl https://github.com/livekit/livekit/releases/download/v${SERVER_VERSION}/livekit_${SERVER_VERSION}_linux_amd64.tar.gz -Lo - | tar -C $DESTDIR/usr/bin -xzf - livekit-server
curl https://github.com/livekit/livekit-cli/releases/download/v${CLI_VERSION}/livekit-cli_${CLI_VERSION}_linux_amd64.tar.gz -Lo - | tar -C $DESTDIR/usr/bin -xzf - livekit-cli
fpm -s dir -C $DESTDIR -n $PACKAGE \
--version $VERSION --epoch 2 \
--before-install before-install.sh \
--after-install after-install.sh \
--before-remove before-remove.sh \
--after-remove after-remove.sh \
--description "BigBlueButton build of LiveKit Server" \
$DIRECTORIES \
$OPTS

View File

@ -0,0 +1,20 @@
[Unit]
Description=LiveKit Server
Wants=redis-server.service
After=syslog.target network.target freeswitch.service redis-server.service
PartOf=bigbluebutton.target
[Service]
Type=exec
ExecStartPre=-bash -c "umask 077; yq eval-all '. as $item ireduce ({}; . * $item )' /usr/share/livekit-server/livekit.yaml /etc/bigbluebutton/livekit.yaml > ${RUNTIME_DIRECTORY}/livekit.yaml"
ExecStart=/usr/bin/livekit-server --config "${RUNTIME_DIRECTORY}/livekit.yaml"
ExecStopPost=rm ${RUNTIME_DIRECTORY}/livekit.yaml
RuntimeDirectory=livekit-server
Restart=always
User=bigbluebutton
Group=bigbluebutton
CPUSchedulingPolicy=fifo
Nice=19
[Install]
WantedBy=multi-user.target bigbluebutton.target

View File

@ -0,0 +1,11 @@
location /livekit/ {
proxy_pass http://127.0.0.1:7880/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_read_timeout 60s;
proxy_send_timeout 60s;
client_body_timeout 60s;
send_timeout 60s;
}

View File

@ -0,0 +1,12 @@
port: 7880
log_level: debug
# when enabled, LiveKit will expose prometheus metrics on :6789/metrics
#prometheus_port: 6789
rtc:
port_range_start: 16384
port_range_end: 32768
use_external_ip: false
redis:
# # redis is recommended for production deploys
# address: servername:6379

View File

@ -0,0 +1,3 @@
. ./opts-global.sh
OPTS="$OPTS -t deb -d yq"