From e4021dfc8fccc3601b171513d863051e8bd4fcb2 Mon Sep 17 00:00:00 2001 From: Luis Guzman Date: Mon, 29 Jun 2020 02:45:17 -0500 Subject: [PATCH 01/26] Check resources --- quick_jibri_installer.sh | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/quick_jibri_installer.sh b/quick_jibri_installer.sh index 4cd67ce..d507cb0 100644 --- a/quick_jibri_installer.sh +++ b/quick_jibri_installer.sh @@ -141,6 +141,43 @@ echo "$(lsb_release -sc), even when it's compatible and functional. We suggest to use the next (LTS) release, for longer support and security reasons." read -n 1 -s -r -p "Press any key to continue..."$'\n' fi +#Check resources +echo "Verifying System Resources:" +if [ "$(nproc --all)" -lt 4 ];then + echo "Warning: The system do not meet the minimum requirements for Jibri to run." + echo "Warning: We recommend 4 cores/threads for Jibri!" + CPU_MIN="N" +else + echo "CPU Cores/Threads: OK ($(nproc --all))" + CPU_MIN="Y" +fi +### Test RAM size (8GB min) ### +mem_available=$(grep MemTotal /proc/meminfo| grep -o '[0-9]\+') +if [ ${mem_available} -lt 7700000 ]; then + echo "Warning: The system do not meet the minimum requirements for Jibri to run." + echo "Warning: We recommend 8GB RAM for Jibri!" + MEM_MIN="N" +else + echo "Memory: OK ($((mem_available/1024)) MiB)" + MEM_MIN="Y" +fi +if [ $CPU_MIN="Y" ] && [ $MEM_MIN="Y" ];then + echo "All requirements seems meet!" + echo "We hope you have a nice recording/streaming session" +else + echo "Seems CPU/RAM requirements are NOT meet!" + echo "Even when you can use the videconference sessions, we advice to increase the resoruces in order to user Jibri." + while [[ "$CONTINUE_LOW_RES" != "yes" && "$CONTINUE_LOW_RES" != "no" ]] + do + read -p "> Do you want to continue?: (yes or no)"$'\n' -r CONTINUE_LOW_RES + if [ "$CONTINUE_LOW_RES" = "no" ]; then + echo "See you next time with more resources!..." + exit + elif [ "$CONTINUE_LOW_RES" = "yes" ]; then + echo "Please keep in mind that trying to use Jibri with low resources might fail." + fi + done +fi # Jitsi-Meet Repo echo "Add Jitsi key" if [ "$JITSI_REPO" = "stable" ]; then From 8518515b9d2d56b86ba3c8878e15b341854a40b6 Mon Sep 17 00:00:00 2001 From: Luis Guzman Date: Tue, 30 Jun 2020 01:41:38 -0500 Subject: [PATCH 02/26] Update README.md --- README.md | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 82e87bc..80f5bbb 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,15 @@ # Quick Jibri Installer Bash installer for Jibri on **\*buntu LTS** based systems using **nginx** as default webserver. +## Usage + +``` +git clone https://github.com/switnet-ltd/quick-jibri-installer +cd quick-jibri-installer +bash quick-jibri-installer.sh +``` +Please check more details on our wiki. + ## Requirements * Clean VM/VPS/Server using Ubuntu LTS * Valid domain with DNS record, **mandatory** for SSL certs via Let's Encrypt. @@ -8,6 +17,13 @@ Bash installer for Jibri on **\*buntu LTS** based systems using **nginx** as def * Minimum recommended for video recording: 8 GB RAM / 2 Cores. * Webcam +### Jigasi Transcript +* SIP account +* Google Cloud Account with Billing setup. +### Jibri Recodings Access via Nextcloud +* Valid domain with DNS record for Nextcloud SSL. + + ## Features * Enabled Session (video) Recording using Jibri * Enabled Jitsi Electron app detection server side. @@ -17,12 +33,6 @@ Bash installer for Jibri on **\*buntu LTS** based systems using **nginx** as def * (New) Customized brandless mode * (New) Improved recurring updater -### Jigasi Transcript -* SIP account -* Google Cloud Account with Billing setup. - -### Jibri Recodings Access via Nextcloud -* Valid domain with DNS record for Nextcloud SSL. ## Optional custom changes * Optional default language From 60b05e307e2bfe13250c08ee9af7756d6ff63de3 Mon Sep 17 00:00:00 2001 From: Luis Guzman Date: Tue, 30 Jun 2020 20:54:37 -0500 Subject: [PATCH 03/26] Fix evaluation (cherry picked from commit 9d6de4c312eae7f368e614c6baf92be38da5e3fc) --- quick_jibri_installer.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quick_jibri_installer.sh b/quick_jibri_installer.sh index d507cb0..97d9cf7 100644 --- a/quick_jibri_installer.sh +++ b/quick_jibri_installer.sh @@ -161,7 +161,7 @@ else echo "Memory: OK ($((mem_available/1024)) MiB)" MEM_MIN="Y" fi -if [ $CPU_MIN="Y" ] && [ $MEM_MIN="Y" ];then +if [ "$CPU_MIN" = "Y" ] && [ "$MEM_MIN" = "Y" ];then echo "All requirements seems meet!" echo "We hope you have a nice recording/streaming session" else From e010c11f3511468d027c4bfa80a2244db960fe19 Mon Sep 17 00:00:00 2001 From: Luis Guzman Date: Tue, 30 Jun 2020 21:07:22 -0500 Subject: [PATCH 04/26] Improve system verification notice (cherry picked from commit 556aa12f47bab90b1dc1dde052b38d812ee34728) --- quick_jibri_installer.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/quick_jibri_installer.sh b/quick_jibri_installer.sh index 97d9cf7..7d59f95 100644 --- a/quick_jibri_installer.sh +++ b/quick_jibri_installer.sh @@ -144,8 +144,8 @@ fi #Check resources echo "Verifying System Resources:" if [ "$(nproc --all)" -lt 4 ];then - echo "Warning: The system do not meet the minimum requirements for Jibri to run." - echo "Warning: We recommend 4 cores/threads for Jibri!" + echo "Warning!: The system do not meet the minimum requirements for Jibri to run." + echo ">> We recommend 4 cores/threads for Jibri!" CPU_MIN="N" else echo "CPU Cores/Threads: OK ($(nproc --all))" @@ -154,8 +154,8 @@ fi ### Test RAM size (8GB min) ### mem_available=$(grep MemTotal /proc/meminfo| grep -o '[0-9]\+') if [ ${mem_available} -lt 7700000 ]; then - echo "Warning: The system do not meet the minimum requirements for Jibri to run." - echo "Warning: We recommend 8GB RAM for Jibri!" + echo "Warning!: The system do not meet the minimum requirements for Jibri to run." + echo ">> We recommend 8GB RAM for Jibri!" MEM_MIN="N" else echo "Memory: OK ($((mem_available/1024)) MiB)" @@ -165,7 +165,7 @@ if [ "$CPU_MIN" = "Y" ] && [ "$MEM_MIN" = "Y" ];then echo "All requirements seems meet!" echo "We hope you have a nice recording/streaming session" else - echo "Seems CPU/RAM requirements are NOT meet!" + echo "CPU ($(nproc --all))/RAM ($((mem_available/1024)) MiB) does NOT meet minimum recommended requirements!" echo "Even when you can use the videconference sessions, we advice to increase the resoruces in order to user Jibri." while [[ "$CONTINUE_LOW_RES" != "yes" && "$CONTINUE_LOW_RES" != "no" ]] do From 20ed1e74b6393ebebbda47e937402ee481a4d447 Mon Sep 17 00:00:00 2001 From: Luis Guzman Date: Tue, 30 Jun 2020 21:11:26 -0500 Subject: [PATCH 05/26] Improve system verification notice2 (cherry picked from commit bb0855d6cbbd7cb2c0bd559df668abae1af8692e) --- quick_jibri_installer.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/quick_jibri_installer.sh b/quick_jibri_installer.sh index 7d59f95..03468bc 100644 --- a/quick_jibri_installer.sh +++ b/quick_jibri_installer.sh @@ -144,8 +144,10 @@ fi #Check resources echo "Verifying System Resources:" if [ "$(nproc --all)" -lt 4 ];then - echo "Warning!: The system do not meet the minimum requirements for Jibri to run." - echo ">> We recommend 4 cores/threads for Jibri!" + echo " +Warning!: The system do not meet the minimum requirements for Jibri to run. +>> We recommend 4 cores/threads for Jibri! +" CPU_MIN="N" else echo "CPU Cores/Threads: OK ($(nproc --all))" @@ -154,8 +156,10 @@ fi ### Test RAM size (8GB min) ### mem_available=$(grep MemTotal /proc/meminfo| grep -o '[0-9]\+') if [ ${mem_available} -lt 7700000 ]; then - echo "Warning!: The system do not meet the minimum requirements for Jibri to run." - echo ">> We recommend 8GB RAM for Jibri!" + echo " +Warning!: The system do not meet the minimum requirements for Jibri to run. +>> We recommend 8GB RAM for Jibri! +" MEM_MIN="N" else echo "Memory: OK ($((mem_available/1024)) MiB)" From a3a1708f1ed82c6532f81b52f56e270778ff5024 Mon Sep 17 00:00:00 2001 From: Luis Guzman Date: Tue, 30 Jun 2020 21:16:51 -0500 Subject: [PATCH 06/26] Define system asset (cherry picked from commit 1326e1767d4861984c7e2f4dd01916a277e8cc0d) --- quick_jibri_installer.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/quick_jibri_installer.sh b/quick_jibri_installer.sh index 03468bc..89933b2 100644 --- a/quick_jibri_installer.sh +++ b/quick_jibri_installer.sh @@ -145,7 +145,7 @@ fi echo "Verifying System Resources:" if [ "$(nproc --all)" -lt 4 ];then echo " -Warning!: The system do not meet the minimum requirements for Jibri to run. +Warning!: The system do not meet the minimum CPU requirements for Jibri to run. >> We recommend 4 cores/threads for Jibri! " CPU_MIN="N" @@ -157,7 +157,7 @@ fi mem_available=$(grep MemTotal /proc/meminfo| grep -o '[0-9]\+') if [ ${mem_available} -lt 7700000 ]; then echo " -Warning!: The system do not meet the minimum requirements for Jibri to run. +Warning!: The system do not meet the minimum RAM requirements for Jibri to run. >> We recommend 8GB RAM for Jibri! " MEM_MIN="N" From 4200becd9bf5a83e0eab3b8b3fa0392b3abd5e9f Mon Sep 17 00:00:00 2001 From: Luis Guzman Date: Tue, 30 Jun 2020 20:35:53 -0500 Subject: [PATCH 07/26] Move into postgresql as base DB Also delete tmp patch (cherry picked from commit 877b08825570fccc9212ab6dee46a54e03a6f3a0) --- files/patch_425_3dty.patch | 24 ---------------------- jra_nextcloud.sh | 41 ++++++++++---------------------------- 2 files changed, 10 insertions(+), 55 deletions(-) delete mode 100644 files/patch_425_3dty.patch diff --git a/files/patch_425_3dty.patch b/files/patch_425_3dty.patch deleted file mode 100644 index e97492c..0000000 --- a/files/patch_425_3dty.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- Compiler.php 2020-03-11 08:52:46.000000000 -0600 -+++ Compiler-fixed.php 2020-04-04 06:56:43.175786008 -0600 -@@ -5211,10 +5211,10 @@ - return new Node\Number(strlen($stringContent), ''); - } - -- protected static $libStrSlice = ['string', 'start-at', 'end-at']; -+ protected static $libStrSlice = ['string', 'start-at', 'end-at:-1']; - protected function libStrSlice($args) - { -- if (isset($args[2]) && $args[2][1] == 0) { -+ if (isset($args[2]) && ! $args[2][1]) { - return static::$nullString; - } - -@@ -5227,7 +5227,7 @@ - $start--; - } - -- $end = (int) $args[2][1]; -+ $end = isset($args[2]) ? (int) $args[2][1] : -1; - $length = $end < 0 ? $end + 1 : ($end > 0 ? $end - $start : $end); - - $string[2] = $length diff --git a/jra_nextcloud.sh b/jra_nextcloud.sh index b546a58..93f7845 100644 --- a/jra_nextcloud.sh +++ b/jra_nextcloud.sh @@ -50,7 +50,7 @@ done DISTRO_RELEASE="$(lsb_release -sc)" DOMAIN=$(ls /etc/prosody/conf.d/ | grep -v localhost | awk -F'.cfg' '{print $1}' | awk '!NF || !seen[$0]++') PHPVER="7.4" -MDBVER="10.4" +PSGVER="$(apt-cache madison postgresql | head -n1 | awk '{print $3}' | cut -d "+" -f1)" PHP_FPM_DIR="/etc/php/$PHPVER/fpm" PHP_INI="$PHP_FPM_DIR/php.ini" PHP_CONF="/etc/php/$PHPVER/fpm/pool.d/www.conf" @@ -86,16 +86,6 @@ if [ "$(dpkg-query -W -f='${Status}' $1 2>/dev/null | grep -c "ok installed")" = apt-get -yq2 install $1 fi } -add_mariadb() { - if [ "$(dpkg-query -W -f='${Status}' "mariadb-server" 2>/dev/null | grep -c "ok installed")" == "1" ]; then - echo "MariaDB already installed" - else - echo "# Adding MariaDB $MDBVER repository" - apt-key adv --recv-keys --keyserver keyserver.ubuntu.com C74CD1D8 - echo "deb [arch=amd64] http://ftp.ddg.lth.se/mariadb/repo/$MDBVER/ubuntu $DISTRO_RELEASE main" > /etc/apt/sources.list.d/mariadb.list - apt-get update -q2 - fi -} add_php74() { if [ "$(dpkg-query -W -f='${Status}' "php$PHPVER-fpm" 2>/dev/null | grep -c "ok installed")" == "1" ]; then echo "PHP $PHPVER already installed" @@ -107,15 +97,13 @@ add_php74() { fi } #Prevent root folder permission issues -cp $PWD/files/patch_425_3dty.patch /tmp cp $PWD/files/jra-nc-app-ef.json /tmp -exit_ifinstalled mariadb-server +exit_ifinstalled postgresql-$PSGVER ## Install software requirements -# MariaDB -add_mariadb -install_ifnot mariadb-server-$MDBVER +# PostgresSQL +install_ifnot postgresql-$PSGVER # PHP 7.4 add_php74 @@ -129,7 +117,7 @@ apt-get install -y \ php$PHPVER-json \ php$PHPVER-ldap \ php$PHPVER-mbstring \ - php$PHPVER-mysql \ + php$PHPVER-pgsql \ php$PHPVER-soap \ php$PHPVER-xml \ php$PHPVER-xmlrpc \ @@ -182,18 +170,15 @@ systemctl restart php$PHPVER-fpm.service # Create MySQL user #-------------------------------------------------- -echo -e "\n---- Creating the MariaDB User ----" +echo -e "\n---- Creating the PgSQL DB & User ----" -mysql -u root < $NC_NGINX_CONF @@ -376,17 +361,11 @@ mv nextcloud $NC_PATH chown -R www-data:www-data $NC_PATH chmod -R 755 $NC_PATH -if $(dpkg --compare-versions "$NCVERSION" "le" "18.0.3"); then -echo " --> Patching #425 (scssphp/src/Compiler.php)..." -sudo -u www-data patch -d "$NC_PATH/3rdparty/leafo/scssphp/src/" -p0 < /tmp/patch_425_3dty.patch -fi - echo " Database installation... " sudo -u www-data php $NC_PATH/occ maintenance:install \ ---database=mysql \ +--database=pgsql \ --database-name="$NC_DB" \ --database-user="$NC_DB_USER" \ --database-pass="$NC_DB_PASSWD" \ From 1e5acb5a3655acd4cb2a861503f8f11c70daed4b Mon Sep 17 00:00:00 2001 From: Luis Guzman Date: Tue, 30 Jun 2020 21:41:31 -0500 Subject: [PATCH 08/26] Change to PostgreSQL as defaul DB server Still prevent prosody custom repo. --- quick_jibri_installer.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/quick_jibri_installer.sh b/quick_jibri_installer.sh index 89933b2..7835d43 100644 --- a/quick_jibri_installer.sh +++ b/quick_jibri_installer.sh @@ -101,7 +101,15 @@ fi var_dlim() { grep -n $1 add-jibri-node.sh|head -n1|cut -d ":" -f1 } - +add_prosody_repo() { +echo "Add Prosody repo" +if [ "$PROSODY_REPO" = "main" ]; then + echo "Prosody repository already installed" +else + echo "deb http://packages.prosody.im/debian $(lsb_release -sc) main" > /etc/apt/sources.list.d/prosody.list + wget -qO - https://prosody.im/files/prosody-debian-packages.key | apt-key add - +fi +} clear echo ' ######################################################################## From a63b2f67359b707f36f670066c8232fa60c4376b Mon Sep 17 00:00:00 2001 From: Luis Guzman Date: Tue, 30 Jun 2020 21:41:31 -0500 Subject: [PATCH 09/26] Make add prosody repo a function Leave it out (cherry picked from commit 6646665066cf0ee3c728b6f397fa98f5d8e89ee8) --- quick_jibri_installer.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/quick_jibri_installer.sh b/quick_jibri_installer.sh index 7835d43..26133d1 100644 --- a/quick_jibri_installer.sh +++ b/quick_jibri_installer.sh @@ -190,6 +190,8 @@ else fi done fi +#Prosody repository +#add_prosody_repo # Jitsi-Meet Repo echo "Add Jitsi key" if [ "$JITSI_REPO" = "stable" ]; then From 08decca7c8ad1a5c8c02aa9cdbf81586555ae54d Mon Sep 17 00:00:00 2001 From: Luis Guzman Date: Sat, 4 Jul 2020 09:14:07 -0500 Subject: [PATCH 10/26] Fix serve from sub_path Grafana option. Working! (cherry picked from commit 107d98b37f1bd0d96aeacd0a8016b87dfdd84704) --- grafana.sh | 200 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 200 insertions(+) create mode 100644 grafana.sh diff --git a/grafana.sh b/grafana.sh new file mode 100644 index 0000000..a52b098 --- /dev/null +++ b/grafana.sh @@ -0,0 +1,200 @@ +#!/bin/bash +# Grafana Installer +# Based on: +# https://community.jitsi.org/t/how-to-to-setup-grafana-dashboards-to-monitor-jitsi-my-comprehensive-tutorial-for-the-beginner/ +# by Woodworker_Life +# Woodworker_Life © - 2020 +# Jitsi Metrics - Grafana dashboard by mephisto +# https://grafana.com/grafana/dashboards/11969 +# SwITNet Ltd © - 2020, https://switnet.net/ +# GPLv3 or later. + +while getopts m: option +do + case "${option}" + in + m) MODE=${OPTARG};; + \?) echo "Usage: sudo ./grafana.sh [-m debug]" && exit;; + esac +done + +#DEBUG +if [ "$MODE" = "debug" ]; then +set -x +fi + +MAIN_TEL="/etc/telegraf/telegraf.conf" +TEL_JIT="/etc/telegraf/telegraf.d/jitsi.conf" +GRAFANA_INI="/etc/grafana/grafana.ini" +DOMAIN=$(ls /etc/prosody/conf.d/ | grep -v localhost | awk -F'.cfg' '{print $1}' | awk '!NF || !seen[$0]++') +WS_CONF="/etc/nginx/sites-enabled/$DOMAIN.conf" +GRAFANA_PASS="$(tr -dc "a-zA-Z0-9#_*" < /dev/urandom | fold -w 14 | head -n1)" + +# Min requirements +apt update && apt install -y gnupg2 curl wget jq + +echo " +# Setup InfluxDB Packages +" +wget -qO- https://repos.influxdata.com/influxdb.key | sudo apt-key add - +echo "deb https://repos.influxdata.com/debian buster stable" | sudo tee /etc/apt/sources.list.d/influxdb.list +apt update && apt install influxdb -y +systemctl enable influxdb +systemctl status influxdb + +echo " +# Setup Grafana Packages +" +curl -s https://packages.grafana.com/gpg.key | sudo apt-key add - +add-apt-repository "deb https://packages.grafana.com/oss/deb stable main" +apt update && apt install grafana -y +systemctl enable grafana-server +systemctl status grafana-server + +echo " +# Setup Telegraf Packages +" +wget -qO- https://repos.influxdata.com/influxdb.key | sudo apt-key add - +echo "deb https://repos.influxdata.com/debian buster stable" | sudo tee /etc/apt/sources.list.d/influxdb.list +apt update && apt install telegraf -y +mv /etc/telegraf/telegraf.conf /etc/telegraf/telegraf.conf.original + +echo " +# Setup Telegraf config files +" +cat << TELEGRAF > $MAIN_TEL +[global_tags] + +############################################################################### +# GLOBAL # +############################################################################### + +[agent] + interval = "10s" + debug = false + hostname = "localhost" + round_interval = true + flush_interval = "10s" + flush_jitter = "0s" + collection_jitter = "0s" + metric_batch_size = 1000 + metric_buffer_limit = 10000 + quiet = false + logfile = "" + omit_hostname = false + +TELEGRAF + +cat << JITSI_TELEGRAF > $TEL_JIT +############################################################################### +# INPUTS # +############################################################################### + +[[inputs.http]] + name_override = "jitsi_stats" + urls = [ + "http://localhost:8080/colibri/stats" + ] + + data_format = "json" + +############################################################################### +# OUTPUTS # +############################################################################### + +[[outputs.influxdb]] + urls = ["http://localhost:8086"] + database = "jitsi" + timeout = "0s" + retention_policy = "" + +JITSI_TELEGRAF + +systemctl enable telegraf +systemctl restart telegraf +systemctl status telegraf + +echo " +# Setup videobridge options +" +sed -i "s|JVB_OPTS=\"--apis.*|JVB_OPTS=\"--apis=rest,xmpp\"|" /etc/jitsi/videobridge/config +sed -i "s|TRANSPORT=muc|TRANSPORT=muc,colibri|" /etc/jitsi/videobridge/sip-communicator.properties +systemctl restart jitsi-videobridge2 + +echo " +# Setup Grafana nginx domain +" +sed -i "s|;protocol =.*|protocol = http|" $GRAFANA_INI +sed -i "s|;http_addr =.*|http_addr = localhost|" $GRAFANA_INI +sed -i "s|;http_port =.*|http_port = 3000|" $GRAFANA_INI +sed -i "s|;domain =.*|domain = $DOMAIN|" $GRAFANA_INI +sed -i "s|;enforce_domain =.*|enforce_domain = false|" $GRAFANA_INI +sed -i "s|;root_url =.*|root_url = http://$DOMAIN:3000/grafana/|" $GRAFANA_INI +sed -i "s|;serve_from_sub_path =.*|serve_from_sub_path = true|" $GRAFANA_INI +systemctl restart grafana-server + +if [ -f $WS_CONF ]; then + sed -i "/Anything that didn't match above/i \ \ \ \ location \~ \^\/(grafana\/|grafana\/login) {" $WS_CONF + sed -i "/Anything that didn't match above/i \ \ \ \ \ \ \ \ proxy_pass http:\/\/localhost:3000;" $WS_CONF + sed -i "/Anything that didn't match above/i \ \ \ \ }" $WS_CONF + sed -i "/Anything that didn't match above/i \\\n" $WS_CONF + systemctl restart nginx +else + echo "No app configuration done to server file, please report to: + -> https://github.com/switnet-ltd/quick-jibri-installer/issues" +fi + +echo " +# Setup Grafana credentials. +" +curl -X PUT -H "Content-Type: application/json" -d "{ + \"oldPassword\": \"admin\", + \"newPassword\": \"$GRAFANA_PASS\", + \"confirmNew\": \"$GRAFANA_PASS\" +}" http://admin:admin@localhost:3000/grafana/api/user/password + +echo " +# Create InfluxDB datasource +" +curl -X \ +POST -H 'Content-Type: application/json;charset=UTF-8' -d \ +'{ + "name":"InfluxDB", + "type":"influxdb", + "url":"http://localhost:8086", + "access":"proxy", + "isDefault":true, + "database":"jitsi" +}' http://admin:$GRAFANA_PASS@localhost:3000/grafana/api/datasources + +echo " +# Add Grafana Dashboard +" +grafana_host="http://localhost:3000/grafana" +grafana_cred="admin:$GRAFANA_PASS" +grafana_datasource="InfluxDB" +ds=(11969); +for d in "${ds[@]}"; do + echo -n "Processing $d: " + j=$(curl -s -k -u "$grafana_cred" $grafana_host/api/gnet/dashboards/$d | jq .json) + curl -s -k -u "$grafana_cred" -XPOST -H "Accept: application/json" \ + -H "Content-Type: application/json" \ + -d "{\"dashboard\":$j,\"overwrite\":true, \ + \"inputs\":[{\"name\":\"DS_INFLUXDB\",\"type\":\"datasource\", \ + \"pluginId\":\"influxdb\",\"value\":\"$grafana_datasource\"}]}" \ + $grafana_host/api/dashboards/import; echo "" +done + +echo " +Go check: + +>> http://$DOMAIN/grafana/ + +(emphasis on the trailing \"/\") to review configuration and dashboards. + +User: admin +Password: $GRAFANA_PASS + +Please save it somewhere safe. +" +read -n 1 -s -r -p "Press any key to continue..."$'\n' From 743da51e9f298b34e2423a9e31974496921b3072 Mon Sep 17 00:00:00 2001 From: Luis Guzman Date: Sat, 4 Jul 2020 09:39:09 -0500 Subject: [PATCH 11/26] Integrate Grafana Dashboard to Quick Jibri Installer --- quick_jibri_installer.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/quick_jibri_installer.sh b/quick_jibri_installer.sh index 26133d1..96064fe 100644 --- a/quick_jibri_installer.sh +++ b/quick_jibri_installer.sh @@ -462,6 +462,17 @@ elif [ "$ENABLE_TRANSCRIPT" = "yes" ]; then echo "Jigasi Transcription will be enabled." fi done +#Grafana +while [[ "$ENABLE_GRAFANA_DSH" != "yes" && "$ENABLE_GRAFANA_DSH" != "no" ]] +do +read -p "> Do you want to setup Grafana Dashboard: (yes or no) +( Please check requirements at: https://github.com/switnet-ltd/quick-jibri-installer )"$'\n' -r ENABLE_GRAFANA_DSH +if [ "$ENABLE_GRAFANA_DSH" = "no" ]; then + echo "Grafana Dashboard won't be enabled." +elif [ "$ENABLE_GRAFANA_DSH" = "yes" ]; then + echo "Grafana Dashboard will be enabled." +fi +done #Start configuration echo ' ######################################################################## @@ -817,6 +828,11 @@ if [ "$ENABLE_TRANSCRIPT" = "yes" ]; then bash $PWD/jigasi.sh fi { +#Grafana Dashboard +if [ "$ENABLE_GRAFANA_DSH" = "yes" ]; then + echo "Grafana Dashboard will be enabled." + bash $PWD/grafana.sh +fi #Prevent Jibri conecction issue sed -i "/127.0.0.1/a \\ 127.0.0.1 $DOMAIN" /etc/hosts From ee5976a645f213fa52415b6b9040beda5fa55bdd Mon Sep 17 00:00:00 2001 From: Luis Guzman Date: Sat, 4 Jul 2020 11:48:58 -0500 Subject: [PATCH 12/26] Set importance question (cherry picked from commit 4141feec39e816e1c7282917bb0116170d3b3425) --- quick_jibri_installer.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/quick_jibri_installer.sh b/quick_jibri_installer.sh index 96064fe..f3449cf 100644 --- a/quick_jibri_installer.sh +++ b/quick_jibri_installer.sh @@ -331,6 +331,11 @@ LE_RENEW_LOG="/var/log/letsencrypt/renew.log" MOD_LISTU="https://prosody.im/files/mod_listusers.lua" MOD_LIST_FILE="/usr/lib/prosody/modules/mod_listusers.lua" ENABLE_SA="yes" +#Sysadmin email +while [[ -z $SYSADMIN_EMAIL ]] +do +read -p "Set sysadmin email (this is a mandatory field):"$'\n' -r SYSADMIN_EMAIL +done #Language echo "## Setting up Jitsi Meet language ## You can define the language, for a complete list of the supported languages @@ -341,10 +346,6 @@ https://github.com/jitsi/jitsi-meet/blob/master/lang/languages.json Jitsi Meet web interface will be set to use such language. " read -p "Please set your language (Press enter to default to 'en'):"$'\n' -r LANG -while [[ -z $SYSADMIN_EMAIL ]] -do -read -p "Set sysadmin email (this is a mandatory field):"$'\n' -r SYSADMIN_EMAIL -done #Drop unsecure TLS while [[ "$DROP_TLS1" != "yes" && "$DROP_TLS1" != "no" ]] do From 613ee202cd3683f43d90abb4795686c8fcdd49cd Mon Sep 17 00:00:00 2001 From: Luis Guzman Date: Sat, 4 Jul 2020 13:26:33 -0500 Subject: [PATCH 13/26] add systemclt function 4 services (cherry picked from commit ae70c60700dd3afc80e693109f96051a52bef6dd) --- grafana.sh | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/grafana.sh b/grafana.sh index a52b098..316feac 100644 --- a/grafana.sh +++ b/grafana.sh @@ -23,6 +23,11 @@ if [ "$MODE" = "debug" ]; then set -x fi +run_service() { +systemclt enable $1 +systemctl restart $1 +systemctl status $1 +} MAIN_TEL="/etc/telegraf/telegraf.conf" TEL_JIT="/etc/telegraf/telegraf.d/jitsi.conf" GRAFANA_INI="/etc/grafana/grafana.ini" @@ -39,8 +44,7 @@ echo " wget -qO- https://repos.influxdata.com/influxdb.key | sudo apt-key add - echo "deb https://repos.influxdata.com/debian buster stable" | sudo tee /etc/apt/sources.list.d/influxdb.list apt update && apt install influxdb -y -systemctl enable influxdb -systemctl status influxdb +run_service influxdb echo " # Setup Grafana Packages @@ -48,8 +52,7 @@ echo " curl -s https://packages.grafana.com/gpg.key | sudo apt-key add - add-apt-repository "deb https://packages.grafana.com/oss/deb stable main" apt update && apt install grafana -y -systemctl enable grafana-server -systemctl status grafana-server +run_service grafana-server echo " # Setup Telegraf Packages @@ -110,9 +113,7 @@ cat << JITSI_TELEGRAF > $TEL_JIT JITSI_TELEGRAF -systemctl enable telegraf -systemctl restart telegraf -systemctl status telegraf +run_service telegraf echo " # Setup videobridge options @@ -132,6 +133,7 @@ sed -i "s|;enforce_domain =.*|enforce_domain = false|" $GRAFANA_INI sed -i "s|;root_url =.*|root_url = http://$DOMAIN:3000/grafana/|" $GRAFANA_INI sed -i "s|;serve_from_sub_path =.*|serve_from_sub_path = true|" $GRAFANA_INI systemctl restart grafana-server +systemctl status grafana-server if [ -f $WS_CONF ]; then sed -i "/Anything that didn't match above/i \ \ \ \ location \~ \^\/(grafana\/|grafana\/login) {" $WS_CONF @@ -151,7 +153,7 @@ curl -X PUT -H "Content-Type: application/json" -d "{ \"oldPassword\": \"admin\", \"newPassword\": \"$GRAFANA_PASS\", \"confirmNew\": \"$GRAFANA_PASS\" -}" http://admin:admin@localhost:3000/grafana/api/user/password +}" http://admin:admin@localhost:3000/api/user/password echo " # Create InfluxDB datasource @@ -165,12 +167,12 @@ POST -H 'Content-Type: application/json;charset=UTF-8' -d \ "access":"proxy", "isDefault":true, "database":"jitsi" -}' http://admin:$GRAFANA_PASS@localhost:3000/grafana/api/datasources +}' http://admin:$GRAFANA_PASS@localhost:3000/api/datasources echo " # Add Grafana Dashboard " -grafana_host="http://localhost:3000/grafana" +grafana_host="http://localhost:3000" grafana_cred="admin:$GRAFANA_PASS" grafana_datasource="InfluxDB" ds=(11969); From 1fceb867001803726ca39c9935ed60c63111f30e Mon Sep 17 00:00:00 2001 From: Luis Guzman Date: Sat, 4 Jul 2020 14:26:10 -0500 Subject: [PATCH 14/26] Clean format --- grafana.sh | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/grafana.sh b/grafana.sh index 316feac..52ef0e1 100644 --- a/grafana.sh +++ b/grafana.sh @@ -133,7 +133,6 @@ sed -i "s|;enforce_domain =.*|enforce_domain = false|" $GRAFANA_INI sed -i "s|;root_url =.*|root_url = http://$DOMAIN:3000/grafana/|" $GRAFANA_INI sed -i "s|;serve_from_sub_path =.*|serve_from_sub_path = true|" $GRAFANA_INI systemctl restart grafana-server -systemctl status grafana-server if [ -f $WS_CONF ]; then sed -i "/Anything that didn't match above/i \ \ \ \ location \~ \^\/(grafana\/|grafana\/login) {" $WS_CONF @@ -149,11 +148,12 @@ fi echo " # Setup Grafana credentials. " -curl -X PUT -H "Content-Type: application/json" -d "{ +curl -X PUT -H "Content-Type: application/json;charset=UTF-8" -d \ +"{ \"oldPassword\": \"admin\", \"newPassword\": \"$GRAFANA_PASS\", \"confirmNew\": \"$GRAFANA_PASS\" -}" http://admin:admin@localhost:3000/api/user/password +}" http://admin:admin@localhost:3000/api/user/password; echo "" echo " # Create InfluxDB datasource @@ -161,13 +161,13 @@ echo " curl -X \ POST -H 'Content-Type: application/json;charset=UTF-8' -d \ '{ - "name":"InfluxDB", - "type":"influxdb", - "url":"http://localhost:8086", - "access":"proxy", - "isDefault":true, - "database":"jitsi" -}' http://admin:$GRAFANA_PASS@localhost:3000/api/datasources + "name": "InfluxDB", + "type": "influxdb", + "url": "http://localhost:8086", + "access": "proxy", + "isDefault": true, + "database": "jitsi" +}' http://admin:$GRAFANA_PASS@localhost:3000/api/datasources; echo "" echo " # Add Grafana Dashboard @@ -181,10 +181,16 @@ for d in "${ds[@]}"; do j=$(curl -s -k -u "$grafana_cred" $grafana_host/api/gnet/dashboards/$d | jq .json) curl -s -k -u "$grafana_cred" -XPOST -H "Accept: application/json" \ -H "Content-Type: application/json" \ - -d "{\"dashboard\":$j,\"overwrite\":true, \ - \"inputs\":[{\"name\":\"DS_INFLUXDB\",\"type\":\"datasource\", \ - \"pluginId\":\"influxdb\",\"value\":\"$grafana_datasource\"}]}" \ - $grafana_host/api/dashboards/import; echo "" + -d "{ + \"dashboard\": $j, + \"overwrite\": true, + \"inputs\": [{ + \"name\": \"DS_INFLUXDB\", + \"type\": \"datasource\", + \"pluginId\": \"influxdb\", + \"value\": \"$grafana_datasource\" + }] + }" $grafana_host/api/dashboards/import; echo "" done echo " From 57f9a5fe1dcc0e1ce8ef50dcc885ea51dd16b1e6 Mon Sep 17 00:00:00 2001 From: Luis Guzman Date: Sat, 4 Jul 2020 14:57:37 -0500 Subject: [PATCH 15/26] Improve and prevent password characters break curl sent data Set head notice --- grafana.sh | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/grafana.sh b/grafana.sh index 52ef0e1..2e11a54 100644 --- a/grafana.sh +++ b/grafana.sh @@ -23,6 +23,18 @@ if [ "$MODE" = "debug" ]; then set -x fi +if ! [ $(id -u) = 0 ]; then + echo "You need to be root or have sudo privileges!" + exit 0 +fi + +clear +echo ' +######################################################################## + Grafana Dashboard addon +######################################################################## + by Software, IT & Networks Ltd +' run_service() { systemclt enable $1 systemctl restart $1 @@ -33,7 +45,7 @@ TEL_JIT="/etc/telegraf/telegraf.d/jitsi.conf" GRAFANA_INI="/etc/grafana/grafana.ini" DOMAIN=$(ls /etc/prosody/conf.d/ | grep -v localhost | awk -F'.cfg' '{print $1}' | awk '!NF || !seen[$0]++') WS_CONF="/etc/nginx/sites-enabled/$DOMAIN.conf" -GRAFANA_PASS="$(tr -dc "a-zA-Z0-9#_*" < /dev/urandom | fold -w 14 | head -n1)" +GRAFANA_PASS="$(tr -dc "a-zA-Z0-9#_*=" < /dev/urandom | fold -w 14 | head -n1)" # Min requirements apt update && apt install -y gnupg2 curl wget jq @@ -158,7 +170,7 @@ curl -X PUT -H "Content-Type: application/json;charset=UTF-8" -d \ echo " # Create InfluxDB datasource " -curl -X \ +curl -s -k -u "admin:$GRAFANA_PASS" -X \ POST -H 'Content-Type: application/json;charset=UTF-8' -d \ '{ "name": "InfluxDB", @@ -167,7 +179,7 @@ POST -H 'Content-Type: application/json;charset=UTF-8' -d \ "access": "proxy", "isDefault": true, "database": "jitsi" -}' http://admin:$GRAFANA_PASS@localhost:3000/api/datasources; echo "" +}' http://localhost:3000/api/datasources; echo "" echo " # Add Grafana Dashboard From 67491720eb05603e5f56a3c87ecd57b2d71adfed Mon Sep 17 00:00:00 2001 From: Luis Guzman Date: Sat, 4 Jul 2020 15:17:05 -0500 Subject: [PATCH 16/26] Add systemctl status to allow grafana be ready (cherry picked from commit c9606959ca0db7d012dda5b7cc430e381a0debd6) --- grafana.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/grafana.sh b/grafana.sh index 2e11a54..822784a 100644 --- a/grafana.sh +++ b/grafana.sh @@ -145,6 +145,7 @@ sed -i "s|;enforce_domain =.*|enforce_domain = false|" $GRAFANA_INI sed -i "s|;root_url =.*|root_url = http://$DOMAIN:3000/grafana/|" $GRAFANA_INI sed -i "s|;serve_from_sub_path =.*|serve_from_sub_path = true|" $GRAFANA_INI systemctl restart grafana-server +systemctl status grafana-server if [ -f $WS_CONF ]; then sed -i "/Anything that didn't match above/i \ \ \ \ location \~ \^\/(grafana\/|grafana\/login) {" $WS_CONF @@ -160,17 +161,18 @@ fi echo " # Setup Grafana credentials. " -curl -X PUT -H "Content-Type: application/json;charset=UTF-8" -d \ +curl -k -u "admin:admin" -X \ +PUT -H "Content-Type: application/json;charset=UTF-8" -d \ "{ \"oldPassword\": \"admin\", \"newPassword\": \"$GRAFANA_PASS\", \"confirmNew\": \"$GRAFANA_PASS\" -}" http://admin:admin@localhost:3000/api/user/password; echo "" +}" http://localhost:3000/api/user/password; echo "" echo " # Create InfluxDB datasource " -curl -s -k -u "admin:$GRAFANA_PASS" -X \ +curl -k -u "admin:$GRAFANA_PASS" -X \ POST -H 'Content-Type: application/json;charset=UTF-8' -d \ '{ "name": "InfluxDB", @@ -191,7 +193,7 @@ ds=(11969); for d in "${ds[@]}"; do echo -n "Processing $d: " j=$(curl -s -k -u "$grafana_cred" $grafana_host/api/gnet/dashboards/$d | jq .json) - curl -s -k -u "$grafana_cred" -XPOST -H "Accept: application/json" \ + curl -k -u "$grafana_cred" -XPOST -H "Accept: application/json" \ -H "Content-Type: application/json" \ -d "{ \"dashboard\": $j, From 06e0d1ef0c6f00993d46ee5fd8b73cba54161789 Mon Sep 17 00:00:00 2001 From: Luis Guzman Date: Sat, 4 Jul 2020 15:32:11 -0500 Subject: [PATCH 17/26] Add delay to allow grafana to load. (cherry picked from commit 3dd48a73de595118527d04d9021ce1eebfea21bc) --- grafana.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/grafana.sh b/grafana.sh index 822784a..8e4c674 100644 --- a/grafana.sh +++ b/grafana.sh @@ -144,8 +144,15 @@ sed -i "s|;domain =.*|domain = $DOMAIN|" $GRAFANA_INI sed -i "s|;enforce_domain =.*|enforce_domain = false|" $GRAFANA_INI sed -i "s|;root_url =.*|root_url = http://$DOMAIN:3000/grafana/|" $GRAFANA_INI sed -i "s|;serve_from_sub_path =.*|serve_from_sub_path = true|" $GRAFANA_INI + systemctl restart grafana-server -systemctl status grafana-server +echo "Waiting for Grafana to load..." +secs=$((10)) +while [ $secs -gt 0 ]; do + echo -ne "$secs\033[0K\r" + sleep 1 + : $((secs--)) +done if [ -f $WS_CONF ]; then sed -i "/Anything that didn't match above/i \ \ \ \ location \~ \^\/(grafana\/|grafana\/login) {" $WS_CONF From 35bc407c34bc5dd8760bc42a70bc7aec43bb2e73 Mon Sep 17 00:00:00 2001 From: Luis Guzman Date: Mon, 6 Jul 2020 15:37:02 -0500 Subject: [PATCH 18/26] Prevent sing up Make curl silent --- grafana.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/grafana.sh b/grafana.sh index 8e4c674..c4f6f1e 100644 --- a/grafana.sh +++ b/grafana.sh @@ -144,6 +144,7 @@ sed -i "s|;domain =.*|domain = $DOMAIN|" $GRAFANA_INI sed -i "s|;enforce_domain =.*|enforce_domain = false|" $GRAFANA_INI sed -i "s|;root_url =.*|root_url = http://$DOMAIN:3000/grafana/|" $GRAFANA_INI sed -i "s|;serve_from_sub_path =.*|serve_from_sub_path = true|" $GRAFANA_INI +sed -i "s|;allow_sign_up =.*|allow_sign_up = false|" $GRAFANA_INI systemctl restart grafana-server echo "Waiting for Grafana to load..." @@ -168,7 +169,7 @@ fi echo " # Setup Grafana credentials. " -curl -k -u "admin:admin" -X \ +curl -s -k -u "admin:admin" -X \ PUT -H "Content-Type: application/json;charset=UTF-8" -d \ "{ \"oldPassword\": \"admin\", @@ -179,7 +180,7 @@ PUT -H "Content-Type: application/json;charset=UTF-8" -d \ echo " # Create InfluxDB datasource " -curl -k -u "admin:$GRAFANA_PASS" -X \ +curl -s -k -u "admin:$GRAFANA_PASS" -X \ POST -H 'Content-Type: application/json;charset=UTF-8' -d \ '{ "name": "InfluxDB", @@ -200,7 +201,7 @@ ds=(11969); for d in "${ds[@]}"; do echo -n "Processing $d: " j=$(curl -s -k -u "$grafana_cred" $grafana_host/api/gnet/dashboards/$d | jq .json) - curl -k -u "$grafana_cred" -XPOST -H "Accept: application/json" \ + curl -s -k -u "$grafana_cred" -XPOST -H "Accept: application/json" \ -H "Content-Type: application/json" \ -d "{ \"dashboard\": $j, From 7a2650874305b155ac6958cafbdc32f31a200359 Mon Sep 17 00:00:00 2001 From: Luis Guzman Date: Mon, 6 Jul 2020 15:39:49 -0500 Subject: [PATCH 19/26] Set copyright holders and tune copyright notice --- grafana.sh | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/grafana.sh b/grafana.sh index c4f6f1e..d6bde92 100644 --- a/grafana.sh +++ b/grafana.sh @@ -1,12 +1,15 @@ #!/bin/bash -# Grafana Installer +# Grafana Installer for Jitsi Meet +# # Based on: -# https://community.jitsi.org/t/how-to-to-setup-grafana-dashboards-to-monitor-jitsi-my-comprehensive-tutorial-for-the-beginner/ -# by Woodworker_Life -# Woodworker_Life © - 2020 -# Jitsi Metrics - Grafana dashboard by mephisto -# https://grafana.com/grafana/dashboards/11969 +# - https://community.jitsi.org/t/38696 +# by Igor Kerstges +# - https://grafana.com/grafana/dashboards/11969 +# by "mephisto" +# +# Igor Kerstges © - 2020 # SwITNet Ltd © - 2020, https://switnet.net/ +# # GPLv3 or later. while getopts m: option From a17df88d282f5da30b1c38814e0bef0a86cf69cd Mon Sep 17 00:00:00 2001 From: Luis Guzman Date: Mon, 6 Jul 2020 17:12:55 -0500 Subject: [PATCH 20/26] Fix typo enable service (cherry picked from commit cb31cbb708a55a3721c8fd9fb2ba3059ae841ccf) --- grafana.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grafana.sh b/grafana.sh index d6bde92..78b9857 100644 --- a/grafana.sh +++ b/grafana.sh @@ -39,7 +39,7 @@ echo ' by Software, IT & Networks Ltd ' run_service() { -systemclt enable $1 +systemctl enable $1 systemctl restart $1 systemctl status $1 } From a1cbb7231a5a2821d0215acb2ad3f0d5bc1bb294 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Sun, 19 Jul 2020 22:50:54 -0500 Subject: [PATCH 21/26] Update README (cherry picked from commit 735739832dbc1a9a1f8f3fdf5747cff909a0cdf3) --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 80f5bbb..38c5d58 100644 --- a/README.md +++ b/README.md @@ -29,9 +29,10 @@ Please check more details on our wiki. * Enabled Jitsi Electron app detection server side. * Standalone SSL Certbot/LE implementation * Jigasi Transcript - Speech to Text powered by Google API -* (New) JRA (Jibri Recordings Access) via Nextcloud -* (New) Customized brandless mode -* (New) Improved recurring updater +* JRA (Jibri Recordings Access) via Nextcloud +* Customized brandless mode +* Improved recurring updater +* (New) Grafana Dashboard ## Optional custom changes From 84c1568c2072df99708b8c647bd5cc57d92353cd Mon Sep 17 00:00:00 2001 From: Ark74 Date: Sun, 19 Jul 2020 22:57:12 -0500 Subject: [PATCH 22/26] Increase timeout on JRA nginx settings Useful when update servers might be overloaded. (cherry picked from commit 471de215ef9fe3aa9f6fc45a14700e66b972567d) --- jra_nextcloud.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/jra_nextcloud.sh b/jra_nextcloud.sh index 93f7845..1249cf3 100644 --- a/jra_nextcloud.sh +++ b/jra_nextcloud.sh @@ -285,6 +285,7 @@ server { fastcgi_pass php-handler; fastcgi_intercept_errors on; fastcgi_request_buffering off; + fastcgi_read_timeout 300; } location ~ ^/(?:updater|ocs-provider)(?:\$|/) { From 8280661c9ac1fd7dd14d6a7a380601e380e996a7 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Mon, 20 Jul 2020 00:47:34 -0500 Subject: [PATCH 23/26] Start focal testing for support Add HWE and PPA Certbot check to install, avoid if not. (cherry picked from commit d29dea7fef09529f01b7052b49df9cf4227d4ecf) --- quick_jibri_installer.sh | 69 +++++++++++++++++++++++++--------------- 1 file changed, 43 insertions(+), 26 deletions(-) diff --git a/quick_jibri_installer.sh b/quick_jibri_installer.sh index f3449cf..7e40f8f 100644 --- a/quick_jibri_installer.sh +++ b/quick_jibri_installer.sh @@ -22,11 +22,13 @@ fi # SYSTEM SETUP JITSI_REPO=$(apt-cache policy | grep http | grep jitsi | grep stable | awk '{print $3}' | head -n 1 | cut -d "/" -f1) CERTBOT_REPO=$(apt-cache policy | grep http | grep certbot | head -n 1 | awk '{print $2}' | cut -d "/" -f4) +CERTBOT_REL_FILE="http://ppa.launchpad.net/certbcertbot/ubuntu/dists/$(lsb_release -sc)/Release" APACHE_2=$(dpkg-query -W -f='${Status}' apache2 2>/dev/null | grep -c "ok installed") NGINX=$(dpkg-query -W -f='${Status}' nginx 2>/dev/null | grep -c "ok installed") DIST=$(lsb_release -sc) GOOGL_REPO="/etc/apt/sources.list.d/dl_google_com_linux_chrome_deb.list" PROSODY_REPO=$(apt-cache policy | grep http | grep prosody| awk '{print $3}' | head -n 1 | cut -d "/" -f2) +HWE_VIR_MOD=$(apt-cache madison linux-modules-extra-virtual-hwe-$(lsb_release -sr) 2>/dev/null|head -n1|grep -c "extra-virtual-hwe") if [ $DIST = flidas ]; then DIST="xenial" @@ -79,24 +81,6 @@ else read -n 1 -s -r -p "Press any key to continue..."$'\n' fi } -update_certbot() { - if [ "$CERTBOT_REPO" = "certbot" ]; then - echo " -Cerbot repository already on the system! -Checking for updates... -" - apt-get -q2 update - apt-get -yq2 dist-upgrade -else - echo " -Adding cerbot (formerly letsencrypt) PPA repository for latest updates -" - echo "deb http://ppa.launchpad.net/certbot/certbot/ubuntu $DIST main" > /etc/apt/sources.list.d/certbot.list - apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 75BCA694 - apt-get -q2 update - apt-get -yq2 dist-upgrade -fi -} # sed limiters for add-jibri-node.sh variables var_dlim() { grep -n $1 add-jibri-node.sh|head -n1|cut -d ":" -f1 @@ -135,12 +119,14 @@ if ! [ $(id -u) = 0 ]; then echo "You need to be root or have sudo privileges!" exit 0 fi -if [ "$DIST" = "xenial" ] || [ "$DIST" = "bionic" ]; then - echo "OS: $(lsb_release -sd) -Good, this is a supported platform!" +if [ "$DIST" = "xenial" ] || \ + [ "$DIST" = "bionic" ] || \ + [ "$DIST" = "focal" ]; then + echo "OS: $(lsb_release -sd)" + echo "Good, this is a supported platform!" else - echo "OS: $(lsb_release -sd) -Sorry, this platform is not supported... exiting" + echo "OS: $(lsb_release -sd)" + echo "Sorry, this platform is not supported... exiting" exit fi #Suggest 18.04 LTS release over 16.04 @@ -223,11 +209,19 @@ apt-get -y install \ git \ htop \ letsencrypt \ - linux-image-generic-hwe-$(lsb_release -r|awk '{print$2}') \ - linux-modules-extra-virtual-hwe-$(lsb_release -r|awk '{print$2}') \ unzip \ wget +echo "# Check and Install HWE kernel if possible..." +if [ "$HWE_VIR_MOD" == "1" ]; then + apt-get -y install \ + linux-image-generic-hwe-$(lsb_release -sr) \ + linux-modules-extra-virtual-hwe-$(lsb_release -sr) + else + apt-get -y install \ + linux-modules-extra-$(uname -r) +fi + check_serv echo " @@ -505,7 +499,30 @@ echo ' #Disabled 'til fixed upstream #bash /usr/share/jitsi-meet/scripts/install-letsencrypt-cert.sh -update_certbot +echo "#Set and upgrade certbot PPA if posssible..." +if [ "$CERTBOT_REPO" = "certbot" ]; then + echo " +Cerbot repository already on the system! +Checking for updates... +" + apt-get -q2 update + apt-get -yq2 dist-upgrade +else + if [ "$(curl -s -o /dev/null -w "%{http_code}" $CERTBOT_REL_FILE )" == "200" ]; then + echo " +Adding cerbot (formerly letsencrypt) PPA repository for latest updates +" + echo "deb http://ppa.launchpad.net/certbot/certbot/ubuntu $DIST main" > /etc/apt/sources.list.d/certbot.list + apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 75BCA694 + apt-get -q2 update + apt-get -yq2 dist-upgrade + fi + if [ "$(curl -s -o /dev/null -w "%{http_code}" $CERTBOT_REL_FILE )" == "404" ]; then + echo " +Certbot PPA is not available for $(lsb_release -sc) just yet, it won't be installed... +" + fi +fi else echo "SSL setup will be skipped." From 10409f96ad552b415a155d4ce9cc386306a8fac2 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Mon, 20 Jul 2020 03:03:54 -0500 Subject: [PATCH 24/26] Improve repo checks, add new packages, ... ...enable sharing of external folder, and add db checks (cherry picked from commit 2c46e87c6802a6a3b8d72990c509442468796f88) --- jra_nextcloud.sh | 43 ++++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/jra_nextcloud.sh b/jra_nextcloud.sh index 1249cf3..7ec36e1 100644 --- a/jra_nextcloud.sh +++ b/jra_nextcloud.sh @@ -49,6 +49,7 @@ fi done DISTRO_RELEASE="$(lsb_release -sc)" DOMAIN=$(ls /etc/prosody/conf.d/ | grep -v localhost | awk -F'.cfg' '{print $1}' | awk '!NF || !seen[$0]++') +PHP_REPO=$(apt-cache policy | grep http | grep php | head -n 1 | awk '{print $2}' | cut -d "/" -f5) PHPVER="7.4" PSGVER="$(apt-cache madison postgresql | head -n1 | awk '{print $3}' | cut -d "+" -f1)" PHP_FPM_DIR="/etc/php/$PHPVER/fpm" @@ -87,10 +88,12 @@ if [ "$(dpkg-query -W -f='${Status}' $1 2>/dev/null | grep -c "ok installed")" = fi } add_php74() { - if [ "$(dpkg-query -W -f='${Status}' "php$PHPVER-fpm" 2>/dev/null | grep -c "ok installed")" == "1" ]; then + if [ "$PHP_REPO" = "php" ]; then echo "PHP $PHPVER already installed" + apt-get -q2 update + apt-get -yq2 dist-upgrade else - echo "# Adding PHP $PHPVER Repository" + echo "# Adding Ondrej PHP $PHPVER PPA Repository" apt-key adv --recv-keys --keyserver keyserver.ubuntu.com E5267A6C echo "deb [arch=amd64] http://ppa.launchpad.net/ondrej/php/ubuntu $DISTRO_RELEASE main" > /etc/apt/sources.list.d/php7x.list apt-get update -q2 @@ -108,23 +111,24 @@ install_ifnot postgresql-$PSGVER # PHP 7.4 add_php74 apt-get install -y \ - php$PHPVER-fpm \ - php$PHPVER-bz2 \ - php$PHPVER-curl \ - php$PHPVER-gd \ - php$PHPVER-gmp \ - php$PHPVER-intl \ - php$PHPVER-json \ - php$PHPVER-ldap \ - php$PHPVER-mbstring \ - php$PHPVER-pgsql \ - php$PHPVER-soap \ - php$PHPVER-xml \ - php$PHPVER-xmlrpc \ - php$PHPVER-zip \ - php-imagick \ - php-redis \ - redis-server + php$PHPVER-fpm \ + php$PHPVER-bcmath \ + php$PHPVER-bz2 \ + php$PHPVER-curl \ + php$PHPVER-gd \ + php$PHPVER-gmp \ + php$PHPVER-intl \ + php$PHPVER-json \ + php$PHPVER-ldap \ + php$PHPVER-mbstring \ + php$PHPVER-pgsql \ + php$PHPVER-soap \ + php$PHPVER-xml \ + php$PHPVER-xmlrpc \ + php$PHPVER-zip \ + php-imagick \ + php-redis \ + redis-server #System related install_ifnot smbclient @@ -423,6 +427,7 @@ Fixing possible missing tables... " echo "y"|sudo -u www-data php $NC_PATH/occ db:convert-filecache-bigint sudo -u www-data php $NC_PATH/occ db:add-missing-indices +sudo -u www-data php $NC_PATH/occ db:add-missing-columns echo " Adding trusted domain... From 08640c9ff1d6ff6d437468365d8575288abd54dc Mon Sep 17 00:00:00 2001 From: Ark74 Date: Mon, 20 Jul 2020 04:20:47 -0500 Subject: [PATCH 25/26] Enable sharing on external folder (cherry picked from commit 19ff6a7f4b59824fddef6bb95907ceb87b4aa4dd) --- files/jra-nc-app-ef.json | 1 + jra_nextcloud.sh | 1 + 2 files changed, 2 insertions(+) diff --git a/files/jra-nc-app-ef.json b/files/jra-nc-app-ef.json index 42b2a1e..4e6d95b 100644 --- a/files/jra-nc-app-ef.json +++ b/files/jra-nc-app-ef.json @@ -14,6 +14,7 @@ "filesystem_check_changes": 1, "encoding_compatibility": false, "readonly": false + "enable_sharing": true }, "applicable_users": [], "applicable_groups": [ diff --git a/jra_nextcloud.sh b/jra_nextcloud.sh index 7ec36e1..cc9bd92 100644 --- a/jra_nextcloud.sh +++ b/jra_nextcloud.sh @@ -358,6 +358,7 @@ fi echo " Latest version to be installed: $STABLEVERSION + (This might take sometime, please be patient...) " curl -s $NC_REPO/$STABLEVERSION.zip > /tmp/$STABLEVERSION.zip unzip -q /tmp/$STABLEVERSION.zip From 90be29dc9548ef7128cd2c87d5ed3097c1f9945b Mon Sep 17 00:00:00 2001 From: Ark74 Date: Mon, 20 Jul 2020 04:56:46 -0500 Subject: [PATCH 26/26] Fix typo (cherry picked from commit cd10656b71d50517c9ea5fff59e19f3e5b4fd8c8) --- quick_jibri_installer.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quick_jibri_installer.sh b/quick_jibri_installer.sh index 7e40f8f..d048700 100644 --- a/quick_jibri_installer.sh +++ b/quick_jibri_installer.sh @@ -191,7 +191,7 @@ while [[ $LE_SSL != yes && $LE_SSL != no ]] do read -p "> Do you plan to use Let's Encrypt SSL certs?: (yes or no)"$'\n' -r LE_SSL if [ $LE_SSL = yes ]; then - echo "We'll defaul to Let's Encrypt SSL cers." + echo "We'll defaul to Let's Encrypt SSL certs." elif [ $LE_SSL = no ]; then echo "We'll let you choose later on for it." fi