From abeac58d730d93990472c3b82509e31705f363f8 Mon Sep 17 00:00:00 2001 From: omidmaldar Date: Sun, 17 Oct 2021 01:01:07 +0300 Subject: [PATCH] Enable optimization for Prometheus when recording is enabled --- docker-compose.tmpl.yml | 19 ++++++++++++------- sample.env | 9 +++++---- scripts/generate-compose | 1 + scripts/setup | 33 ++++++++++++++++++++++++--------- 4 files changed, 42 insertions(+), 20 deletions(-) diff --git a/docker-compose.tmpl.yml b/docker-compose.tmpl.yml index 846fec0..4587534 100644 --- a/docker-compose.tmpl.yml +++ b/docker-compose.tmpl.yml @@ -115,7 +115,7 @@ services: - ./conf/dialplan_public:/etc/freeswitch/dialplan/public_docker - vol-freeswitch:/var/freeswitch/meetings network_mode: host - + nginx: build: mod/nginx restart: unless-stopped @@ -156,7 +156,7 @@ services: retries: 30 networks: bbb-net: - ipv4_address: 10.7.7.5 + ipv4_address: 10.7.7.5 mongodb: image: mongo:4.4 @@ -177,7 +177,7 @@ services: kurento: image: kurento/kurento-media-server:6.16 restart: unless-stopped - environment: + environment: KMS_STUN_IP: ${STUN_IP} KMS_STUN_PORT: ${STUN_PORT} KMS_MIN_PORT: 24577 @@ -188,7 +188,7 @@ services: network_mode: host volumes: - vol-kurento:/var/kurento - + webrtc-sfu: build: mod/webrtc-sfu restart: unless-stopped @@ -249,7 +249,7 @@ services: networks: bbb-net: ipv4_address: 10.7.7.20 - + periodic: build: mod/periodic restart: unless-stopped @@ -385,15 +385,20 @@ services: prometheus-exporter: image: greenstatic/bigbluebutton-exporter:v0.7.0-preview2 restart: unless-stopped - environment: + environment: API_BASE_URL: http://10.7.7.1:8080/bigbluebutton/api/ API_SECRET: ${SHARED_SECRET} - RECORDINGS_METRICS_READ_FROM_DISK: "false" + RECORDINGS_METRICS_READ_FROM_DISK: "${ENABLE_PROMETHEUS_EXPORTER_OPTIMIZATION}" networks: bbb-net: ipv4_address: 10.7.7.33 + {{ if isTrue .Env.ENABLE_PROMETHEUS_EXPORTER_OPTIMIZATION }} + volumes: + - bigbluebutton:/var/bigbluebutton:ro + {{end}} {{end}} + volumes: bigbluebutton: vol-freeswitch: diff --git a/sample.env b/sample.env index fe507bb..975b174 100644 --- a/sample.env +++ b/sample.env @@ -8,7 +8,7 @@ ENABLE_HTTPS_PROXY=true # coturn (a TURN Server) -# requires either the abhove HTTPS Proxy to be enabled +# requires either the abhove HTTPS Proxy to be enabled # or TLS certificates to be mounted to container ENABLE_COTURN=true #COTURN_TLS_CERT_PATH= @@ -26,9 +26,10 @@ ENABLE_GREENLIGHT=true # 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 +# 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 @@ -132,7 +133,7 @@ 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" +# 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 @@ -224,7 +225,7 @@ ALLOW_GREENLIGHT_ACCOUNTS=true # SMTP_AUTH=plain # SMTP_STARTTLS_AUTO=true # -# If your mail server has a self-signed certificate, you'll also need to include the line below. +# If your mail server has a self-signed certificate, you'll also need to include the line below. # Please note that enable this presents its own security risks and should not be done unless necessary. # SMTP_OPENSSL_VERIFY_MODE=none # diff --git a/scripts/generate-compose b/scripts/generate-compose index 37b8353..43e01b1 100755 --- a/scripts/generate-compose +++ b/scripts/generate-compose @@ -43,6 +43,7 @@ docker run \ -e ENABLE_COTURN=${ENABLE_COTURN:-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} \ -e NUMBER_OF_BACKEND_NODEJS_PROCESSES=${NUMBER_OF_BACKEND_NODEJS_PROCESSES:-1} \ -e NUMBER_OF_FRONTEND_NODEJS_PROCESSES=${NUMBER_OF_FRONTEND_NODEJS_PROCESSES:-1} \ jwilder/dockerize -template /docker-compose.tmpl.yml \ diff --git a/scripts/setup b/scripts/setup index 8bac629..3d87534 100755 --- a/scripts/setup +++ b/scripts/setup @@ -43,18 +43,13 @@ then echo " you must provide a relative or absolute path" echo " to your certificates." while [[ -z "$CERTPATH" ]]; do - read -p "Please enter path to cert.pem: " CERTPATH + read -p "Please enter path to cert.pem: " CERTPATH done while [[ -z "$KEYPATH" ]]; do - read -p "Please enter path to key.pem: " KEYPATH + read -p "Please enter path to key.pem: " KEYPATH done fi -prometheus_exporter="" -while [[ ! $prometheus_exporter =~ ^(y|n)$ ]]; do - read -p "Should a Prometheus exporter be included? (y/n): " prometheus_exporter -done - DOMAIN="" while [[ -z "$DOMAIN" ]]; do read -p "Please enter the domain name: " DOMAIN @@ -68,10 +63,25 @@ 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 + ip_correct="" while [[ ! $ip_correct =~ ^(y|n)$ ]]; do read -p "Is $EXTERNAL_IPv4 your external IPv4 address? (y/n): " ip_correct @@ -142,7 +152,12 @@ fi if [ "$prometheus_exporter" == "y" ] then - sed -i "s/#ENABLE_PROMETHEUS_EXPORTER.*/ENABLE_PROMETHEUS_EXPORTER=true/" .env + 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