diff --git a/README.md b/README.md index 4bf8daf..5eafa02 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,13 @@ # BigBlueButton Docker +## Features +- Easy installation +- Greenlight included +- TURN server included +- Fully automated HTTPS certificates +- Runs on almost any major linux distributon (Debian, Ubuntu, CentOS,...) +- Full IPv6 support + ## Install 1. Install docker-ce & docker-compose 1. follow instructions @@ -28,53 +36,11 @@ $ ./scripts/compose exec greenlight bundle exec rake admin:create ``` - - - - -## 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 http://docs.bigbluebutton.org/2.2/configure-firewall.html - - -## Upgrading - -```bash -cd bbb-docker - -# if you use greenlight: -# create a database backup -docker exec -t docker_postgres_1 pg_dumpall -c -U postgres > /root/greenlight_`date +%d-%m-%Y"_"%H_%M_%S`.sql - -# upgrade! -./scripts/upgrade - -# restart updated services -./scripts/compose up -d -``` - -If you're on an old version, you might get following error: \ -`no such file or directory: ./scripts/upgrade` \ -A simple `$ git pull` resolves that, by fetching a newer version which includes the upgrade script. +## How-To's +- [Upgrade](docs/upgrading.md) +- [Behind NAT](docs/behind-nat.md) +- [BBB-Docker Development](docs/development.md) +- [Integration into an existing web server](docs/existing-web-server.md) ## Special thanks to - @dkrenn, whos dockerized version (bigbluebutton#8858)(https://github.com/bigbluebutton/bigbluebutton/pull/8858) helped me a lot in understand and some configs. - -## Open Tasks -- add support for recording -- add coturn -- add prometheus exporter -- further separate `bbb-core` into individual container -- enable IPv6 support -- switch `html5` to node v12 -- drop root privileges in `webrtc-sfu` \ No newline at end of file diff --git a/docker-compose.coturn.yml b/docker-compose.coturn.yml index e50708d..6485378 100644 --- a/docker-compose.coturn.yml +++ b/docker-compose.coturn.yml @@ -4,7 +4,8 @@ services: image: instrumentisto/coturn:4.5 restart: unless-stopped command: - - "--external-ip=${EXTERNAL_IP}" + - "--external-ip=${EXTERNAL_IPv4}/${EXTERNAL_IPv4}" + - "--external-ip=${EXTERNAL_IPv6:-::1}/${EXTERNAL_IPv6:-::1}" - "--static-auth-secret=${TURN_SECRET}" volumes: - ssl_data:/etc/resty-auto-ssl diff --git a/docker-compose.greenlight.yml b/docker-compose.greenlight.yml index 018ca9c..0ca79fa 100644 --- a/docker-compose.greenlight.yml +++ b/docker-compose.greenlight.yml @@ -12,7 +12,7 @@ services: DB_NAME: greenlight DB_USERNAME: postgres DB_PASSWORD: password - BIGBLUEBUTTON_ENDPOINT: https://${DOMAIN}/bigbluebutton/api/ + BIGBLUEBUTTON_ENDPOINT: ${GREENLIGHT_ENDPOINT} BIGBLUEBUTTON_SECRET: ${SHARED_SECRET} SECRET_KEY_BASE: ${RAILS_SECRET} ports: diff --git a/docker-compose.https.yml b/docker-compose.https.yml index cf0ca3a..4ed824f 100644 --- a/docker-compose.https.yml +++ b/docker-compose.https.yml @@ -3,14 +3,12 @@ services: https_proxy: image: valian/docker-nginx-auto-ssl restart: unless-stopped - ports: - - 80:80 - - 443:443 volumes: - ssl_data:/etc/resty-auto-ssl + - ./mod/https/${HTTPS_SITE_FILE}:/etc/nginx/conf.d/bbb-docker.conf environment: - ALLOWED_DOMAINS: ${DOMAIN} - SITES: ${DOMAIN}=10.7.7.1:8080 + ALLOWED_DOMAINS: ${CERTIFICATE_DOMAINS} + network_mode: host volumes: ssl_data: diff --git a/docker-compose.prometheus.yml b/docker-compose.prometheus.yml new file mode 100644 index 0000000..94d96f1 --- /dev/null +++ b/docker-compose.prometheus.yml @@ -0,0 +1,15 @@ +version: '3.6' + +services: + prometheus-exporter: + image: greenstatic/bigbluebutton-exporter:v0.5.1 + restart: unless-stopped + environment: + API_BASE_URL: http://10.7.7.1:8080/bigbluebutton/api/ + API_SECRET: ${SHARED_SECRET} + RECORDINGS_METRICS_READ_FROM_DISK: "false" + networks: + bbb-net: + ipv4_address: 10.7.7.33 + # volumes: + # - bigbluebutton:/var/bigbluebutton \ No newline at end of file diff --git a/docker-compose.webhooks.yml b/docker-compose.webhooks.yml new file mode 100644 index 0000000..b7ed70b --- /dev/null +++ b/docker-compose.webhooks.yml @@ -0,0 +1,13 @@ +version: '3.6' +services: + webhooks: + build: mod/webhooks + restart: unless-stopped + environment: + DOMAIN: ${DOMAIN} + SHARED_SECRET: ${SHARED_SECRET} + extra_hosts: + - "redis:10.7.7.5" + networks: + bbb-net: + ipv4_address: 10.7.7.15 \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index ee97f2d..c124ac7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,8 +7,10 @@ services: depends_on: - redis environment: + DEV_MODE: ${DEV_MODE:-} DOMAIN: ${DOMAIN} SHARED_SECRET: ${SHARED_SECRET} + WELCOME_MESSAGE: ${WELCOME_MESSAGE:-} WELCOME_FOOTER: ${WELCOME_FOOTER} STUN_SERVER: stun:${STUN_IP}:${STUN_PORT} TURN_SERVER: ${TURN_SERVER:-} @@ -31,14 +33,18 @@ services: - SYS_RESOURCE environment: DOMAIN: ${DOMAIN} - EXTERNAL_IP: ${EXTERNAL_IP} + 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} volumes: - ./conf/sip_profiles:/etc/freeswitch/sip_profiles/external - ./conf/dialplan_public:/etc/freeswitch/dialplan/public_docker network_mode: host nginx: - image: nginx:1.18-alpine + image: nginx:1.19-alpine restart: unless-stopped depends_on: - etherpad @@ -51,11 +57,13 @@ services: - ./mod/nginx/bbb:/etc/nginx/bbb - ./mod/nginx/bigbluebutton:/etc/nginx/conf.d/default.conf - ${DEFAULT_PRESENTATION:-/dev/null}:/etc/nginx/html/default.pdf - networks: - bbb-net: - ipv4_address: 10.7.7.13 + 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: build: mod/etherpad @@ -85,14 +93,13 @@ services: ipv4_address: 10.7.7.6 kurento: - image: kurento/kurento-media-server:6.13.2 + image: kurento/kurento-media-server:6.14 restart: unless-stopped environment: KMS_STUN_IP: ${STUN_IP} KMS_STUN_PORT: ${STUN_PORT} KMS_MIN_PORT: 24577 KMS_MAX_PORT: 32768 - KMS_EXTERNAL_ADDRESS: ${EXTERNAL_IP} KMS_TURN_URL: KMS_NETWORK_INTERFACES: ${NETWORK_INTERFACE:-} network_mode: host @@ -111,10 +118,10 @@ services: KURENTO_NAME: kurento REDIS_HOST: redis FREESWITCH_IP: host.docker.internal - FREESWITCH_SIP_IP: ${EXTERNAL_IP} + FREESWITCH_SIP_IP: ${EXTERNAL_IPv4} ESL_IP: host.docker.internal LOG_LEVEL: info - NODE_CONFIG: '{"kurento":[{"ip":"${EXTERNAL_IP}","url":"ws://kurento:8888/kurento"}]}' + NODE_CONFIG: '{"kurento":[{"ip":"${EXTERNAL_IPv4}","url":"ws://kurento:8888/kurento"}]}' ports: - "127.0.0.1:3008:3008" extra_hosts: @@ -135,6 +142,13 @@ services: DOMAIN: ${DOMAIN} CLIENT_TITLE: ${CLIENT_TITLE} ETHERPAD_API_KEY: ${ETHERPAD_API_KEY} + LISTEN_ONLY_MODE: ${LISTEN_ONLY_MODE:-true} + DISABLE_ECHO_TEST: ${DISABLE_ECHO_TEST:-false} + AUTO_SHARE_WEBCAM: ${AUTO_SHARE_WEBCAM:-false} + DISABLE_VIDEO_PREVIEW: ${DISABLE_VIDEO_PREVIEW:-false} + CHAT_ENABLED: ${CHAT_ENABLED:-true} + CHAT_START_CLOSED: ${CHAT_START_CLOSED:-false} + DEV_MODE: ${DEV_MODE:-} networks: bbb-net: ipv4_address: 10.7.7.11 diff --git a/docs/behind-nat.md b/docs/behind-nat.md new file mode 100644 index 0000000..3453aad --- /dev/null +++ b/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 http://docs.bigbluebutton.org/2.2/configure-firewall.html + diff --git a/docs/development.md b/docs/development.md new file mode 100644 index 0000000..4a72642 --- /dev/null +++ b/docs/development.md @@ -0,0 +1,45 @@ +# bbb-docker Development + +## Running +you can run bbb-docker locally without any certificate issues with following `.env` configurations: + +``` +DEV_MODE=true + +ENABLE_HTTPS_PROXY=true +#ENABLE_COTURN=true +#ENABLE_GREENLIGHT=true +#ENABLE_WEBHOOKS=true + +DOMAIN=10.7.7.1 +EXTERNAL_IP=10.7.7.1 +STUN_IP=216.93.246.18 +STUN_PORT=3478 +TURN_SERVER=turns:localhost:465?transport=tcp + +TURN_SECRET=SuperTurnSecret +SHARED_SECRET=SuperSecret +ETHERPAD_API_KEY=SuperEtherpadKey +RAILS_SECRET=SuperRailsSecret + +# ==================================== +# CUSTOMIZATION +# ==================================== + +[... add rest of sample.env here ...] +``` + +- you can than start it with \ + `$ ./scripts/compose up -d` +- view the logs with \ + `$ ./scripts/compose logs -f` +- and access the API via \ + https://mconf.github.io/api-mate/#server=https://10.7.7.1/bigbluebutton/api&sharedSecret=SuperSecret + * 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)"_ + +## Changes +- After doing some changes you usually must... + * rebuild the image(s): \ + `$ ./scripts/compose build [containername]` + * restart changes image(s): \ + `$ ./scripts/compose up -d` \ No newline at end of file diff --git a/docs/existing-web-server.md b/docs/existing-web-server.md new file mode 100644 index 0000000..d4f4f33 --- /dev/null +++ b/docs/existing-web-server.md @@ -0,0 +1,43 @@ +# 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 8080. 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 +> *Not written yet. can you imagine writing down some instructions?* + +## 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:8080%{REQUEST_URI} [P,QSA,L] + + + Require all granted + ProxyPass http://127.0.0.1:8080/ + ProxyPassReverse http://127.0.0.1:8080/ + +``` +3. Restart Apache: +``` +service apache2 restart +``` diff --git a/docs/upgrading.md b/docs/upgrading.md new file mode 100644 index 0000000..f3a2bc5 --- /dev/null +++ b/docs/upgrading.md @@ -0,0 +1,21 @@ +# How To Upgrade bbb-docker + +## 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 +./scripts/compose up -d +``` + + +## "no such file or directory: ./scripts/upgrade" +If you're on an old version, you might get this error. +A simple `$ git pull` resolves that, by fetching a newer version which includes the upgrade script. diff --git a/mod/core/Dockerfile b/mod/core/Dockerfile index e0f42b4..4c7291a 100644 --- a/mod/core/Dockerfile +++ b/mod/core/Dockerfile @@ -28,7 +28,7 @@ RUN apt-get install -y supervisor apt-transport-https equivs libreoffice haveged # bbb repo & packages RUN LC_CTYPE=C.UTF-8 add-apt-repository ppa:bigbluebutton/support RUN sh -c 'wget https://ubuntu.bigbluebutton.org/repo/bigbluebutton.asc -O- | apt-key add -' \ - && sh -c 'echo "deb https://packages-eu.bigbluebutton.org/xenial-22 bigbluebutton-xenial main" > /etc/apt/sources.list.d/bigbluebutton.list' + && sh -c 'echo "deb https://ubuntu.bigbluebutton.org/xenial-22 bigbluebutton-xenial main" > /etc/apt/sources.list.d/bigbluebutton.list' # create dummy packages to satisfy dependencies RUN equivs-control redis-server.control \ @@ -37,6 +37,10 @@ RUN equivs-control redis-server.control \ && dpkg -i /*.deb \ && rm /*.deb +# this variable is not used, but it triggers +# rebuilding from here on if changed +ENV VERSION v2.2.22 + RUN apt-get update && apt-get install -y bbb-web \ bbb-fsesl-akka bbb-apps-akka bbb-transcode-akka bbb-apps \ bbb-apps-video bbb-apps-screenshare bbb-apps-video-broadcast \ diff --git a/mod/core/web/bigbluebutton.properties b/mod/core/web/bigbluebutton.properties index d7893b8..b1f4064 100644 --- a/mod/core/web/bigbluebutton.properties +++ b/mod/core/web/bigbluebutton.properties @@ -146,7 +146,7 @@ defaultGuestPolicy=ALWAYS_ACCEPT # # native2ascii -encoding UTF8 bigbluebutton.properties bigbluebutton.properties # -defaultWelcomeMessage=Welcome to %%CONFNAME%%!

For help on using BigBlueButton see these (short) tutorial videos.

To join the audio bridge click the phone button. Use a headset to avoid causing background noise for others. +defaultWelcomeMessage={{ .Env.WELCOME_MESSAGE }} defaultWelcomeMessageFooter={{ .Env.WELCOME_FOOTER }} # Default maximum number of users a meeting can have. @@ -297,7 +297,11 @@ beans.presentationService.testPresentationName=appkonference # Uploaded presentation file beans.presentationService.testUploadedPresentation=appkonference.txt # Default Uploaded presentation file +{{ if isTrue .Env.DEV_MODE }} +beans.presentationService.defaultUploadedPresentation=https://test.bigbluebutton.org/default.pdf +{{else}} beans.presentationService.defaultUploadedPresentation=${bigbluebutton.web.serverURL}/default.pdf +{{end}} presentationBaseURL=${bigbluebutton.web.serverURL}/bigbluebutton/presentation diff --git a/mod/coturn/turnserver.conf b/mod/coturn/turnserver.conf index 832897e..ddb8111 100644 --- a/mod/coturn/turnserver.conf +++ b/mod/coturn/turnserver.conf @@ -60,4 +60,12 @@ no-tlsv1 no-tlsv1_1 # To enable single filename logs you need to enable the simple-log flag -syslog \ No newline at end of file +syslog + + +# Allocate Address Family according +# If enabled then TURN server allocates address family according the TURN +# Client <=> Server communication address family. +# (By default Coturn works according RFC 6156.) +# !!Warning: Enabling this option breaks RFC6156 section-4.2 (violates use default IPv4)!! +keep-address-family diff --git a/mod/freeswitch/Dockerfile b/mod/freeswitch/Dockerfile index fb3bf26..a15c4fc 100644 --- a/mod/freeswitch/Dockerfile +++ b/mod/freeswitch/Dockerfile @@ -35,7 +35,6 @@ RUN apt-get update && apt-get install -y \ freeswitch-mod-hash \ freeswitch-mod-httapi \ freeswitch-mod-local-stream \ - freeswitch-mod-logfile \ freeswitch-mod-loopback \ freeswitch-mod-lua \ freeswitch-mod-native-file \ @@ -49,7 +48,8 @@ RUN apt-get update && apt-get install -y \ freeswitch-mod-spandsp \ freeswitch-mod-tone-stream \ freeswitch-mod-verto \ - freeswitch-sounds-en-us-callie + freeswitch-sounds-en-us-callie \ + iptables # Potentially missing # (included in bbb-freeswitch-core but not referenced in https://github.com/bigbluebutton/bigbluebutton/issues/9064) diff --git a/mod/freeswitch/conf/autoload_configs/conference.conf.xml.tmpl b/mod/freeswitch/conf/autoload_configs/conference.conf.xml.tmpl new file mode 100644 index 0000000..516b2c7 --- /dev/null +++ b/mod/freeswitch/conf/autoload_configs/conference.conf.xml.tmpl @@ -0,0 +1,284 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{if not (isTrue .Env.DISABLE_SOUND_MUTED) }} + + + {{end}} + {{if not (isTrue .Env.DISABLE_SOUND_ALONE) }} + + {{end}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mod/freeswitch/conf/autoload_configs/modules.conf.xml b/mod/freeswitch/conf/autoload_configs/modules.conf.xml new file mode 100644 index 0000000..d99e78a --- /dev/null +++ b/mod/freeswitch/conf/autoload_configs/modules.conf.xml @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mod/freeswitch/conf/sip_profiles/external-ipv6.xml b/mod/freeswitch/conf/sip_profiles/external-ipv6.xml index a01b6cd..f1421ce 100644 --- a/mod/freeswitch/conf/sip_profiles/external-ipv6.xml +++ b/mod/freeswitch/conf/sip_profiles/external-ipv6.xml @@ -1,4 +1,113 @@ - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mod/freeswitch/conf/vars.xml.tmpl b/mod/freeswitch/conf/vars.xml.tmpl index 04ef431..e8a070f 100644 --- a/mod/freeswitch/conf/vars.xml.tmpl +++ b/mod/freeswitch/conf/vars.xml.tmpl @@ -60,7 +60,8 @@ --> - + + @@ -300,7 +301,7 @@ If unspecified, the bind_server_ip value is used. Used by: sofia.conf.xml dingaling.conf.xml --> - + - +