From 57232b14088e32d13ab8302361658e8019159491 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Mon, 28 Jun 2021 01:39:32 -0500 Subject: [PATCH 1/9] Test set Jibri resolution from installer. --- add-jibri-node.sh | 4 ++-- quick_jibri_installer.sh | 43 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 44 insertions(+), 3 deletions(-) diff --git a/add-jibri-node.sh b/add-jibri-node.sh index b6ee47e..c0b4dd6 100644 --- a/add-jibri-node.sh +++ b/add-jibri-node.sh @@ -46,8 +46,8 @@ MJS_USER=TBD MJS_USER_PASS=TBD THIS_SRV_DIST=$(lsb_release -sc) JITSI_REPO=$(apt-cache policy | awk '/jitsi/&&/stable/{print$3}' | awk -F / 'NR==1{print$1}') -START=0 -LAST=TBD +JIBRI_RES_CONF=TBD +JIBRI_RES_XORG_CONF=TBD JIBRI_CONF="/etc/jitsi/jibri/jibri.conf" DIR_RECORD="/var/jbrecord" REC_DIR="/home/jibri/finalize_recording.sh" diff --git a/quick_jibri_installer.sh b/quick_jibri_installer.sh index 88eb7f4..aaf2d82 100644 --- a/quick_jibri_installer.sh +++ b/quick_jibri_installer.sh @@ -471,6 +471,7 @@ MJS_RAND_TAIL="$(tr -dc "a-zA-Z0-9" < /dev/urandom | fold -w 4 | head -n1)" MJS_USER="jbsync_$MJS_RAND_TAIL" MJS_USER_PASS="$(tr -dc "a-zA-Z0-9#_*=" < /dev/urandom | fold -w 32 | head -n1)" FQDN_HOST="fqdn" +JIBRI_XORG_CONF="/etc/jitsi/jibri/xorg-video-dummy.conf" # Rename hostname for jitsi server while [[ "$FQDN_HOST" != "yes" && "$FQDN_HOST" != "no" && ! -z "$FQDN_HOST" ]] @@ -573,6 +574,7 @@ do fi done +# Set authentication method echo " > Jitsi Meet Auth Method selection. " @@ -599,6 +601,39 @@ do esac done +# Set jibris default resolution +echo " +> What jibri resolution should be the default for this and all the following jibri nodes? +" +PS3='The more resolution the more resources jibri will require to record properly: ' +jib_res=("HD 720" "FHD 1080") +select res in "${jib_res[@]}" +do + case $res in + "HD 720") + echo -e "\n > HD (1280x720) is good enough for most cases, and requires a moderate high hw requirements.\n" + JIBRI_RES="720" + break + ;; + "FHD 1080") + echo -e "\n > Full HD (1920x1080) is the best resolution available, it also requires high hw requirements.\n" + JIBRI_RES="1080" + break + ;; + *) echo "Invalid option «$REPLY», choose 1 or 2";; + esac +done + +if [ "$JIB_RES" = "720" ]; then + JIBRI_RES_CONF="\"1280x720\"" + JIBRI_RES_XORG_CONF="1280 720" +fi + +if [ "$JIB_RES" = "1080" ]; then + JIBRI_RES_CONF="\"1920x1080\"" + JIBRI_RES_XORG_CONF="1920 1080" +fi + #Jibri Records Access (JRA) via Nextcloud while [[ "$ENABLE_NC_ACCESS" != "yes" && "$ENABLE_NC_ACCESS" != "no" ]] do @@ -848,7 +883,7 @@ jibri { ] } ffmpeg { - resolution = "1920x1080" + resolution = $JIBRI_RES_CONF } chrome { // The flags which will be passed to chromium when launching @@ -946,6 +981,10 @@ jibri { } } NEW_CONF + +#Jibri xorg resolution +sed "s|[[:space:]]Virtual .*|Virtual $JIBRI_RES_XORG_CONF|" $JIBRI_XORG_CONF + #Create receiver user useradd -m -g jibri $MJS_USER echo "$MJS_USER:$MJS_USER_PASS" | chpasswd @@ -966,6 +1005,8 @@ sed -i "s|JB_AUTH_PASS=.*|JB_AUTH_PASS=\"$JB_AUTH_PASS\"|" add-jibri-node.sh sed -i "s|JB_REC_PASS=.*|JB_REC_PASS=\"$JB_REC_PASS\"|" add-jibri-node.sh sed -i "s|MJS_USER=.*|MJS_USER=\"$MJS_USER\"|" add-jibri-node.sh sed -i "s|MJS_USER_PASS=.*|MJS_USER_PASS=\"$MJS_USER_PASS\"|" add-jibri-node.sh +sed -i "s|JIBRI_RES_CONF=.*|JIBRI_RES_CONF=\"$JIBRI_RES_CONF\"|" add-jibri-node.sh +sed -i "s|JIBRI_RES_XORG_CONF=.*|JIBRI_RES_XORG_CONF=\"$JIBRI_RES_XORG_CONF\"|" add-jibri-node.sh sed -i "$(var_dlim 0_LAST),$(var_dlim 1_LAST){s|LETS: .*|LETS: $(date -R)|}" add-jibri-node.sh echo "Last file edition at: $(grep "LETS:" add-jibri-node.sh|head -n1|awk -F'LETS:' '{print$2}')" From 096eb6a530bc92e64ea550b505d8a5c7b8c9fcf1 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Mon, 28 Jun 2021 03:37:21 -0500 Subject: [PATCH 2/9] Fix variable --- quick_jibri_installer.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/quick_jibri_installer.sh b/quick_jibri_installer.sh index aaf2d82..16bdf34 100644 --- a/quick_jibri_installer.sh +++ b/quick_jibri_installer.sh @@ -262,7 +262,7 @@ do This is an unsupported use, as it will likely BREAK YOUR SYSTEM, so please don't." exit else - echo -e "\n > No standard desktop environment for user oriented porpuse detected, continuing..." + echo -e "\n > No standard desktop environment \'$de\' for user oriented porpuse detected, continuing..." fi done @@ -624,12 +624,12 @@ do esac done -if [ "$JIB_RES" = "720" ]; then +if [ "$JIBRI_RES" = "720" ]; then JIBRI_RES_CONF="\"1280x720\"" JIBRI_RES_XORG_CONF="1280 720" fi -if [ "$JIB_RES" = "1080" ]; then +if [ "$JIBRI_RES" = "1080" ]; then JIBRI_RES_CONF="\"1920x1080\"" JIBRI_RES_XORG_CONF="1920 1080" fi From 1801e73cec7cfdf4f23deb697e2a028df02a7bf1 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Mon, 28 Jun 2021 03:39:21 -0500 Subject: [PATCH 3/9] Add clean /etc/hosts file --- tools/start-over.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/start-over.sh b/tools/start-over.sh index a6614e7..3294dd9 100644 --- a/tools/start-over.sh +++ b/tools/start-over.sh @@ -51,6 +51,7 @@ echo -e ' \n' SYNC_USER="$(ls /home|awk '/jbsync/{print}')" +DOMAIN="$(ls /etc/prosody/conf.d/ | awk -F'.cfg' '!/localhost/{print $1}' | awk '!NF || !seen[$0]++')" echo "We are about to remove and clean all the jitsi-meet platform bits and pieces... Please make sure you have backed up anything you don't want to loose." @@ -110,6 +111,9 @@ remove_residuals /opt/jitsi remove_residuals /usr/share/jicofo remove_residuals /usr/share/jitsi-* +#Clean /etc/hosts +sed -i "/$DOMAIN/d" /etc/hosts + #Purging debconf db purge_debconf jicofo purge_debconf jigasi From b62302fb5dbee2bc55928cf44bb62e3401f68a48 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Mon, 28 Jun 2021 03:43:30 -0500 Subject: [PATCH 4/9] Improve readability --- 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 16bdf34..a101474 100644 --- a/quick_jibri_installer.sh +++ b/quick_jibri_installer.sh @@ -262,7 +262,7 @@ do This is an unsupported use, as it will likely BREAK YOUR SYSTEM, so please don't." exit else - echo -e "\n > No standard desktop environment \'$de\' for user oriented porpuse detected, continuing..." + echo -e "\n > No standard desktop environment '$de' for user oriented porpuse detected, continuing..." fi done From 63ceaf3877436e3697439712c60f1f731fe20e80 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Mon, 28 Jun 2021 03:45:12 -0500 Subject: [PATCH 5/9] Improve readability2 --- quick_jibri_installer.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/quick_jibri_installer.sh b/quick_jibri_installer.sh index a101474..f5705f5 100644 --- a/quick_jibri_installer.sh +++ b/quick_jibri_installer.sh @@ -250,7 +250,8 @@ So you can add a Jibri server on a instance with enough resources.\n" fi #Check system oriented porpuse -echo "Checking system oriented purpose...." +echo "Checking system oriented purpose.... +" apt-get -yq2 update SYSTEM_DE="$(apt-cache search "ubuntu-(desktop|mate-desktop)"|awk '{print$1}'|xargs|sed 's|$| trisquel triskel trisquel-mini|')" SYSTEM_DE_ARRAY=( $SYSTEM_DE ) @@ -262,7 +263,7 @@ do This is an unsupported use, as it will likely BREAK YOUR SYSTEM, so please don't." exit else - echo -e "\n > No standard desktop environment '$de' for user oriented porpuse detected, continuing..." + echo -e " > No standard desktop environment '$de' for user oriented porpuse detected, continuing...\n" fi done From d246eff041eec4374b1c3230100291d12a53509d Mon Sep 17 00:00:00 2001 From: Ark74 Date: Mon, 28 Jun 2021 03:49:48 -0500 Subject: [PATCH 6/9] Fix sed --- 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 f5705f5..4ea5bc9 100644 --- a/quick_jibri_installer.sh +++ b/quick_jibri_installer.sh @@ -984,7 +984,7 @@ jibri { NEW_CONF #Jibri xorg resolution -sed "s|[[:space:]]Virtual .*|Virtual $JIBRI_RES_XORG_CONF|" $JIBRI_XORG_CONF +sed -i "s|[[:space:]]Virtual .*|Virtual $JIBRI_RES_XORG_CONF|" $JIBRI_XORG_CONF #Create receiver user useradd -m -g jibri $MJS_USER From 4025eba0ee5f0b89c7d007bb3bc158951a2a5bc6 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Mon, 28 Jun 2021 04:21:22 -0500 Subject: [PATCH 7/9] Add resolution changes to add-jibri-node.sh --- add-jibri-node.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/add-jibri-node.sh b/add-jibri-node.sh index c0b4dd6..aa8a199 100644 --- a/add-jibri-node.sh +++ b/add-jibri-node.sh @@ -44,10 +44,10 @@ JB_AUTH_PASS=TBD JB_REC_PASS=TBD MJS_USER=TBD MJS_USER_PASS=TBD -THIS_SRV_DIST=$(lsb_release -sc) -JITSI_REPO=$(apt-cache policy | awk '/jitsi/&&/stable/{print$3}' | awk -F / 'NR==1{print$1}') JIBRI_RES_CONF=TBD JIBRI_RES_XORG_CONF=TBD +THIS_SRV_DIST=$(lsb_release -sc) +JITSI_REPO=$(apt-cache policy | awk '/jitsi/&&/stable/{print$3}' | awk -F / 'NR==1{print$1}') JIBRI_CONF="/etc/jitsi/jibri/jibri.conf" DIR_RECORD="/var/jbrecord" REC_DIR="/home/jibri/finalize_recording.sh" @@ -96,7 +96,9 @@ JMS_DATA=($MAIN_SRV_DIST \ $JB_AUTH_PASS \ $JB_REC_PASS \ $MJS_USER \ - $MJS_USER_PASS) + $MJS_USER_PASS \ + $JIBRI_RES_CONF \ + $JIBRI_RES_XORG_CONF) JMS_EVAL=${JMS_DATA[0]} for i in "${JMS_DATA[@]}"; do @@ -124,6 +126,8 @@ check_var JB_AUTH_PASS "$JB_AUTH_PASS" check_var JB_REC_PASS "$JB_REC_PASS" check_var MJS_USER "$MJS_USER" check_var MJS_USER_PASS "$MJS_USER_PASS" +check_var JIBRI_RES_CONF "$JIBRI_RES_CONF" +check_var JIBRI_RES_XORG_CONF "$JIBRI_RES_XORG_CONF" #Check server and node OS if [ ! "$THIS_SRV_DIST" = "$MAIN_SRV_DIST" ]; then @@ -354,7 +358,7 @@ jibri { ] } ffmpeg { - resolution = "1920x1080" + resolution = $JIBRI_RES_CONF } chrome { // The flags which will be passed to chromium when launching @@ -453,6 +457,9 @@ jibri { } NEW_CONF +#Jibri xorg resolution +sed -i "s|[[:space:]]Virtual .*|Virtual $JIBRI_RES_XORG_CONF|" $JIBRI_XORG_CONF + echo -e "\n---- Create random nodesync user ----" useradd -m -g jibri $NJN_USER echo "$NJN_USER:$NJN_USER_PASS" | chpasswd From ba838c78938f410c0e9ee6ea5f93b089e2fd19f5 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Mon, 28 Jun 2021 04:52:19 -0500 Subject: [PATCH 8/9] Add missing variable, also match quotes on conf. --- add-jibri-node.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/add-jibri-node.sh b/add-jibri-node.sh index aa8a199..6d72e56 100644 --- a/add-jibri-node.sh +++ b/add-jibri-node.sh @@ -63,6 +63,7 @@ GITHUB_RAW="https://raw.githubusercontent.com" GIT_REPO="switnet-ltd/quick-jibri-installer" TEST_JIBRI_ENV="$GITHUB_RAW/$GIT_REPO/unstable/tools/test-jibri-env.sh" SHORT_ID="$(awk '{print substr($0,0,7)}' /etc/machine-id)" +JIBRI_XORG_CONF="/etc/jitsi/jibri/xorg-video-dummy.conf" ### 1_VAR_DEF # sed limiters for add-jibri-node.sh variables @@ -358,7 +359,7 @@ jibri { ] } ffmpeg { - resolution = $JIBRI_RES_CONF + resolution = "$JIBRI_RES_CONF" } chrome { // The flags which will be passed to chromium when launching From 3e06f5a5ff39b425ca959706b8f133fa277fd484 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Mon, 28 Jun 2021 04:53:01 -0500 Subject: [PATCH 9/9] Add chrome removal bits --- tools/start-over.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/start-over.sh b/tools/start-over.sh index 3294dd9..09a497f 100644 --- a/tools/start-over.sh +++ b/tools/start-over.sh @@ -96,6 +96,10 @@ apt-get -y purge jibri \ jitsi-videobridge2 \ prosody +#Chome related packages +apt-get -y purge google-chrome-stable +rm /usr/local/bin/chromedriver + #Services stop remove_services jibri remove_services jibri-icewm