diff --git a/.github/workflows/automated-tests.yml b/.github/workflows/automated-tests.yml index 94d1cf78fb..2d9f73d1aa 100644 --- a/.github/workflows/automated-tests.yml +++ b/.github/workflows/automated-tests.yml @@ -17,7 +17,7 @@ permissions: contents: read jobs: build-install-and-test: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 - run: ./build/get_external_dependencies.sh @@ -28,6 +28,7 @@ jobs: - run: ./build/setup.sh bbb-freeswitch-core - run: ./build/setup.sh bbb-freeswitch-sounds - run: ./build/setup.sh bbb-fsesl-akka + - run: ./build/setup.sh bbb-graphql-server - run: ./build/setup.sh bbb-html5-nodejs - run: ./build/setup.sh bbb-html5 - run: ./build/setup.sh bbb-learning-dashboard diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5cf0b24422..ed12fb5584 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -101,6 +101,11 @@ bbb-html5-build: script: - build/setup-inside-docker.sh bbb-html5 +bbb-graphql-server-build: + extends: .build_job + script: + - build/setup-inside-docker.sh bbb-graphql-server + bbb-learning-dashboard-build: extends: .build_job script: diff --git a/build/package-names.inc.sh b/build/package-names.inc.sh index 28ab6234fb..488d7b37c3 100644 --- a/build/package-names.inc.sh +++ b/build/package-names.inc.sh @@ -7,6 +7,7 @@ DEBNAME_TO_SOURCEDIR[bbb-export-annotations]="bbb-export-annotations" DEBNAME_TO_SOURCEDIR[bbb-freeswitch-core]="freeswitch bbb-voice-conference" DEBNAME_TO_SOURCEDIR[bbb-freeswitch-sounds]="do_not_copy_anything" DEBNAME_TO_SOURCEDIR[bbb-fsesl-akka]="akka-bbb-fsesl bbb-common-message bbb-fsesl-client" +DEBNAME_TO_SOURCEDIR[bbb-graphql-server]="bbb-graphql-server" DEBNAME_TO_SOURCEDIR[bbb-html5]="bigbluebutton-html5" DEBNAME_TO_SOURCEDIR[bbb-html5-nodejs]="do_not_copy_anything" DEBNAME_TO_SOURCEDIR[bbb-learning-dashboard]="bbb-learning-dashboard" diff --git a/build/packages-template/bbb-graphql-server/after-install.sh b/build/packages-template/bbb-graphql-server/after-install.sh new file mode 100755 index 0000000000..39654671c3 --- /dev/null +++ b/build/packages-template/bbb-graphql-server/after-install.sh @@ -0,0 +1,30 @@ +#!/bin/bash -e + +case "$1" in + configure|upgrade|1|2) + + fc-cache -f + + sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'bigbluebutton'" + sudo -u postgres psql -c "create database bigbluebutton" + sudo -u postgres psql -U postgres -d bigbluebutton -a -f bbb_schema.sql --set ON_ERROR_STOP=on + sudo -u postgres psql -c "create database hasura_app" + echo "Postgresql configured" + + # Apply BBB metadata in Hasura + /usr/local/bin/hasura metadata apply + + + systemctl enable bbb-graphql-server.service + systemctl daemon-reload + startService bbb-graphql-server || echo "bbb-graphql-server service 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-graphql-server/after-remove.sh b/build/packages-template/bbb-graphql-server/after-remove.sh new file mode 100755 index 0000000000..c7a17a74e3 --- /dev/null +++ b/build/packages-template/bbb-graphql-server/after-remove.sh @@ -0,0 +1,17 @@ +#!/bin/bash -e + +case "$1" in + remove|failed-upgrade|abort-upgrade|abort-install|disappear|0|1) + + ;; + purge) + # remove Hasura + rm -rf /usr/local/bin/hasura + ;; + upgrade) + ;; + *) + echo "postinst called with unknown argument $1" >&2 + ;; +esac + diff --git a/build/packages-template/bbb-graphql-server/before-remove.sh b/build/packages-template/bbb-graphql-server/before-remove.sh new file mode 100755 index 0000000000..b9890fcf65 --- /dev/null +++ b/build/packages-template/bbb-graphql-server/before-remove.sh @@ -0,0 +1,3 @@ +#!/bin/bash -e + +stopService bbb-graphql-server || echo "bbb-graphql-server could not be unregistered or stopped" diff --git a/build/packages-template/bbb-graphql-server/build.sh b/build/packages-template/bbb-graphql-server/build.sh new file mode 100755 index 0000000000..bc4425f337 --- /dev/null +++ b/build/packages-template/bbb-graphql-server/build.sh @@ -0,0 +1,56 @@ +#!/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) +BUILD=$1 + +# +# Clean up directories +rm -rf staging + +# +# package + +git clone --branch v2.22.1 https://github.com/iMDT/hasura-graphql-engine.git #TODO +cat hasura-graphql-engine/hasura-graphql.part-a* > hasura-graphql +rm -rf hasura-graphql-engine/ +chmod +x hasura-graphql + +mkdir -p staging/usr/local/bin/hasura-graphql-engine +cp -r hasura-graphql staging/usr/local/bin/hasura-graphql-engine + +mkdir -p staging/etc/default/bbb-graphql-server +cp ./hasura-config.env staging/etc/default/bbb-graphql-server + +mkdir -p staging/lib/systemd/system/bbb-graphql-server.service +cp ./bbb-graphql-server.service staging/lib/systemd/system/bbb-graphql-server.service + +mkdir -p staging/usr/share/bigbluebutton/nginx +cp graphql.nginx staging/usr/share/bigbluebutton/nginx + +mkdir -p hasura-cli +cd hasura-cli +npm install --save-dev hasura-cli +ls -l node_modules +mkdir -p staging/usr/local/bin/hasura +cp -r node_modules/hasura-cli/* staging/usr/local/bin/hasura +cd .. +rm -rf hasura-cli + +. ./opts-$DISTRO.sh + +# +# Build package +fpm -s dir -C ./staging -n $PACKAGE \ + --version $VERSION --epoch $EPOCH \ + --after-install after-install.sh \ + --after-remove after-remove.sh \ + --before-remove before-remove.sh \ + --description "GraphQL server component for BigBlueButton" \ + $DIRECTORIES \ + $OPTS diff --git a/build/packages-template/bbb-graphql-server/opts-jammy.sh b/build/packages-template/bbb-graphql-server/opts-jammy.sh new file mode 100644 index 0000000000..7cba418d6b --- /dev/null +++ b/build/packages-template/bbb-graphql-server/opts-jammy.sh @@ -0,0 +1,4 @@ +. ./opts-global.sh + +OPTS="$OPTS -d postgresql,postgresql-contrib -t deb" +# OPTS="$OPTS -d postgresql,postgresql-contrib,gnupg2,curl,apt-transport-https,ca-certificates,libkrb5-3,libpq5,libnuma1,unixodbc-dev,libmariadb-dev-compat,mariadb-client-10.3 -t deb" diff --git a/build/packages-template/bbb-html5/build.sh b/build/packages-template/bbb-html5/build.sh index 60ca4ae207..c7c56861f0 100755 --- a/build/packages-template/bbb-html5/build.sh +++ b/build/packages-template/bbb-html5/build.sh @@ -91,7 +91,8 @@ cp bbb-html5-with-roles.conf staging/usr/share/meteor/bundle cp mongod_start_pre.sh staging/usr/share/meteor/bundle chmod +x staging/usr/share/meteor/bundle/mongod_start_pre.sh -cp mongo-ramdisk.conf staging/etc/mongod.conf +cp mongo-ramdisk.conf staging/usr/share/meteor/bundle +# cp mongo-ramdisk.conf staging/etc/mongod.conf mkdir -p staging/usr/lib/systemd/system cp bbb-html5.service staging/usr/lib/systemd/system diff --git a/build/packages-template/bbb-html5/opts-jammy.sh b/build/packages-template/bbb-html5/opts-jammy.sh index 249f9439d2..7989d06c33 100644 --- a/build/packages-template/bbb-html5/opts-jammy.sh +++ b/build/packages-template/bbb-html5/opts-jammy.sh @@ -1,3 +1,3 @@ . ./opts-global.sh -OPTS="$OPTS -d bc,bbb-pads,bbb-webrtc-sfu,bbb-export-annotations,bbb-web,bbb-html5-nodejs,yq,mongodb-org -t deb" +OPTS="$OPTS -d bc,bbb-pads,bbb-webrtc-sfu,bbb-export-annotations,bbb-web,bbb-html5-nodejs,bbb-graphql-server,yq,mongodb-org -t deb"