diff --git a/opt/02-core/bigbluebutton/.gitignore b/opt/02-core/bigbluebutton/.gitignore new file mode 100644 index 0000000..ef811d5 --- /dev/null +++ b/opt/02-core/bigbluebutton/.gitignore @@ -0,0 +1,26 @@ +docker-compose.yml +docker-compose.override.yml + +# IDEA generated +.idea + +# OS generated +.DS_Store +.AppleDouble + +# Tmp files +*.swp +*.log + +# App generated +.env +.env.bak +postgres-data +greenlight-data + +.cache/*/** +!.cache/*/.gitkeep +data/* +!data/.gitkeep + +conf/bbb-html5.yml \ No newline at end of file diff --git a/opt/02-core/bigbluebutton/.gitmodules b/opt/02-core/bigbluebutton/.gitmodules new file mode 100644 index 0000000..5a8521f --- /dev/null +++ b/opt/02-core/bigbluebutton/.gitmodules @@ -0,0 +1,27 @@ +[submodule "repos/bbb-etherpad-skin"] + path = repos/bbb-etherpad-skin + url = https://github.com/alangecker/bbb-etherpad-skin +[submodule "repos/bbb-etherpad-plugin"] + path = repos/bbb-etherpad-plugin + url = https://github.com/alangecker/bbb-etherpad-plugin +[submodule "repos/bbb-webhooks"] + path = repos/bbb-webhooks + url = https://github.com/bigbluebutton/bbb-webhooks +[submodule "repos/bbb-playback"] + path = repos/bbb-playback + url = https://github.com/bigbluebutton/bbb-playback +[submodule "repos/freeswitch"] + path = repos/freeswitch + url = https://github.com/signalwire/freeswitch.git +[submodule "repos/bigbluebutton"] + path = repos/bigbluebutton + url = https://github.com/bigbluebutton/bigbluebutton.git +[submodule "repos/bbb-webrtc-sfu"] + path = repos/bbb-webrtc-sfu + url = https://github.com/bigbluebutton/bbb-webrtc-sfu.git +[submodule "repos/bbb-pads"] + path = repos/bbb-pads + url = https://github.com/bigbluebutton/bbb-pads.git +[submodule "repos/bbb-webrtc-recorder"] + path = repos/bbb-webrtc-recorder + url = https://github.com/bigbluebutton/bbb-webrtc-recorder.git diff --git a/opt/02-core/bigbluebutton/CHANGELOG.md b/opt/02-core/bigbluebutton/CHANGELOG.md new file mode 100644 index 0000000..8dd1e7a --- /dev/null +++ b/opt/02-core/bigbluebutton/CHANGELOG.md @@ -0,0 +1,140 @@ +# Changelog + +## Unreleased + +## Release v3.0.4 (2025-03-27) +- update to 3.0.4 @tibroc [#347](https://github.com/bigbluebutton/docker/pull/347 +- fix not accepting length of dial in / voiceBridge numbers @alangecker +- upgrade: migrate postgres & greenlight data @alangecker + +## Release v3.0.1 (2025-03-11) +**Breaking change!** make sure to read the [upgrading notes](https://github.com/bigbluebutton/docker/blob/develop/docs/upgrading.md) + +- :tada: **BigBlueButton 3.0** [#313](https://github.com/bigbluebutton/docker/pull/313) + + +## Release v2.7.3 (2023-12-08) + +**Breaking change!** make sure to read the [upgrading notes](https://github.com/bigbluebutton/docker/blob/develop/docs/upgrading.md) + +- BigBlueButton 2.7.3 @alangecker [#304](https://github.com/bigbluebutton/docker/pull/304) +- use local sources instead of pulling inside container @alangecker [#307](https://github.com/bigbluebutton/docker/pull/307) +- BigBlueButton 2.7.0 @alangecker [#291](https://github.com/bigbluebutton/docker/pull/291) +- Update to ComposeV2 @leonidas-o [#271](https://github.com/bigbluebutton/docker/pull/271) +- recordings: fix for missing `SHARED_SECRET` @ichdasich [#274](https://github.com/bigbluebutton/docker/issues/274) [#268](https://github.com/bigbluebutton/docker/issues/268) +- Add RESOLVER_ADDRESS to env for docker-nginx-auto-ssl @pkolmann [#277](https://github.com/bigbluebutton/docker/pull/277) +- Fix learning-dashboard @yanus [#262](https://github.com/bigbluebutton/docker/pull/262) + +## Release v2.6.0-2 (2023-04-04) +- hotfix for broken freeswitch container due to enabled compresion with max file count == 1 [#260](https://github.com/bigbluebutton/docker/issues/260) + +## Release v2.6.0 (2023-04-03) +- **Breaking change:** Greenlight v3 (see [upgrade note](docs/upgrading.md) @alangecker [#255](https://github.com/bigbluebutton/docker/pull/255) +- BigBlueButton v2.6 @alangecker [#255](https://github.com/bigbluebutton/docker/pull/255) +- Set client_max_body_size for greenlight @nr23730 [#252](https://github.com/bigbluebutton/docker/pull/252) +- self building freeswitch (applying patches and independent from external apt repos) @alangecker +- reduce amount of logs with senstivie data @alangecker + +## Release v2.5.8 (2022-11-06) +- BBB 2.5.8 @alangecker [#238](https://github.com/bigbluebutton/docker/pull/238) +- recordings: fix for missing ffmpeg filter @alangecker [#235](https://github.com/bigbluebutton/docker/issues/235) [#230](https://github.com/bigbluebutton/docker/pull/230) + +## Release v2.5.0 (2022-06-10) +- BigBlueButton v2.5 @alangecker [#207](https://github.com/bigbluebutton/docker/pull/207) +- central `tags.env` file with the tag names of most BBB components @alangecker +- Usage of [official docker build images](https://gitlab.senfcall.de/senfcall-public/docker-bbb-build) for building @alangecker +- publish docker images @alangecker [#174](https://github.com/bigbluebutton/docker/issues/174) +- etherpad: enforce bbb-pads session handling @pedrobmarin [#211](https://github.com/bigbluebutton/docker/pull/211) +- etherpad: avoid icons overlapping @pedrobmarin [#210](https://github.com/bigbluebutton/docker/pull/210) +- fix recordings which include presentation polls @lightweight [#205](https://github.com/bigbluebutton/docker/pull/205) + +## Release v2.4.5 (2022-03-24) +- Applied BBB v2.4.5 changes @alangecker +- New mute & unmute sounds by senfcall +- Update etherpad @pedrobmarin [#202](https://github.com/bigbluebutton/docker/pull/202) +- Use own freeswitch mirror instead of the official login-only one @alangecker [#203](https://github.com/bigbluebutton/docker/issues/203) +- Ignore docker-compose.override.yml @dorianim [#183](https://github.com/bigbluebutton/docker/pull/183) + +## Release v2.4.4 (2022-02-23) +- Applied v2.4.4 changes @alangecker [#195](https://github.com/bigbluebutton/docker/pull/195) +- Update Russian sound announcement examples @lexuzieel [#196](https://github.com/bigbluebutton/docker/pull/196) +- fix for presentation slides not displayed if they contain type 3 fonts @rottaran [#191](https://github.com/bigbluebutton/docker/pull/191) + +## Release v2.4.0 (2021-12-29) +- BigBlueButton v2.4 @alangecker [#159](https://github.com/bigbluebutton/docker/pull/159) +- **Breaking change:** change nginx port from `8080` to `48087`. see [upgrade note](docs/upgrading.md) @alangeker [#133](https://github.com/bigbluebutton/docker/issues/133) +- Enable optimization for Prometheus Exporter when recording is enabled @omidmaldar [#161](https://github.com/bigbluebutton/docker/pull/161) +- Automatically remove old recordings after N days @omidmaldar [#162](https://github.com/bigbluebutton/docker/pull/162) + + +## Release v2.3.14-1 (2021-10-06) +- Applied changes v2.3.5-v2.3.14 @alangecker +- updated wget to not use proxies [#143](https://github.com/bigbluebutton/docker/pull/143) @mghadam +- fixed sed delimiter for CERTPATH and KEYPATH [#144](https://github.com/bigbluebutton/docker/pull/144) @mghadam +- https_proxy: fix setting of ALLOWED_DOMAINS [#145](https://github.com/bigbluebutton/docker/pull/145) @clandmeter +- coturn: expose ENABLE_HTTPS_PROXY env variable [#146](https://github.com/bigbluebutton/docker/pull/146) [#156](https://github.com/bigbluebutton/docker/pull/156) @clandmeter @omidmaldar + +## Release v2.3.4-1 (2021-06-22) #131 +- Applied v2.3.4 changes [#130](https://github.com/bigbluebutton/docker/pull/130) @alangecker +- Reintegrate turn with default ports and support for external certificates [#126](https://github.com/bigbluebutton/docker/pull/126) @cjhille +- Fix freeswitch package names for languages with uppercase characters in the path [#119](https://github.com/bigbluebutton/docker/pull/119) @lexuzieel +- Exclude CLIENT_TITLE when generating compose file [#118](https://github.com/bigbluebutton/docker/pull/118) @bb +- Fix for preuploaded presentations not working [#116](https://github.com/bigbluebutton/docker/pull/116) @manfred-w +- Add POSTGRESQL_SECRET as environement variable [#111](https://github.com/bigbluebutton/docker/pull/111) @caminsha + + +## Release v2.3.0 +- :tada: **BigBlueButton 2.3** including all its changes +- Template based generation of docker-compose.yml [2.2.x#71](https://github.com/alangecker/bigbluebutton-docker/pull/71) [2.2.x#42](https://github.com/alangecker/bigbluebutton-docker/issues/42) @trickert76 @alangecker +- Removal of `core` and all dependencies on the bigbluebutton ubuntu repository. Seperate container for `bbb-web`, `fsesl-akka` and `apps-akka` [2.2.x#26](https://github.com/alangecker/bigbluebutton-docker/issues/26) @alangecker +- Fix recordings for Moodle BBB plugin: [2.2.x#110](https://github.com/alangecker/bigbluebutton-docker/pull/110) @danjesus +- Fixed recordings container restart setting [2.2.x#109](https://github.com/alangecker/bigbluebutton-docker/pull/109) @manfred-w +- Option for freeswitch language [2.2.x#85](https://github.com/alangecker/bigbluebutton-docker/pull/85) @alangecker @Daedalus3 +- Disabled integrated coturn [#73](https://github.com/bigbluebutton/docker/issues/73) + +## Release v2.2.31-1 (2020-12-23) #84 +- Applied v2.2.31 changes @alangecker +- Fix when presentation after recording unable to delete and change access rights #82 #63 @cardinalit +- Enable cameraQualityThresholds by default + +## Release v2.2.30-1 (2020-12-01) #79 +- Applied v2.2.30 changes @alangecker +- Applied v2.2.29 changes @alangecker +- Fix bug due to unnecessary port forward #81 @trickert76 @alangecker + +## Release v2.2.28-1 (2020-10-22) #67 +- Applied v2.2.28 changes @alangecker +- Etherpad skin & plugin #69 @alangecker +- Updated `development.md` docs (example config & note about issue #66) @alangecker +- Allow setting the breakout room limit @alangecker + +## Release v2.2.27-2 (2020-10-16) +- Increase proxy timeout to avoid aborting websocket connections @alangecker +- Added a changelog + +## Release v2.2.27-1 (2020-10-14) +- Applied BBB v2.2.27 changes https://github.com/bigbluebutton/bigbluebutton/releases/tag/v2.2.27 @alangecker +- Upgrade docker base images (etherpad and bigbluebutton-exporter) @alangecker + +## Release v2.2.26-1 (2020-09-29) +- Applied changes from BBB v2.2.24 to v2.2.26 #58 #60 @alangecker + +## Release v2.2.23-1 (2020-09-06) +- :tada: Recording #16 by @artemtech and @alangecker +- v2.2.23 changes by @alangecker +- sip_profile extension field #54 by @yksflip +- Remove greenlight container name #49 by @alangecker + +## Hotfix (2020-08-15) +- Allow imagemagick to convert to pdf/svg #51 #52 @alangecker + +## Release v2.2.22-1 (2020-08-12) #50 +- v2.2.22 changes by @alangecker +- Disable freeswitch logfiles inside containers + +## Release v2.2.21-1 (2020-7-18) +- Changes for v2.2.21 #44 @alangecker +- expose more BBB settings in .env file #34 @cjhille +- IPv6 Support #32 @alangecker +- Development Mode & Instructions #39 @alangecker +- Prometheus Exporter Integration #40 @alangecker diff --git a/opt/02-core/bigbluebutton/LICENSE b/opt/02-core/bigbluebutton/LICENSE new file mode 100644 index 0000000..65c5ca8 --- /dev/null +++ b/opt/02-core/bigbluebutton/LICENSE @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/opt/02-core/bigbluebutton/README.md b/opt/02-core/bigbluebutton/README.md new file mode 100644 index 0000000..1b658ae --- /dev/null +++ b/opt/02-core/bigbluebutton/README.md @@ -0,0 +1,82 @@ +bbb-docker-banner + + +# 📦 BigBlueButton 3.0 Docker + +Version: 3.0.4 | [Changelog](CHANGELOG.md) | [Issues](https://github.com/bigbluebutton/docker/issues) | [Upgrading](docs/upgrading.md) | [Development](docs/development.md) + +## Features +- Easy installation +- Greenlight included +- TURN server included +- Fully automated HTTPS certificates +- Full IPv6 support +- Runs on any major linux distributon (Debian, Ubuntu, CentOS,...) + +## currently missing / broken +- NAT support +- bbb-transcription-controller +- livekit + +## Requirements +- 4GB of RAM +- Linux (it will not work under Windows/WSL) +- Root access (bbb-docker uses host networking, so it won't work with Kubernetes, any "CaaS"-Service, etc.) +- Public IPv4 (expect issues with a firewall / NAT) +- firewall allows internal networking (e.g. for ufw: `ufw allow 10.7.7.0/24`) +- git installed + +## Install production server +1. Ensure the requirements above are fulfilled (it really doesn't work without them) +2. Install docker-ce & docker-compose-plugin + 1. follow instructions + * Debian: https://docs.docker.com/engine/install/debian/ + * CentOS: https://docs.docker.com/engine/install/centos/ + * Fedora: https://docs.docker.com/engine/install/fedora/ + * Ubuntu: https://docs.docker.com/engine/install/ubuntu/ + 2. Ensure docker works with `$ docker run hello-world` + 3. Ensure you use a docker version ≥ 23.0 : `$ docker --version` +3. Clone this repository + ```sh + $ git clone https://github.com/bigbluebutton/docker.git bbb-docker + $ cd bbb-docker + + # optional: use the more stable main branch (often much older) + $ git checkout main + ``` +4. Run setup: + ```bash + $ ./scripts/setup + ``` +5. (optional) Make additional configuration adjustments + ```bash + $ nano .env + # always recreate the docker-compose.yml file after making any changes + $ ./scripts/generate-compose + ``` +6. Start containers: + ```bash + $ docker compose up -d --no-build + ``` +7. If you use greenlight, you can create an admin account with: + ```bash + $ docker compose exec greenlight bundle exec rake admin:create + ``` + +## Development setup +1. Clone this repository + ```sh + $ git clone --recurse-submodules https://github.com/bigbluebutton/docker.git bbb-dev + ``` +2. Start dev server + ```sh + $ cd bbb-dev + $ ./scripts/dev + ``` +3. Use API Mate with the link presented in the console to create & join a conference + + +## Further How-To's + +- [Integration into an existing web server](docs/existing-web-server.md) + diff --git a/opt/02-core/bigbluebutton/conf/.gitignore b/opt/02-core/bigbluebutton/conf/.gitignore new file mode 100644 index 0000000..55a0124 --- /dev/null +++ b/opt/02-core/bigbluebutton/conf/.gitignore @@ -0,0 +1,4 @@ +*/* +!.gitkeep +!example.xml +*.pdf \ No newline at end of file diff --git a/opt/02-core/bigbluebutton/conf/sip_profiles/.gitkeep b/opt/02-core/bigbluebutton/conf/sip_profiles/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/opt/02-core/bigbluebutton/conf/sip_profiles/example.xml b/opt/02-core/bigbluebutton/conf/sip_profiles/example.xml new file mode 100644 index 0000000..513d245 --- /dev/null +++ b/opt/02-core/bigbluebutton/conf/sip_profiles/example.xml @@ -0,0 +1,12 @@ + + + diff --git a/opt/02-core/bigbluebutton/data/.gitkeep b/opt/02-core/bigbluebutton/data/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/opt/02-core/bigbluebutton/docker-compose.tmpl.yml b/opt/02-core/bigbluebutton/docker-compose.tmpl.yml new file mode 100644 index 0000000..7f8acd1 --- /dev/null +++ b/opt/02-core/bigbluebutton/docker-compose.tmpl.yml @@ -0,0 +1,576 @@ +{{/* if you read this, you can ignore the following lines */}} +# auto generated by ./scripts/generate-compose +# don't edit this directly. +{{/* -------- */}} + +{{ $ignore_tls_cert_errors := or (isTrue .Env.DEV_MODE) (isTrue .Env.IGNORE_TLS_CERT_ERRORS)}} + +services: + {{ if isTrue .Env.DEV_MODE }} + html5-dev: + build: + context: mod/html5-dev + args: + BBB_BUILD_TAG: {{ .Env.BBB_BUILD_TAG }} + user: ${BBB_DEV_UID}:${BBB_DEV_GID} + restart: unless-stopped + volumes: + - ./repos/bigbluebutton/bigbluebutton-html5:/app/:rw + - ./.cache/npm:/tmp/.npm:rw + network_mode: host + {{ end }} + + bbb-web: + build: + context: mod/bbb-web + additional_contexts: + - src-web=./repos/bigbluebutton/bigbluebutton-web + - src-common-message=./repos/bigbluebutton/bbb-common-message + - src-common-web=./repos/bigbluebutton/bbb-common-web + args: + BBB_BUILD_TAG: {{ .Env.BBB_BUILD_TAG }} + image: alangecker/bbb-docker-web:{{ .Env.TAG_BBB }} + restart: unless-stopped + depends_on: + - redis + - etherpad + - bbb-pads + - collabora + healthcheck: + test: wget --no-proxy --no-verbose --tries=1 --spider http://10.7.7.2:8090/bigbluebutton/api || exit 1 + start_period: 2m + environment: + IGNORE_TLS_CERT_ERRORS: {{ $ignore_tls_cert_errors }} + DOMAIN: ${DOMAIN} + ENABLE_RECORDING: ${ENABLE_RECORDING:-false} + SHARED_SECRET: ${SHARED_SECRET} + WELCOME_MESSAGE: ${WELCOME_MESSAGE:-} + WELCOME_FOOTER: ${WELCOME_FOOTER} + STUN_SERVER: stun:${STUN_IP}:${STUN_PORT} + ENABLE_HTTPS_PROXY: ${ENABLE_HTTPS_PROXY:-false} + TURN_SECRET: ${TURN_SECRET:-} + TURN_EXT_SERVER: ${TURN_EXT_SERVER:-} + TURN_EXT_SECRET: ${TURN_EXT_SECRET:-} + ENABLE_LEARNING_DASHBOARD: ${ENABLE_LEARNING_DASHBOARD:-true} + volumes: + - ./data/bigbluebutton:/var/bigbluebutton + - ./data/freeswitch-meetings:/var/freeswitch/meetings + networks: + bbb-net: + ipv4_address: 10.7.7.2 + + + freeswitch: + container_name: bbb-freeswitch + build: + context: mod/freeswitch + additional_contexts: + - freeswitch=./repos/freeswitch/ + - build-files=./repos/bigbluebutton/build/packages-template/bbb-freeswitch-core/ + - fs-config=./repos/bigbluebutton/bbb-voice-conference/config/freeswitch/conf/ + args: + BBB_BUILD_TAG: {{ .Env.BBB_BUILD_TAG }} + image: alangecker/bbb-docker-freeswitch:{{ .Env.TAG_FREESWITCH }}-{{ .Env.TAG_BBB }} + restart: unless-stopped + cap_add: + - IPC_LOCK + - NET_ADMIN + - NET_RAW + - NET_BROADCAST + - SYS_NICE + - SYS_RESOURCE + environment: + DOMAIN: ${DOMAIN} + EXTERNAL_IPv4: ${EXTERNAL_IPv4} + EXTERNAL_IPv6: ${EXTERNAL_IPv6:-::1} + SIP_IP_ALLOWLIST: ${SIP_IP_ALLOWLIST:-} + DISABLE_SOUND_MUTED: ${DISABLE_SOUND_MUTED:-false} + DISABLE_SOUND_ALONE: ${DISABLE_SOUND_ALONE:-false} + SOUNDS_LANGUAGE: ${SOUNDS_LANGUAGE:-en-us-callie} + ESL_PASSWORD: ${FSESL_PASSWORD:-ClueCon} + {{ if .Env.SIP_IP_ALLOWLIST }} + ports: + - 5060:5060/udp + {{ end }} + volumes: + - ./conf/sip_profiles:/etc/freeswitch/sip_profiles/external-dialin + - ./data/freeswitch-meetings:/var/freeswitch/meetings + networks: + bbb-net: + ipv4_address: 10.7.7.10 + logging: + # reduce logs to a minimum, so `docker compose logs -f` still works + driver: "local" + options: + max-size: "10k" + max-file: "1" + compress: "false" + + nginx: + build: + context: mod/nginx + additional_contexts: + - src-learning-dashboard=./repos/bigbluebutton/bbb-learning-dashboard + - src-playback=./repos/bbb-playback + - src-html5=./repos/bigbluebutton/bigbluebutton-html5 + args: + BBB_BUILD_TAG: {{ .Env.BBB_BUILD_TAG }} + TAG_BBB: {{ .Env.TAG_BBB }} + image: alangecker/bbb-docker-nginx:{{ .Env.TAG_BBB }}-{{ .Env.TAG_PLAYBACK }}-1.25 + restart: unless-stopped + volumes: + - ./data/bigbluebutton:/var/bigbluebutton + - ${DEFAULT_PRESENTATION:-/dev/null}:/www/default.pdf + + {{ if isTrue .Env.DEV_MODE }} + # overwrite html5 config + - ./mod/nginx/bbb-html5.dev.nginx:/etc/nginx/bbb/bbb-html5.nginx:ro + {{ end }} + tmpfs: + - /tmp + network_mode: host + extra_hosts: + - "host.docker.internal:10.7.7.1" + - "bbb-web:10.7.7.2" + - "etherpad:10.7.7.4" + - "webrtc-sfu:10.7.7.1" + - "greenlight:10.7.7.21" + - "bbb-graphql-server:10.7.7.31" + - "bbb-graphql-middleware:10.7.7.32" + + etherpad: + build: + context: mod/etherpad + additional_contexts: + - plugin=./repos/bbb-etherpad-plugin + - skin=./repos/bbb-etherpad-skin + args: + TAG_ETHERPAD: "2.2.7" + image: alangecker/bbb-docker-etherpad:2.2.7-s{{ .Env.COMMIT_ETHERPAD_SKIN }}-p{{ .Env.COMMIT_ETHERPAD_PLUGIN }} + restart: unless-stopped + depends_on: + - redis + - collabora + environment: + ETHERPAD_API_KEY: ${ETHERPAD_API_KEY} + networks: + bbb-net: + ipv4_address: 10.7.7.4 + + bbb-pads: + build: + context: mod/bbb-pads + additional_contexts: + - src=./repos/bbb-pads + image: alangecker/bbb-docker-pads:{{ .Env.TAG_PADS }} + restart: unless-stopped + depends_on: + - redis + - etherpad + environment: + ETHERPAD_API_KEY: ${ETHERPAD_API_KEY} + networks: + bbb-net: + ipv4_address: 10.7.7.18 + + bbb-export-annotations: + build: + context: mod/bbb-export-annotations + additional_contexts: + src: ./repos/bigbluebutton/bbb-export-annotations + image: alangecker/bbb-docker-bbb-export-annotations:{{ .Env.TAG_BBB }} + restart: unless-stopped + depends_on: + - redis + - etherpad + - bbb-pads + networks: + # need connections to: + # https://github.com/bigbluebutton/bigbluebutton/blob/v2.7.0/bbb-export-annotations/config/settings.json + # "bbbWebAPI": "http://127.0.0.1:8090", -> bbb-web + # "bbbPadsAPI": "http://127.0.0.1:9002", -> bbb-pads + bbb-net: + ipv4_address: 10.7.7.19 + volumes: + - ./data/bigbluebutton:/var/bigbluebutton + tmpfs: + - /tmp + + redis: + image: redis:7.2-alpine + restart: unless-stopped + healthcheck: + test: ["CMD", "redis-cli", "ping"] + interval: 1s + timeout: 3s + retries: 30 + networks: + bbb-net: + ipv4_address: 10.7.7.5 + + webrtc-sfu: + build: + context: mod/webrtc-sfu + additional_contexts: + - source=./repos/bbb-webrtc-sfu + args: + BBB_BUILD_TAG: {{ .Env.BBB_BUILD_TAG }} + image: alangecker/bbb-docker-webrtc-sfu:{{ .Env.TAG_WEBRTC_SFU }} + restart: unless-stopped + depends_on: + - redis + - freeswitch + environment: + ESL_PASSWORD: ${FSESL_PASSWORD:-ClueCon} + {{ if .Env.EXTERNAL_IPv6 }} + MS_WEBRTC_LISTEN_IPS: '[{"ip":"::", "announcedIp":"${EXTERNAL_IPv6}"}, {"ip":"${EXTERNAL_IPv4}", "announcedIp":"${EXTERNAL_IPv4}"}]' + {{else}} + MS_WEBRTC_LISTEN_IPS: '[{"ip":"${EXTERNAL_IPv4}", "announcedIp":"${EXTERNAL_IPv4}"}]' + {{end}} + volumes: + - ./data/mediasoup:/var/mediasoup + tmpfs: + - /var/log/bbb-webrtc-sfu + network_mode: host + security_opt: + - seccomp:unconfined # allow io_uring access for mediasoup + ulimits: + memlock: -1 # allow io_uring_register_buffers to allocate enough ram + + fsesl-akka: + build: + context: mod/fsesl-akka + additional_contexts: + - src-common-message=./repos/bigbluebutton/bbb-common-message + - src-fsesl-client=./repos/bigbluebutton/bbb-fsesl-client + - src-fsesl-akka=./repos/bigbluebutton/akka-bbb-fsesl + args: + BBB_BUILD_TAG: {{ .Env.BBB_BUILD_TAG }} + image: alangecker/bbb-docker-fsesl-akka:{{ .Env.TAG_BBB }} + restart: unless-stopped + depends_on: + - redis + - freeswitch + environment: + FSESL_PASSWORD: ${FSESL_PASSWORD:-ClueCon} + networks: + bbb-net: + ipv4_address: 10.7.7.14 + + apps-akka: + build: + context: mod/apps-akka + additional_contexts: + - src-common-message=./repos/bigbluebutton/bbb-common-message + - src-apps-akka=./repos/bigbluebutton/akka-bbb-apps + - src-config=./repos/bigbluebutton/bigbluebutton-html5/private/config/ + args: + BBB_BUILD_TAG: {{ .Env.BBB_BUILD_TAG }} + TAG_BBB: {{ .Env.TAG_BBB }} + image: alangecker/bbb-docker-apps-akka:{{ .Env.TAG_BBB }} + restart: unless-stopped + depends_on: + - redis + - postgres + environment: + DOMAIN: ${DOMAIN} + SHARED_SECRET: ${SHARED_SECRET} + POSTGRES_PASSWORD: ${POSTGRESQL_SECRET:-password} + volumes: + - ./data/freeswitch-meetings:/var/freeswitch/meetings + - ./conf/bbb-html5.yml:/etc/bigbluebutton/bbb-html5.yml:ro + networks: + bbb-net: + ipv4_address: 10.7.7.15 + + bbb-graphql-server: + build: + context: mod/bbb-graphql-server + additional_contexts: + - src=./repos/bigbluebutton/bbb-graphql-server + args: + BBB_BUILD_TAG: {{ .Env.BBB_BUILD_TAG }} + GRAPHQL_ENGINE_TAG: v2.45.0 + image: alangecker/bbb-docker-graphql-server:{{ .Env.TAG_BBB }} + depends_on: + - postgres + - bbb-web + - apps-akka + - bbb-graphql-actions + restart: unless-stopped + environment: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: ${POSTGRESQL_SECRET:-password} + HASURA_GRAPHQL_ADMIN_SECRET: TODO_CHANGE_ME + networks: + bbb-net: + ipv4_address: 10.7.7.31 + + + bbb-graphql-actions: + build: + context: mod/bbb-graphql-actions + {{ if isTrue .Env.DEV_MODE }} + dockerfile: Dockerfile.dev + {{ else }} + additional_contexts: + - src=./repos/bigbluebutton/bbb-graphql-actions + {{ end }} + args: + BBB_BUILD_TAG: {{ .Env.BBB_BUILD_TAG }} + image: alangecker/bbb-docker-graphql-actions:{{ .Env.TAG_BBB }} + restart: unless-stopped + depends_on: + - redis + - apps-akka + networks: + bbb-net: + ipv4_address: 10.7.7.30 + {{ if isTrue .Env.DEV_MODE }} + volumes: + - ./repos/bigbluebutton/bbb-graphql-actions:/app/:rw + - ./.cache/npm:/tmp/.npm:rw + {{ end }} + + bbb-graphql-middleware: + build: + context: mod/bbb-graphql-middleware + {{ if isTrue .Env.DEV_MODE }} + dockerfile: Dockerfile.dev + {{ else }} + additional_contexts: + - src=./repos/bigbluebutton/bbb-graphql-middleware + {{ end }} + args: + BBB_BUILD_TAG: {{ .Env.BBB_BUILD_TAG }} + image: alangecker/bbb-docker-graphql-middleware:{{ .Env.TAG_BBB }} + restart: unless-stopped + depends_on: + - bbb-graphql-server + - bbb-graphql-actions + - bbb-web + - redis + networks: + bbb-net: + ipv4_address: 10.7.7.32 + extra_hosts: + - "nginx:10.7.7.1" + + {{ if isTrue .Env.DEV_MODE }} + user: ${BBB_DEV_UID}:${BBB_DEV_GID} + volumes: + - ./repos/bigbluebutton/bbb-graphql-middleware:/app/:ro + - ./repos/bigbluebutton/bbb-graphql-middleware/config/config.yml:/usr/share/bbb-graphql-middleware/config.yml:ro + - ./mod/bbb-graphql-middleware/config.yml:/etc/bigbluebutton/bbb-graphql-middleware.yml:ro + - ./.cache/go:/gopath:rw + - ./.cache/go-build:/.cache/go-build:rw + {{ end }} + + collabora: + image: collabora/code:latest + restart: unless-stopped + tmpfs: + - /tmp + networks: + bbb-net: + ipv4_address: 10.7.7.20 + # disable logging (way to verbose) + logging: + driver: none + + + periodic: + build: mod/periodic + image: alangecker/bbb-docker-periodic:v3.0.0 + restart: unless-stopped + + volumes: + - /var/run/docker.sock:/var/run/docker.sock + - ./data/bigbluebutton:/var/bigbluebutton + - ./data/mediasoup:/var/mediasoup + tmpfs: + - /var/log/bigbluebutton + environment: + ENABLE_RECORDING: ${ENABLE_RECORDING} + REMOVE_OLD_RECORDING: ${REMOVE_OLD_RECORDING} + RECORDING_MAX_AGE_DAYS: ${RECORDING_MAX_AGE_DAYS} + networks: + bbb-net: + ipv4_address: 10.7.7.12 + +{{ if isTrue .Env.ENABLE_RECORDING }} + # recordings + recordings: + build: + context: mod/recordings + additional_contexts: + - record-core=./repos/bigbluebutton/record-and-playback/core + - presentation=./repos/bigbluebutton/record-and-playback/presentation + - bbb-conf=./repos/bigbluebutton/bigbluebutton-config + args: + BBB_BUILD_TAG: {{ .Env.BBB_BUILD_TAG }} + TAG_BBB_PRESENTATION_VIDEO: "5.0.0-beta.2" + image: alangecker/bbb-docker-recordings:{{ .Env.TAG_BBB }} + restart: unless-stopped + depends_on: + - redis + - bbb-pads + environment: + DOMAIN: ${DOMAIN} + SHARED_SECRET: ${SHARED_SECRET} + volumes: + - ./data/bigbluebutton:/var/bigbluebutton + - ./data/freeswitch-meetings:/var/freeswitch/meetings + - ./data/mediasoup:/var/mediasoup + - ./data/bbb-webrtc-recorder:/var/lib/bbb-webrtc-recorder + tmpfs: + - /var/log/bigbluebutton + - /tmp + networks: + bbb-net: + ipv4_address: 10.7.7.16 + + bbb-webrtc-recorder: + build: + context: mod/bbb-webrtc-recorder + additional_contexts: + - src=./repos/bbb-webrtc-recorder + image: alangecker/bbb-docker-webrtc-recorder:{{ .Env.TAG_WEBRTC_RECORDER }} + depends_on: + - redis + volumes: + - ./data/bbb-webrtc-recorder:/var/lib/bbb-webrtc-recorder + # WebRTC connection to bbb-webrtc-sfu seem to + # only to work via the external IP + network_mode: host + extra_hosts: + - "redis:10.7.7.5" +{{end}} + +{{ if isTrue .Env.ENABLE_WEBHOOKS }} + # webhooks + webhooks: + build: + context: mod/webhooks + additional_contexts: + - src=./repos/bbb-webhooks + image: alangecker/bbb-docker-webhooks:{{ .Env.TAG_WEBHOOKS }} + restart: unless-stopped + environment: + DOMAIN: ${DOMAIN} + SHARED_SECRET: ${SHARED_SECRET} + depends_on: + - redis + networks: + bbb-net: + ipv4_address: 10.7.7.17 +{{end}} + +{{ if isTrue .Env.ENABLE_HTTPS_PROXY }} + + haproxy: + build: mod/haproxy + image: alangecker/bbb-haproxy:2.8.10 + volumes: + - ./data/haproxy/letsencrypt:/etc/letsencrypt + - ./mod/haproxy/haproxy.cfg:/etc/haproxy/haproxy.cfg + - ./mod/haproxy/protocolmap:/etc/haproxy/protocolmap + environment: + - IGNORE_TLS_CERT_ERRORS={{$ignore_tls_cert_errors}} + - CERT1=${DOMAIN} + - EMAIL=${LETSENCRYPT_EMAIL} + network_mode: host +{{end}} + + # coturn + coturn: + image: coturn/coturn:4.6-alpine + restart: unless-stopped + command: + - "--external-ip=${EXTERNAL_IPv4}/${EXTERNAL_IPv4}" + - "--external-ip=${EXTERNAL_IPv6:-::1}/${EXTERNAL_IPv6:-::1}" + - "--static-auth-secret=${TURN_SECRET}" + - "--allowed-peer-ip=${EXTERNAL_IPv4}" + - "--relay-ip=${EXTERNAL_IPv4}" + - "--relay-ip=${EXTERNAL_IPv6:-::1}" + volumes: + - ./mod/coturn/turnserver.conf:/etc/coturn/turnserver.conf + network_mode: host + + +{{ if isTrue .Env.ENABLE_GREENLIGHT }} + # greenlight + greenlight: + image: bigbluebutton/greenlight:v3.5.0 + restart: unless-stopped + env_file: .env + depends_on: + - postgres + - redis + + environment: + DATABASE_URL: postgres://postgres:${POSTGRESQL_SECRET:-password}@postgres:5432/greenlight + REDIS_URL: redis://redis:6379 + {{ if $ignore_tls_cert_errors }} + BIGBLUEBUTTON_ENDPOINT: http://10.7.7.1:48083/bigbluebutton/api + {{else}} + BIGBLUEBUTTON_ENDPOINT: https://${DOMAIN}/bigbluebutton/api + {{end}} + BIGBLUEBUTTON_SECRET: ${SHARED_SECRET} + SECRET_KEY_BASE: ${RAILS_SECRET} + RELATIVE_URL_ROOT: / + volumes: + - ./data/greenlight:/usr/src/app/storage + networks: + bbb-net: + ipv4_address: 10.7.7.21 +{{end}} + + postgres: + image: postgres:16-alpine + restart: unless-stopped + environment: + POSTGRES_MULTIPLE_DATABASES: bbb_graphql,hasura_app,greenlight + POSTGRES_USER: postgres + POSTGRES_PASSWORD: ${POSTGRESQL_SECRET:-password} + healthcheck: + test: ["CMD-SHELL", "pg_isready -U postgres"] + interval: 10s + timeout: 5s + retries: 5 + volumes: + - ./data/postgres:/var/lib/postgresql/data + - ./mod/postgres/initdb.sh:/docker-entrypoint-initdb.d/initdb.sh + networks: + bbb-net: + ipv4_address: 10.7.7.22 + +{{ if isTrue .Env.ENABLE_PROMETHEUS_EXPORTER }} + # prometheus + prometheus-exporter: + image: greenstatic/bigbluebutton-exporter:latest + restart: unless-stopped + environment: + API_BASE_URL: http://10.7.7.1:48087/bigbluebutton/api/ + API_SECRET: ${SHARED_SECRET} + RECORDINGS_METRICS_READ_FROM_DISK: "${ENABLE_PROMETHEUS_EXPORTER_OPTIMIZATION:-false}" + networks: + bbb-net: + ipv4_address: 10.7.7.33 + {{ if isTrue .Env.ENABLE_PROMETHEUS_EXPORTER_OPTIMIZATION }} + volumes: + - ./data/bigbluebutton:/var/bigbluebutton:ro + {{end}} + + # the exporter requires /etc/bigbluebutton/bigbluebutton-release + tmpfs: + - /etc/bigbluebutton:mode=777 + entrypoint: sh -c 'echo "BIGBLUEBUTTON_RELEASE=2.7.3" > /etc/bigbluebutton/bigbluebutton-release && python server.py' +{{end}} + +networks: + bbb-net: + ipam: + driver: default + config: + - subnet: "10.7.7.0/24" diff --git a/opt/02-core/bigbluebutton/docs/behind-nat.md b/opt/02-core/bigbluebutton/docs/behind-nat.md new file mode 100644 index 0000000..3a8d1e6 --- /dev/null +++ b/opt/02-core/bigbluebutton/docs/behind-nat.md @@ -0,0 +1,14 @@ +# Note if you use a Firewall / NAT +Kurento binds somehow always to the external IP instead of the local one or `0.0.0.0`. For that reason you need to add your external IP to your interface. + +#### Temporary way (until next reboot) +``` +$ ip addr add 144.76.97.34/32 dev ens3 +``` + +#### Permanent way +Specific to your linux distribution. Use a search engine of your choice. ;) + +## Ports +Also don't forget to forward all necassary ports listed in https://docs.bigbluebutton.org/admin/configure-firewall.html + diff --git a/opt/02-core/bigbluebutton/docs/development.md b/opt/02-core/bigbluebutton/docs/development.md new file mode 100644 index 0000000..e782a97 --- /dev/null +++ b/opt/02-core/bigbluebutton/docs/development.md @@ -0,0 +1,50 @@ +# bbb-docker Development + +## Basics +normally people start BBB with the pre-built docker images, but for developing you need to build them by yourself. For that you need to ensure that the submodules are also checked out + +```sh +$ git clone --recurse-submodules https://github.com/bigbluebutton/docker.git bbb-dev +$ cd bbb-dev +``` + +## Running +you can now run bbb-docker locally by simply starting + +```sh +$ ./scripts/dev +``` + +Use the API Mate with the link presented in the console to create & join a conference. + +### Hints +- the html5 component will watch and automatically reload on any changes 🚀 +- if you change anything in the other components, you need to + * manually rebuilt it \ + `$ docker compose build CONTAINERNAME` + * restart it \ + `$ docker compose up -d CONTAINERNAME` +- if you change any variable in .env, always run following to rebuild the `docker-compose.yml`` + `$ ./scripts/generate-compose` +- view the logs with \ + `$ docker compose logs -f` +- At some point your browser will warn you about an invalid certificate, but you can press _"Accept the Risk and Continue" / "Proceed to 10.7.7.1 (unsafe)"_ + +## Notes +- Due to the self signed ssl certificate it is currently not possible to notify greenlight about recordings in dev mode + +## How to do create a new update for a newer BBB release? +This always consists out of following steps +1. **Get an understanding about changes that happened and find out what changes to bbb-docker that require.** \ + * main source for that are the release notes in https://github.com/bigbluebutton/bigbluebutton/releases +2. **Apply these changes to this project.** + * Often you only need to checkout the git submodules to the specific release tag + * List of all submodules: `git submodule` +3. Test everything (with firefox **and** chromium/chrome) + * Audio + * Video + * Presentation upload + * Shared Notes +4. Create a `CHANGELOG.md` entry +5. Create a Pull Request +6. Receive big thanks from @alangecker diff --git a/opt/02-core/bigbluebutton/docs/existing-web-server.md b/opt/02-core/bigbluebutton/docs/existing-web-server.md new file mode 100644 index 0000000..adf2ff8 --- /dev/null +++ b/opt/02-core/bigbluebutton/docs/existing-web-server.md @@ -0,0 +1,82 @@ +# How to integrate into an existing Web server setup + +Since the non-dockerized version of BigBlueButton has [many requirements](https://docs.bigbluebutton.org/2.2/install.html#minimum-server-requirements), such as a specific Ubuntu version (16.04) as well as ports 80/443 not being in use by other applications, and considering that [a "clean" server dedicated for BigBlueButton is recommended](https://docs.bigbluebutton.org/2.2/install.html#before-you-install), you may enjoy the benefits of this dockerized version in order to run BigBlueButton on a server that is not completely dedicated to this software, on which a Web server may be already in use. + +You could dedicate a virtual host to BigBlueButton, allowing external access to it through a reverse proxy. + +> **Note.** The automatic HTTPS Proxy is not needed if you are going to run BigBlueButton behind a reverse proxy; in that case, you should be able to enable SSL for the virtual host you are going to dedicate to BigBlueButton, using your Web server features. Please notice that it will not be possible to install and use the integrated TURN server, since it requires the automatic HTTPS Proxy to be installed; therefore, if a TURN server is required, you should install and configure it by yourself. You can set BigBlueButton to use a TURN server by uncommenting and adjusting `TURN_SERVER` and `TURN_SECRET` in the `.env` file, which is created after completion of the setup script. + +## Installation +1. Install BigBlueButton Docker [as explained above](#install). While running the setup script, please choose `n` when you're asked the following question: `Should an automatic HTTPS Proxy be included? (y/n)`. +2. Now all the required Docker containers should be running. BigBlueButton listens to port 48087. Create a virtual host by which BigBlueButton will be publicly accessible (in this case, let's assume the following server name for the virtual host: `bbb.example.com`). Enable SSL for the new _https_ virtual host. Make sure that the SSL certificate you will be using is signed by a CA (Certificate Authority). You could generate an SSL certificate for free using Let's Encrypt. It is suggested to add some directives to the _http_ virtual host `bbb.example.com` to redirect all requests to the _https_ one. + +At this point, choose one of the following sections according to which Web server you're running ([Apache](#integration-with-apache)). + +Eventually, BigBlueButton should be publicly accessible on `https://bbb.example.com/`. If you chose to install Greenlight, then the previous URL should allow you to open its home page. The APIs will be accessible through `https://bbb.example.com/bigbluebutton/`. + +## Integration with nginx +1. Add the following directives to the _https_ virtual host `bbb.example.com` +``` +map $http_upgrade $connection_upgrade { + default upgrade; + '' close; +} +map $remote_addr $endpoint_addr { + "~:" [::1]; + default 127.0.0.1; +} + +server { + listen 443 ssl http2 default_server; + listen [::]:443 ssl http2 default_server; + server_name bbb.example.com; + + ssl_certificate /etc/letsencrypt/live/bbb.example.com/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/bbb.example.com/privkey.pem; + + access_log /var/log/nginx/bigbluebutton.access.log; + error_log /var/log/nginx/bigbluebutton.error.log; + + location / { + proxy_http_version 1.1; + proxy_pass http://$endpoint_addr:48087; + 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_set_header Upgrade $http_upgrade; + proxy_set_header Connection $connection_upgrade; + proxy_cache_bypass $http_upgrade; + } +} + +``` +2. Restart nginx +``` +service nginx restart +``` + +## Integration with Apache +1. Make sure that the following Apache modules are in use: `proxy`, `rewrite`, `proxy_http`, `proxy_wstunnel`. On _apache2_, the following command activates these modules, whenever they are not already enabled: +``` +sudo a2enmod proxy rewrite proxy_http proxy_wstunnel +``` +2. Add the following directives to the _https_ virtual host `bbb.example.com`: +``` +ProxyPreserveHost On + +RewriteEngine On +RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC,OR] +RewriteCond %{HTTP:CONNECTION} ^Upgrade$ [NC] +RewriteRule .* ws://127.0.0.1:48087%{REQUEST_URI} [P,QSA,L] + + + Require all granted + ProxyPass http://127.0.0.1:48087/ + ProxyPassReverse http://127.0.0.1:48087/ + +``` +3. Restart Apache: +``` +service apache2 restart +``` diff --git a/opt/02-core/bigbluebutton/docs/network-config.md b/opt/02-core/bigbluebutton/docs/network-config.md new file mode 100644 index 0000000..3289183 --- /dev/null +++ b/opt/02-core/bigbluebutton/docs/network-config.md @@ -0,0 +1,36 @@ + +## Network Configuration +Services as configured. +|Service | Network | IP address | Other Option | +--- | --- | --- | --- +| bbb-web | bbb-net | 10.7.7.2 | +| bbb-pads | bbb-net | 10.7.7.18 | +| html5-backend-{{$i}} | bbb-net | 10.7.7.{{add 100 $i}}| Port {{ add 4000 $i }} +| html5-frontend-{{$i}}| bbb-net | 10.7.7.{{add 200 $i}}| Port {{ add 4100 $i }} +| freeswitch| network_mode: host | | +| nginx | network_mode: host| | extra_hosts:
- "host.docker.internal:10.7.7.1"
- "core:10.7.7.2"
- "etherpad:10.7.7.4"
- "webrtc-sfu:10.7.7.10"
- "html5:10.7.7.11" +| etherpad | bbb-net | 10.7.7.4| +| redis | bbb-net | 10.7.7.5| +| mongodb | bbb-net | 10.7.7.6| +| kurento | network-mode: host | | +| webrtc-sfu | bbb-net | | network_mode: host +| fsesl-akka | bbb-net | 10.7.7.14 | +| apps-akka | bbb-net | 10.7.7.15 | +| libreoffice | bbb-net | 10.7.7.7 | +| periodic | bbb-net | 10.7.7.12 | +| recordings | bbb-net | 10.7.7.16 | +| webhooks | bbb-net | 10.7.7.17 | +| https_proxy | bbb-net | |network_mode: host +| coturn | network_mode: host | | +| greenlight | | | ports: 10.7.7.1:5000:80 +| prometheus | bbb-net | 10.7.7.33 | +| bbb-export-annotations | bbb-net | 10.7.7.19 | + +```yml +networks: + bbb-net: + ipam: + driver: default + config: + - subnet: "10.7.7.0/24" +``` diff --git a/opt/02-core/bigbluebutton/docs/upgrading.md b/opt/02-core/bigbluebutton/docs/upgrading.md new file mode 100644 index 0000000..b2e8f7a --- /dev/null +++ b/opt/02-core/bigbluebutton/docs/upgrading.md @@ -0,0 +1,33 @@ +# How To Upgrade bbb-docker + +### Breaking changes `v2.7.x` -> `v3.0.x` +- **A setup behind NAT does currently not work!** +- `LETSENCRYPT_EMAIL` is now required in `.env` when used with the integrated HAProxy +- the greenlight postgres database is now called `greenlight` instead of `greenlight-v3` + + +### Breaking changes `v2.6.x` -> `v2.7.x` +- We use now Docker Compose V2 + * make sure you have docker ≥ 23.0 installed (`$ docker -v`) + * update all usages of `docker-compose` to `docker compose` in your scripts + +### Breaking changes `v2.5.x` -> `v2.6.x` +- Greenlight got fully rewritten + * it is starting as a fresh installation. you can migrate your data with `./scripts/greenlight-migrate-v2-v3` + * some greenlight settings under `.env` have changed. compare your version with `sample.env` + * it is now served directly under `/` and not in `/b`. If you use an reverse proxy not included in this repo, ensure to update your config accordingly! + +### Backup +if you use greenlight, create a database backup first +```bash +docker exec -t docker_postgres_1 pg_dumpall -c -U postgres > /root/greenlight_`date +%d-%m-%Y"_"%H_%M_%S`.sql +``` + +### Upgrading +```bash +# upgrade! +./scripts/upgrade + +# restart updated services +docker compose up -d --no-build +``` diff --git a/opt/02-core/bigbluebutton/mod/apps-akka/Dockerfile b/opt/02-core/bigbluebutton/mod/apps-akka/Dockerfile new file mode 100644 index 0000000..6d4bf57 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/apps-akka/Dockerfile @@ -0,0 +1,43 @@ +ARG BBB_BUILD_TAG +FROM bigbluebutton/bbb-build:$BBB_BUILD_TAG AS builder + +COPY --from=src-common-message / /bbb-common-message + +# build bbb-common-message +RUN cd /bbb-common-message && ./deploy.sh + +# =================================================== + +ARG TAG_APPS_AKKA + +COPY --from=src-apps-akka / /source + +# compile and unzip bin +RUN cd /source \ + && sbt universal:packageBin \ + && unzip /source/target/universal/bbb-apps-akka-0.0.4.zip -d / + +# =================================================== + + +FROM bigbluebutton/bbb-build:$BBB_BUILD_TAG AS builder-settings +RUN wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/download/v4.44.3/yq_linux_amd64 && chmod a+x /usr/local/bin/yq +COPY --from=src-config /settings.yml /settings.yml +ARG TAG_BBB +RUN yq e -i ".public.app.bbbServerVersion = \"$TAG_BBB\"" /settings.yml +RUN yq e -i ".public.app.html5ClientBuild = \"$TAG_BBB\"" /settings.yml + + +# =================================================== + +FROM alangecker/bbb-docker-base-java + +COPY --from=builder-settings /usr/local/bin/yq /usr/local/bin/yq +COPY --from=builder /bbb-apps-akka-0.0.4 /bbb-apps-akka +COPY bbb-apps-akka.conf /etc/bigbluebutton/bbb-apps-akka.conf.tmpl +COPY logback.xml /bbb-apps-akka/conf/logback.xml +COPY entrypoint.sh /entrypoint.sh +COPY --from=builder-settings --chown=bigbluebutton:bigbluebutton /settings.yml /usr/share/bigbluebutton/html5-client/private/config/settings.yml + +USER bigbluebutton +ENTRYPOINT /entrypoint.sh diff --git a/opt/02-core/bigbluebutton/mod/apps-akka/bbb-apps-akka.conf b/opt/02-core/bigbluebutton/mod/apps-akka/bbb-apps-akka.conf new file mode 100644 index 0000000..e9e3954 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/apps-akka/bbb-apps-akka.conf @@ -0,0 +1,25 @@ +// include default config from upstream +include "/bbb-apps-akka/conf/application.conf" + +redis { + host="10.7.7.5" +} + +services { + bbbWebAPI="https://DOMAIN/bigbluebutton/api" + sharedSecret="SHARED_SECRET" + graphqlMiddlewareAPI = "http://10.7.7.32:8378" +} +http { + interface = "0.0.0.0" +} + +postgres { + properties = { + serverName = "postgres" + portNumber = "5432" + databaseName = "bbb_graphql" + user = "postgres" + password = "POSTGRES_PASSWORD" + } +} \ No newline at end of file diff --git a/opt/02-core/bigbluebutton/mod/apps-akka/entrypoint.sh b/opt/02-core/bigbluebutton/mod/apps-akka/entrypoint.sh new file mode 100755 index 0000000..033429e --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/apps-akka/entrypoint.sh @@ -0,0 +1,17 @@ +#!/bin/sh -e + +# bbb-apps-akka.conf +TARGET=/etc/bigbluebutton/bbb-apps-akka.conf +cp /etc/bigbluebutton/bbb-apps-akka.conf.tmpl $TARGET +sed -i "s/DOMAIN/$DOMAIN/" $TARGET +sed -i "s/SHARED_SECRET/$SHARED_SECRET/" $TARGET +sed -i "s/POSTGRES_PASSWORD/$POSTGRES_PASSWORD/" $TARGET + + +# settings.yml +TARGET=/usr/share/bigbluebutton/html5-client/private/config/settings.yml +yq e -i ".public.kurento.wsUrl = \"wss://$DOMAIN/bbb-webrtc-sfu\"" $TARGET +yq e -i ".public.pads.url = \"https://$DOMAIN/pad\"" $TARGET + +cd /bbb-apps-akka +/bbb-apps-akka/bin/bbb-apps-akka \ No newline at end of file diff --git a/opt/02-core/bigbluebutton/mod/apps-akka/logback.xml b/opt/02-core/bigbluebutton/mod/apps-akka/logback.xml new file mode 100644 index 0000000..c29b1fb --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/apps-akka/logback.xml @@ -0,0 +1,18 @@ + + + + + %d{"yyyy-MM-dd'T'HH:mm:ss.SSSXXX"} %-5level %logger{35} - %msg%n + + + + + + + + + + + + + diff --git a/opt/02-core/bigbluebutton/mod/base-java/Dockerfile b/opt/02-core/bigbluebutton/mod/base-java/Dockerfile new file mode 100644 index 0000000..810feee --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/base-java/Dockerfile @@ -0,0 +1,24 @@ +FROM eclipse-temurin:17-jre-jammy + +RUN apt-get update && apt-get install -y \ + wget unzip gosu locales \ + imagemagick xpdf-utils curl \ + && sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen + +ENV LANG en_US.UTF-8 +ENV LANGUAGE en_US:en +ENV LC_ALL en_US.UTF-8 + +# add user & group +RUN groupadd -g 998 bigbluebutton \ + && useradd -m -u 998 -g bigbluebutton bigbluebutton \ + && mkdir /etc/bigbluebutton \ + && chown bigbluebutton:bigbluebutton /etc/bigbluebutton + +# add dockerize +ENV DOCKERIZE_VERSION v0.7.0 +RUN wget -q https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \ + && tar -C /usr/local/bin -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \ + && rm dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz + + diff --git a/opt/02-core/bigbluebutton/mod/bbb-export-annotations/Dockerfile b/opt/02-core/bigbluebutton/mod/bbb-export-annotations/Dockerfile new file mode 100644 index 0000000..d6c591f --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/bbb-export-annotations/Dockerfile @@ -0,0 +1,23 @@ +FROM node:22-bookworm-slim AS builder + +COPY --from=src / /bbb-export-annotations +RUN cd /bbb-export-annotations && npm ci && npm install + +# -------------------- + +FROM node:22-bookworm-slim + +RUN groupadd -g 998 bigbluebutton \ + && useradd -m -u 998 -g bigbluebutton bigbluebutton + +RUN apt update && apt install -y \ + nodejs npm cairosvg ghostscript imagemagick nodejs poppler-utils + +COPY --from=builder /bbb-export-annotations /bbb-export-annotations +COPY ./config/settings.json /bbb-export-annotations/config/settings.json + +USER bigbluebutton +WORKDIR /bbb-export-annotations +ENV NODE_ENV=production + +ENTRYPOINT npm start diff --git a/opt/02-core/bigbluebutton/mod/bbb-export-annotations/config/settings.json b/opt/02-core/bigbluebutton/mod/bbb-export-annotations/config/settings.json new file mode 100644 index 0000000..7fe69f4 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/bbb-export-annotations/config/settings.json @@ -0,0 +1,40 @@ +{ + "log": { + "level": "info", + "msgName": "PresAnnStatusMsg" + }, + "shared": { + "presAnnDropboxDir": "/tmp/pres-ann-dropbox", + "cairosvg": "/usr/bin/cairosvg", + "ghostscript": "/usr/bin/gs" + }, + "process": { + "maxImageWidth": 1440, + "maxImageHeight": 1080, + "pointsPerInch": 72, + "pixelsPerInch": 96, + "cairoSVGUnsafeFlag": false + }, + "notifier": { + "pod_id": "DEFAULT_PRESENTATION_POD", + "is_downloadable": "false", + "msgName": "NewPresFileAvailableMsg" + }, + "bbbWebAPI": "http://bbb-web:8090", + "bbbPadsAPI": "http://bbb-pads:9002", + "redis": { + "host": "redis", + "port": 6379, + "password": null, + "channels": { + "queue": "exportJobs", + "publish": "to-akka-apps-redis-channel" + } + }, + "fonts": { + "draw": "/usr/local/share/fonts/CaveatBrush-Regular-2015-09-23.ttf", + "sans": "/usr/local/share/fonts/CrimsonPro[wght]-1.003.ttf", + "serif": "/usr/local/share/fonts/SourceSansPro-Regular-2.045.ttf", + "mono": "/usr/local/share/fonts/SourceCodePro-Regular-2.038.ttf" + } +} \ No newline at end of file diff --git a/opt/02-core/bigbluebutton/mod/bbb-graphql-actions/Dockerfile b/opt/02-core/bigbluebutton/mod/bbb-graphql-actions/Dockerfile new file mode 100644 index 0000000..66ac9b8 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/bbb-graphql-actions/Dockerfile @@ -0,0 +1,34 @@ +ARG BBB_BUILD_TAG +FROM bigbluebutton/bbb-build:$BBB_BUILD_TAG AS builder + +COPY --from=src ./ /src +RUN cd /src && \ + npm ci --no-progress && \ + npm run build + +# delete node_modules (it should create a fresh one inside /src/dist/) +RUN rm -rf /src/node_modules + +RUN cd /src/dist && \ + mv index.js bbb-graphql-actions.js && \ + cp ../package.json ../package-lock.json . && \ + npm ci --no-progress --omit=dev + + +# ------------------------------ +FROM node:22-bookworm-slim + +RUN groupadd -g 2062 app \ + && useradd -m -u 2063 -g app app + +USER app + +WORKDIR /app + +ENV SERVER_HOST 0.0.0.0 +ENV BBB_REDIS_HOST redis +ENV NODE_ENV=production + +COPY --from=builder /src/dist /app + +CMD [ "node", "/app/bbb-graphql-actions.js" ] \ No newline at end of file diff --git a/opt/02-core/bigbluebutton/mod/bbb-graphql-actions/Dockerfile.dev b/opt/02-core/bigbluebutton/mod/bbb-graphql-actions/Dockerfile.dev new file mode 100644 index 0000000..22babbb --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/bbb-graphql-actions/Dockerfile.dev @@ -0,0 +1,16 @@ +ARG BBB_BUILD_TAG +FROM bigbluebutton/bbb-build:$BBB_BUILD_TAG AS builder + +RUN apt-get update && apt-get install -y gosu + +# allow any user to use node in /root/.nvm +RUN chmod 755 /root + +COPY dev-entrypoint.sh /dev-entrypoint.sh +ENTRYPOINT [ "/dev-entrypoint.sh" ] + +WORKDIR /app +ENV SERVER_HOST 0.0.0.0 +ENV BBB_REDIS_HOST redis + +CMD [ "npm install && npm start" ] \ No newline at end of file diff --git a/opt/02-core/bigbluebutton/mod/bbb-graphql-actions/dev-entrypoint.sh b/opt/02-core/bigbluebutton/mod/bbb-graphql-actions/dev-entrypoint.sh new file mode 100755 index 0000000..7c3700c --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/bbb-graphql-actions/dev-entrypoint.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# get owner of /app +OWNER="$(stat -c '%u' "/app")" +GROUP="$(stat -c '%g' "/app")" +useradd --home-dir /tmp -u $OWNER user || /bin/true + +# run with same user to avoid any issues +# with file permissions +. /root/.nvm/nvm.sh +gosu $OWNER:$GROUP bash -c "$@" + diff --git a/opt/02-core/bigbluebutton/mod/bbb-graphql-middleware/Dockerfile b/opt/02-core/bigbluebutton/mod/bbb-graphql-middleware/Dockerfile new file mode 100644 index 0000000..763ee1a --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/bbb-graphql-middleware/Dockerfile @@ -0,0 +1,12 @@ +ARG BBB_BUILD_TAG +FROM bigbluebutton/bbb-build:$BBB_BUILD_TAG AS builder + +COPY --from=src / /src/ +RUN cd /src/ && CGO_ENABLED=0 go build -o bbb-graphql-middleware cmd/bbb-graphql-middleware/main.go + +# ------------------------------ +FROM alpine +COPY --from=builder /src/bbb-graphql-middleware /app/bbb-graphql-middleware +COPY --from=builder /src/config/config.yml /usr/share/bbb-graphql-middleware/config.yml +COPY config.yml /etc/bigbluebutton/bbb-graphql-middleware.yml +CMD [ "/app/bbb-graphql-middleware" ] \ No newline at end of file diff --git a/opt/02-core/bigbluebutton/mod/bbb-graphql-middleware/Dockerfile.dev b/opt/02-core/bigbluebutton/mod/bbb-graphql-middleware/Dockerfile.dev new file mode 100644 index 0000000..d1952d4 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/bbb-graphql-middleware/Dockerfile.dev @@ -0,0 +1,8 @@ +ARG BBB_BUILD_TAG +FROM bigbluebutton/bbb-build:$BBB_BUILD_TAG AS builder + +WORKDIR /app + +ENV GOPATH /gopath + +CMD ["go", "run", "cmd/bbb-graphql-middleware/main.go", "--signal", "SIGTERM"] \ No newline at end of file diff --git a/opt/02-core/bigbluebutton/mod/bbb-graphql-middleware/config.yml b/opt/02-core/bigbluebutton/mod/bbb-graphql-middleware/config.yml new file mode 100644 index 0000000..f323157 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/bbb-graphql-middleware/config.yml @@ -0,0 +1,15 @@ +server: + listen_host: 0.0.0.0 + listen_port: 8378 +redis: + host: redis + port: 6379 + password: "" +hasura: + url: ws://nginx:8185/v1/graphql +graphql-actions: + url: http://bbb-graphql-actions:8093 +auth_hook: + url: http://bbb-web:8090/bigbluebutton/connection/checkGraphqlAuthorization +session_vars_hook: + url: http://apps-akka:8901/userInfo \ No newline at end of file diff --git a/opt/02-core/bigbluebutton/mod/bbb-graphql-server/Dockerfile b/opt/02-core/bigbluebutton/mod/bbb-graphql-server/Dockerfile new file mode 100644 index 0000000..3c087cc --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/bbb-graphql-server/Dockerfile @@ -0,0 +1,25 @@ +ARG BBB_BUILD_TAG +ARG GRAPHQL_ENGINE_TAG +FROM bigbluebutton/bbb-build:$BBB_BUILD_TAG AS builder + +RUN curl -L https://github.com/hasura/graphql-engine/raw/stable/cli/get.sh | INSTALL_PATH=/usr/local/bin VERSION=v2.44.0 bash +RUN wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 && chmod a+x /usr/local/bin/yq + +# ---------------------------- +FROM hasura/graphql-engine:$GRAPHQL_ENGINE_TAG + +# install netstat, required for start script +RUN apt-get update && apt-get install -y net-tools gosu + +COPY --from=builder /usr/local/bin/yq /usr/local/bin/yq +COPY --from=builder /usr/local/bin/hasura /usr/local/bin/hasura + +COPY --from=src /bbb_schema.sql /app/ +COPY --from=src /metadata /app/metadata + +COPY config.yaml /app/config.yaml +COPY entrypoint.sh /entrypoint.sh +COPY start.sh /app/start.sh + +ENTRYPOINT [ "/entrypoint.sh" ] +CMD [ "/app/start.sh" ] diff --git a/opt/02-core/bigbluebutton/mod/bbb-graphql-server/config.yaml b/opt/02-core/bigbluebutton/mod/bbb-graphql-server/config.yaml new file mode 100644 index 0000000..cd39dc2 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/bbb-graphql-server/config.yaml @@ -0,0 +1,7 @@ +version: 3 +endpoint: http://localhost:8085 +admin_secret: bigbluebutton +metadata_directory: metadata +actions: + kind: synchronous + handler_webhook_baseurl: http://localhost:3000 diff --git a/opt/02-core/bigbluebutton/mod/bbb-graphql-server/entrypoint.sh b/opt/02-core/bigbluebutton/mod/bbb-graphql-server/entrypoint.sh new file mode 100755 index 0000000..096d49c --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/bbb-graphql-server/entrypoint.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +# for psql +export PGHOST=postgres +export PGUSER="${POSTGRES_USER}" +export PGPASSWORD="${POSTGRES_PASSWORD}" + + +# for hasura +export HASURA_GRAPHQL_DATABASE_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/hasura_app +export HASURA_GRAPHQL_METADATA_DATABASE_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/hasura_app +export HASURA_GRAPHQL_LOG_LEVEL=warn +export HASURA_GRAPHQL_ENABLE_CONSOLE=false +export HASURA_GRAPHQL_LIVE_QUERIES_MULTIPLEXED_REFETCH_INTERVAL=250 +export HASURA_GRAPHQL_LIVE_QUERIES_MULTIPLEXED_BATCH_SIZE=1000 +export HASURA_GRAPHQL_STREAMING_QUERIES_MULTIPLEXED_REFETCH_INTERVAL=100 +export HASURA_GRAPHQL_STREAMING_QUERIES_MULTIPLEXED_BATCH_SIZE=1000 +export HASURA_GRAPHQL_SERVER_PORT=8085 +export HASURA_GRAPHQL_ENABLE_TELEMETRY=false +export HASURA_GRAPHQL_WEBSOCKET_KEEPALIVE=10 +export HASURA_GRAPHQL_AUTH_HOOK=http://apps-akka:8901/userInfo +export HASURA_BBB_GRAPHQL_ACTIONS_ADAPTER_URL=http://bbb-graphql-actions:8093 + + +export HASURA_GRAPHQL_BBB_DATABASE_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/bbb_graphql + +exec $@ \ No newline at end of file diff --git a/opt/02-core/bigbluebutton/mod/bbb-graphql-server/start.sh b/opt/02-core/bigbluebutton/mod/bbb-graphql-server/start.sh new file mode 100755 index 0000000..5fc3354 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/bbb-graphql-server/start.sh @@ -0,0 +1,39 @@ +#!/bin/bash +set -e + +cd /app/ + +# patch database url +# TODO: this should be possible upstream in BBB via an environment variable +yq e -i ".[1].configuration.connection_info.database_url = \"$HASURA_GRAPHQL_BBB_DATABASE_URL\"" metadata/databases/databases.yaml + +sed -i "s/^admin_secret: .*/admin_secret: $HASURA_GRAPHQL_ADMIN_SECRET/g" /app/config.yaml + +echo "SELECT 'CREATE DATABASE hasura_app' WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'hasura_app')\gexec" | psql + +echo "Restarting database bbb_graphql" +psql -c "SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity WHERE datname = 'bbb_graphql'" > /dev/null +psql -c "drop database if exists bbb_graphql with (force)" +psql -c "create database bbb_graphql WITH TEMPLATE template0 LC_COLLATE 'C.UTF-8'" +psql -c "alter database bbb_graphql set timezone to 'UTC'" + +echo "Creating tables in bbb_graphql" +psql -U postgres -d bbb_graphql -q -f bbb_schema.sql --set ON_ERROR_STOP=on + +echo "Starting hasura-graphql-engine" +gosu nobody graphql-engine serve & +PID=$! + +sleep 1 + + +#Check if Hasura is ready before applying metadata +while ! netstat -tuln | grep ":$HASURA_GRAPHQL_SERVER_PORT " > /dev/null; do + echo "Waiting for Hasura's port ($HASURA_GRAPHQL_SERVER_PORT) to be ready..." + sleep 1 +done + +echo "Applying new metadata to Hasura" +/usr/local/bin/hasura metadata apply --skip-update-check + +wait "$PID" \ No newline at end of file diff --git a/opt/02-core/bigbluebutton/mod/bbb-pads/Dockerfile b/opt/02-core/bigbluebutton/mod/bbb-pads/Dockerfile new file mode 100644 index 0000000..fa6762c --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/bbb-pads/Dockerfile @@ -0,0 +1,18 @@ +FROM node:22-bookworm-slim AS builder + +COPY --from=src / /bbb-pads +RUN cd /bbb-pads && rm -r .git && npm install --production + + +RUN chmod 777 /bbb-pads/config +# ------------------------------ + +FROM node:22-bookworm-slim + +RUN apt update && apt install -y jq moreutils \ + && useradd --uid 2003 --create-home --user-group bbb-pads + +COPY --from=builder /bbb-pads /bbb-pads +USER bbb-pads +COPY entrypoint.sh /entrypoint.sh +ENTRYPOINT /entrypoint.sh \ No newline at end of file diff --git a/opt/02-core/bigbluebutton/mod/bbb-pads/entrypoint.sh b/opt/02-core/bigbluebutton/mod/bbb-pads/entrypoint.sh new file mode 100755 index 0000000..9f93722 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/bbb-pads/entrypoint.sh @@ -0,0 +1,15 @@ +#!/bin/sh +set -e + +TARGET=/bbb-pads/config/settings.json + +cp /bbb-pads/config/settings.json.template $TARGET +sed -i "s/ETHERPAD_API_KEY/\"$ETHERPAD_API_KEY\"/g" $TARGET +jq '.etherpad.host = "etherpad"' $TARGET | sponge $TARGET +jq '.express.host = "0.0.0.0"' $TARGET | sponge $TARGET +jq '.redis.host = "redis"' $TARGET | sponge $TARGET + + +cd /bbb-pads +export NODE_ENV=production +npm start \ No newline at end of file diff --git a/opt/02-core/bigbluebutton/mod/bbb-web/Dockerfile b/opt/02-core/bigbluebutton/mod/bbb-web/Dockerfile new file mode 100644 index 0000000..e5fefa5 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/bbb-web/Dockerfile @@ -0,0 +1,57 @@ +ARG BBB_BUILD_TAG +FROM bigbluebutton/bbb-build:$BBB_BUILD_TAG AS builder + +COPY --from=src-common-message / /bbb-common-message + +# build bbb-common-message +RUN cd /bbb-common-message && ./deploy.sh + +# =================================================== + + +COPY --from=src-common-web / /bbb-common-web +# build bbb-common-web +RUN cd /bbb-common-web && ./deploy.sh + +COPY --from=src-web / /bbb-web + +# compile bbb-web +RUN cd /bbb-web && grails assemble + +# compile pres-checker +RUN cd /bbb-web/pres-checker && gradle resolveDeps + +# extract .war +RUN unzip -q /bbb-web/build/libs/bigbluebutton-0.10.0.war -d /dist + + +# =================================================== +FROM alangecker/bbb-docker-base-java + +# add blank presentation files and allow conversion to pdf/svg +RUN mkdir -p /usr/share/bigbluebutton/blank \ + && cd /usr/share/bigbluebutton/blank \ + && wget \ + https://raw.githubusercontent.com/bigbluebutton/bigbluebutton/v2.4.0/bigbluebutton-config/slides/blank-svg.svg \ + https://raw.githubusercontent.com/bigbluebutton/bigbluebutton/v2.4.0/bigbluebutton-config/slides/blank-thumb.png \ + https://raw.githubusercontent.com/bigbluebutton/bigbluebutton/v2.4.0/bigbluebutton-config/slides/blank-presentation.pdf \ + https://raw.githubusercontent.com/bigbluebutton/bigbluebutton/v2.4.0/bigbluebutton-config/slides/blank-png.png \ + && sed -i 's///g' /etc/ImageMagick-6/policy.xml \ + && sed -i '/potrace/d' /etc/ImageMagick-6/delegates.xml + + +# get bbb-web +COPY --from=builder /dist /usr/share/bbb-web + +# get pres-checker +COPY --from=builder /bbb-web/pres-checker/lib /usr/share/prescheck/lib +COPY --from=builder /bbb-web/pres-checker/run.sh /usr/share/prescheck/prescheck.sh + +# add entrypoint and templates +COPY entrypoint.sh /entrypoint.sh +COPY bbb-web.properties /etc/bigbluebutton/bbb-web.properties.tmpl +COPY turn-stun-servers.xml /etc/bigbluebutton/turn-stun-servers.xml.tmpl +COPY logback.xml /usr/share/bbb-web/WEB-INF/classes/logback.xml +COPY office-convert.sh /usr/share/bbb-libreoffice-conversion/convert.sh + +ENTRYPOINT ["/entrypoint.sh"] diff --git a/opt/02-core/bigbluebutton/mod/bbb-web/bbb-web.properties b/opt/02-core/bigbluebutton/mod/bbb-web/bbb-web.properties new file mode 100644 index 0000000..7dc9d15 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/bbb-web/bbb-web.properties @@ -0,0 +1,26 @@ +defaultWelcomeMessage={{ .Env.WELCOME_MESSAGE }} +defaultWelcomeMessageFooter={{ .Env.WELCOME_FOOTER }} + +{{ if isTrue .Env.ENABLE_RECORDING }} +disableRecordingDefault=false +{{ else }} +disableRecordingDefault=true +{{ end }} + +bigbluebutton.web.serverURL=https://{{ .Env.DOMAIN }} + +securitySalt={{ .Env.SHARED_SECRET }} + +redisHost=redis + +{{ if isTrue .Env.IGNORE_TLS_CERT_ERRORS }} +beans.presentationService.defaultUploadedPresentation=https://test27.bigbluebutton.org/default.pdf +# fetch presentations without HTTPS +presentationBaseURL=http://{{ .Env.DOMAIN }}/bigbluebutton/presentation +{{else}} +beans.presentationService.defaultUploadedPresentation=${bigbluebutton.web.serverURL}/default.pdf +{{end}} + +learningDashboardEnabled={{ .Env.ENABLE_LEARNING_DASHBOARD }} + +defaultNumDigitsForTelVoice=9 \ No newline at end of file diff --git a/opt/02-core/bigbluebutton/mod/bbb-web/entrypoint.sh b/opt/02-core/bigbluebutton/mod/bbb-web/entrypoint.sh new file mode 100755 index 0000000..7c9506b --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/bbb-web/entrypoint.sh @@ -0,0 +1,31 @@ +#!/bin/bash +set -e + +# create recording directory structure if it doesn't exist yet +mkdir -p /var/bigbluebutton/recording/status +mkdir -p /var/bigbluebutton/events +mkdir -p /var/bigbluebutton/recording +mkdir -p /var/bigbluebutton/recording/raw +mkdir -p /var/bigbluebutton/recording/process +mkdir -p /var/bigbluebutton/recording/publish +mkdir -p /var/bigbluebutton/recording/status/recorded +mkdir -p /var/bigbluebutton/recording/status/archived +mkdir -p /var/bigbluebutton/recording/status/processed +mkdir -p /var/bigbluebutton/recording/status/ended +mkdir -p /var/bigbluebutton/recording/status/sanity +mkdir -p /var/bigbluebutton/recording/status/published +mkdir -p /var/bigbluebutton/captions +mkdir -p /var/bigbluebutton/captions/inbox +mkdir -p /var/bigbluebutton/published +mkdir -p /var/bigbluebutton/deleted +mkdir -p /var/bigbluebutton/unpublished +mkdir -p /var/bigbluebutton/basic_stats +chown -R bigbluebutton:bigbluebutton /var/bigbluebutton + +cd /usr/share/bbb-web/ +dockerize \ + -template /etc/bigbluebutton/bbb-web.properties.tmpl:/etc/bigbluebutton/bbb-web.properties \ + -template /etc/bigbluebutton/turn-stun-servers.xml.tmpl:/etc/bigbluebutton/turn-stun-servers.xml \ + gosu bigbluebutton java -Dgrails.env=prod -Dserver.address=0.0.0.0 -Dserver.port=8090 -Dspring.main.allow-circular-references=true -Xms384m -Xmx384m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/var/bigbluebutton/diagnostics -cp WEB-INF/lib/*:/:WEB-INF/classes/:. org.springframework.boot.loader.WarLauncher + + diff --git a/opt/02-core/bigbluebutton/mod/bbb-web/logback.xml b/opt/02-core/bigbluebutton/mod/bbb-web/logback.xml new file mode 100644 index 0000000..def4f59 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/bbb-web/logback.xml @@ -0,0 +1,28 @@ + + + + + %d{"yyyy-MM-dd'T'HH:mm:ss.SSSXXX"} %-5level %logger{35} - %msg%n + + + + + + + + + + + + + + + + + + + + + + diff --git a/opt/02-core/bigbluebutton/mod/bbb-web/office-convert.sh b/opt/02-core/bigbluebutton/mod/bbb-web/office-convert.sh new file mode 100755 index 0000000..f896bfc --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/bbb-web/office-convert.sh @@ -0,0 +1,36 @@ +#!/bin/bash +set -e +set -u +PATH="/bin/:/usr/bin/" + +# This script receives three params +# Param 1: Input office file path (e.g. "/tmp/test.odt") +# Param 2: Output pdf file path (e.g. "/tmp/test.pdf") +# Param 3: Destination Format (pdf default) +# Param 4: Timeout (secs) (optional) + +if (( $# == 0 )); then + echo "Missing parameter 1 (Input office file path)"; + exit 1 +elif (( $# == 1 )); then + echo "Missing parameter 2 (Output pdf file path)"; + exit 1 +fi; + + +source="$1" +dest="$2" + +# If output format is missing, define PDF +convertTo="${3:-pdf}" + +# If timeout is missing, define 60 +timeoutSecs="${4:-60}" +# Truncate timeout to max 3 digits (as expected by sudoers) +timeoutSecs="${timeoutSecs:0:3}" + +# The timeout is important. + +timeout $(printf %03d $timeoutSecs)s curl -F "data=@${source}" -k https://collabora:9980/cool/convert-to/$convertTo > "${dest}" + +exit 0 diff --git a/opt/02-core/bigbluebutton/mod/bbb-web/turn-stun-servers.xml b/opt/02-core/bigbluebutton/mod/bbb-web/turn-stun-servers.xml new file mode 100644 index 0000000..de92838 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/bbb-web/turn-stun-servers.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + {{if and (isTrue .Env.ENABLE_HTTPS_PROXY) (not (isTrue .Env.IGNORE_TLS_CERT_ERRORS)) }} + {{/* ignore when using a self signed certificate in dev mode */}} + + + + + + {{end}} + + + {{if .Env.TURN_EXT_SERVER }} + + + + + + {{end}} + + + + + + + + + + + + {{if and (isTrue .Env.ENABLE_HTTPS_PROXY) (not (isTrue .Env.IGNORE_TLS_CERT_ERRORS)) }} + + {{end}} + + {{if .Env.TURN_EXT_SERVER }} + + {{end}} + + + + + + + + diff --git a/opt/02-core/bigbluebutton/mod/bbb-webrtc-recorder/Dockerfile b/opt/02-core/bigbluebutton/mod/bbb-webrtc-recorder/Dockerfile new file mode 100644 index 0000000..d7d7e4b --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/bbb-webrtc-recorder/Dockerfile @@ -0,0 +1,40 @@ +# Build stage +FROM golang:1.23 as builder + +ARG APP_VERSION=devel +ARG GOMOD=github.com/bigbluebutton/bbb-webrtc-recorder + +WORKDIR /app + +COPY --from=src go.* ./ + +RUN go mod tidy + +COPY --from=src . ./ + +RUN APP_VERSION=$(cat ./VERSION | sed 's/ /-/g') \ + go build -o ./build/bbb-webrtc-recorder \ + -ldflags="-X '$GOMOD/internal.AppVersion=v${APP_VERSION1}'" \ + ./cmd/bbb-webrtc-recorder + + +RUN mv /app/build/bbb-webrtc-recorder /usr/bin/bbb-webrtc-recorder + +# Running stage +FROM debian:bookworm-slim + +RUN apt-get update && apt-get install -y gosu + +# use same UID as in the recordings container +RUN groupadd -g 998 bigbluebutton && useradd -m -u 998 -g bigbluebutton bigbluebutton + +# config +ENV BBBRECORDER_PUBSUB_ADAPTERS_REDIS_ADDRESS=redis:6379 +ENV BBBRECORDER_PUBSUB_ADAPTERS_REDIS_NETWORK=tcp +ENV BBBRECORDER_DEBUG=true + +# Copy the binary to the production image from the builder stage. +COPY --from=builder /usr/bin/bbb-webrtc-recorder /usr/bin/bbb-webrtc-recorder +COPY --from=builder /app/config/bbb-webrtc-recorder.yml /etc/bbb-webrtc-recorder/bbb-webrtc-recorder.yml + +CMD ["/bin/sh", "-c", "chown -R bigbluebutton:bigbluebutton /var/lib/bbb-webrtc-recorder && gosu bigbluebutton /usr/bin/bbb-webrtc-recorder"] \ No newline at end of file diff --git a/opt/02-core/bigbluebutton/mod/coturn/turnserver.conf b/opt/02-core/bigbluebutton/mod/coturn/turnserver.conf new file mode 100644 index 0000000..55cdf9d --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/coturn/turnserver.conf @@ -0,0 +1,28 @@ +listening-port=3478 + +# listening-ip=${INTERNAL_IP:-$IP} +# relay-ip=${INTERNAL_IP:-$IP} + +min-port=32769 +max-port=65535 +# verbose + +fingerprint +lt-cred-mech +use-auth-secret +realm=bbb-docker + +keep-address-family + +no-cli +no-tlsv1 +no-tlsv1_1 + +# Block connections to IP ranges which shouldn't be reachable +no-loopback-peers +no-multicast-peers + + +# we only need to allow peer connections from the machine itself (from mediasoup or freeswitch). +denied-peer-ip=0.0.0.0-255.255.255.255 +denied-peer-ip=::-ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff \ No newline at end of file diff --git a/opt/02-core/bigbluebutton/mod/etherpad/Dockerfile b/opt/02-core/bigbluebutton/mod/etherpad/Dockerfile new file mode 100644 index 0000000..705867c --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/etherpad/Dockerfile @@ -0,0 +1,29 @@ +ARG TAG_ETHERPAD +FROM etherpad/etherpad:$TAG_ETHERPAD + +USER root + +RUN apk add git curl + +USER etherpad + +RUN pnpm run plugins i \ + ep_disable_chat@0.0.10 \ + ep_auth_session@1.1.1 \ + --github \ + mconf/ep_cursortrace#56fb8c2b211cdda4fc8715ec99e1cb7b7d9eb851 \ + mconf/ep_pad_ttl#360136cd38493dd698435631f2373cbb7089082d \ + mconf/ep_redis_publisher#2b6e47c1c59362916a0b2961a29b259f2977b694 + + +# add skin from git submodule +COPY --chown=etherpad:0 --from=skin / /opt/etherpad-lite/src/static/skins/bigbluebutton + +# add plugin from git submodule +COPY --chown=etherpad:0 --from=plugin / /ep_bigbluebutton_patches +RUN pnpm run plugins i --path /ep_bigbluebutton_patches + +COPY settings.json /opt/etherpad-lite/settings.json +COPY etherpad-export.sh /etherpad-export.sh +COPY entrypoint.sh /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file diff --git a/opt/02-core/bigbluebutton/mod/etherpad/entrypoint.sh b/opt/02-core/bigbluebutton/mod/etherpad/entrypoint.sh new file mode 100755 index 0000000..acc2392 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/etherpad/entrypoint.sh @@ -0,0 +1,3 @@ +#!/bin/sh +echo $ETHERPAD_API_KEY > /tmp/apikey +pnpm run prod --apikey /tmp/apikey \ No newline at end of file diff --git a/opt/02-core/bigbluebutton/mod/etherpad/etherpad-export.sh b/opt/02-core/bigbluebutton/mod/etherpad/etherpad-export.sh new file mode 100755 index 0000000..6bf6e67 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/etherpad/etherpad-export.sh @@ -0,0 +1,9 @@ +#!/bin/sh +src="$8" +dest="$(echo $8 | sed -E -e 's/html|odt/'$7'/')" +convertTo="$7" + + +curl -v -F "data=@${src}" -k https://collabora:9980/cool/convert-to/$convertTo > "${dest}" + +exit 0 \ No newline at end of file diff --git a/opt/02-core/bigbluebutton/mod/etherpad/settings.json b/opt/02-core/bigbluebutton/mod/etherpad/settings.json new file mode 100644 index 0000000..d3c1c4e --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/etherpad/settings.json @@ -0,0 +1,723 @@ +/* + * This file must be valid JSON. But comments are allowed + * + * Please edit settings.json, not settings.json.template + * + * Please note that starting from Etherpad 1.6.0 you can store DB credentials in + * a separate file (credentials.json). + * + * + * ENVIRONMENT VARIABLE SUBSTITUTION + * ================================= + * + * All the configuration values can be read from environment variables using the + * syntax "${ENV_VAR}" or "${ENV_VAR:default_value}". + * + * This is useful, for example, when running in a Docker container. + * + * DETAILED RULES: + * - If the environment variable is set to the string "true" or "false", the + * value becomes Boolean true or false. + * - If the environment variable is set to the string "null", the value + * becomes null. + * - If the environment variable is set to the string "undefined", the setting + * is removed entirely, except when used as the member of an array in which + * case it becomes null. + * - If the environment variable is set to a string representation of a finite + * number, the string is converted to that number. + * - If the environment variable is set to any other string, including the + * empty string, the value is that string. + * - If the environment variable is unset and a default value is provided, the + * value is as if the environment variable was set to the provided default: + * - "${UNSET_VAR:}" becomes the empty string. + * - "${UNSET_VAR:foo}" becomes the string "foo". + * - "${UNSET_VAR:true}" and "${UNSET_VAR:false}" become true and false. + * - "${UNSET_VAR:null}" becomes null. + * - "${UNSET_VAR:undefined}" causes the setting to be removed (or be set + * to null, if used as a member of an array). + * - If the environment variable is unset and no default value is provided, + * the value becomes null. THIS BEHAVIOR MAY CHANGE IN A FUTURE VERSION OF + * ETHERPAD; if you want the default value to be null, you should explicitly + * specify "null" as the default value. + * + * EXAMPLE: + * "port": "${PORT:9001}" + * "minify": "${MINIFY}" + * "skinName": "${SKIN_NAME:colibris}" + * + * Would read the configuration values for those items from the environment + * variables PORT, MINIFY and SKIN_NAME. + * + * If PORT and SKIN_NAME variables were not defined, the default values 9001 and + * "colibris" would be used. + * The configuration value "minify", on the other hand, does not have a + * designated default value. Thus, if the environment variable MINIFY were + * undefined, "minify" would be null. + * + * REMARKS: + * 1) please note that variable substitution always needs to be quoted. + * + * "port": 9001, <-- Literal values. When not using + * "minify": false substitution, only strings must be + * "skinName": "colibris" quoted. Booleans and numbers must not. + * + * "port": "${PORT:9001}" <-- CORRECT: if you want to use a variable + * "minify": "${MINIFY:true}" substitution, put quotes around its name, + * "skinName": "${SKIN_NAME}" even if the required value is a number or + * a boolean. + * Etherpad will take care of rewriting it + * to the proper type if necessary. + * + * "port": ${PORT:9001} <-- ERROR: this is not valid json. Quotes + * "minify": ${MINIFY} around variable names are missing. + * "skinName": ${SKIN_NAME} + * + * 2) Beware of undefined variables and default values: nulls and empty strings + * are different! + * + * This is particularly important for user's passwords (see the relevant + * section): + * + * "password": "${PASSW}" // if PASSW is not defined would result in password === null + * "password": "${PASSW:}" // if PASSW is not defined would result in password === '' + * + * If you want to use an empty value (null) as default value for a variable, + * simply do not set it, without putting any colons: "${ABIWORD}". + * + * 3) if you want to use newlines in the default value of a string parameter, + * use "\n" as usual. + * + * "defaultPadText" : "${DEFAULT_PAD_TEXT}Line 1\nLine 2" + */ + { + /* + * Name your instance! + */ + "title": "Etherpad", + + /* + * Pathname of the favicon you want to use. If null, the skin's favicon is + * used if one is provided by the skin, otherwise the default Etherpad favicon + * is used. If this is a relative path it is interpreted as relative to the + * Etherpad root directory. + */ + "favicon": null, + + /* + * Skin name. + * + * Its value has to be an existing directory under src/static/skins. + * You can write your own, or use one of the included ones: + * + * - "no-skin": an empty skin (default). This yields the unmodified, + * traditional Etherpad theme. + * - "colibris": the new experimental skin (since Etherpad 1.8), candidate to + * become the default in Etherpad 2.0 + */ + "skinName": "bigbluebutton", + + /* + * Skin Variants + * + * Use the UI skin variants builder at /p/test#skinvariantsbuilder + * + * For the colibris skin only, you can choose how to render the three main + * containers: + * - toolbar (top menu with icons) + * - editor (containing the text of the pad) + * - background (area outside of editor, mostly visible when using page style) + * + * For each of the 3 containers you can choose 4 color combinations: + * super-light, light, dark, super-dark. + * + * For example, to make the toolbar dark, you will include "dark-toolbar" into + * skinVariants. + * + * You can provide multiple skin variants separated by spaces. Default + * skinVariant is "super-light-toolbar super-light-editor light-background". + * + * For the editor container, you can also make it full width by adding + * "full-width-editor" variant (by default editor is rendered as a page, with + * a max-width of 900px). + */ + "skinVariants": "", + + /* + * IP and port which Etherpad should bind at. + * + * Binding to a Unix socket is also supported: just use an empty string for + * the ip, and put the full path to the socket in the port parameter. + * + * EXAMPLE USING UNIX SOCKET: + * "ip": "", // <-- has to be an empty string + * "port" : "/somepath/etherpad.socket", // <-- path to a Unix socket + */ + "ip": "0.0.0.0", + "port": 9001, + + /* + * Option to hide/show the settings.json in admin page. + * + * Default option is set to true + */ + "showSettingsInAdminPage": true, + + /* + * Settings for cleanup of pads + */ + "cleanup": { + "enabled": false, + "keepRevisions": 5 + }, + + /* + * Node native SSL support + * + * This is disabled by default. + * Make sure to have the minimum and correct file access permissions set so + * that the Etherpad server can access them + */ + + /* + "ssl" : { + "key" : "/path-to-your/epl-server.key", + "cert" : "/path-to-your/epl-server.crt", + "ca": ["/path-to-your/epl-intermediate-cert1.crt", "/path-to-your/epl-intermediate-cert2.crt"] + }, + */ + + /* + * The type of the database. + * + * You can choose between many DB drivers, for example: dirty, postgres, + * sqlite, mysql. + * + * You shouldn't use "dirty" for for anything else than testing or + * development. + * + * + * Database specific settings are dependent on dbType, and go in dbSettings. + * Remember that since Etherpad 1.6.0 you can also store this information in + * credentials.json. + * + * For a complete list of the supported drivers, please refer to: + * https://www.npmjs.com/package/ueberdb2 + */ + + "dbType": "redis", + "dbSettings": { + "url": "redis://redis:6379" + }, + + /* + * An Example of MySQL Configuration (commented out). + * + * See: https://github.com/ether/etherpad-lite/wiki/How-to-use-Etherpad-Lite-with-MySQL + */ + + /* + "dbType" : "redis", + "dbSettings" : { + "host": "127.0.0.1", + "port": 6379, + "client_options": { + "password": "PASSWORD" + } + }, + */ + + /* + * The default text of a pad: A zero-width-space is used to work around an issue with Etherpad 1.9.1 where empty pads are not being created. + * See: https://github.com/ether/etherpad-lite/issues/5787 + */ + "defaultPadText" : "\u200b", + + /* + * Default Pad behavior. + * + * Change them if you want to override. + */ + "padOptions": { + "noColors": true, + "showControls": true, + "showChat": false, + "showLineNumbers": false, + "useMonospaceFont": false, + "userName": false, + "userColor": false, + "rtl": false, + "alwaysShowChat": false, + "chatAndUsers": false, + "lang": "en" + }, + + /* + * Pad Shortcut Keys + */ + "padShortcutEnabled" : { + "altF9": true, /* focus on the File Menu and/or editbar */ + "altC": false, /* focus on the Chat window */ + "cmdShift2": true, /* shows a gritter popup showing a line author */ + "delete": true, + "return": true, + "esc": true, /* in mozilla versions 14-19 avoid reconnecting pad */ + "cmdS": true, /* save a revision */ + "tab": true, /* indent */ + "cmdZ": true, /* undo/redo */ + "cmdY": true, /* redo */ + "cmdI": true, /* italic */ + "cmdB": true, /* bold */ + "cmdU": true, /* underline */ + "cmd5": true, /* strike through */ + "cmdShiftL": true, /* unordered list */ + "cmdShiftN": true, /* ordered list */ + "cmdShift1": true, /* ordered list */ + "cmdShiftC": true, /* clear authorship */ + "cmdH": true, /* backspace */ + "ctrlHome": true, /* scroll to top of pad */ + "pageUp": true, + "pageDown": true + }, + + /* + * Enables the use of a different server. We have a different one that syncs changes from the original server. + * It is hosted on GitHub and should not be blocked by many firewalls. + * https://etherpad.org/ep_infos + */ + + "updateServer": "https://etherpad.org/ep_infos", + + /* + * Should we suppress errors from being visible in the default Pad Text? + */ + "suppressErrorsInPadText": true, + + /* + * If this option is enabled, a user must have a session to access pads. + * This effectively allows only group pads to be accessed. + */ + "requireSession": true, + + /* + * Users may edit pads but not create new ones. + * + * Pad creation is only via the API. + * This applies both to group pads and regular pads. + */ + "editOnly": true, + + /* + * If true, all css & js will be minified before sending to the client. + * + * This will improve the loading performance massively, but makes it difficult + * to debug the javascript/css + */ + "minify": true, + + /* + * How long may clients use served javascript code (in seconds)? + * + * Not setting this may cause problems during deployment. + * Set to 0 to disable caching. + */ + "maxAge": 21600, // 60 * 60 * 6 = 6 hours + + /* + * Absolute path to the Abiword executable. + * + * Abiword is needed to get advanced import/export features of pads. Setting + * it to null disables Abiword and will only allow plain text and HTML + * import/exports. + */ + "abiword": null, + + /* + * This is the absolute path to the soffice executable. + * + * LibreOffice can be used in lieu of Abiword to export pads. + * Setting it to null disables LibreOffice exporting. + */ + "soffice": "/etherpad-export.sh", + + /* + * Allow import of file types other than the supported ones: + * txt, doc, docx, rtf, odt, html & htm + */ + "allowUnknownFileEnds": false, + + /* + * This setting is used if you require authentication of all users. + * + * Note: "/admin" always requires authentication. + */ + "requireAuthentication": false, + + /* + * Require authorization by a module, or a user with is_admin set, see below. + */ + "requireAuthorization": false, + + /* + * When you use NGINX or another proxy/load-balancer set this to true. + * + * This is especially necessary when the reverse proxy performs SSL + * termination, otherwise the cookies will not have the "secure" flag. + * + * The other effect will be that the logs will contain the real client's IP, + * instead of the reverse proxy's IP. + */ + "trustProxy": true, + + /* + * Settings controlling the session cookie issued by Etherpad. + */ + "cookie": { + /* + * How often (in milliseconds) the key used to sign the express_sid cookie + * should be rotated. Long rotation intervals reduce signature verification + * overhead (because there are fewer historical keys to check) and database + * load (fewer historical keys to store, and less frequent queries to + * get/update the keys). Short rotation intervals are slightly more secure. + * + * Multiple Etherpad processes sharing the same database (table) is + * supported as long as the clock sync error is significantly less than this + * value. + * + * Key rotation can be disabled (not recommended) by setting this to 0 or + * null, or by disabling session expiration (see sessionLifetime). + */ + "keyRotationInterval": 86400000, // = 1d * 24h/d * 60m/h * 60s/m * 1000ms/s + + /* + * Value of the SameSite cookie property. "Lax" is recommended unless + * Etherpad will be embedded in an iframe from another site, in which case + * this must be set to "None". Note: "None" will not work (the browser will + * not send the cookie to Etherpad) unless https is used to access Etherpad + * (either directly or via a reverse proxy with "trustProxy" set to true). + * + * "Strict" is not recommended because it has few security benefits but + * significant usability drawbacks vs. "Lax". See + * https://stackoverflow.com/q/41841880 for discussion. + */ + "sameSite": "None", + + /* + * How long (in milliseconds) after navigating away from Etherpad before the + * user is required to log in again. (The express_sid cookie is set to + * expire at time now + sessionLifetime when first created, and its + * expiration time is periodically refreshed to a new now + sessionLifetime + * value.) If requireAuthentication is false then this value does not really + * matter. + * + * The "best" value depends on your users' usage patterns and the amount of + * convenience you desire. A long lifetime is more convenient (users won't + * have to log back in as often) but has some drawbacks: + * - It increases the amount of state kept in the database. + * - It might weaken security somewhat: The cookie expiration is refreshed + * indefinitely without consulting authentication or authorization + * hooks, so once a user has accessed a pad, the user can continue to + * use the pad until the user leaves for longer than sessionLifetime. + * - More historical keys (sessionLifetime / keyRotationInterval) must be + * checked when verifying signatures. + * + * Session lifetime can be set to infinity (not recommended) by setting this + * to null or 0. Note that if the session does not expire, most browsers + * will delete the cookie when the browser exits, but a session record is + * kept in the database forever. + */ + "sessionLifetime": 864000000, // = 10d * 24h/d * 60m/h * 60s/m * 1000ms/s + + /* + * How long (in milliseconds) before the expiration time of an active user's + * session is refreshed (to now + sessionLifetime). This setting affects the + * following: + * - How often a new session expiration time will be written to the + * database. + * - How often each user's browser will ping the Etherpad server to + * refresh the expiration time of the session cookie. + * + * High values reduce the load on the database and the load from browsers, + * but can shorten the effective session lifetime if Etherpad is restarted + * or the user navigates away. + * + * Automatic session refreshes can be disabled (not recommended) by setting + * this to null. + */ + "sessionRefreshInterval": 86400000 // = 1d * 24h/d * 60m/h * 60s/m * 1000ms/s + }, + + /* + * Privacy: disable IP logging + */ + "disableIPlogging": true, + + /* + * Time (in seconds) to automatically reconnect pad when a "Force reconnect" + * message is shown to user. + * + * Set to 0 to disable automatic reconnection. + */ + "automaticReconnectionTimeout": 0, + + /* + * By default, when caret is moved out of viewport, it scrolls the minimum + * height needed to make this line visible. + */ + "scrollWhenFocusLineIsOutOfViewport": { + + /* + * Percentage of viewport height to be additionally scrolled. + * + * E.g.: use "percentage.editionAboveViewport": 0.5, to place caret line in + * the middle of viewport, when user edits a line above of the + * viewport + * + * Set to 0 to disable extra scrolling + */ + "percentage": { + "editionAboveViewport": 0, + "editionBelowViewport": 0 + }, + + /* + * Time (in milliseconds) used to animate the scroll transition. + * Set to 0 to disable animation + */ + "duration": 0, + + /* + * Flag to control if it should scroll when user places the caret in the + * last line of the viewport + */ + "scrollWhenCaretIsInTheLastLineOfViewport": false, + + /* + * Percentage of viewport height to be additionally scrolled when user + * presses arrow up in the line of the top of the viewport. + * + * Set to 0 to let the scroll to be handled as default by Etherpad + */ + "percentageToScrollWhenUserPressesArrowUp": 0 + }, + + /* + * User accounts. These accounts are used by: + * - default HTTP basic authentication if no plugin handles authentication + * - some but not all authentication plugins + * - some but not all authorization plugins + * + * User properties: + * - password: The user's password. Some authentication plugins will ignore + * this. + * - is_admin: true gives access to /admin. Defaults to false. If you do not + * uncomment this, /admin will not be available! + * - readOnly: If true, this user will not be able to create new pads or + * modify existing pads. Defaults to false. + * - canCreate: If this is true and readOnly is false, this user can create + * new pads. Defaults to true. + * + * Authentication and authorization plugins may define additional properties. + * + * WARNING: passwords should not be stored in plaintext in this file. + * If you want to mitigate this, please install ep_hash_auth and + * follow the section "secure your installation" in README.md + */ + + /* + "users": { + "admin": { + // 1) "password" can be replaced with "hash" if you install ep_hash_auth + // 2) please note that if password is null, the user will not be created + "password": "changeme1", + "is_admin": true + }, + "user": { + // 1) "password" can be replaced with "hash" if you install ep_hash_auth + // 2) please note that if password is null, the user will not be created + "password": "changeme1", + "is_admin": false + } + }, + */ + + /* + * Restrict socket.io transport methods + */ + "socketTransportProtocols" : ["websocket", "polling"], + + "socketIo": { + /* + * Maximum permitted client message size (in bytes). All messages from + * clients that are larger than this will be rejected. Large values make it + * possible to paste large amounts of text, and plugins may require a larger + * value to work properly, but increasing the value increases susceptibility + * to denial of service attacks (malicious clients can exhaust memory). + */ + "maxHttpBufferSize": 50000 + }, + + /* + * Allow Load Testing tools to hit the Etherpad Instance. + * + * WARNING: this will disable security on the instance. + */ + "loadTest": false, + + /** + * Disable dump of objects preventing a clean exit + */ + "dumpOnUncleanExit": false, + + /* + * Disable indentation on new line when previous line ends with some special + * chars (':', '[', '(', '{') + */ + + /* + "indentationOnNewLine": false, + */ + + "ep_pad_ttl": { + "ttl": 86400, // 24 hours + "timeout": 30, + "interval": 21600 // 6 hours + }, + + /* + * Redis publisher plugin configuration. + * npm i git+https://git@github.com/mconf/ep_redis_publisher.git + */ + + "ep_redis_publisher": { + "host": "redis", + "port": 6379 + }, + + /* + * From Etherpad 1.8.3 onwards, import and export of pads is always rate + * limited. + * + * The default is to allow at most 10 requests per IP in a 90 seconds window. + * After that the import/export request is rejected. + * + * See https://github.com/nfriedly/express-rate-limit for more options + */ + "importExportRateLimiting": { + // duration of the rate limit window (milliseconds) + "windowMs": 90000, + + // maximum number of requests per IP to allow during the rate limit window + "max": 32 + }, + + /* + * From Etherpad 1.8.3 onwards, the maximum allowed size for a single imported + * file is always bounded. + * + * File size is specified in bytes. Default is 50 MB. + */ + "importMaxFileSize": 52428800, // 50 * 1024 * 1024 + + /* + The authentication method used by the server. + The default value is sso + If you want to use the old authentication system, change this to apikey + */ + "authenticationMethod": "apikey", + + /* + * From Etherpad 1.8.5 onwards, when Etherpad is in production mode commits from individual users are rate limited + * + * The default is to allow at most 10 changes per IP in a 1 second window. + * After that the change is rejected. + * + * See https://github.com/animir/node-rate-limiter-flexible/wiki/Overall-example#websocket-single-connection-prevent-flooding for more options + */ + "commitRateLimiting": { + // duration of the rate limit window (seconds) + "duration": 1, + + // maximum number of changes per IP to allow during the rate limit window + "points": 100 + }, + + /* + * Toolbar buttons configuration. + * + * Uncomment to customize. + */ + + "toolbar": { + "left": [ + ["bold", "italic", "underline", "strikethrough"], + ["orderedlist", "unorderedlist", "undo", "redo"], + ["importexport"] + ], + "right": [[]] + }, + + /* + * Expose Etherpad version in the web interface and in the Server http header. + * + * Do not enable on production machines. + */ + "exposeVersion": false, + + /* + * The log level we are using. + * + * Valid values: DEBUG, INFO, WARN, ERROR + */ + "loglevel": "INFO", + + /* + * The log layout type to use. + * + * Valid values: basic, colored + */ + "logLayoutType": "colored", + + /* Override any strings found in locale directories */ + "customLocaleStrings": { + "de": { + "pad.importExport.import_export": "Export", + "pad.toolbar.import_export.title": "Export zu verschiedenen Dateiformaten" + }, + "en-gb": { + "pad.importExport.import_export": "Export", + "pad.toolbar.import_export.title": "Export to different file formats" + }, + "en": { + "pad.importExport.import_export": "Export", + "pad.toolbar.import_export.title": "Export to different file formats" + }, + "es": { + "pad.importExport.import_export": "Exportar", + "pad.toolbar.import_export.title": "Exportar a diferentes formatos de archivos" + }, + "fr": { + "pad.importExport.import_export": "Exporter", + "pad.toolbar.import_export.title": "Exporter vers un format de fichier différent" + }, + "it": { + "pad.importExport.import_export": "Esportazione", + "pad.toolbar.import_export.title": "Esporta a diversi formati di file" + }, + "pt-br": { + "pad.importExport.import_export": "Exportar", + "pad.toolbar.import_export.title": "Exportar para diferentes formatos de arquivo" + }, + "pt": { + "pad.importExport.import_export": "Exportar", + "pad.toolbar.import_export.title": "Exportar para diferentes formatos de ficheiro" + } + }, + + /* Disable Admin UI tests */ + "enableAdminUITests": false, + + /* + * Enable/Disable case-insensitive pad names. + */ + "lowerCasePadIds": false +} \ No newline at end of file diff --git a/opt/02-core/bigbluebutton/mod/freeswitch/Dockerfile b/opt/02-core/bigbluebutton/mod/freeswitch/Dockerfile new file mode 100644 index 0000000..0153763 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/freeswitch/Dockerfile @@ -0,0 +1,71 @@ +ARG BBB_BUILD_TAG +FROM bigbluebutton/bbb-build:$BBB_BUILD_TAG AS builder + +COPY --from=freeswitch / /build/freeswitch + +# install most recent git version for proper sparse-checkout support +# https://stackoverflow.com/questions/72223738/failed-to-initialize-sparse-checkout +RUN echo 'deb https://ppa.launchpadcontent.net/git-core/ppa/ubuntu focal main' > /etc/apt/sources.list.d/git-core-ppa.list && \ + apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A1715D88E1DF1F24 && \ + apt-get update && \ + apt-get install -y git + +# get build files for bbb-freeswitch (build/packages-template/bbb-freeswitch-core/) +COPY --from=build-files / /build/ + +# mock files expected by build.sh +RUN mkdir -p /build/bbb-voice-conference/config/freeswitch/conf/ && \ + touch \ + /build/opts-build.sh \ + /build/freeswitch.service.build \ + /build/bbb-voice-conference/config/freeswitch/conf/a \ + && \ + echo "" > /usr/local/bin/fpm + +# build freeswitch +RUN cd /build && ./build.sh + + +# add english sounds +RUN mkdir -p /build/staging/opt/freeswitch/share/freeswitch && \ + wget https://ubuntu.bigbluebutton.org/sounds.tar.gz -O sounds.tar.gz && \ + tar xvfz sounds.tar.gz -C /build/staging/opt/freeswitch/share/freeswitch && \ + wget https://gitlab.senfcall.de/senfcall-public/mute-and-unmute-sounds/-/archive/master/mute-and-unmute-sounds-master.zip && \ + unzip mute-and-unmute-sounds-master.zip && \ + cd mute-and-unmute-sounds-master/sounds && \ + find . -name "*.wav" -exec /bin/bash -c "sox -v 0.3 {} /tmp/tmp.wav; cp /tmp/tmp.wav /build/staging/opt/freeswitch/share/freeswitch/sounds/en/us/callie/conference/{}" \; + +# add bigblugbutton config +ARG TAG_FS_CONFIG +COPY --from=fs-config / /build/staging/opt/freeswitch/etc/freeswitch/ + +# =============================================== + +# we are using ubuntu here, because libjpeg8 is required, but not available in debian +FROM ubuntu:22.04 +RUN apt-get update && \ + apt-get install -y \ + xmlstarlet wget iptables curl \ + libfreetype6 libcurl4 libspeex1 libspeexdsp1 libopus0 libsndfile1 libopusfile0 liblua5.2-0 libjbig0 libldns3 libedit2 libtiff5 libpng16-16 libsqlite3-0 \ + && \ +# install libopusenc0 + wget -O /tmp/libopusenc0_0.2.1-1bbb2_amd64.deb https://launchpad.net/~bigbluebutton/+archive/ubuntu/support/+files/libopusenc0_0.2.1-1bbb2_amd64.deb \ + && dpkg -i /tmp/libopusenc0_0.2.1-1bbb2_amd64.deb \ + && rm /tmp/libopusenc0_0.2.1-1bbb2_amd64.deb + +# add dockerize +COPY --from=alangecker/bbb-docker-base-java /usr/local/bin/dockerize /usr/local/bin/dockerize + +# copy over built freeswitch & config +COPY --from=builder /build/staging/opt /opt +COPY --from=builder /build/staging/etc /etc + +RUN ldconfig && \ + ln -s /opt/freeswitch/conf /etc/freeswitch && \ + groupadd freeswitch && \ + useradd --home-dir /opt/freeswitch --shell /usr/sbin/nologin -g freeswitch freeswitch + +COPY ./entrypoint.sh /entrypoint.sh +COPY ./conf /etc/freeswitch/ + +ENTRYPOINT /entrypoint.sh \ No newline at end of file diff --git a/opt/02-core/bigbluebutton/mod/freeswitch/conf/autoload_configs/conference.conf.xml.tmpl b/opt/02-core/bigbluebutton/mod/freeswitch/conf/autoload_configs/conference.conf.xml.tmpl new file mode 100644 index 0000000..1171614 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/freeswitch/conf/autoload_configs/conference.conf.xml.tmpl @@ -0,0 +1,285 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{if not (isTrue .Env.DISABLE_SOUND_MUTED) }} + + + {{end}} + {{if not (isTrue .Env.DISABLE_SOUND_ALONE) }} + + {{end}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/opt/02-core/bigbluebutton/mod/freeswitch/conf/autoload_configs/event_socket.conf.xml b/opt/02-core/bigbluebutton/mod/freeswitch/conf/autoload_configs/event_socket.conf.xml new file mode 100644 index 0000000..6d7d4d7 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/freeswitch/conf/autoload_configs/event_socket.conf.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/opt/02-core/bigbluebutton/mod/freeswitch/conf/autoload_configs/modules.conf.xml b/opt/02-core/bigbluebutton/mod/freeswitch/conf/autoload_configs/modules.conf.xml new file mode 100644 index 0000000..f05aa52 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/freeswitch/conf/autoload_configs/modules.conf.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/opt/02-core/bigbluebutton/mod/freeswitch/conf/dialplan/public/dialin.xml b/opt/02-core/bigbluebutton/mod/freeswitch/conf/dialplan/public/dialin.xml new file mode 100644 index 0000000..02c4ed7 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/freeswitch/conf/dialplan/public/dialin.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/opt/02-core/bigbluebutton/mod/freeswitch/conf/sip_profiles/external-dialin.xml b/opt/02-core/bigbluebutton/mod/freeswitch/conf/sip_profiles/external-dialin.xml new file mode 100644 index 0000000..fbe7ca3 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/freeswitch/conf/sip_profiles/external-dialin.xml @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/opt/02-core/bigbluebutton/mod/freeswitch/conf/sip_profiles/external.xml b/opt/02-core/bigbluebutton/mod/freeswitch/conf/sip_profiles/external.xml new file mode 100644 index 0000000..53c9de1 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/freeswitch/conf/sip_profiles/external.xml @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/opt/02-core/bigbluebutton/mod/freeswitch/conf/vars.xml.tmpl b/opt/02-core/bigbluebutton/mod/freeswitch/conf/vars.xml.tmpl new file mode 100644 index 0000000..b86502d --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/freeswitch/conf/vars.xml.tmpl @@ -0,0 +1,453 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/opt/02-core/bigbluebutton/mod/freeswitch/entrypoint.sh b/opt/02-core/bigbluebutton/mod/freeswitch/entrypoint.sh new file mode 100755 index 0000000..bf6dae1 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/freeswitch/entrypoint.sh @@ -0,0 +1,72 @@ +#!/bin/bash -e + +# remove all SIP (port 5060) iptable rules +iptables -S INPUT | grep "\-\-dport 5060 " | cut -d " " -f 2- | xargs -rL1 iptables -D + +# block requests to 5060 (tcp/udp) +iptables -A INPUT -p tcp --dport 5060 -s 0.0.0.0/0 -j REJECT +iptables -A INPUT -p udp --dport 5060 -s 0.0.0.0/0 -j REJECT + +# allow some IPs +IFS=',' read -ra ADDR <<< "$SIP_IP_ALLOWLIST" +for IP in "${ADDR[@]}"; do + # process "$i" + echo "allow port 5060/udp for $IP" + iptables -I INPUT -p udp --dport 5060 -s $IP -j ACCEPT +done + +mkdir -p /var/freeswitch/meetings +chown -R freeswitch:daemon /var/freeswitch/meetings +chmod 777 /var/freeswitch/meetings +chown -R freeswitch:daemon /opt/freeswitch/var +chown -R freeswitch:daemon /opt/freeswitch/etc +chmod -R g-rwx,o-rwx /opt/freeswitch/etc + +# install freeswitch sounds if missing +SOUNDS_DIR=/opt/freeswitch/share/freeswitch/sounds +if [ "$SOUNDS_LANGUAGE" == "en-us-callie" ]; then + # default, is already installed + echo "" +elif [ "$SOUNDS_LANGUAGE" == "de-de-daedalus3" ]; then + if [ ! -d "$SOUNDS_DIR/de/de/daedalus3" ]; then + echo "sounds package for de-de-daedalus3 not installed yet" + wget -O /tmp/freeswitch-german-soundfiles.zip https://github.com/Daedalus3/freeswitch-german-soundfiles/archive/master.zip + mkdir -p $SOUNDS_DIR/de/de/daedalus3 + unzip /tmp/freeswitch-german-soundfiles.zip -d /tmp/ + mv /tmp/freeswitch-german-soundfiles-master $SOUNDS_DIR/de/de/daedalus3/conference + + # symlink other folders + for folder in "digits" "ivr" "misc"; do + ln -s $SOUNDS_DIR/en/us/callie/$folder $SOUNDS_DIR/de/de/daedalus3/$folder + done + + fi +else + if [ ! -f $SOUNDS_DIR/$SOUNDS_LANGUAGE.installed ]; then + echo "sounds package for $SOUNDS_LANGUAGE not installed yet" + + # get filename of latest release for this sound package + FILENAME=$(curl -s https://files.freeswitch.org/releases/sounds/ | grep -i $SOUNDS_LANGUAGE 2> /dev/null | awk -F'\"' '{print $8}' | grep -E '\-48000-.*\.gz$' | sort -V | tail -n 1) + + if [ "$FILENAME" = "" ]; then + echo "Error: could not find sounds for language '$SOUNDS_LANGUAGE'" + echo "make sure to specify a value for SOUNDS_LANGUAGE which exists on https://files.freeswitch.org/releases/sounds/" + exit 1 + fi + for bitrate in 8000 16000 32000 48000; do + URL=https://files.freeswitch.org/releases/sounds/$(echo $FILENAME | sed "s/48000/$bitrate/") + wget -O /tmp/sounds.tar.gz $URL + tar xvfz /tmp/sounds.tar.gz -C $SOUNDS_DIR + done + + touch $SOUNDS_DIR/$SOUNDS_LANGUAGE.installed + fi +fi + + +export SOUNDS_PATH=$SOUNDS_DIR/$(echo "$SOUNDS_LANGUAGE" | sed 's|-|/|g') + +dockerize \ + -template /etc/freeswitch/vars.xml.tmpl:/etc/freeswitch/vars.xml \ + -template /etc/freeswitch/autoload_configs/conference.conf.xml.tmpl:/etc/freeswitch/autoload_configs/conference.conf.xml \ + /opt/freeswitch/bin/freeswitch -u freeswitch -g daemon -nonat -nf diff --git a/opt/02-core/bigbluebutton/mod/fsesl-akka/Dockerfile b/opt/02-core/bigbluebutton/mod/fsesl-akka/Dockerfile new file mode 100644 index 0000000..8f66f59 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/fsesl-akka/Dockerfile @@ -0,0 +1,30 @@ +ARG BBB_BUILD_TAG +FROM bigbluebutton/bbb-build:$BBB_BUILD_TAG AS builder + +COPY --from=src-common-message / /bbb-common-message + +# build bbb-common-message +RUN cd /bbb-common-message && ./deploy.sh + +# =================================================== +COPY --from=src-fsesl-client / /bbb-fsesl-client +RUN cd /bbb-fsesl-client && ./deploy.sh + +COPY --from=src-fsesl-akka / /source + +# compile and unzip bin +RUN cd /source \ + && sbt universal:packageBin +RUN unzip /source/target/universal/bbb-fsesl-akka-0.0.2.zip -d / + +# # =================================================== + +FROM alangecker/bbb-docker-base-java + +COPY --from=builder /bbb-fsesl-akka-0.0.2 /bbb-fsesl-akka +COPY bbb-fsesl-akka.conf /etc/bigbluebutton/bbb-fsesl-akka.conf.tmpl +COPY logback.xml /bbb-fsesl-akka/conf/logback.xml +COPY entrypoint.sh /entrypoint.sh + +USER bigbluebutton +ENTRYPOINT /entrypoint.sh \ No newline at end of file diff --git a/opt/02-core/bigbluebutton/mod/fsesl-akka/bbb-fsesl-akka.conf b/opt/02-core/bigbluebutton/mod/fsesl-akka/bbb-fsesl-akka.conf new file mode 100644 index 0000000..12acb3e --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/fsesl-akka/bbb-fsesl-akka.conf @@ -0,0 +1,18 @@ +// include default config from upstream +include "/bbb-fsesl-akka/conf/application.conf" + + +freeswitch { + esl { + host="freeswitch" + password="FSESL_PASSWORD" + } +} + +redis { + host="redis" +} + +http { + interface = "0.0.0.0" +} \ No newline at end of file diff --git a/opt/02-core/bigbluebutton/mod/fsesl-akka/entrypoint.sh b/opt/02-core/bigbluebutton/mod/fsesl-akka/entrypoint.sh new file mode 100755 index 0000000..2000ce3 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/fsesl-akka/entrypoint.sh @@ -0,0 +1,9 @@ +#!/bin/sh -e + +TARGET=/etc/bigbluebutton/bbb-fsesl-akka.conf + +cp /etc/bigbluebutton/bbb-fsesl-akka.conf.tmpl $TARGET +sed -i "s/FSESL_PASSWORD/$FSESL_PASSWORD/" $TARGET + +cd /bbb-fsesl-akka +/bbb-fsesl-akka/bin/bbb-fsesl-akka \ No newline at end of file diff --git a/opt/02-core/bigbluebutton/mod/fsesl-akka/logback.xml b/opt/02-core/bigbluebutton/mod/fsesl-akka/logback.xml new file mode 100644 index 0000000..9e587d9 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/fsesl-akka/logback.xml @@ -0,0 +1,17 @@ + + + + + %d{"yyyy-MM-dd'T'HH:mm:ss.SSSXXX"} %-5level %logger{35} - %msg%n + + + + + + + + + + + + diff --git a/opt/02-core/bigbluebutton/mod/haproxy/Dockerfile b/opt/02-core/bigbluebutton/mod/haproxy/Dockerfile new file mode 100644 index 0000000..f172a4b --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/haproxy/Dockerfile @@ -0,0 +1,4 @@ +FROM ghcr.io/tomdess/docker-haproxy-certbot:2.8.10 + +# overwrite bootstrap.sh +COPY bootstrap.sh /bootstrap.sh \ No newline at end of file diff --git a/opt/02-core/bigbluebutton/mod/haproxy/bootstrap.sh b/opt/02-core/bigbluebutton/mod/haproxy/bootstrap.sh new file mode 100755 index 0000000..c17e9f9 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/haproxy/bootstrap.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +set -e + +# save container environment variables to use it +# in cron scripts + +declare -p | grep -Ev '^declare -[[:alpha:]]*r' > /container.env + +# when used with an IP, we'll also disable certbot +if [[ "$CERT1" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + IGNORE_TLS_CERT_ERRORS=true +fi + +if [ "$IGNORE_TLS_CERT_ERRORS" ] && [ "$IGNORE_TLS_CERT_ERRORS" != "false" ]; then + # use self signed certificate + if [ ! -f /etc/haproxy/certs/haproxy-10.7.7.1.pem ]; then + mkdir -p /etc/haproxy/certs + # generate self signed certificate + openssl req -x509 -nodes -days 700 -newkey rsa:2048 \ + -keyout /tmp/domain.key -out /tmp/domain.crt \ + -subj "/C=CA/ST=Quebec/L=Montreal/O=BigBlueButton Development/OU=bbb-docker/CN=10.7.7.1" + + cat /tmp/domain.key /tmp/domain.crt | tee /etc/haproxy/certs/haproxy-10.7.7.1.pem >/dev/null + fi +else + # obtain certificates from lets encrypt + /certs.sh +fi +supervisord -c /etc/supervisord.conf -n \ No newline at end of file diff --git a/opt/02-core/bigbluebutton/mod/haproxy/haproxy.cfg b/opt/02-core/bigbluebutton/mod/haproxy/haproxy.cfg new file mode 100644 index 0000000..a66c2dd --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/haproxy/haproxy.cfg @@ -0,0 +1,80 @@ +global + log stdout format raw local0 debug + + maxconn 20480 + ############# IMPORTANT ################################# + ## DO NOT SET CHROOT OTHERWISE YOU HAVE TO CHANGE THE ## + ## acme-http01-webroot.lua file ## + # chroot /jail ## + ######################################################### + lua-load /etc/haproxy/acme-http01-webroot.lua + # + # SSL options + ssl-default-bind-ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:RSA+AESGCM:RSA+AES:!aNULL:!MD5:!DSS + ssl-default-bind-options ssl-min-ver TLSv1.2 + tune.ssl.default-dh-param 4096 + + + # workaround for bug #14 (Cert renewal blocks HAProxy indefinitely with Websocket connections) + hard-stop-after 3s + + +# DNS runt-time resolution on backend hosts +resolvers docker + nameserver dns "127.0.0.11:53" + +defaults + log global + mode http + timeout connect 5000ms + timeout client 50000ms + timeout server 50000ms + # option forwardfor + option httplog + + option dontlognull + timeout connect 5000 + timeout client 50000 + timeout server 50000 + + # never fail on address resolution + default-server init-addr last,libc,none + +frontend http + bind *:80,[::]:80 + mode http + acl url_acme_http01 path_beg /.well-known/acme-challenge/ + http-request use-service lua.acme-http01 if METH_GET url_acme_http01 + redirect scheme https code 301 if !{ ssl_fc } + +frontend nginx_or_turn + bind *:443,:::443 ssl crt /etc/haproxy/certs/ ssl-min-ver TLSv1.2 alpn h2,http/1.1,stun.turn + mode tcp + option tcplog + tcp-request content capture req.payload(0,1) len 1 + log-format "%ci:%cp [%t] %ft %b/%s %Tw/%Tc/%Tt %B %ts %ac/%fc/%bc/%sc/%rc %sq/%bq captured_user:%{+X}[capture.req.hdr(0)]" + tcp-request inspect-delay 30s + # We terminate SSL on haproxy. HTTP2 is a binary protocol. haproxy has to + # decide which protocol is spoken. This is negotiated by ALPN. + # + # Depending on the ALPN value traffic is redirected to either port 82 (HTTP2, + # ALPN value h2) or 81 (HTTP 1.0 or HTTP 1.1, ALPN value http/1.1 or no value) + # If no ALPN value is set, the first byte is inspected and depending on the + # value traffic is sent to either port 81 or coturn. + use_backend nginx-http2 if { ssl_fc_alpn h2 } + use_backend nginx if { ssl_fc_alpn http/1.1 } + use_backend turn if { ssl_fc_alpn stun.turn } + use_backend %[capture.req.hdr(0),map_str(/etc/haproxy/protocolmap,turn)] + default_backend turn + +backend turn + mode tcp + server localhost 10.7.7.1:3478 check + +backend nginx + mode tcp + server localhost 10.7.7.1:48081 send-proxy check + +backend nginx-http2 + mode tcp + server localhost 10.7.7.1:48082 send-proxy check diff --git a/opt/02-core/bigbluebutton/mod/haproxy/protocolmap b/opt/02-core/bigbluebutton/mod/haproxy/protocolmap new file mode 100644 index 0000000..0f85dd0 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/haproxy/protocolmap @@ -0,0 +1,52 @@ +a nginx +b nginx +c nginx +d nginx +e nginx +f nginx +g nginx +h nginx +i nginx +j nginx +k nginx +l nginx +m nginx +n nginx +o nginx +p nginx +q nginx +r nginx +s nginx +t nginx +u nginx +v nginx +w nginx +x nginx +y nginx +z nginx +A nginx +B nginx +C nginx +D nginx +E nginx +F nginx +G nginx +H nginx +I nginx +J nginx +K nginx +L nginx +M nginx +N nginx +O nginx +P nginx +Q nginx +R nginx +S nginx +T nginx +U nginx +V nginx +W nginx +X nginx +Y nginx +Z nginx \ No newline at end of file diff --git a/opt/02-core/bigbluebutton/mod/html5-dev/Dockerfile b/opt/02-core/bigbluebutton/mod/html5-dev/Dockerfile new file mode 100644 index 0000000..474410a --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/html5-dev/Dockerfile @@ -0,0 +1,13 @@ +ARG BBB_BUILD_TAG +FROM bigbluebutton/bbb-build:$BBB_BUILD_TAG + + +# use /tmp as home dir as writeable directory for whatever UID we get +ENV HOME /tmp + +# allow all user to access .nvm in root +RUN chmod 755 /root + +WORKDIR /app +COPY /entrypoint.sh /entrypoint.sh +ENTRYPOINT /entrypoint.sh diff --git a/opt/02-core/bigbluebutton/mod/html5-dev/entrypoint.sh b/opt/02-core/bigbluebutton/mod/html5-dev/entrypoint.sh new file mode 100755 index 0000000..09c1ee1 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/html5-dev/entrypoint.sh @@ -0,0 +1,11 @@ +set -e + +# enable nvm +. /root/.nvm/nvm.sh + +if [ -n "$1" ]; then + exec "$@" +else + npm install + npm start -- --host 0.0.0.0 +fi \ No newline at end of file diff --git a/opt/02-core/bigbluebutton/mod/livekit/livekit.yaml b/opt/02-core/bigbluebutton/mod/livekit/livekit.yaml new file mode 100644 index 0000000..55653f3 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/livekit/livekit.yaml @@ -0,0 +1,15 @@ +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: redis:6379 + +keys: + # TODO: change keys + TEST: TEST diff --git a/opt/02-core/bigbluebutton/mod/nginx/Dockerfile b/opt/02-core/bigbluebutton/mod/nginx/Dockerfile new file mode 100644 index 0000000..5ef2488 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/nginx/Dockerfile @@ -0,0 +1,49 @@ +ARG BBB_BUILD_TAG +FROM bigbluebutton/bbb-build:$BBB_BUILD_TAG AS builder-learning-dashboard +COPY --from=src-learning-dashboard / /bbb-learning-dashboard +RUN cd /bbb-learning-dashboard && npm ci && npm run build + + +FROM bigbluebutton/bbb-build:$BBB_BUILD_TAG AS builder-playback +COPY --from=src-playback / /bbb-playback +RUN cd /bbb-playback && npm install && npm run-script build + +FROM bigbluebutton/bbb-build:$BBB_BUILD_TAG AS builder-html5 +COPY --from=src-html5 / /source +RUN cd /source && CI=true npm ci +RUN cd /source && DISABLE_ESLINT_PLUGIN=true npm run build-safari && npm run build +RUN cd /source/dist && \ + HASH=$(ls | grep -Eo 'bundle\.[a-f0-9]{20}\.js' | head -n 1 | grep -Eo '[a-f0-9]{20}') && \ + if [ -z "$HASH" ]; then \ + echo "Bundle hash not found."; \ + else \ + for FILE in *.safari.js *.safari.js.map; do \ + if [[ "$FILE" == *"$HASH"* ]]; then \ + continue; \ + fi; \ + PREFIX="${FILE%%.safari.js*}"; \ + SUFFIX="${FILE#*.safari.js}"; \ + NEW_NAME="${PREFIX}.${HASH}.safari.js${SUFFIX}"; \ + echo "Renaming $FILE → $NEW_NAME"; \ + mv "$FILE" "$NEW_NAME"; \ + done; \ + fi + +RUN find /source/dist -name '*.js' -exec gzip -k -f -9 '{}' \; \ + && find /source/dist -name '*.css' -exec gzip -k -f -9 '{}' \; \ + && find /source/dist -name '*.wasm' -exec gzip -k -f -9 '{}' \; + +RUN sed -i "s/VERSION/$BBB_BUILD_TAG/g" /source/dist/index.html && \ + sed -i "s/VERSION/$BBB_BUILD_TAG/g" /source/dist/stylesheets/fonts.css + +# -------------------- + +FROM nginx:1.27-alpine + +COPY --from=builder-learning-dashboard /bbb-learning-dashboard/build /www/learning-analytics-dashboard/ +COPY --from=builder-playback /bbb-playback/build /www/playback/presentation/2.3 +COPY --from=builder-html5 /source/dist /usr/share/bigbluebutton/html5-client/ +COPY ./bbb /etc/nginx/bbb +COPY ./bigbluebutton /etc/nginx/conf.d/default.conf +COPY ./bbb-graphql-client-settings-cache.conf /etc/nginx/conf.d/bbb-graphql-client-settings-cache.conf +COPY ./nginx.conf /etc/nginx/nginx.conf diff --git a/opt/02-core/bigbluebutton/mod/nginx/bbb-graphql-client-settings-cache.conf b/opt/02-core/bigbluebutton/mod/nginx/bbb-graphql-client-settings-cache.conf new file mode 100644 index 0000000..fbea8b7 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/nginx/bbb-graphql-client-settings-cache.conf @@ -0,0 +1 @@ +proxy_cache_path /tmp/hasura-client-settings-cache levels=1:2 keys_zone=client_settings_cache:64m inactive=2880m use_temp_path=off; \ No newline at end of file diff --git a/opt/02-core/bigbluebutton/mod/nginx/bbb-html5.dev.nginx b/opt/02-core/bigbluebutton/mod/nginx/bbb-html5.dev.nginx new file mode 100644 index 0000000..aa3a4a6 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/nginx/bbb-html5.dev.nginx @@ -0,0 +1,23 @@ +# serve locale index from prebuilt static files +location = /html5client/locales/ { + alias /usr/share/bigbluebutton/html5-client/locales/; + autoindex on; + autoindex_format json; + + # Prevent browsers from caching + add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0"; + add_header Pragma "no-cache"; + add_header Expires 0; +} + +# running from source (npm start) +location /html5client/ { + rewrite /html5client/(.*) /$1 break; + gzip_static on; + proxy_pass http://10.7.7.1:3000/; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "Upgrade"; + proxy_set_header Host $host; +} + diff --git a/opt/02-core/bigbluebutton/mod/nginx/bbb/bbb-exporter.nginx b/opt/02-core/bigbluebutton/mod/nginx/bbb/bbb-exporter.nginx new file mode 100644 index 0000000..2a2be48 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/nginx/bbb/bbb-exporter.nginx @@ -0,0 +1,4 @@ +location /bbb-exporter { + proxy_pass http://10.7.7.33:9688; + proxy_http_version 1.1; +} \ No newline at end of file diff --git a/opt/02-core/bigbluebutton/mod/nginx/bbb/bbb-html5.nginx b/opt/02-core/bigbluebutton/mod/nginx/bbb/bbb-html5.nginx new file mode 100644 index 0000000..e62c047 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/nginx/bbb/bbb-html5.nginx @@ -0,0 +1,13 @@ +# running in production (static assets) +location /html5client { + gzip_static on; + alias /usr/share/bigbluebutton/html5-client/; + index index.html; + try_files $uri $uri/ =404; +} + +location /html5client/locales { + alias /usr/share/bigbluebutton/html5-client/locales; + autoindex on; + autoindex_format json; +} diff --git a/opt/02-core/bigbluebutton/mod/nginx/bbb/demo.nginx b/opt/02-core/bigbluebutton/mod/nginx/bbb/demo.nginx new file mode 100644 index 0000000..8b68775 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/nginx/bbb/demo.nginx @@ -0,0 +1,26 @@ + # Forward request to /demo to tomcat. This is for + # the BigBlueButton api demos. + location = /demo/ { + return 301 /demo/demo1.jsp; + } + location /demo { + proxy_pass http://host.docker.internal:8001; + proxy_redirect default; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + + # Allow 30M uploaded presentation document. + client_max_body_size 30m; + client_body_buffer_size 128k; + + proxy_connect_timeout 90; + proxy_send_timeout 90; + proxy_read_timeout 90; + + proxy_buffer_size 4k; + proxy_buffers 4 32k; + proxy_busy_buffers_size 64k; + proxy_temp_file_write_size 64k; + + include fastcgi_params; + } + diff --git a/opt/02-core/bigbluebutton/mod/nginx/bbb/graphql.nginx b/opt/02-core/bigbluebutton/mod/nginx/bbb/graphql.nginx new file mode 100644 index 0000000..526ce5f --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/nginx/bbb/graphql.nginx @@ -0,0 +1,39 @@ +# Websocket connection +location /graphql { + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "Upgrade"; + proxy_set_header Host $host; + #proxy_pass http://bbb-graphql-server:8085; #Hasura (it requires to change the location to /v1/graphql) + proxy_pass http://bbb-graphql-middleware:8378; #Graphql Middleware +} + +#Set cache system for client settings +location /api/rest/clientSettings { + auth_request /bigbluebutton/connection/checkGraphqlAuthorization; + auth_request_set $meeting_id $sent_http_meeting_id; + + proxy_cache client_settings_cache; + proxy_cache_key "$uri|$meeting_id"; + proxy_cache_use_stale updating; + proxy_cache_valid 24h; + proxy_cache_lock on; + add_header X-Cached $upstream_cache_status; + + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "Upgrade"; + proxy_set_header Host $host; + proxy_pass http://127.0.0.1:8185; #Hasura +} + +location /api/rest/userMetadata { + auth_request /bigbluebutton/connection/checkGraphqlAuthorization; + auth_request_set $meeting_id $sent_http_meeting_id; + + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "Upgrade"; + proxy_set_header Host $host; + proxy_pass http://127.0.0.1:8185; #Hasura +} diff --git a/opt/02-core/bigbluebutton/mod/nginx/bbb/learning-dashboard.nginx b/opt/02-core/bigbluebutton/mod/nginx/bbb/learning-dashboard.nginx new file mode 100644 index 0000000..f0b4fc3 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/nginx/bbb/learning-dashboard.nginx @@ -0,0 +1,4 @@ +location /learning-analytics-dashboard/ { + alias /www/learning-analytics-dashboard/; + autoindex off; +} diff --git a/opt/02-core/bigbluebutton/mod/nginx/bbb/livekit.nginx b/opt/02-core/bigbluebutton/mod/nginx/bbb/livekit.nginx new file mode 100644 index 0000000..c295562 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/nginx/bbb/livekit.nginx @@ -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; +} diff --git a/opt/02-core/bigbluebutton/mod/nginx/bbb/loadbalancer.nginx b/opt/02-core/bigbluebutton/mod/nginx/bbb/loadbalancer.nginx new file mode 100644 index 0000000..e254118 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/nginx/bbb/loadbalancer.nginx @@ -0,0 +1,4 @@ +# If you run this BBB node behind a proxy loadbalancer set the hostname of +# the loadbalancer here. This will be used to add CORS headers so requesting +# slides and API calls won't fail +set $bbb_loadbalancer_node ''; diff --git a/opt/02-core/bigbluebutton/mod/nginx/bbb/notes-playback.nginx b/opt/02-core/bigbluebutton/mod/nginx/bbb/notes-playback.nginx new file mode 100644 index 0000000..16f7c43 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/nginx/bbb/notes-playback.nginx @@ -0,0 +1,4 @@ +location /notes { + root /var/bigbluebutton/published; + index index.html index.htm; +} \ No newline at end of file diff --git a/opt/02-core/bigbluebutton/mod/nginx/bbb/notes.nginx b/opt/02-core/bigbluebutton/mod/nginx/bbb/notes.nginx new file mode 100644 index 0000000..4965d2d --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/nginx/bbb/notes.nginx @@ -0,0 +1,77 @@ +# https://github.com/ether/etherpad-lite/wiki/How-to-put-Etherpad-Lite-behind-a-reverse-Proxy +location /pad/p/ { + # Avoid setting the user name from the embedded URL + if ($arg_userName) { + return 401; + } + + rewrite /pad/p/(.*) /p/$1 break; + rewrite ^/pad/p$ /pad/p/ permanent; + proxy_pass http://etherpad:9001/p; + proxy_pass_header Server; + proxy_redirect /p /pad/p; + proxy_set_header Host $host; + proxy_buffering off; + + proxy_set_header X-Real-IP $remote_addr; # http://wiki.nginx.org/HttpProxyModule + proxy_set_header X-Forwarded-For $remote_addr; # EP logs to show the actual remote IP + proxy_set_header X-Forwarded-Proto $real_scheme; # for EP to set secure cookie flag when https is used + proxy_http_version 1.1; + + auth_request /bigbluebutton/connection/checkAuthorization; + auth_request_set $auth_status $upstream_status; +} + +location /pad/auth_session { + rewrite /pad/auth_session(.*) /auth_session$1 break; + proxy_pass http://etherpad:9001/; + proxy_pass_header Server; + proxy_set_header Host $host; + proxy_buffering off; + auth_request /bigbluebutton/connection/checkAuthorization; + auth_request_set $auth_status $upstream_status; +} + +location /pad { + rewrite /pad/(.*) /$1 break; + rewrite ^/pad$ /pad/ permanent; + proxy_pass http://etherpad:9001/; + proxy_pass_header Server; + proxy_redirect / /pad/; + proxy_set_header Host $host; + proxy_buffering off; +} + +location /pad/socket.io/socket.io.js { + rewrite /pad/socket.io/socket.io.js /socket.io/socket.io.js break; + proxy_pass http://etherpad:9001/; + proxy_set_header Host $host; + proxy_buffering off; +} + +location /pad/socket.io { + rewrite /pad/socket.io/(.*) /socket.io/$1 break; + proxy_pass http://etherpad:9001/; + proxy_redirect / /pad/; + proxy_set_header Host $host; + proxy_buffering off; + proxy_set_header X-Real-IP $remote_addr; # http://wiki.nginx.org/HttpProxyModule + proxy_set_header X-Forwarded-For $remote_addr; # EP logs to show the actual remote IP + proxy_set_header X-Forwarded-Proto $real_scheme; # for EP to set secure cookie flag when https is used + proxy_set_header Host $host; # pass the host header + proxy_http_version 1.1; # recommended with keepalive connections + # WebSocket proxying - from http://nginx.org/en/docs/http/websocket.html + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "Upgrade"; + + auth_request /bigbluebutton/connection/checkAuthorization; + auth_request_set $auth_status $upstream_status; +} + +location /static { + rewrite /static/(.*) /static/$1 break; + proxy_pass http://etherpad:9001/; + proxy_set_header Host $host; + proxy_buffering off; +} + diff --git a/opt/02-core/bigbluebutton/mod/nginx/bbb/playback-video.nginx b/opt/02-core/bigbluebutton/mod/nginx/bbb/playback-video.nginx new file mode 100644 index 0000000..39d0c68 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/nginx/bbb/playback-video.nginx @@ -0,0 +1,21 @@ +# This file is part of BigBlueButton. +# +# Copyright © BigBlueButton Inc. and by respective authors. +# +# BigBlueButton is free software: you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by the +# Free Software Foundation, either version 3.0 of the License, or (at your +# option) any later version. +# +# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more +# details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with BigBlueButton. If not, see . + +location /playback/video/ { + alias /var/bigbluebutton/published/video/; + index index.html index.htm; +} diff --git a/opt/02-core/bigbluebutton/mod/nginx/bbb/podcast.nginx b/opt/02-core/bigbluebutton/mod/nginx/bbb/podcast.nginx new file mode 100644 index 0000000..7d8c0a8 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/nginx/bbb/podcast.nginx @@ -0,0 +1,22 @@ +# +# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +# +# Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +# +# This program is free software; you can redistribute it and/or modify it under the +# terms of the GNU Lesser General Public License as published by the Free Software +# Foundation; either version 3.0 of the License, or (at your option) any later +# version. +# +# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License along +# with BigBlueButton; if not, see . +# + + location /podcast { + root /var/bigbluebutton/published; + index index.html index.htm; + } \ No newline at end of file diff --git a/opt/02-core/bigbluebutton/mod/nginx/bbb/presentation-slides.nginx b/opt/02-core/bigbluebutton/mod/nginx/bbb/presentation-slides.nginx new file mode 100644 index 0000000..d90adeb --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/nginx/bbb/presentation-slides.nginx @@ -0,0 +1,46 @@ +# +# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +# +# Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +# +# This program is free software; you can redistribute it and/or modify it under the +# terms of the GNU Lesser General Public License as published by the Free Software +# Foundation; either version 3.0 of the License, or (at your option) any later +# version. +# +# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License along +# with BigBlueButton; if not, see . +# + +# Have nginx serve the presentation slides instead of tomcat as large files +# causes tomcat to OOM. (ralam sept 20, 2018) + + location ~^\/bigbluebutton\/presentation\/(?[A-Za-z0-9\-]+)\/(?[A-Za-z0-9\-]+)\/(?[A-Za-z0-9\-]+)\/svg\/(?\d+)$ { + default_type image/svg+xml; + alias /var/bigbluebutton/$meeting_id_2/$meeting_id_2/$pres_id/svgs/slide$page_num.svg; + add_header 'Access-Control-Allow-Origin' '*' always; + } + + location ~^\/bigbluebutton\/presentation\/(?[A-Za-z0-9\-]+)\/(?[A-Za-z0-9\-]+)\/(?[A-Za-z0-9\-]+)\/pdf\/(?[A-Za-z0-9]+)\/annotated_slides.pdf$ { + default_type application/pdf; + alias /var/bigbluebutton/$meeting_id_2/$meeting_id_2/$pres_id/pdfs/$job_id/annotated_slides.pdf; + add_header 'Access-Control-Allow-Origin' '*' always; + } + + location ~^\/bigbluebutton\/presentation\/(?[A-Za-z0-9\-]+)\/(?[A-Za-z0-9\-]+)\/(?[A-Za-z0-9\-]+)\/thumbnail\/(?\d+)$ { + default_type image/png; + alias /var/bigbluebutton/$meeting_id_2/$meeting_id_2/$pres_id/thumbnails/thumb-$page_num.png; + add_header 'Access-Control-Allow-Origin' '*' always; + } + + location ~^\/bigbluebutton\/presentation\/(?[A-Za-z0-9\-]+)\/(?[A-Za-z0-9\-]+)\/(?[A-Za-z0-9\-]+)\/textfiles\/(?\d+)$ { + default_type text/plain; + alias /var/bigbluebutton/$meeting_id_2/$meeting_id_2/$pres_id/textfiles/slide-$page_num.txt; + add_header 'Access-Control-Allow-Origin' '*' always; + } + + diff --git a/opt/02-core/bigbluebutton/mod/nginx/bbb/presentation.nginx b/opt/02-core/bigbluebutton/mod/nginx/bbb/presentation.nginx new file mode 100644 index 0000000..2199332 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/nginx/bbb/presentation.nginx @@ -0,0 +1,28 @@ +# +# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +# +# Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +# +# This program is free software; you can redistribute it and/or modify it under the +# terms of the GNU Lesser General Public License as published by the Free Software +# Foundation; either version 3.0 of the License, or (at your option) any later +# version. +# +# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License along +# with BigBlueButton; if not, see . +# + location /playback/presentation/2.0/playback.html { + return 301 /playback/presentation/2.3/$arg_meetingId?$query_string; + } + location /playback/presentation/2.3 { + try_files $uri /playback/presentation/2.3/index.html; + } + + location /presentation { + root /var/bigbluebutton/published; + index index.html index.htm; + } diff --git a/opt/02-core/bigbluebutton/mod/nginx/bbb/recording-screenshare.nginx b/opt/02-core/bigbluebutton/mod/nginx/bbb/recording-screenshare.nginx new file mode 100644 index 0000000..d639110 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/nginx/bbb/recording-screenshare.nginx @@ -0,0 +1,22 @@ +# +# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +# +# Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +# +# This program is free software; you can redistribute it and/or modify it under the +# terms of the GNU Lesser General Public License as published by the Free Software +# Foundation; either version 3.0 of the License, or (at your option) any later +# version. +# +# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License along +# with BigBlueButton; if not, see . +# + + location /recording/screenshare { + alias /var/bigbluebutton/published/screenshare; + index index.html index.htm; + } \ No newline at end of file diff --git a/opt/02-core/bigbluebutton/mod/nginx/bbb/slides.nginx b/opt/02-core/bigbluebutton/mod/nginx/bbb/slides.nginx new file mode 100644 index 0000000..1c3d170 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/nginx/bbb/slides.nginx @@ -0,0 +1,28 @@ + +# +# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +# +# Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +# +# This program is free software; you can redistribute it and/or modify it under the +# terms of the GNU Lesser General Public License as published by the Free Software +# Foundation; either version 3.0 of the License, or (at your option) any later +# version. +# +# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License along +# with BigBlueButton; if not, see . +# + location /playback/slides { + root /var/bigbluebutton; + index index.html index.htm; + } + + location /slides { + root /var/bigbluebutton/published; + index index.html index.htm; + } + diff --git a/opt/02-core/bigbluebutton/mod/nginx/bbb/web.nginx b/opt/02-core/bigbluebutton/mod/nginx/bbb/web.nginx new file mode 100755 index 0000000..5849527 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/nginx/bbb/web.nginx @@ -0,0 +1,182 @@ + # Handle request to bbb-web running within a SpringBoot Tomcat embedded servlet container. This is for BBB-API and Presentation. + location /bigbluebutton { + proxy_http_version 1.1; + + location /bigbluebutton { + proxy_pass http://bbb-web:8090; + proxy_redirect default; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + + # Workaround IE refusal to set cookies in iframe + add_header P3P 'CP="No P3P policy available"'; + } + + + location ~ "^\/bigbluebutton\/presentation\/(?[a-zA-Z0-9_-]+)/upload$" { + proxy_pass http://bbb-web:8090; + proxy_redirect default; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + + # Workaround IE refusal to set cookies in iframe + add_header P3P 'CP="No P3P policy available"'; + + # high limit for presentation as bbb-web will reject upload if larger than configured + client_max_body_size 1000m; + client_body_buffer_size 128k; + + proxy_connect_timeout 90; + proxy_send_timeout 90; + proxy_read_timeout 90; + + proxy_buffer_size 4k; + proxy_buffers 4 32k; + proxy_busy_buffers_size 64k; + proxy_temp_file_write_size 64k; + + include fastcgi_params; + + proxy_request_buffering off; + + # Send a sub-request to allow bbb-web to refuse before loading + # If file is larger than configured bbb-web will return with code 403 and Header: x-file-too-large = 1 + auth_request /bigbluebutton/presentation/checkPresentation; + error_page 403 = @error403; + auth_request_set $file_too_large_header $upstream_http_x_file_too_large; + + } + + location /bigbluebutton/presentation/download { + return 404; + } + + location ~ "^/bigbluebutton/presentation/download\/[0-9a-f]+-[0-9]+/[0-9a-f]+-[0-9]+$" { + if ($arg_presFilename !~ "^[0-9a-f]+-[0-9]+\.[0-9a-zA-Z]+$") { + return 404; + } + proxy_pass http://bbb-web:8090$uri$is_args$args; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + # Workaround IE refusal to set cookies in iframe + add_header P3P 'CP="No P3P policy available"'; + } + + location = /bigbluebutton/presentation/checkPresentation { + proxy_pass http://bbb-web:8090; + proxy_redirect default; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + + proxy_set_header X-Presentation-Token $prestoken; + proxy_set_header X-Original-URI $request_uri; + proxy_set_header Content-Length ""; + proxy_set_header X-Original-Content-Length $http_content_length; + proxy_set_header X-Original-Method $request_method; + + # high limit for presentation as bbb-web will reject upload if larger than configured + client_max_body_size 1000m; + client_body_buffer_size 128k; + + proxy_pass_request_body off; + proxy_request_buffering off; + + } + + # To check connection authentication, include: + # auth_request /bigbluebutton/connection/checkAuthorization; + # auth_request_set $auth_status $upstream_status; + # + # and make sure to add sessionToken param in the request URI + location = /bigbluebutton/connection/checkAuthorization { + internal; + proxy_pass http://bbb-web:8090; + proxy_pass_request_body off; + proxy_set_header Content-Length ""; + proxy_set_header X-Original-URI $request_uri; + } + + location = /bigbluebutton/connection/checkGraphqlAuthorization { + internal; + proxy_pass http://bbb-web:8090; + proxy_pass_request_body off; + proxy_set_header Content-Length ""; + proxy_set_header X-Original-URI $request_uri; + # this is required for CORS preflight checks in cluster setup + proxy_set_header X-Original-Method $request_method; + } + + location = /bigbluebutton/connection/legacyCheckAuthorization { + internal; + proxy_pass http://bbb-web:8090; + proxy_pass_request_body off; + proxy_set_header Content-Length ""; + proxy_set_header X-Original-URI $request_uri; + } + + location = /bigbluebutton/connection/validatePad { + internal; + proxy_pass http://bbb-web:8090; + proxy_pass_request_body off; + proxy_set_header Content-Length ""; + proxy_set_header X-Original-URI $request_uri; + } + + location ~ "^/bigbluebutton\/textTrack\/(?[a-zA-Z0-9]+)\/(?[a-zA-Z0-9_-]+)\/(?.+)$" { + # Workaround IE refusal to set cookies in iframe + add_header P3P 'CP="No P3P policy available"'; + + # Allow 30M uploaded presentation document. + client_max_body_size 30m; + client_body_buffer_size 128k; + + proxy_connect_timeout 90; + proxy_send_timeout 90; + proxy_read_timeout 90; + + proxy_buffer_size 4k; + proxy_buffers 4 32k; + proxy_busy_buffers_size 64k; + proxy_temp_file_write_size 64k; + + include fastcgi_params; + + proxy_request_buffering off; + + # Send a sub-request to allow bbb-web to refuse before loading + auth_request /bigbluebutton/textTrack/validateAuthToken; + + default_type text/plain; + alias /var/bigbluebutton/captions/$recordId/$textTrack; + + } + + location = /bigbluebutton/textTrack/validateAuthToken { + internal; + proxy_pass http://bbb-web:8090; + proxy_redirect default; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + + proxy_set_header X-textTrack-token $textTrackToken; + proxy_set_header X-textTrack-recordId $recordId; + proxy_set_header X-textTrack-track $textTrack; + proxy_set_header X-Original-URI $request_uri; + } + + location /bigbluebutton/rtt-check { + default_type text/plain; + add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0"; + add_header Pragma "no-cache"; + add_header Expires "0"; + # this Header is required for cluster setups as the ping check is a + # CORS request. No cookies are required so we can just allow anyone + # to use this endpoint. + add_header 'Access-Control-Allow-Origin' '*'; + return 200 ""; + } + + } + + location @error403 { + if ($file_too_large_header = '1') { + return 413; + } + + return 403; + } diff --git a/opt/02-core/bigbluebutton/mod/nginx/bbb/webhooks.nginx b/opt/02-core/bigbluebutton/mod/nginx/bbb/webhooks.nginx new file mode 100644 index 0000000..003e35c --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/nginx/bbb/webhooks.nginx @@ -0,0 +1,9 @@ +# Pass to the webhooks app all requests made to the webhooks API. +location /bigbluebutton/api/hooks { + proxy_pass http://10.7.7.17:3005; + proxy_redirect default; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header Host $http_host; + proxy_set_header X-NginX-Proxy true; +} diff --git a/opt/02-core/bigbluebutton/mod/nginx/bbb/webrtc-sfu.nginx b/opt/02-core/bigbluebutton/mod/nginx/bbb/webrtc-sfu.nginx new file mode 100644 index 0000000..0422486 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/nginx/bbb/webrtc-sfu.nginx @@ -0,0 +1,25 @@ +location /bbb-webrtc-sfu { + auth_request /bigbluebutton/connection/checkAuthorization; + auth_request_set $auth_status $upstream_status; + # Extra variables are annotated by bbb-web as custom headers + auth_request_set $user_id $sent_http_user_id; + auth_request_set $meeting_id $sent_http_meeting_id; + auth_request_set $voice_bridge $sent_http_voice_bridge; + auth_request_set $user_name $sent_http_user_name; + + proxy_pass http://10.7.7.1:3008; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "Upgrade"; + # Following custom headers are used by bbb-webrtc-sfu + proxy_set_header User-Id $user_id; + proxy_set_header Meeting-Id $meeting_id; + proxy_set_header Voice-Bridge $voice_bridge; + proxy_set_header User-Name $user_name; + + proxy_read_timeout 60s; + proxy_send_timeout 60s; + client_body_timeout 60s; + send_timeout 60s; +} + diff --git a/opt/02-core/bigbluebutton/mod/nginx/bigbluebutton b/opt/02-core/bigbluebutton/mod/nginx/bigbluebutton new file mode 100644 index 0000000..58c5b20 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/nginx/bigbluebutton @@ -0,0 +1,86 @@ +server { + # proxied from HAProxy + listen 48082 http2 proxy_protocol; + listen 48081 proxy_protocol; + + # optional ports for other reverse proxies + listen 48087 default_server; + listen [::]:48087 default_server; + + server_name _; + access_log /dev/stdout; + absolute_redirect off; + root /www/; + + # This variable is used instead of $scheme by bigbluebutton nginx include + # files, so $scheme can be overridden in reverse-proxy configurations. + set $real_scheme $scheme; + + # opt-out of google's floc tracking + # https://www.eff.org/deeplinks/2021/03/googles-floc-terrible-idea + add_header Permissions-Policy "interest-cohort=()"; + + + # Include specific rules for record and playback + include /etc/nginx/bbb/*.nginx; + + # redirect old greenlight v2 room links + location ~ "/b/([a-z0-9\-]+)" { + return 302 /rooms/$1; + } + + # serve default.pdf from /www/ + location = /default.pdf { + try_files $uri =404; + } + + location / { + proxy_pass http://greenlight:3000; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For "127.0.0.1"; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-Ssl on; + proxy_http_version 1.1; + client_max_body_size 1000m; + } + + location /cable { + proxy_pass http://greenlight:3000; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For "127.0.0.1"; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-Ssl on; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "Upgrade"; + proxy_http_version 1.1; + proxy_read_timeout 6h; + proxy_send_timeout 6h; + client_body_timeout 6h; + send_timeout 6h; + } +} + +upstream hasura { + least_conn; + server bbb-graphql-server:8085; + # you might want to add more bbb-graphql-server@ instances to balance the + # load to multiple bbb-graphql-server instances. Execute + # `systemctl enable --now bbb-graphql-server@8086` and uncomment the + # following line: + # server 127.0.0.1:8086; +} +server { + listen 10.7.7.1:8185; + listen 127.0.0.1:8185; + + root /var/www/html; + + location / { + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "Upgrade"; + proxy_set_header Host $host; + + proxy_pass http://hasura; + } +} \ No newline at end of file diff --git a/opt/02-core/bigbluebutton/mod/nginx/default.pdf b/opt/02-core/bigbluebutton/mod/nginx/default.pdf new file mode 100644 index 0000000..8a23582 Binary files /dev/null and b/opt/02-core/bigbluebutton/mod/nginx/default.pdf differ diff --git a/opt/02-core/bigbluebutton/mod/nginx/nginx.conf b/opt/02-core/bigbluebutton/mod/nginx/nginx.conf new file mode 100644 index 0000000..270b9ea --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/nginx/nginx.conf @@ -0,0 +1,53 @@ +user nginx; +worker_processes auto; + +error_log /var/log/nginx/error.log warn; +pid /var/run/nginx.pid; + +worker_rlimit_nofile 20000; + +events { + worker_connections 10000; +} + + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log main; + + sendfile on; + #tcp_nopush on; + + keepalive_timeout 65; + + #gzip on; + + include /etc/nginx/conf.d/*.conf; + + + server { + # additional server only used for greenlight in dev mode + # allows it to use the BBB API without failing + # due to the self signed certificates + # + # all other requests (e.g. /join) is then redirected + listen 48083 http2; + + location /bigbluebutton/api/join { + return 301 https://10.7.7.1$request_uri; + } + location /bigbluebutton/api { + proxy_pass http://127.0.0.1:48087; + } + location / { + return 301 https://10.7.7.1$request_uri; + } + } + +} diff --git a/opt/02-core/bigbluebutton/mod/periodic/Dockerfile b/opt/02-core/bigbluebutton/mod/periodic/Dockerfile new file mode 100644 index 0000000..770dcaf --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/periodic/Dockerfile @@ -0,0 +1,10 @@ +FROM debian:bookworm-slim + +# -- install docker cli +COPY --from=library/docker:latest /usr/local/bin/docker /usr/bin/docker + +COPY bbb-remove-old-recordings bbb-resync-freeswitch entrypoint.sh / + +RUN chmod +x bbb-remove-old-recordings + +ENTRYPOINT ["/entrypoint.sh"] diff --git a/opt/02-core/bigbluebutton/mod/periodic/bbb-remove-old-recordings b/opt/02-core/bigbluebutton/mod/periodic/bbb-remove-old-recordings new file mode 100755 index 0000000..33f6c38 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/periodic/bbb-remove-old-recordings @@ -0,0 +1,41 @@ +#!/bin/bash + +# Source: https://docs.bigbluebutton.org/admin/customize.html#delete-recordings-older-than-n-days + +set -e +LOGFILE=/var/log/bigbluebutton/bbb-recording-cleanup-$(date --iso-8601='seconds' -u).log +shopt -s nullglob +NOW=$(date +%s) + +echo "$(date --rfc-3339=seconds) Deleting recordings older than ${RECORDING_MAX_AGE_DAYS} days" >"${LOGFILE}" + +# Find the name of recordings container in order to access `bbb-record` utility +BBB_RECORDINGS_CONTAINER_NAME=$(docker ps --filter "name=recordings" --filter "status=running" --format "{{.Names}}") +if [ $BBB_RECORDINGS_CONTAINER_NAME == "" ]; then + echo "$(date --rfc-3339=seconds) ERROR: recordings container is not running" >>"${LOGFILE}" + exit 1 +fi + +for donefile in /var/bigbluebutton/recording/status/published/*-presentation.done ; do + MTIME=$(stat -c %Y "${donefile}") + # Check the age of the recording + if [ $(( ( $NOW - $MTIME ) / 86400 )) -gt $RECORDING_MAX_AGE_DAYS ]; then + MEETING_ID=$(basename "${donefile}") + MEETING_ID=${MEETING_ID%-presentation.done} + echo "${MEETING_ID}" >> "${LOGFILE}" + + docker exec "$BBB_RECORDINGS_CONTAINER_NAME" bbb-record --delete "${MEETING_ID}" >>"${LOGFILE}" + fi +done + +for eventsfile in /var/bigbluebutton/recording/raw/*/events.xml ; do + MTIME=$(stat -c %Y "${eventsfile}") + # Check the age of the recording + if [ $(( ( $NOW - $MTIME ) / 86400 )) -gt $RECORDING_MAX_AGE_DAYS ]; then + MEETING_ID="${eventsfile%/events.xml}" + MEETING_ID="${MEETING_ID##*/}" + echo "${MEETING_ID}" >> "${LOGFILE}" + + docker exec "$BBB_RECORDINGS_CONTAINER_NAME" bbb-record --delete "${MEETING_ID}" >>"${LOGFILE}" + fi +done diff --git a/opt/02-core/bigbluebutton/mod/periodic/bbb-resync-freeswitch b/opt/02-core/bigbluebutton/mod/periodic/bbb-resync-freeswitch new file mode 100755 index 0000000..ee3d087 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/periodic/bbb-resync-freeswitch @@ -0,0 +1,5 @@ +#!/bin/bash + +# https://github.com/bigbluebutton/bigbluebutton/pull/9597/files + +docker exec -it bbb-freeswitch fs_cli -H 10.7.7.1 -P 8021 -x 'fsctl sync_clock_when_idle' \ No newline at end of file diff --git a/opt/02-core/bigbluebutton/mod/periodic/entrypoint.sh b/opt/02-core/bigbluebutton/mod/periodic/entrypoint.sh new file mode 100755 index 0000000..cc3bbb0 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/periodic/entrypoint.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +# +# How N days back to keep files +# +history=5 + +while : +do + + # resync freeswitch + /bbb-resync-freeswitch + + # delete presentations older than N days + find /var/bigbluebutton/ -maxdepth 1 -type d -name "*-[0-9]*" -mtime +$history -exec rm -rf '{}' + + + # delete recordings older than $RECORDING_MAX_AGE_DAYS + if [ "$ENABLE_RECORDING" == true ] && [ "$REMOVE_OLD_RECORDING" == true ]; then + /bbb-remove-old-recordings + fi + + sleep 30m +done diff --git a/opt/02-core/bigbluebutton/mod/postgres/initdb.sh b/opt/02-core/bigbluebutton/mod/postgres/initdb.sh new file mode 100755 index 0000000..fb0560e --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/postgres/initdb.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +set -e +set -u + +function create_user_and_database() { + local database=$1 + echo " Creating user and database '$database'" + psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" <<-EOSQL + CREATE DATABASE $database; + GRANT ALL PRIVILEGES ON DATABASE $database TO $POSTGRES_USER; +EOSQL +} + +if [ -n "$POSTGRES_MULTIPLE_DATABASES" ]; then + echo "Multiple database creation requested: $POSTGRES_MULTIPLE_DATABASES" + for db in $(echo $POSTGRES_MULTIPLE_DATABASES | tr ',' ' '); do + create_user_and_database $db + done + echo "Multiple databases created" +fi \ No newline at end of file diff --git a/opt/02-core/bigbluebutton/mod/recordings/Dockerfile b/opt/02-core/bigbluebutton/mod/recordings/Dockerfile new file mode 100644 index 0000000..828aa1d --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/recordings/Dockerfile @@ -0,0 +1,125 @@ + +FROM ruby:3.0-slim-bullseye + +# install apt dependencies +RUN apt-get update && apt-get install -y \ + wget \ + subversion \ + rsync \ + build-essential \ + libsystemd-dev \ + python3 \ + python3-attr \ + python3-cairo \ + python3-gi \ + python3-gi-cairo \ + python3-lxml \ + python3-icu \ + python3-pyinotify \ + python3-sortedcollections \ + python3-packaging \ + gir1.2-pangocairo-1.0 \ + gir1.2-poppler-0.18 \ + gir1.2-gtk-3.0 \ + gir1.2-gdkpixbuf-2.0 \ + fonts-croscore \ + ffmpeg \ + poppler-utils \ + imagemagick \ + supervisor \ + unzip \ + locales \ + locales-all +# TODO: missing packages + +ENV LC_ALL en_US.UTF-8 +ENV LANG en_US.UTF-8 +ENV LANGUAGE en_US.UTF-8 + +# compile and install mkclean +RUN cd /tmp \ + && wget https://phoenixnap.dl.sourceforge.net/project/matroska/mkclean/mkclean-0.8.10.tar.bz2 \ + && tar -xf /tmp/mkclean-0.8.10.tar.bz2 \ + && cd /tmp/mkclean-0.8.10 \ + && sed -i 's/\r//g' ./mkclean/configure.compiled \ + && ./mkclean/configure.compiled \ + && make -C mkclean \ + && cp ./release/gcc_linux_x64/mkclean /usr/bin/mkclean \ + && rm -r /tmp/mkclean-* + +# add dockerize +ENV DOCKERIZE_VERSION v0.6.1 +RUN wget -q https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \ + && tar -C /usr/local/bin -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \ + && rm dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz + +# add yq for bbb-record +RUN wget -q https://github.com/mikefarah/yq/releases/download/v4.45.1/yq_linux_amd64 -O /usr/bin/yq \ + && chmod +x /usr/bin/yq + +RUN mkdir -p \ + /usr/local/bigbluebutton \ + /usr/local/bigbluebutton/core \ + /etc/bigbluebutton \ + /etc/bigbluebutton/recording + +# dependency for bbb-presentation-video +RUN wget -q -O /tmp/python3-perfect-freehand.deb https://github.com/bigbluebutton/perfect-freehand-python/releases/download/1.2.0/python3-perfect-freehand_1.2.0_all.deb && \ + dpkg -i /tmp/python3-perfect-freehand.deb && \ + rm /tmp/python3-perfect-freehand.deb + +ARG TAG_RECORDINGS + +COPY --from=record-core / /usr/local/bigbluebutton/core + +# add bbb-playback-presentation scripts +COPY --from=presentation /scripts /usr/local/bigbluebutton/core/scripts/ + +# install ruby dependencies +RUN cd /usr/local/bigbluebutton/core \ + && gem install builder \ + && gem install bundler --no-document \ + && bundle config set --local deployment true \ + && bundle install \ + && bundle clean \ + && rm -r vendor/bundle/ruby/*/cache \ + && find vendor/bundle -name '*.o' -delete + +# log to file instead of journald +RUN sed -i 's|Journald::Logger\.new.*|Logger.new("/var/log/bigbluebutton/recording.log")|g' /usr/local/bigbluebutton/core/lib/recordandplayback.rb && \ + sed -i 's|Journald::Logger\.new.*|Logger.new("/var/log/bigbluebutton/recording.log")|g' /usr/local/bigbluebutton/core/scripts/rap-caption-inbox.rb && \ + sed -i 's|Logger\.new.*|Logger.new("/var/log/bigbluebutton/recording.log")|g' /usr/local/bigbluebutton/core/scripts/rap-process-worker.rb && \ + sed -i 's|Logger\.new.*|Logger.new("/var/log/bigbluebutton/recording.log")|g' /usr/local/bigbluebutton/core/scripts/archive/archive.rb && \ + sed -i 's|Logger\.new.*|Logger.new("/var/log/bigbluebutton/recording.log")|g' /usr/local/bigbluebutton/core/scripts/publish/presentation.rb && \ + sed -i 's|Logger\.new.*|Logger.new("/var/log/bigbluebutton/recording.log")|g' /usr/local/bigbluebutton/core/scripts/utils/captions.rb && \ + sed -i 's|Logger\.new.*|Logger.new("/var/log/bigbluebutton/recording.log")|g' /usr/local/bigbluebutton/core/scripts/process/presentation.rb + +# add bbb-record with some adjustments so bbb-record works in this environment +COPY --from=bbb-conf /bin/bbb-record /usr/bin/bbb-record +RUN cd /usr/bin \ + && chmod +x /usr/bin/bbb-record \ + && sed -i 's/^BBB_WEB.*/BBB_WEB=""/' /usr/bin/bbb-record \ + && sed -i 's/systemctl.*//' /usr/bin/bbb-record \ + && echo "BIGBLUEBUTTON_RELEASE=$TAG_RECORDINGS" > /etc/bigbluebutton/bigbluebutton-release + +# create user +# the ID should match the one creating the files in `core` +RUN groupadd -g 998 bigbluebutton && useradd -m -u 998 -g bigbluebutton bigbluebutton + +# change owner +# https://github.com/alangecker/bigbluebutton-docker/issues/63 +RUN chown -R 998:998 /usr/local/bigbluebutton + +ARG TAG_BBB_PRESENTATION_VIDEO +RUN cd /tmp/ && \ + wget -q -O bbb-presentation-video.zip "https://github.com/bigbluebutton/bbb-presentation-video/releases/download/${TAG_BBB_PRESENTATION_VIDEO}/ubuntu-20.04.zip" && \ + unzip -o bbb-presentation-video.zip -d bbb-presentation-video && \ + dpkg -i bbb-presentation-video/bbb-presentation-video*.deb && \ + rm -rf /tmp/* + +COPY bbb-web.properties /etc/bigbluebutton/bbb-web.properties.tmpl +COPY recording.yml /etc/bigbluebutton/recording/recording.yml.tmpl +COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf +COPY entrypoint.sh /entrypoint.sh + +ENTRYPOINT /entrypoint.sh diff --git a/opt/02-core/bigbluebutton/mod/recordings/bbb-web.properties b/opt/02-core/bigbluebutton/mod/recordings/bbb-web.properties new file mode 100644 index 0000000..e891d1c --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/recordings/bbb-web.properties @@ -0,0 +1,2 @@ +bigbluebutton.web.serverURL=https://{{ .Env.DOMAIN }} +securitySalt={{ .Env.SHARED_SECRET }} \ No newline at end of file diff --git a/opt/02-core/bigbluebutton/mod/recordings/entrypoint.sh b/opt/02-core/bigbluebutton/mod/recordings/entrypoint.sh new file mode 100755 index 0000000..a62b229 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/recordings/entrypoint.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +touch /var/log/bigbluebutton/recording.log +touch /var/log/bigbluebutton/bbb-web.log +touch /var/log/bigbluebutton/sanity.log +touch /var/log/bigbluebutton/post_publish.log +mkdir -p /var/log/bigbluebutton/presentation +chown -R bigbluebutton:bigbluebutton /var/log/bigbluebutton + +dockerize \ + -template /etc/bigbluebutton/recording/recording.yml.tmpl:/etc/bigbluebutton/recording/recording.yml \ + -template /etc/bigbluebutton/bbb-web.properties.tmpl:/etc/bigbluebutton/bbb-web.properties \ + -stdout /var/log/bigbluebutton/recording.log \ + -stdout /var/log/bigbluebutton/post_publish.log \ + -stdout /var/log/bigbluebutton/sanity.log \ + /usr/bin/supervisord --nodaemon \ No newline at end of file diff --git a/opt/02-core/bigbluebutton/mod/recordings/recording.yml b/opt/02-core/bigbluebutton/mod/recordings/recording.yml new file mode 100644 index 0000000..2e79bdf --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/recordings/recording.yml @@ -0,0 +1,4 @@ +redis_host: redis +notes_endpoint: http://bbb-pads:9002/p +playback_host: {{ .Env.DOMAIN }} +playback_protocol: https diff --git a/opt/02-core/bigbluebutton/mod/recordings/supervisord.conf b/opt/02-core/bigbluebutton/mod/recordings/supervisord.conf new file mode 100644 index 0000000..22e456d --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/recordings/supervisord.conf @@ -0,0 +1,34 @@ +[supervisord] +user=root + +[program:rasque_workers] +command=bundle exec rake -f Rakefile resque:workers +directory=/usr/local/bigbluebutton/core/scripts +environment=QUEUE="rap:archive,rap:publish,rap:process,rap:sanity,rap:captions,rap:events",COUNT="1",HOME="/home/bigbluebutton" +user=bigbluebutton +stdout_logfile=/dev/fd/1 +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/fd/2 +stderr_logfile_maxbytes=0 + + +[program:rap_starter] +command=bundle exec ruby /usr/local/bigbluebutton/core/scripts/rap-starter.rb +directory=/usr/local/bigbluebutton/core/scripts +environment=HOME="/home/bigbluebutton" +user=bigbluebutton +stdout_logfile=/dev/fd/1 +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/fd/2 +stderr_logfile_maxbytes=0 + + +[program:rap_caption_inbox] +command=bundle exec ruby /usr/local/bigbluebutton/core/scripts/rap-caption-inbox.rb +directory=/usr/local/bigbluebutton/core/scripts +environment=HOME="/home/bigbluebutton" +user=bigbluebutton +stdout_logfile=/dev/fd/1 +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/fd/2 +stderr_logfile_maxbytes=0 diff --git a/opt/02-core/bigbluebutton/mod/webhooks/Dockerfile b/opt/02-core/bigbluebutton/mod/webhooks/Dockerfile new file mode 100644 index 0000000..e4b7ce3 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/webhooks/Dockerfile @@ -0,0 +1,25 @@ +FROM node:22-bookworm-slim AS builder + + +RUN apt-get update && apt-get install -y git wget + +RUN wget -q https://github.com/mikefarah/yq/releases/download/v4.25.1/yq_linux_amd64 -O /usr/bin/yq \ + && chmod +x /usr/bin/yq + +COPY --from=src / /bbb-webhooks +RUN cd /bbb-webhooks && npm ci --omit=dev && rm -rf /bbb-webhooks./.git + +RUN chmod 777 /bbb-webhooks/config +# ------------------------------ + +FROM node:22-bookworm-slim +RUN useradd --uid 2004 --user-group bbb-webhooks + +COPY --from=builder /usr/bin/yq /usr/bin/yq +COPY --from=builder /bbb-webhooks /bbb-webhooks +COPY entrypoint.sh /entrypoint.sh + +RUN mkdir /bbb-webhooks/log && chmod 777 /bbb-webhooks/log +USER bbb-webhooks +ENTRYPOINT /entrypoint.sh + diff --git a/opt/02-core/bigbluebutton/mod/webhooks/entrypoint.sh b/opt/02-core/bigbluebutton/mod/webhooks/entrypoint.sh new file mode 100755 index 0000000..1cd89e0 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/webhooks/entrypoint.sh @@ -0,0 +1,17 @@ +#!/bin/sh +set -e +TARGET=/bbb-webhooks/config/production.yml +cp /bbb-webhooks/config/default.example.yml $TARGET + +yq e -i ".hooks.getRaw = false" $TARGET +yq e -i '.modules."../out/webhooks/index.js".config.getRaw = false' $TARGET + +export NODE_ENV=production +export REDIS_HOST=redis +export SERVER_DOMAIN=$DOMAIN +export BEARER_AUTH=true +export SERVER_BIND_IP=0.0.0.0 + +cd /bbb-webhooks +node app.js + diff --git a/opt/02-core/bigbluebutton/mod/webrtc-sfu/Dockerfile b/opt/02-core/bigbluebutton/mod/webrtc-sfu/Dockerfile new file mode 100644 index 0000000..cd2ee00 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/webrtc-sfu/Dockerfile @@ -0,0 +1,42 @@ +ARG BBB_BUILD_TAG +FROM bigbluebutton/bbb-build:$BBB_BUILD_TAG AS builder + + +RUN useradd --uid 2004 --user-group webrtc-sfu + +# cache packages +COPY --from=source /package.json /cache/package.json +RUN cd /cache && npm install --unsafe-perm + +COPY --from=source / /app + +ENV NODE_ENV production + + +RUN cd /app \ + && rm -rf /app/node_modules && cp -a /cache/node_modules /app/node_modules \ + && cp config/default.example.yml config/production.yml \ + && npm install --unsafe-perm \ + && npm cache clear --force \ + && rm -rf node_modules/mediasoup/worker/out/Release/subprojects \ + && rm -rf node_modules/mediasoup/worker/out/Release/mediasoup-worker.p \ + && rm -rf node_modules/mediasoup/worker/out/Release/deps + + +# ============================= +FROM node:22-bookworm-slim +RUN useradd --uid 2004 --user-group webrtc-sfu +ENV NODE_ENV production + +COPY --from=builder /app /app +RUN mkdir /home/webrtc-sfu && chown -R webrtc-sfu:webrtc-sfu /app/config /home/webrtc-sfu + +USER webrtc-sfu +WORKDIR /app + + +COPY config.yaml /etc/bigbluebutton/bbb-webrtc-sfu/production.yml +ENV NODE_ENV=production +ENV NODE_CONFIG_DIR=/app/config/:/etc/bigbluebutton/bbb-webrtc-sfu/ +ENV ALLOW_CONFIG_MUTATIONS=true +CMD [ "npm", "start" ] diff --git a/opt/02-core/bigbluebutton/mod/webrtc-sfu/config.yaml b/opt/02-core/bigbluebutton/mod/webrtc-sfu/config.yaml new file mode 100644 index 0000000..e06ea17 --- /dev/null +++ b/opt/02-core/bigbluebutton/mod/webrtc-sfu/config.yaml @@ -0,0 +1,32 @@ +kurento: [] +redisHost: 10.7.7.5 +clientHost: 10.7.7.1 +recordingAdapter: bbb-webrtc-recorder + +mcs-host: 10.7.7.1 +mcs-address: 10.7.7.1 +freeswitch: + ip: 10.7.7.10 + sip_ip: 10.7.7.10 + port: 5066 + esl_ip: 10.7.7.10 + esl_port: 8021 + +log: + # trace|debug|info|warn|error + level: debug + # Whether to log to stdout + stdout: true + # Whether to log to a file + file: false + +mediasoup: + dedicatedMediaTypeWorkers: + audio: auto + workerBalancing: + strategy: least-loaded + + plainRtp: + listenIp: + ip: "0.0.0.0" + announcedIp: "10.7.7.1" \ No newline at end of file diff --git a/opt/02-core/bigbluebutton/repos/tags b/opt/02-core/bigbluebutton/repos/tags new file mode 100644 index 0000000..e8b18b0 --- /dev/null +++ b/opt/02-core/bigbluebutton/repos/tags @@ -0,0 +1,14 @@ +# autogenerated by ./scripts/collect-tags +# +# used to determine submodule tags without the need for +# checking out the whole submodule + +repos/bbb-etherpad-plugin 88f3f6b +repos/bbb-etherpad-skin 8328b77 +repos/bbb-pads v1.5.3 +repos/bbb-playback v5.3.1 +repos/bbb-webhooks v3.3.1 +repos/bbb-webrtc-recorder v0.8.0 +repos/bbb-webrtc-sfu v2.17.0-beta.6 +repos/bigbluebutton v3.0.4 +repos/freeswitch v1.10.12 diff --git a/opt/02-core/bigbluebutton/scripts/bbb-record b/opt/02-core/bigbluebutton/scripts/bbb-record new file mode 100755 index 0000000..5038a77 --- /dev/null +++ b/opt/02-core/bigbluebutton/scripts/bbb-record @@ -0,0 +1,17 @@ +#!/bin/bash +set -e + +cd $(dirname $0)/.. + +# load .env +. scripts/functions.sh +load_env + +if [ ! "$ENABLE_RECORDING" == true ]; then + echo "Error: recording is disabled why can't use bbb-record" + echo "set ENABLE_RECORDING in .env if you want to use it" + exit 1 +fi + +docker compose exec recordings bbb-record $@ +docker compose logs --tail=15 recordings \ No newline at end of file diff --git a/opt/02-core/bigbluebutton/scripts/collect-tags b/opt/02-core/bigbluebutton/scripts/collect-tags new file mode 100755 index 0000000..d0e4b73 --- /dev/null +++ b/opt/02-core/bigbluebutton/scripts/collect-tags @@ -0,0 +1,20 @@ +#!/bin/bash +set -e +cd "$(dirname "$0")/.." +. scripts/functions.sh + +# can't summarize the submodules without having the submodules +ensure_submodules + +FILE=repos/tags +echo '# autogenerated by ./scripts/collect-tags' > $FILE +echo '#' >> $FILE +echo '# used to determine submodule tags without the need for' >> $FILE +echo '# checking out the whole submodule' >> $FILE +echo "" >> $FILE + +# get list of submodules and their current tag as `git describe` also provides + + +git submodule foreach --quiet 'echo $sm_path $(git describe --tags --always)' >> $FILE + diff --git a/opt/02-core/bigbluebutton/scripts/dev b/opt/02-core/bigbluebutton/scripts/dev new file mode 100755 index 0000000..e599ea8 --- /dev/null +++ b/opt/02-core/bigbluebutton/scripts/dev @@ -0,0 +1,70 @@ +#!/bin/bash + +set -e +cd "$(dirname "$0")/.." +. scripts/functions.sh + +ensure_bbbhtml5yml + +create_dev_env () { + cp dev.env .env + sed -i "s/BBB_DEV_UID=.*/BBB_DEV_UID=$(id -u)/" .env + sed -i "s/BBB_DEV_GID=.*/BBB_DEV_GID=$(id -g)/" .env + load_env +} + +if [ -f ".env" ]; then + load_env + if [[ "$DEV_MODE" == "" ]]; then + echo "Error: .env is not configured as a development environment" + echo "" + read -r -p "Should .env be automatically overwritten with a predefined .env? [Y/n]" response + response=${response,,} # tolower + if [[ $response =~ ^(y| ) ]] || [[ -z $response ]]; then + cp .env .env.bak + create_dev_env + else + echo "we can't continue with a .env file configured as a development environment" + exit 1 + fi + fi +else + echo "# creating a .env for the dev setup" + create_dev_env +fi + + +echo "" +echo "# ensure submodules are checked out" +ensure_submodules + +echo "" +echo "# ensure IP in .env is correct" +EXTERNAL_IPv4=$(ip route get 8.8.8.8 | head -1 | awk '{ print $7 }') +echo "The IP of this machine in the local network seems to be" +echo " $EXTERNAL_IPv4" +sed -i "s/EXTERNAL_IPv4=.*/EXTERNAL_IPv4=${EXTERNAL_IPv4}/" .env +sed -i "s/DOMAIN=.*/DOMAIN=${EXTERNAL_IPv4}/" .env + +echo "" +echo "# recreating docker-compose.yml" +./scripts/generate-compose + +echo "" +echo "# rebuilding images" +docker compose build + + +echo "" +echo "============================================" +echo "BBB Development server" +echo "============================================" +echo "API Mate: https://mconf.github.io/api-mate/#server=https://${EXTERNAL_IPv4}/bigbluebutton/api&sharedSecret=SuperSecret" +echo "Greenlight: https://${EXTERNAL_IPv4}/" +echo "Check containers: docker-compose ps" +echo "Rebuilding container: docker-compose up --build CONTAINERNAME" +echo "============================================" + +sleep 1 + +docker compose up \ No newline at end of file diff --git a/opt/02-core/bigbluebutton/scripts/fs_cli b/opt/02-core/bigbluebutton/scripts/fs_cli new file mode 100755 index 0000000..f252276 --- /dev/null +++ b/opt/02-core/bigbluebutton/scripts/fs_cli @@ -0,0 +1,10 @@ +#!/bin/bash +set -e + +cd $(dirname $0)/.. + +# load .env +. ./scripts/functions.sh +load_env + +docker compose exec freeswitch /opt/freeswitch/bin/fs_cli -H 10.7.7.10 -p "$FSESL_PASSWORD" $@ diff --git a/opt/02-core/bigbluebutton/scripts/functions.sh b/opt/02-core/bigbluebutton/scripts/functions.sh new file mode 100644 index 0000000..5edb57a --- /dev/null +++ b/opt/02-core/bigbluebutton/scripts/functions.sh @@ -0,0 +1,31 @@ +function load_env { + export $(cat .env | sed 's/#.*//g' | grep -v "WELCOME_FOOTER" | grep -v "WELCOME_MESSAGE" | xargs) +} + +function ensure_submodules { + MISSING_SUBMODULES=$(git submodule status | grep -v ' (' | awk '{print $2}' || /bin/true) + echo + if [ ! -z "$MISSING_SUBMODULES" ]; then + echo "ERROR: following submodules are not checked out. we can't continue here" + git submodule status | grep -v ' (' | awk '{print " -", $2}' + echo "" + echo "if you really want to build images by yourself (not required for a normal production setup), use following command to check out all the submodules and try again" + echo " git submodule update --init" + exit 1 + fi + +} + +# this file should exist, otherwise it is created by docker +# with the wrong permissions +function ensure_bbbhtml5yml { + if [ ! -f conf/bbb-html5.yml ]; then + + cat << EOF > conf/bbb-html5.yml +# this file equals the /etc/bigbluebutton/bbb-html5.yml file referenced in the docs +public: + app: + appName: BigBlueButton HTML5 Client (docker) +EOF + fi +} \ No newline at end of file diff --git a/opt/02-core/bigbluebutton/scripts/generate-compose b/opt/02-core/bigbluebutton/scripts/generate-compose new file mode 100755 index 0000000..54617dc --- /dev/null +++ b/opt/02-core/bigbluebutton/scripts/generate-compose @@ -0,0 +1,65 @@ +#!/bin/bash +set -e + +cd $(dirname $0)/.. + +# load .env +. scripts/functions.sh +load_env + +ensure_bbbhtml5yml + +# check for non-optional environment variables, +# which got introduced later and may miss in existing +# .env files during upgrades +if [ -z "$EXTERNAL_IPv4" ]; then + echo "ERROR: EXTERNAL_IPv4 is not set in .env" + echo "BBB won't work without it." + exit 1 +fi + +if [ "$ENABLE_HTTPS_PROXY" ] && [ -z "$LETSENCRYPT_EMAIL" ] && [ -z "$DEV_MODE" ]; then + echo "ERROR: LETSENCRYPT_EMAIL is not set in .env" + echo "you need to specify an email adress, otherwise the certificate" + echo "retrieval will fail" + exit 1 +fi + +function get_tag { + # is submodule checked out? + if [ -f "$1/.git" ]; then + git --git-dir=$1/.git describe --tags --always + else + # get cached tag name from repos/tags + grep "$1" repos/tags | awk '{print $2}' + fi +} + +# https://hub.docker.com/r/bigbluebutton/bbb-build +BBB_BUILD_TAG=v3.0.x-release + +docker run \ + --rm \ + -v $(pwd)/docker-compose.tmpl.yml:/docker-compose.tmpl.yml \ + -e TAG_BBB=$(get_tag repos/bigbluebutton) \ + -e TAG_FREESWITCH=$(get_tag repos/freeswitch) \ + -e TAG_WEBRTC_SFU=$(get_tag repos/bbb-webrtc-sfu) \ + -e TAG_WEBHOOKS=$(get_tag repos/bbb-webhooks) \ + -e TAG_PLAYBACK=$(get_tag repos/bbb-playback) \ + -e TAG_WEBRTC_RECORDER=$(get_tag repos/bbb-webrtc-recorder) \ + -e TAG_PADS=$(get_tag repos/bbb-pads) \ + -e COMMIT_ETHERPAD_SKIN=$(get_tag repos/bbb-etherpad-skin) \ + -e COMMIT_ETHERPAD_PLUGIN=$(get_tag repos/bbb-etherpad-plugin) \ + -e BBB_BUILD_TAG=${BBB_BUILD_TAG} \ + -e DEV_MODE=${DEV_MODE:-false} \ + -e IGNORE_TLS_CERT_ERRORS=${IGNORE_TLS_CERT_ERRORS:-} \ + -e EXTERNAL_IPv6=${EXTERNAL_IPv6:-} \ + -e SIP_IP_ALLOWLIST=${SIP_IP_ALLOWLIST:-} \ + -e ENABLE_RECORDING=${ENABLE_RECORDING:-false} \ + -e ENABLE_HTTPS_PROXY=${ENABLE_HTTPS_PROXY:-false} \ + -e ENABLE_WEBHOOKS=${ENABLE_WEBHOOKS:-false} \ + -e ENABLE_GREENLIGHT=${ENABLE_GREENLIGHT:-false} \ + -e ENABLE_PROMETHEUS_EXPORTER=${ENABLE_PROMETHEUS_EXPORTER:-false} \ + -e ENABLE_PROMETHEUS_EXPORTER_OPTIMIZATION=${ENABLE_PROMETHEUS_EXPORTER_OPTIMIZATION:-false} \ + jwilder/dockerize -template /docker-compose.tmpl.yml \ + > docker-compose.yml diff --git a/opt/02-core/bigbluebutton/scripts/greenlight-migrate-v2-v3 b/opt/02-core/bigbluebutton/scripts/greenlight-migrate-v2-v3 new file mode 100755 index 0000000..e6ad3d1 --- /dev/null +++ b/opt/02-core/bigbluebutton/scripts/greenlight-migrate-v2-v3 @@ -0,0 +1,49 @@ +#!/bin/bash + +cd $(dirname $0)/.. + +# load .env +if [ -f .env ] +then + export $(cat .env | sed 's/#.*//g' | grep -E "RAILS_SECRET|POSTGRESQL_SECRET" | xargs) +fi + +COMPOSE_PREFIX=$(docker compose ps | grep postgres | awk '{print $1}' | sed 's/-postgres-1//') + +docker kill -s SIGKILL greenlight-v2-tmp 2>/dev/null +sleep 1 + +echo "temporarily starting old greenlight v2..." +docker run \ + --rm \ + --detach --name greenlight-v2-tmp \ + --network ${COMPOSE_PREFIX}_bbb-net \ + --env-file .env \ + -e DB_ADAPTER=postgresql \ + -e DB_HOST=10.7.7.22 \ + -e DB_NAME=greenlight \ + -e DB_USERNAME=postgres \ + -e DB_PASSWORD=${POSTGRESQL_SECRET:-password} \ + -e SECRET_KEY_BASE=${RAILS_SECRET} \ + -e V3_ENDPOINT="http://10.7.7.21:3000" \ + -e V3_SECRET_KEY_BASE=${RAILS_SECRET} \ + bigbluebutton/greenlight:v2.14 + +docker logs -f greenlight-v2-tmp & +LOGGING_PID=$! + +while ! docker exec greenlight-v2-tmp nc -zw3 127.0.0.1 80 +do + echo "Waiting for greenlight v2 to start up ..." + sleep 1 +done + +echo "greenlight is up! starting migrations" + +docker exec -it greenlight-v2-tmp bundle exec rake migrations:roles && \ +docker exec -it greenlight-v2-tmp bundle exec rake migrations:users && \ +docker exec -it greenlight-v2-tmp bundle exec rake migrations:rooms && \ +docker exec -it greenlight-v2-tmp bundle exec rake migrations:settings + +kill $LOGGING_PID +docker kill greenlight-v2-tmp diff --git a/opt/02-core/bigbluebutton/scripts/postgres-migrate b/opt/02-core/bigbluebutton/scripts/postgres-migrate new file mode 100755 index 0000000..ec658a8 --- /dev/null +++ b/opt/02-core/bigbluebutton/scripts/postgres-migrate @@ -0,0 +1,57 @@ +#!/bin/bash -e + +OLD_DATA_DIR=$(realpath "$1") +NEW_DATA_DIR=$(realpath "$2") +NEW_POSTGRES_VERSION=$3 + +if [ -d "$NEW_DATA_DIR" ]; then + echo "new postgres data directory $2 already exists. this is not expected" + exit 1 +fi + + +OLD_PG_VERSION=$(cat "$OLD_DATA_DIR/PG_VERSION") + + + +echo spin up a temporary postgres instance on $OLD_DATA_DIR +TEMP_CONTAINER_ID=$(docker run --detach --rm "-v=$OLD_DATA_DIR:/var/lib/postgresql/data" -e POSTGRES_HOST_AUTH_METHOD=trust postgres:$OLD_PG_VERSION-alpine) + +until docker exec $TEMP_CONTAINER_ID psql -U postgres -c "select 1" > /dev/null 2>&1; do + echo "Waiting for postgres server..." + sleep 1 +done + +echo "find old greenlight database..." +if docker exec $TEMP_CONTAINER_ID psql -U postgres -lqt | cut -d \| -f 1 | grep greenlight-v3; then + OLD_DATABASE=greenlight-v3 +elif docker exec $TEMP_CONTAINER_ID psql -U postgres -lqt | cut -d \| -f 1 | grep greenlight; then + OLD_DATABASE=greenlight +fi +echo "old database is called $OLD_DATABASE" +echo "" + +echo "dumping data from old databse..." +GREENLIGHT_DUMP=$(mktemp) +docker exec $TEMP_CONTAINER_ID pg_dump -U postgres $OLD_DATABASE > $GREENLIGHT_DUMP +docker stop $TEMP_CONTAINER_ID + + +echo spin up a temporary postgres instance on $NEW_DATA_DIR +TEMP_CONTAINER_ID=$(docker run --detach --rm "-v=$NEW_DATA_DIR:/var/lib/postgresql/data" -e POSTGRES_HOST_AUTH_METHOD=trust postgres:$NEW_POSTGRES_VERSION-alpine) + +until docker exec $TEMP_CONTAINER_ID psql -U postgres -c "select 1" > /dev/null 2>&1; do + echo "Waiting for postgres server..." + sleep 1 +done + +echo "create all databases..." +for database in "bbb_graphql" "hasura_app" "greenlight"; do + echo "creating $database" + docker exec $TEMP_CONTAINER_ID psql -U postgres -c "CREATE DATABASE $database;" -c "GRANT ALL PRIVILEGES ON DATABASE $database TO postgres;" +done + +echo "restoring greenlight from dump..." +cat $GREENLIGHT_DUMP | docker exec -i $TEMP_CONTAINER_ID psql -U postgres greenlight + +docker stop $TEMP_CONTAINER_ID \ No newline at end of file diff --git a/opt/02-core/bigbluebutton/scripts/publish b/opt/02-core/bigbluebutton/scripts/publish new file mode 100755 index 0000000..601b787 --- /dev/null +++ b/opt/02-core/bigbluebutton/scripts/publish @@ -0,0 +1,48 @@ +#!/bin/bash + +set -e +cd "$(dirname "$0")/.." + +# load .env +. functions.sh +load_env + +if [ -z "$ENABLE_WEBHOOKS" ]; then + echo "ERROR: ENABLE_WEBHOOKS must be set to true, otherwise the image would not be built" + exit 1 +fi + +if [ -z "$ENABLE_RECORDING" ]; then + echo "ERROR: ENABLE_RECORDING must be set to true, otherwise the image would not be built" + exit 1 +fi + + +# generate compose file +./scripts/generate-compose + +# ensure submodules are matching tags.env +./scripts/checkout-submodules + +# build and push java base image +docker build -t alangecker/bbb-docker-base-java:latest mod/base-java + +# buld and push other images +docker compose build + +# push images +docker push alangecker/bbb-docker-base-java:latest +docker compose push \ + html5-backend-1 \ + bbb-web \ + freeswitch \ + apps-akka \ + bbb-pads \ + etherpad \ + fsesl-akka \ + jodconverter \ + nginx \ + periodic \ + recordings \ + webhooks \ + webrtc-sfu diff --git a/opt/02-core/bigbluebutton/scripts/setup b/opt/02-core/bigbluebutton/scripts/setup new file mode 100755 index 0000000..94927a6 --- /dev/null +++ b/opt/02-core/bigbluebutton/scripts/setup @@ -0,0 +1,196 @@ +#!/bin/bash + +set -e +cd "$(dirname "$0")/.." + +if ! [ -x "$(command -v curl)" ]; then + echo "Error: curl is not installed, but the setup script relies on it." + echo "on debian based operating systems try following command:" + echo " $ sudo apt-get install curl" + exit 1 +fi + +# load .env +if [ -f .env ] +then + echo "Error: the configuration file .env already exists." + echo "either edit variables manually in there or remove the file and try this script again" + exit 1 +fi + +. scripts/functions.sh +ensure_bbbhtml5yml + +EXTERNAL_IPv4=$(curl -4 -s https://icanhazip.com) +EXTERNAL_IPv6=$(curl -6 -s -m 10 https://icanhazip.com || true) + +greenlight="" +while [[ ! $greenlight =~ ^(y|n)$ ]]; do + read -p "Should greenlight be included? (y/n): " greenlight +done + +https_proxy="" +LETSENCRYPT_EMAIL="" +while [[ ! $https_proxy =~ ^(y|n)$ ]]; do + read -p "Should an automatic HTTPS Proxy be included? (y/n): " https_proxy +done + +if [ "$https_proxy" == "y" ] +then + while [[ ! $LETSENCRYPT_EMAIL =~ ^.+@.+\..+$ ]]; do + read -p "Please enter an Email adress for the Let's Encrypt notifications: " LETSENCRYPT_EMAIL + done +fi + +DOMAIN="" +while [[ -z "$DOMAIN" ]]; do + read -p "Please enter the domain name: " DOMAIN +done + +recording="" +echo "Should the recording feature be included?" +echo " IMPORTANT: this is currently a big privacy issues, because it will " +echo " record everything which happens in the conference, even when the button" +echo " suggests, that it does not." +echo " make sure that you always get people's consent, before they join a room!" +echo " https://github.com/bigbluebutton/bigbluebutton/issues/9202" +while [[ ! $recording =~ ^(y|n)$ ]]; do + read -p "Choice (y/n): " recording +done + +prometheus_exporter="" +while [[ ! $prometheus_exporter =~ ^(y|n)$ ]]; do + read -p "Should a Prometheus exporter be included? (y/n): " prometheus_exporter +done +if [ "$prometheus_exporter" == "y" ] && [ "$recording" == "y" ] +then + echo "Should Prometheus exporter optimization be enabled?" + echo " This instructs exporter to collect expensive recordings metrics by querying the disk instead of the API." + echo " Enabling this can substantially decrease the scrape time required for the exporter to respond to metrics requests" + prometheus_exporter_optimization="" + while [[ ! $prometheus_exporter_optimization =~ ^(y|n)$ ]]; do + read -p "Choice (y/n): " prometheus_exporter_optimization + done +fi + +if [ "$recording" == "y" ] +then + + remove_old_recording="" + while [[ ! $remove_old_recording =~ ^(y|n)$ ]]; do + read -p "Should old recordings be removed? (y/n): " remove_old_recording + done + + if [ "$remove_old_recording" == "y" ] + then + recording_max_age_days="" + while [[ ! $recording_max_age_days =~ ^[0-9]{1,4}$ ]]; do + read -p "Please enter max age(days) for keeping recordings: " recording_max_age_days + done + fi + +fi + +ip_correct="" +while [[ ! $ip_correct =~ ^(y|n)$ ]]; do + read -p "Is $EXTERNAL_IPv4 your external IPv4 address? (y/n): " ip_correct +done + +if [ ! "$ip_correct" == "y" ] +then + EXTERNAL_IPv4="" + while [[ ! $EXTERNAL_IPv4 =~ ^[1-9][0-9]{0,2}\.[0-9]{0,3}\.[0-9]{0,3}\.[1-9][0-9]{0,2}$ ]]; do + read -p "Please enter correct IPv4 address: " EXTERNAL_IPv4 + done +fi + +if [ -n "$EXTERNAL_IPv6" ] +then + ip_correct="" + while [[ ! $ip_correct =~ ^(y|n)$ ]]; do + read -p "Is $EXTERNAL_IPv6 your external IPv6 address? (y/n): " ip_correct + done + + if [ ! "$ip_correct" == "y" ] + then + EXTERNAL_IPv6="" + while [[ ! $EXTERNAL_IPv6 =~ ^[0-9a-z:]{3,39}$ ]]; do + read -p "Please enter correct IPv6 address: " EXTERNAL_IPv6 + done + fi +fi + + + +# write settings +cp sample.env .env +sed -i "s/EXTERNAL_IPv4=.*/EXTERNAL_IPv4=$EXTERNAL_IPv4/" .env +sed -i "s/EXTERNAL_IPv6=.*/EXTERNAL_IPv6=$EXTERNAL_IPv6/" .env +sed -i "s/DOMAIN=.*/DOMAIN=$DOMAIN/" .env +sed -i "s/.*STUN_IP=.*/STUN_IP=$EXTERNAL_IPv4/" .env + +if [ ! "$greenlight" == "y" ] +then + sed -i "s/ENABLE_GREENLIGHT.*/#ENABLE_GREENLIGHT=true/" .env +fi + +if [ ! "$https_proxy" == "y" ] +then + sed -i "s/ENABLE_HTTPS_PROXY.*/#ENABLE_HTTPS_PROXY=true/" .env +fi + +sed -i "s/LETSENCRYPT_EMAIL=.*/LETSENCRYPT_EMAIL=$LETSENCRYPT_EMAIL/" .env + + +if [ "$recording" == "y" ] +then + sed -i "s/#ENABLE_RECORDING.*/ENABLE_RECORDING=true/" .env +fi + +if [ "$remove_old_recording" == "y" ] +then + sed -i "s/#REMOVE_OLD_RECORDING=.*/REMOVE_OLD_RECORDING=true/" .env + sed -i "s/#RECORDING_MAX_AGE_DAYS=.*/RECORDING_MAX_AGE_DAYS=$recording_max_age_days/" .env +fi + + +if [ "$prometheus_exporter" == "y" ] +then + sed -i "s/#ENABLE_PROMETHEUS_EXPORTER=.*/ENABLE_PROMETHEUS_EXPORTER=true/" .env +fi + +if [ "$prometheus_exporter_optimization" == "y" ] +then + sed -i "s/#ENABLE_PROMETHEUS_EXPORTER_OPTIMIZATION=.*/ENABLE_PROMETHEUS_EXPORTER_OPTIMIZATION=true/" .env +fi + +# change secrets +RANDOM_1=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 40) +RANDOM_2=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 40) +RANDOM_3=$(head /dev/urandom | tr -dc a-f0-9 | head -c 128) +RANDOM_4=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 40) +RANDOM_5=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 40) +TURN_SECRET=$(head /dev/urandom | tr -dc A-Za-f0-9 | head -c 32) + + +sed -i "s/SHARED_SECRET=.*/SHARED_SECRET=$RANDOM_1/" .env +sed -i "s/ETHERPAD_API_KEY=.*/ETHERPAD_API_KEY=$RANDOM_2/" .env +sed -i "s/RAILS_SECRET=.*/RAILS_SECRET=$RANDOM_3/" .env +sed -i "s/FSESL_PASSWORD=.*/FSESL_PASSWORD=$RANDOM_4/" .env +sed -i "s/POSTGRESQL_SECRET=.*/POSTGRESQL_SECRET=$RANDOM_5/" .env +sed -i "s/.*TURN_SECRET=.*/TURN_SECRET=$TURN_SECRET/" .env + + +./scripts/generate-compose + +echo "--------------------------------------------------" +echo "configuration file .env got successfully created!" +echo "" +echo "you can look through it for further adjusments" +echo " $ nano .env" +echo "" +echo "make sure to recreate the docker-compose.yml after each change" +echo " $ ./scripts/generate-compose" +echo "" +echo "to start bigbluebutton run" +echo " $ docker compose up -d" diff --git a/opt/02-core/bigbluebutton/scripts/upgrade b/opt/02-core/bigbluebutton/scripts/upgrade new file mode 100755 index 0000000..961ea9a --- /dev/null +++ b/opt/02-core/bigbluebutton/scripts/upgrade @@ -0,0 +1,75 @@ +#!/bin/bash + +set -e +cd $(dirname $0)/.. + +if [ -z $RESTARTED ] +then + + echo "# pull newest bigblugbutton-docker.git" + git pull + + # restart script, since it might have changed. + RESTARTED=1 ./scripts/upgrade + exit + +else + + echo "" + echo "# recreate docker-compose.yml" + ./scripts/generate-compose + + + echo "" + echo "# checking for old volumes & migrate them" + COMPOSE_PREFIX=$(docker compose config | grep '^name:' | awk '{print $2}') + + function migrate_vol { + VOLUME=${COMPOSE_PREFIX}_${1} + EXISTING=$(docker volume ls | grep $VOLUME | tail -n1 | awk '{print $2}') + if [ -n "$EXISTING" ]; then + # ensure volume is not used + docker compose down --remove-orphans + + echo "Migrating $VOLUME to $2" + docker run --rm -v $VOLUME:/src -v $2:/dest --entrypoint /bin/sh eeacms/rsync -c 'rsync -av /src/ /dest' + docker volume rm $EXISTING + fi + } + migrate_vol bigbluebutton ./data/bigbluebutton + migrate_vol vol-freeswitch ./data/freeswitch-meetings + migrate_vol vol-mediasoup ./data/mediasoup + + if [ -d "./postgres-data" ]; then + echo "folder ./postgres-data still exists and probably uses postgres 12. migrating to a fresh postgres 16 data directory..." + docker compose down --remove-orphans + ./scripts/postgres-migrate ./postgres-data ./data/postgres 16 + mv postgres-data postgres-data.automigrate-bak + fi + + if [ -d "./greenlight-data" ]; then + if [ -d "./data/greenlight" ]; then + mv ./data/greenlight ./data/greenlight.automigrate-bak + fi + mv ./greenlight-data ./data/greenlight + fi + + # TODO: ask for LETSENCRYPT_EMAIL + + echo "" + echo "# pull newest images" + docker compose pull --ignore-pull-failures + + + COMMIT_HASH=$(git rev-parse --short HEAD) + BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD) + + echo "" + echo "-------------------------------------" + echo "update is ready!" + echo "we are on $COMMIT_HASH ($BRANCH_NAME)" + echo "" + echo "use following command for restarting bbb:" + echo " $ docker compose up -d --no-build" + echo "-------------------------------------" +fi \ No newline at end of file diff --git a/opt/02-core/bigbluebutton/scripts/upgrade-and-build b/opt/02-core/bigbluebutton/scripts/upgrade-and-build new file mode 100755 index 0000000..c4a2644 --- /dev/null +++ b/opt/02-core/bigbluebutton/scripts/upgrade-and-build @@ -0,0 +1,43 @@ +#!/bin/bash + +set -e +cd $(dirname $0)/.. + +if [ -z $RESTARTED ] +then + + echo "# pull newest bigblugbutton-docker.git" + git pull + + # restart script, since it might have changed. + RESTARTED=1 ./scripts/upgrade-and-build + exit + +else + echo "" + echo "# recreate docker-compose.yml" + ./scripts/generate-compose + + echo "" + echo "# pull newest images" + docker compose pull --ignore-pull-failures + + echo "" + echo "# rebuild images" + docker build -t alangecker/bbb-docker-base-java:latest mod/base-java + + # rebuild everything which got modified + docker compose build + + COMMIT_HASH=$(git rev-parse --short HEAD) + BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD) + + echo "" + echo "-------------------------------------" + echo "images successfully rebuilt!" + echo "we are on $COMMIT_HASH ($BRANCH_NAME)" + echo "" + echo "use following command for restarting bbb:" + echo " $ docker compose up -d" + echo "-------------------------------------" +fi \ No newline at end of file