From d6e461efd4dfb76dbaac9a5fce8b865d2b10574d Mon Sep 17 00:00:00 2001 From: chandi Date: Sun, 17 Apr 2022 12:43:46 +0200 Subject: [PATCH] mediasoup support and partial kurento removal --- docker-compose.tmpl.yml | 39 +++++++++++----------------- mod/nginx/bbb/webrtc-sfu.nginx | 2 +- mod/periodic/Dockerfile | 2 +- mod/periodic/bbb-restart-kms | 40 ----------------------------- mod/periodic/entrypoint.sh | 2 -- mod/webrtc-sfu/Dockerfile | 4 +-- mod/webrtc-sfu/docker-entrypoint.sh | 6 ----- sample.env | 5 ---- 8 files changed, 18 insertions(+), 82 deletions(-) delete mode 100755 mod/periodic/bbb-restart-kms delete mode 100755 mod/webrtc-sfu/docker-entrypoint.sh diff --git a/docker-compose.tmpl.yml b/docker-compose.tmpl.yml index 41a972d..93e206d 100644 --- a/docker-compose.tmpl.yml +++ b/docker-compose.tmpl.yml @@ -70,7 +70,6 @@ services: volumes: - bigbluebutton:/var/bigbluebutton - vol-freeswitch:/var/freeswitch/meetings - - vol-kurento:/var/kurento networks: bbb-net: ipv4_address: 10.7.7.2 @@ -149,7 +148,7 @@ services: - "host.docker.internal:10.7.7.1" - "bbb-web:10.7.7.2" - "etherpad:10.7.7.4" - - "webrtc-sfu:10.7.7.10" + - "webrtc-sfu:10.7.7.1" - "html5:10.7.7.11" etherpad: @@ -204,8 +203,9 @@ services: bbb-net: ipv4_address: 10.7.7.6 + # TODO: remove as soon as not required anymore by webrtc-sfu kurento: - image: kurento/kurento-media-server:6.16 + image: kurento/kurento-media-server:6.17 restart: unless-stopped environment: KMS_STUN_IP: ${STUN_IP} @@ -213,11 +213,10 @@ services: KMS_MIN_PORT: 24577 KMS_MAX_PORT: 32768 KMS_TURN_URL: - KMS_NETWORK_INTERFACES: ${NETWORK_INTERFACE:-} GST_DEBUG: 3,Kurento*:4,kms*:4,KurentoWebSocketTransport:5 network_mode: host - volumes: - - vol-kurento:/var/kurento + tmpfs: + - /var/kurento webrtc-sfu: build: @@ -227,27 +226,21 @@ services: restart: unless-stopped depends_on: - redis - - kurento + - freeswitch environment: - CLIENT_HOST: 0.0.0.0 - KURENTO_NAME: kurento - REDIS_HOST: redis - FREESWITCH_IP: host.docker.internal + CLIENT_HOST: 10.7.7.1 + REDIS_HOST: 10.7.7.5 + FREESWITCH_IP: 10.7.7.1 FREESWITCH_SIP_IP: ${EXTERNAL_IPv4} - ESL_IP: host.docker.internal + ESL_IP: 10.7.7.1 ESL_PASSWORD: ${FSESL_PASSWORD:-ClueCon} - LOG_LEVEL: info - NODE_CONFIG: '{"kurento":[{"ip":"${EXTERNAL_IPv4}","url":"ws://kurento:8888/kurento"}]}' - ports: - - "127.0.0.1:3008:3008" - extra_hosts: - - host.docker.internal:10.7.7.1 - - kurento:10.7.7.1 + # TODO: add mediasoup IPv6 + # TODO: can listen to 0.0.0.0 for nat support? https://github.com/versatica/mediasoup/issues/487 + MS_WEBRTC_LISTEN_IPS: '[{"ip":"${EXTERNAL_IPv4}", "announcedIp":"${EXTERNAL_IPv4}"}]' + MS_RTP_LISTEN_IP: '{"ip":"0.0.0.0", "announcedIp":"${EXTERNAL_IPv4}"}' volumes: - vol-mediasoup:/var/mediasoup - networks: - bbb-net: - ipv4_address: 10.7.7.10 + network_mode: host fsesl-akka: build: @@ -334,7 +327,6 @@ services: volumes: - bigbluebutton:/var/bigbluebutton - vol-freeswitch:/var/freeswitch/meetings - - vol-kurento:/var/kurento - vol-mediasoup:/var/mediasoup tmpfs: - /var/log/bigbluebutton @@ -463,7 +455,6 @@ services: volumes: bigbluebutton: vol-freeswitch: - vol-kurento: vol-mediasoup: html5-static: {{ if isTrue .Env.ENABLE_HTTPS_PROXY }} diff --git a/mod/nginx/bbb/webrtc-sfu.nginx b/mod/nginx/bbb/webrtc-sfu.nginx index 71a5a00..c226485 100644 --- a/mod/nginx/bbb/webrtc-sfu.nginx +++ b/mod/nginx/bbb/webrtc-sfu.nginx @@ -6,7 +6,7 @@ location /bbb-webrtc-sfu { auth_request_set $meeting_id $sent_http_meeting_id; auth_request_set $voice_bridge $sent_http_voice_bridge; - proxy_pass http://webrtc-sfu:3008; + proxy_pass http://10.7.7.1:3008; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; diff --git a/mod/periodic/Dockerfile b/mod/periodic/Dockerfile index bf98d56..184cc89 100644 --- a/mod/periodic/Dockerfile +++ b/mod/periodic/Dockerfile @@ -3,7 +3,7 @@ FROM debian:bullseye-slim # -- install docker cli COPY --from=library/docker:latest /usr/local/bin/docker /usr/bin/docker -COPY bbb-remove-old-recordings bbb-restart-kms bbb-resync-freeswitch entrypoint.sh / +COPY bbb-remove-old-recordings bbb-resync-freeswitch entrypoint.sh / RUN chmod +x bbb-remove-old-recordings diff --git a/mod/periodic/bbb-restart-kms b/mod/periodic/bbb-restart-kms deleted file mode 100755 index 2788203..0000000 --- a/mod/periodic/bbb-restart-kms +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash - -# Source: -# https://github.com/alangecker/bbb-packages/blob/f83431c227be2c95025ea81083baeaa87667b170/bbb-webrtc-sfu/data/etc/cron.hourly/bbb-restart-kms - -# -# Restart Kurento every 24+ hours -# - -if [ ! -f /tmp/bbb-kms-last-restart.txt ]; then - date +%Y-%m-%d\ %H:%M:%S > /tmp/bbb-kms-last-restart.txt - exit -fi - -users=$(docker exec bbb-mongodb mongo --quiet mongodb://10.7.7.6:27017/meteor --eval "db.users.count()") -echo "currently active users: $users" - -if [ "$users" -eq 0 ]; then - - # Make sure 24 hours have passed since last restart - - # Seconds since epoch for last restart - dt1=$(cat /tmp/bbb-kms-last-restart.txt) - t1=`date --date="$dt1" +%s` - - # Current seconds since epoch - dt2=`date +%Y-%m-%d\ %H:%M:%S` - t2=`date --date="$dt2" +%s` - - # Hours since last restart - let "tDiff=$t2-$t1" - let "hDiff=$tDiff/3600" - - if [ "$hDiff" -ge 24 ]; then - echo "scheduled restart of kurento after 24h" - CONTAINER_ID=$(docker ps | grep kurento | awk '{print $1}') - docker restart $CONTAINER_ID - date +%Y-%m-%d\ %H:%M:%S > /tmp/bbb-kms-last-restart.txt - fi -fi diff --git a/mod/periodic/entrypoint.sh b/mod/periodic/entrypoint.sh index dd060d8..cc3bbb0 100755 --- a/mod/periodic/entrypoint.sh +++ b/mod/periodic/entrypoint.sh @@ -7,8 +7,6 @@ history=5 while : do - # restart kurento after 24h - /bbb-restart-kms # resync freeswitch /bbb-resync-freeswitch diff --git a/mod/webrtc-sfu/Dockerfile b/mod/webrtc-sfu/Dockerfile index 474142a..da222c0 100644 --- a/mod/webrtc-sfu/Dockerfile +++ b/mod/webrtc-sfu/Dockerfile @@ -30,8 +30,6 @@ ENV NODE_ENV production COPY --from=builder /app /app RUN chown -R webrtc-sfu:webrtc-sfu /app/config -COPY docker-entrypoint.sh /app/docker-entrypoint.sh - USER webrtc-sfu -ENTRYPOINT [ "/app/docker-entrypoint.sh" ] +WORKDIR /app CMD [ "npm", "start" ] diff --git a/mod/webrtc-sfu/docker-entrypoint.sh b/mod/webrtc-sfu/docker-entrypoint.sh deleted file mode 100755 index 0f1218e..0000000 --- a/mod/webrtc-sfu/docker-entrypoint.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -e -cd /app -sed -i "s|^\(localIpAddress\):.*|\1: \"10.7.7.10\"|g" config/production.yml -export KURENTO_IP="10.7.7.1" - -exec "$@" diff --git a/sample.env b/sample.env index 78e945d..f91bf97 100644 --- a/sample.env +++ b/sample.env @@ -59,11 +59,6 @@ DOMAIN=bbb.example.com EXTERNAL_IPv4=144.76.97.10 EXTERNAL_IPv6= -# setting the network interface speeds up kurentos WebRTC connection time, -# but currently also disables IPv6 for Kurento -# (https://github.com/Kurento/bugtracker/issues/500) -#NETWORK_INTERFACE=ens3 - # STUN SERVER # stun.freeswitch.org STUN_IP=216.93.246.18