script for instant development mode

This commit is contained in:
chandi 2023-12-07 19:16:47 +01:00
parent 8c0409fa53
commit 1b0c9a9602
15 changed files with 405 additions and 66 deletions

0
.cache/meteor/.gitkeep Normal file
View File

0
.cache/npm/.gitkeep Normal file
View File

4
.gitignore vendored
View File

@ -14,5 +14,9 @@ docker-compose.override.yml
# App generated # App generated
.env .env
.env.bak
postgres-data postgres-data
greenlight-data greenlight-data
.cache/*/**
!.cache/*/.gitkeep

213
dev.env Normal file
View File

@ -0,0 +1,213 @@
# fixed environment for an working dev setup
DEV_MODE=true
# use meteor dev server for html5
DEV_HTML5=true
# ====================================
# ADDITIONS to BigBlueButton
# ====================================
# (place a '#' before to disable them)
# HTTPS Proxy
# fully automated Lets Encrypt certificates
ENABLE_HTTPS_PROXY=true
# If your network doesn't allow access to DNS at 8.8.8.8 specify your own resolvers
#RESOLVER_ADDRESS=x.x.x.x
# coturn (a TURN Server)
# requires either the abhove HTTPS Proxy to be enabled
# or TLS certificates to be mounted to container
ENABLE_COTURN=false
#COTURN_TLS_CERT_PATH=
#COTURN_TLS_KEY_PATH=
# Greenlight Frontend
# https://docs.bigbluebutton.org/greenlight/gl-overview.html
ENABLE_GREENLIGHT=true
# Enable Webhooks
# used by some integrations
ENABLE_WEBHOOKS=true
# Prometheus Exporter
# serves the bigbluebutton-exporter under following URL:
# https://yourdomain/bbb-exporter
ENABLE_PROMETHEUS_EXPORTER=true
#ENABLE_PROMETHEUS_EXPORTER_OPTIMIZATION=true
# Recording
# IMPORTANT: this is currently a big privacy issues, because it will
# record everything which happens in the conference, even when the button
# suggets, that it does not.
# https://github.com/bigbluebutton/bigbluebutton/issues/9202
# make sure that you get peoples consent, before they join a room
ENABLE_RECORDING=true
#REMOVE_OLD_RECORDING=false
#RECORDING_MAX_AGE_DAYS=14
# ====================================
# SECRETS
# ====================================
# important! change these to any random values
SHARED_SECRET=SuperSecret
ETHERPAD_API_KEY=SuperEtherpadKey
RAILS_SECRET=SuperRailsSecret_SuperRailsSecret
POSTGRESQL_SECRET=SuperPostgresSecret
FSESL_PASSWORD=SuperFreeswitchESLPassword
# ====================================
# CONNECTION
# ====================================
DOMAIN=10.7.7.1
EXTERNAL_IPv4=10.7.7.1
EXTERNAL_IPv6=
# STUN SERVER
# stun.freeswitch.org
STUN_IP=147.182.188.245
STUN_PORT=3478
# TURN SERVER
# uncomment and adjust following two lines to add an external TURN server
#TURN_SERVER=turns:localhost:465?transport=tcp
#TURN_SECRET=
# Allowed SIP IPs
# due to high traffic caused by bots, by default the SIP port is blocked.
# but you can allow access by your providers IP or IP ranges (comma seperated)
# Hint: if you want to allow requests from every IP, you can use 0.0.0.0/0
SIP_IP_ALLOWLIST=0.0.0.0/0
# ====================================
# CUSTOMIZATION
# ====================================
CLIENT_TITLE=BigBlueButton (Development)
# use following lines to replace the default welcome message and footer
WELCOME_MESSAGE="Welcome to <b>%%CONFNAME%%</b>!<br><br>For help on using BigBlueButton see these (short) <a href='https://www.bigbluebutton.org/html5' target='_blank'><u>tutorial videos</u></a>.<br><br>To join the audio bridge click the speaker button. Use a headset to avoid causing background noise for others."
WELCOME_FOOTER="This server is running <a href='https://docs.bigbluebutton.org/'' target='_blank'><u>BigBlueButton</u></a>."
# use following line for an additional SIP dial-in message
#WELCOME_FOOTER="This server is running <a href='https://docs.bigbluebutton.org/' target='_blank'><u>BigBlueButton</u></a>. <br><br>To join this meeting by phone, dial:<br> INSERT_YOUR_PHONE_NUMBER_HERE<br>Then enter %%CONFNUM%% as the conference PIN number."
# for a different default presentation, place the pdf file in ./conf/ and
# adjust the following path
DEFAULT_PRESENTATION=./mod/nginx/default.pdf
# language of sound announcements
# options:
# - en-ca-june - EN Canadian June
# - en-us-allison - US English Allison
# - en-us-callie - US English Callie (default)
# - de-de-daedalus3 - German by Daedalus3 (https://github.com/Daedalus3/freeswitch-german-soundfiles)
# - es-ar-mario - Spanish/Argentina Mario
# - fr-ca-june - FR Canadian June
# - pt-br-karina - Brazilian Portuguese Karina
# - ru-RU-elena - RU Russian Elena
# - ru-RU-kirill - RU Russian Kirill
# - ru-RU-vika - RU Russian Viktoriya
# - sv-se-jakob - Swedish (Sweden) Jakob
# - zh-cn-sinmei - Chinese/China Sinmei
# - zh-hk-sinmei - Chinese/Hong Kong Sinmei
SOUNDS_LANGUAGE=en-us-callie
# set to false to disable listenOnlyMode
LISTEN_ONLY_MODE=true
# set to true to disable echo test
DISABLE_ECHO_TEST=false
# set to true to automatically share webcam
AUTO_SHARE_WEBCAM=false
# set to true to disable video preview for webcam sharing
DISABLE_VIDEO_PREVIEW=false
# set to false to disable chat
CHAT_ENABLED=true
# set to true to start chat closed
CHAT_START_CLOSED=false
# set to true to disable announcements "You are now (un-)muted"
DISABLE_SOUND_MUTED=false
# set to true to disable announcement "You are the only person in this conference"
DISABLE_SOUND_ALONE=false
# maximum count of breakout rooms per meeting
# Warning: increasing the limit of breakout rooms per meeting
# can generate excessive overhead to the server. We recommend
# this value to be kept under 12.
BREAKOUTROOM_LIMIT=8
# set to false to disable the learning dashboard
ENABLE_LEARNING_DASHBOARD=true
# ====================================
# Tuning
# ====================================
# Default = 2; Min = 1; Max = 4
# On powerful systems with high number of meetings you can set values up to 4 to accelerate handling of events
NUMBER_OF_BACKEND_NODEJS_PROCESSES=1
# Default = 2; Min = 1; Max = 8
# Set a number between 1 and 4 times the value of NUMBER_OF_BACKEND_NODEJS_PROCESSES where higher number helps with meetings
# stretching the recommended number of users in BigBlueButton
NUMBER_OF_FRONTEND_NODEJS_PROCESSES=1
# ====================================
# GREENLIGHT CONFIGURATION
# ====================================
### SMTP CONFIGURATION
# Emails are required for the basic features of Greenlight to function.
# Please refer to your SMTP provider to get the values for the variables below
#SMTP_SENDER_EMAIL=
#SMTP_SENDER_NAME=
#SMTP_SERVER=
#SMTP_PORT=
#SMTP_DOMAIN=
#SMTP_USERNAME=
#SMTP_PASSWORD=
#SMTP_AUTH=
#SMTP_STARTTLS_AUTO=true
#SMTP_STARTTLS=false
#SMTP_TLS=false
#SMTP_SSL_VERIFY=true
### EXTERNAL AUTHENTICATION METHODS
#
#OPENID_CONNECT_CLIENT_ID=
#OPENID_CONNECT_CLIENT_SECRET=
#OPENID_CONNECT_ISSUER=
#OPENID_CONNECT_REDIRECT=
# To enable hCaptcha on the user sign up and sign in, define these 2 keys
#HCAPTCHA_SITE_KEY=
#HCAPTCHA_SECRET_KEY=
# Set these if you are using a Simple Storage Service (S3)
# Uncomment S3_ENDPOINT only if you are using a S3 OTHER than Amazon Web Service (AWS) S3.
#S3_ACCESS_KEY_ID=
#S3_SECRET_ACCESS_KEY=
#S3_REGION=
#S3_BUCKET=
#S3_ENDPOINT=
# Define the default locale language code (i.e. 'en' for English) from the fallowing list:
# [en, ar, fr, es]
#DEFAULT_LOCALE=en

View File

@ -81,6 +81,34 @@ services:
ipv4_address: 10.7.7.2 ipv4_address: 10.7.7.2
{{ if isTrue .Env.DEV_HTML5 }}
html5-dev:
build:
context: mod/html5
dockerfile: Dockerfile.dev
args:
BBB_BUILD_TAG: bbb27-2023-06-13-java17
user: ${BBB_DOCKER_USER}
restart: unless-stopped
depends_on:
- redis
- mongodb
- etherpad
volumes:
- ./repos/bigbluebutton/bigbluebutton-html5:/app/:rw
- ./.cache/npm:/tmp/.npm:rw
- ./.cache/meteor:/tmp/.meteor:rw
- ./mod/html5/bbb-html5.yml:/tmp/bbb-html5.yml.tmpl
environment:
<<: *html5backend-env
HOME: /tmp
BBB_HTML5_ROLE: ""
networks:
bbb-net:
ipv4_address: 10.7.7.200
{{ else }}
{{ range $i := loop 0 (atoi .Env.NUMBER_OF_BACKEND_NODEJS_PROCESSES) }} {{ range $i := loop 0 (atoi .Env.NUMBER_OF_BACKEND_NODEJS_PROCESSES) }}
html5-backend-{{ add $i 1 }}: html5-backend-{{ add $i 1 }}:
<<: *html5backend <<: *html5backend
@ -105,6 +133,8 @@ services:
ipv4_address: 10.7.7.{{ add 200 $i }} ipv4_address: 10.7.7.{{ add 200 $i }}
{{end}} {{end}}
{{ end }}
freeswitch: freeswitch:
container_name: bbb-freeswitch container_name: bbb-freeswitch
@ -160,11 +190,20 @@ services:
depends_on: depends_on:
- etherpad - etherpad
- webrtc-sfu - webrtc-sfu
{{ if isTrue .Env.DEV_HTML5 }}
- html5-dev
{{ else }}
- html5-backend-1 - html5-backend-1
{{ end }}
volumes: volumes:
- bigbluebutton:/var/bigbluebutton - bigbluebutton:/var/bigbluebutton
- html5-static:/html5-static:ro - html5-static:/html5-static:ro
- ${DEFAULT_PRESENTATION:-/dev/null}:/www/default.pdf - ${DEFAULT_PRESENTATION:-/dev/null}:/www/default.pdf
{{ if isTrue .Env.DEV_HTML5 }}
# don't let nginx directly serve static files
- ./mod/nginx/bbb-html5.dev.nginx:/etc/nginx/bbb/bbb-html5.nginx:ro
{{ end }}
network_mode: host network_mode: host
extra_hosts: extra_hosts:
- "host.docker.internal:10.7.7.1" - "host.docker.internal:10.7.7.1"

View File

@ -1,50 +1,29 @@
# bbb-docker Development # bbb-docker Development
## Basics ## 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: 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 ```sh
$ git submodule update --init $ git clone --recurse-submodules https://github.com/bigbluebutton/docker.git bbb-dev
$ cd bbb-dev
``` ```
## Running ## Running
you can run bbb-docker locally without any certificate issues with following `.env` configurations: you can now run bbb-docker locally by simply starting
``` ```sh
DEV_MODE=true $ ./scripts/dev
ENABLE_HTTPS_PROXY=true
#ENABLE_COTURN=true
#ENABLE_GREENLIGHT=true
#ENABLE_WEBHOOKS=true
#ENABLE_PROMETHEUS_EXPORTER=true
#ENABLE_RECORDING=true
DOMAIN=10.7.7.1
EXTERNAL_IPv4=10.7.7.1
STUN_IP=216.93.246.18
STUN_PORT=3478
TURN_SERVER=turns:localhost:5349?transport=tcp
TURN_SECRET=SuperTurnSecret
SHARED_SECRET=SuperSecret
ETHERPAD_API_KEY=SuperEtherpadKey
RAILS_SECRET=SuperRailsSecret_SuperRailsSecret
# ====================================
# CUSTOMIZATION
# ====================================
[... add rest of sample.env here ...]
``` ```
- regenerate `docker-compose.yml` \ ### 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` `$ ./scripts/generate-compose`
- build the images \
`$ docker compose build`
- you can than start it with \
`$ docker compose up -d`
- view the logs with \ - view the logs with \
`$ docker compose logs -f` `$ docker compose logs -f`
- and access the API via \ - and access the API via \
@ -55,16 +34,6 @@ RAILS_SECRET=SuperRailsSecret_SuperRailsSecret
## Notes ## Notes
- Due to the self signed ssl certificate it is currently not possible to notify greenlight about recordings in dev mode - Due to the self signed ssl certificate it is currently not possible to notify greenlight about recordings in dev mode
## Changes
- After doing some changes you usually must...
- recreate `docker-compose.yml` \
`$ ./scripts/generate-compose`
* rebuild the image(s): \
`$ docker compose build [containername]`
* restart changes image(s): \
`$ docker compose up -d`
## How to do create a new update for a newer BBB release? ## How to do create a new update for a newer BBB release?
This always consists out of following steps 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.** \ 1. **Get an understanding about changes that happened and find out what changes to bbb-docker that require.** \

View File

@ -4,8 +4,6 @@ FROM bigbluebutton/bbb-build:$BBB_BUILD_TAG AS builder
# RUN groupadd -g 2000 meteor && useradd -m -u 2001 -g meteor meteor # RUN groupadd -g 2000 meteor && useradd -m -u 2001 -g meteor meteor
# USER meteor # USER meteor
ARG TAG_HTML5
COPY --from=source ./ /source COPY --from=source ./ /source
RUN cd /source && meteor npm ci --production \ RUN cd /source && meteor npm ci --production \
&& METEOR_DISABLE_OPTIMISTIC_CACHING=1 meteor build --architecture os.linux.x86_64 --allow-superuser --directory /app \ && METEOR_DISABLE_OPTIMISTIC_CACHING=1 meteor build --architecture os.linux.x86_64 --allow-superuser --directory /app \
@ -17,6 +15,7 @@ RUN cd /app/bundle/programs/server \
RUN mkdir -p /app/bundle/programs/web.browser/app/files && \ RUN mkdir -p /app/bundle/programs/web.browser/app/files && \
cp /app/bundle/programs/server/npm/node_modules/@fontsource/*/files/*.woff* /app/bundle/programs/web.browser/app/files/ cp /app/bundle/programs/server/npm/node_modules/@fontsource/*/files/*.woff* /app/bundle/programs/web.browser/app/files/
ARG TAG_BBB
RUN sed -i "s/VERSION/$TAG_BBB/" /app/bundle/programs/web.browser/head.html \ RUN sed -i "s/VERSION/$TAG_BBB/" /app/bundle/programs/web.browser/head.html \
&& find /app/bundle/programs/web.browser -name '*.js' -exec gzip -k -f -9 '{}' \; \ && find /app/bundle/programs/web.browser -name '*.js' -exec gzip -k -f -9 '{}' \; \
&& find /app/bundle/programs/web.browser -name '*.css' -exec gzip -k -f -9 '{}' \; \ && find /app/bundle/programs/web.browser -name '*.css' -exec gzip -k -f -9 '{}' \; \

16
mod/html5/Dockerfile.dev Normal file
View File

@ -0,0 +1,16 @@
ARG BBB_BUILD_TAG
FROM bigbluebutton/bbb-build:$BBB_BUILD_TAG AS builder
RUN curl https://install.meteor.com/\?release\=2.13 | sh
COPY --from=alangecker/bbb-docker-base-java /usr/local/bin/dockerize /usr/local/bin/dockerize
# make /root/.meteor accessible for user
RUN chmod 777 /root /root/.meteor
COPY entrypoint.dev.sh /entrypoint.dev.sh
ENTRYPOINT ["/entrypoint.dev.sh"]

View File

@ -1,7 +1,7 @@
public: public:
app: app:
html5ClientBuild: {{ .Env.TAG_HTML5 }} html5ClientBuild: {{ .Env.TAG_BBB }}
bbbServerVersion: {{ .Env.TAG_HTML5 }}-docker bbbServerVersion: {{ .Env.TAG_BBB }}-docker
listenOnlyMode: {{ .Env.LISTEN_ONLY_MODE }} listenOnlyMode: {{ .Env.LISTEN_ONLY_MODE }}
skipCheck: {{ .Env.DISABLE_ECHO_TEST }} skipCheck: {{ .Env.DISABLE_ECHO_TEST }}
clientTitle: {{ .Env.CLIENT_TITLE }} clientTitle: {{ .Env.CLIENT_TITLE }}

31
mod/html5/entrypoint.dev.sh Executable file
View File

@ -0,0 +1,31 @@
#!/bin/sh -e
# use /tmp as home dir as writeable directory for whatever UID we get
export HOME=/tmp
export MONGO_OPLOG_URL=mongodb://10.7.7.6/local
export MONGO_URL=mongodb://10.7.7.6/meteor
export ROOT_URL=http://127.0.0.1/html5client
export BIND_IP=0.0.0.0
export LANG=en_US.UTF-8
export BBB_HTML5_LOCAL_SETTINGS=/tmp/bbb-html5.yml
echo "DEV_MODE=true, disable TLS certificate rejecting"
export NODE_TLS_REJECT_UNAUTHORIZED=0
if [ ! -f "/tmp/.meteor/copy-done" ]; then
echo "# copying over .meteor from docker image... (this might take some minutes)"
cp -a /root/.meteor/* /tmp/.meteor
touch /tmp/.meteor/copy-done
fi
cd /app
echo "# meteor npm install"
meteor npm install
echo "# npm start"
dockerize \
-template /tmp/bbb-html5.yml.tmpl:/tmp/bbb-html5.yml \
npm start

View File

@ -0,0 +1,6 @@
location /html5client {
proxy_pass http://10.7.7.200:4100; # use for production
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}

76
scripts/dev Executable file
View File

@ -0,0 +1,76 @@
#!/bin/bash
set -e
cd "$(dirname "$0")/.."
. scripts/functions.sh
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
cp dev.env .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"
cp dev.env .env
fi
# to avoid any file permission issues we want to run some containers with the same
# UID and GID as the current user
export BBB_DOCKER_USER="$(id -u):$(id -g)"
# also add it to ~/.zshrc and/or ~/.bashrc so
# that people can also use commands like `docker compose up`
# without that variable being missing
function add_permanent_env {
STR='export BBB_DOCKER_USER="$(id -u):$(id -g)"'
if [ -z "$(grep "$STR" "$1")" ]; then
echo "append"
echo "" >> $1
echo "# following line got added by bbb-docker" >> $1
echo "$STR" >> $1
fi
}
if [ -f "$(realpath ~/.zshrc)" ]; then
add_permanent_env "$(realpath ~/.zshrc)"
fi
if [ -f "$(realpath ~/.bashrc)" ]; then
add_permanent_env "$(realpath ~/.bashrc)"
fi
echo ""
echo "# ensure submodules are checked out"
ensure_submodules
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://10.7.7.1/bigbluebutton/api&sharedSecret=SuperSecret"
echo "Greenlight: https://10.7.7.1/"
echo "Check containers: docker-compose ps"
echo "Rebuilding container: docker-compose up --build CONTAINERNAME"
echo "============================================"
sleep 1
docker compose up

View File

@ -1,15 +1,5 @@
function load_env { function load_env {
FILE=.env export $(cat .env | sed 's/#.*//g' | grep -v "WELCOME_FOOTER" | grep -v "WELCOME_MESSAGE" | grep -v "CLIENT_TITLE" | xargs)
if [ "$BBB_DOCKER_DEV" = "1" ]; then
FILE=dev.env
else
FILE=.env
fi
if [ -f $FILE ]
then
export $(cat $FILE | sed 's/#.*//g' | grep -v "WELCOME_FOOTER" | grep -v "WELCOME_MESSAGE" | grep -v "CLIENT_TITLE" | xargs)
fi
} }
function ensure_submodules { function ensure_submodules {

View File

@ -52,6 +52,7 @@ docker run \
-e COMMIT_ETHERPAD_SKIN=$(get_tag repos/bbb-etherpad-skin) \ -e COMMIT_ETHERPAD_SKIN=$(get_tag repos/bbb-etherpad-skin) \
-e COMMIT_ETHERPAD_PLUGIN=$(get_tag repos/bbb-etherpad-plugin) \ -e COMMIT_ETHERPAD_PLUGIN=$(get_tag repos/bbb-etherpad-plugin) \
-e DEV_MODE=${DEV_MODE:-false} \ -e DEV_MODE=${DEV_MODE:-false} \
-e DEV_HTML5=${DEV_HTML5:-false} \
-e EXTERNAL_IPv6=${EXTERNAL_IPv6:-} \ -e EXTERNAL_IPv6=${EXTERNAL_IPv6:-} \
-e ENABLE_RECORDING=${ENABLE_RECORDING:-false} \ -e ENABLE_RECORDING=${ENABLE_RECORDING:-false} \
-e ENABLE_HTTPS_PROXY=${ENABLE_HTTPS_PROXY:-false} \ -e ENABLE_HTTPS_PROXY=${ENABLE_HTTPS_PROXY:-false} \

View File

@ -14,11 +14,6 @@ then
exit exit
else else
echo ""
echo "# pull newest git submodules"
./scripts/checkout-submodules
echo "" echo ""
echo "# recreate docker-compose.yml" echo "# recreate docker-compose.yml"
./scripts/generate-compose ./scripts/generate-compose