From cf4ff9453caca7fcc8ade492fe66dcf1ec57a812 Mon Sep 17 00:00:00 2001 From: prlanzarin <4529051+prlanzarin@users.noreply.github.com> Date: Fri, 19 May 2023 12:38:55 -0300 Subject: [PATCH] build: add bbb-transcription-controller Added as an optional package --- .github/workflows/automated-tests.yml | 1 + .gitlab-ci.yml | 6 +++ bbb-transcription-controller.placeholder.sh | 1 + bigbluebutton-config/bin/bbb-conf | 10 ++++- build/package-names.inc.sh | 1 + .../bbb-transcription-controller/.build-files | 5 +++ .../after-install.sh | 18 ++++++++ .../bbb-transcription-controller.service | 18 ++++++++ .../before-remove.sh | 3 ++ .../bbb-transcription-controller/build.sh | 42 +++++++++++++++++++ .../opts-focal.sh | 3 ++ 11 files changed, 106 insertions(+), 2 deletions(-) create mode 100755 bbb-transcription-controller.placeholder.sh create mode 100644 build/packages-template/bbb-transcription-controller/.build-files create mode 100755 build/packages-template/bbb-transcription-controller/after-install.sh create mode 100644 build/packages-template/bbb-transcription-controller/bbb-transcription-controller.service create mode 100755 build/packages-template/bbb-transcription-controller/before-remove.sh create mode 100755 build/packages-template/bbb-transcription-controller/build.sh create mode 100644 build/packages-template/bbb-transcription-controller/opts-focal.sh diff --git a/.github/workflows/automated-tests.yml b/.github/workflows/automated-tests.yml index e520bf1bbf..f1b7355b48 100644 --- a/.github/workflows/automated-tests.yml +++ b/.github/workflows/automated-tests.yml @@ -44,6 +44,7 @@ jobs: - run: ./build/setup.sh bbb-web - run: ./build/setup.sh bbb-webrtc-sfu - run: ./build/setup.sh bbb-webrtc-recorder + - run: ./build/setup.sh bbb-transcription-controller - run: ./build/setup.sh bigbluebutton - run: tar cvf artifacts.tar artifacts/ - name: Archive packages diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 718973c721..9f7b812277 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -51,6 +51,7 @@ get_external_dependencies: - freeswitch - bbb-pads - bbb-playback + - bbb-transcription-controller expire_in: 1h 30min # template job for build step @@ -176,6 +177,11 @@ bbb-webrtc-recorder-build: script: - build/setup-inside-docker.sh bbb-webrtc-recorder +bbb-transcription-controller-build: + extends: .build_job + script: + - build/setup-inside-docker.sh bbb-transcription-controller + bigbluebutton-build: extends: .build_job script: diff --git a/bbb-transcription-controller.placeholder.sh b/bbb-transcription-controller.placeholder.sh new file mode 100755 index 0000000000..c668a62e07 --- /dev/null +++ b/bbb-transcription-controller.placeholder.sh @@ -0,0 +1 @@ +git clone --branch v0.1.0 --depth 1 https://github.com/bigbluebutton/bbb-transcription-controller bbb-transcription-controller diff --git a/bigbluebutton-config/bin/bbb-conf b/bigbluebutton-config/bin/bbb-conf index ab39b8638e..b1e73bd2be 100755 --- a/bigbluebutton-config/bin/bbb-conf +++ b/bigbluebutton-config/bin/bbb-conf @@ -489,11 +489,15 @@ display_bigbluebutton_status () { units="$units bbb-rap-starter" fi + if [ -f /usr/lib/systemd/system/bbb-transcription-controller.service ]; then + units="$units bbb-transcription-controller" + fi + if systemctl list-units --full -all | grep -q $TOMCAT_USER.service; then TOMCAT_SERVICE=$TOMCAT_USER fi - line='——————————————————————►' + line='—————————————————————————————►' for unit in $units; do status=$(systemctl is-active "$unit") if [ "$status" = "active" ]; then @@ -1724,7 +1728,9 @@ if [ -n "$HOST" ]; then sudo yq w -i /usr/local/bigbluebutton/bbb-webrtc-sfu/config/default.yml freeswitch.esl_password "$ESL_PASSWORD" sudo xmlstarlet edit --inplace --update 'configuration/settings//param[@name="password"]/@value' --value $ESL_PASSWORD /opt/freeswitch/etc/freeswitch/autoload_configs/event_socket.conf.xml - + if [ -f /usr/local/bigbluebutton/bbb-transcription-controller/config/default.yml ]; then + sudo yq w -i /usr/local/bigbluebutton/bbb-transcription-controller/config/default.yml freeswitch.esl_password "$ESL_PASSWORD" + fi echo "Restarting BigBlueButton $BIGBLUEBUTTON_RELEASE ..." stop_bigbluebutton diff --git a/build/package-names.inc.sh b/build/package-names.inc.sh index 28ab6234fb..4769a11805 100644 --- a/build/package-names.inc.sh +++ b/build/package-names.inc.sh @@ -25,6 +25,7 @@ DEBNAME_TO_SOURCEDIR[bbb-web]="bigbluebutton-web bbb-common-web bbb-common-messa DEBNAME_TO_SOURCEDIR[bbb-webhooks]="bbb-webhooks" DEBNAME_TO_SOURCEDIR[bbb-webrtc-sfu]="bbb-webrtc-sfu" DEBNAME_TO_SOURCEDIR[bbb-webrtc-recorder]="bbb-webrtc-recorder" +DEBNAME_TO_SOURCEDIR[bbb-transcription-controller]="bbb-transcription-controller" DEBNAME_TO_SOURCEDIR[bigbluebutton]="do_not_copy_anything" export DEBNAME_TO_SOURCEDIR diff --git a/build/packages-template/bbb-transcription-controller/.build-files b/build/packages-template/bbb-transcription-controller/.build-files new file mode 100644 index 0000000000..fbd3759de7 --- /dev/null +++ b/build/packages-template/bbb-transcription-controller/.build-files @@ -0,0 +1,5 @@ +after-install.sh +bbb-transcription-controller.service +before-remove.sh +build.sh +opts-focal.sh diff --git a/build/packages-template/bbb-transcription-controller/after-install.sh b/build/packages-template/bbb-transcription-controller/after-install.sh new file mode 100755 index 0000000000..9d0b38dd29 --- /dev/null +++ b/build/packages-template/bbb-transcription-controller/after-install.sh @@ -0,0 +1,18 @@ +#!/bin/bash -e + +case "$1" in + configure|upgrade|1|2) + TARGET=/usr/local/bigbluebutton/bbb-transcription-controller/config/default.yml + cp /usr/local/bigbluebutton/bbb-transcription-controller/config/default.example.yml $TARGET + + startService bbb-transcription-controller|| echo "bbb-transcription-controller could not be registered or started" + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac diff --git a/build/packages-template/bbb-transcription-controller/bbb-transcription-controller.service b/build/packages-template/bbb-transcription-controller/bbb-transcription-controller.service new file mode 100644 index 0000000000..d0d964bd09 --- /dev/null +++ b/build/packages-template/bbb-transcription-controller/bbb-transcription-controller.service @@ -0,0 +1,18 @@ +[Unit] +Description=BigBlueButton Transcription Controller +Wants=redis-server.service +After=syslog.target network.target redis-server.service freeswitch.service bbb-apps-akka.service +PartOf=bigbluebutton.target + +[Service] +WorkingDirectory=/usr/local/bigbluebutton/bbb-transcription-controller +ExecStart=/usr/bin/node app.js +Restart=always +SyslogIdentifier=bbb-transcription-controller +User=bigbluebutton +Group=bigbluebutton +Environment=NODE_ENV=production +Environment=NODE_CONFIG_DIR=/etc/bigbluebutton/bbb-transcription-controller/:/usr/local/bigbluebutton/bbb-transcription-controller/config/ + +[Install] +WantedBy=multi-user.target bigbluebutton.target diff --git a/build/packages-template/bbb-transcription-controller/before-remove.sh b/build/packages-template/bbb-transcription-controller/before-remove.sh new file mode 100755 index 0000000000..a4cc2af16b --- /dev/null +++ b/build/packages-template/bbb-transcription-controller/before-remove.sh @@ -0,0 +1,3 @@ +#!/bin/bash -e + +stopService bbb-transcription-controller || echo "bbb-transcription-controller could not be unregistered or stopped" diff --git a/build/packages-template/bbb-transcription-controller/build.sh b/build/packages-template/bbb-transcription-controller/build.sh new file mode 100755 index 0000000000..57740a01b1 --- /dev/null +++ b/build/packages-template/bbb-transcription-controller/build.sh @@ -0,0 +1,42 @@ +#!/bin/bash -ex + +TARGET=`basename $(pwd)` + +PACKAGE=$(echo $TARGET | cut -d'_' -f1) +VERSION=$(echo $TARGET | cut -d'_' -f2) +DISTRO=$(echo $TARGET | cut -d'_' -f3) +TAG=$(echo $TARGET | cut -d'_' -f4) + +# +# Clean up directories +rm -rf staging + +# +# package + +mkdir -p staging/usr/local/bigbluebutton/bbb-transcription-controller + +find -maxdepth 1 ! -path . ! -name staging $(printf "! -name %s " $(cat .build-files)) -exec cp -r {} staging/usr/local/bigbluebutton/bbb-transcription-controller/ \; + +pushd . +cd staging/usr/local/bigbluebutton/bbb-transcription-controller/ +npm install --production +popd + +mkdir -p staging/usr/lib/systemd/system +cp bbb-transcription-controller.service staging/usr/lib/systemd/system + +## + +. ./opts-$DISTRO.sh + +# +# Build RPM package +fpm -s dir -C ./staging -n $PACKAGE \ + --version $VERSION --epoch $EPOCH \ + --after-install after-install.sh \ + --before-remove before-remove.sh \ + --description "BigBlueButton Transcription Controller" \ + $DIRECTORIES \ + $OPTS + diff --git a/build/packages-template/bbb-transcription-controller/opts-focal.sh b/build/packages-template/bbb-transcription-controller/opts-focal.sh new file mode 100644 index 0000000000..849bbb2d04 --- /dev/null +++ b/build/packages-template/bbb-transcription-controller/opts-focal.sh @@ -0,0 +1,3 @@ +. ./opts-global.sh + +OPTS="$OPTS -d nodejs,npm,bbb-apps-akka,bbb-freeswitch-core -t deb"