From 781ca9489292278ba975e6f15a69bace58710d63 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Fri, 4 Jun 2021 04:53:51 -0500 Subject: [PATCH 1/6] Update README --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 777b5eb..d231641 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,8 @@ git clone https://github.com/switnet-ltd/quick-jibri-installer cd quick-jibri-installer bash quick-jibri-installer.sh ``` +![QJI - Setup](https://raw.githubusercontent.com/wiki/switnet-ltd/quick-jibri-installer/images/qji-diagram-setup.png) + If your server meet the necessary resources, then at the end on the installer you should have a working Jitsi Meet Server along with a Jibri server ready to record. Additional jibris need to be set on separate servers, only necesary on simultaneous recordings for that please use add-jibri-node.sh. From fb48b726c7d55dd24a33ea8091fafa15393f1fed Mon Sep 17 00:00:00 2001 From: Ark74 Date: Sat, 12 Jun 2021 15:55:56 -0500 Subject: [PATCH 2/6] Add open port test JMS/Jibri --- tools/test-jibri-env.sh | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/tools/test-jibri-env.sh b/tools/test-jibri-env.sh index cc6f143..b6f1ccf 100644 --- a/tools/test-jibri-env.sh +++ b/tools/test-jibri-env.sh @@ -51,6 +51,7 @@ SND_AL_MODULE=$(lsmod | awk '{print$1}'| grep snd_aloop) HWE_VIR_MOD=$(apt-cache madison linux-image-generic-hwe-$(lsb_release -sr) 2>/dev/null|head -n1|grep -c "hwe-$(lsb_release -sr)") CONF_JSON="/etc/jitsi/jibri/config.json" JIBRI_CONF="/etc/jitsi/jibri/jibri.conf" +JMS_DOMAIN="$(awk -F '"' '/xmpp-domain/{print$2}' $JIBRI_CONF)" CHDB="$(whereis chromedriver | awk '{print$2}')" CHD_VER_LOCAL="$($CHDB --version 2>/dev/null| awk '{print$1,$2}')" GOOGL_VER_LOCAL="$(/usr/bin/google-chrome --version 2>/dev/null)" @@ -163,7 +164,7 @@ please try rebooting.\nFor now wait 'til the end of the recommended kernel insta fi T4=0 else - echo -e "Great!\nModule snd-aloop found!" + echo -e "Great!, module snd-aloop found. \xE2\x9C\x94" T4=1 fi @@ -175,10 +176,10 @@ ASRC_MASTER_MD5SUM=$(curl -sL $ASRC_MASTER | md5sum | cut -d ' ' -f 1) ASRC_INSTALLED_MD5SUM=$(md5sum $ASRC_INSTALLED | cut -d ' ' -f 1) if [ "$ASRC_MASTER_MD5SUM" == "$ASRC_INSTALLED_MD5SUM" ]; then - echo "Seems to be using the latest asoundrc file available!" + echo -e "Seems to be using the latest asoundrc file available. \xE2\x9C\x94" T5=1 else - echo "asoundrc files differ, if you have errors, you might wanna check this file!" + echo -e "asoundrc files differ, if you have errors, you might wanna check this file \xE2\x9C\x96" T5=0 fi @@ -217,11 +218,22 @@ https://github.com/switnet-ltd/quick-jibri-installer/issues\n" T6_1=0 fi -TEST_TOTAL=$(awk "BEGIN{ print $T1 + $T2 + $T3 + $T4 + $T5 + $T6 + $T6_1 }") +#T7 +echo -e "\n#5 -- Check for open communication port among Jibri and JMS --\n" +nc -z -v -w5 $JMS_DOMAIN 5222 +if [ "$?" -ne 0 ]; then + echo -e "Connection failed! \xE2\x9C\x96\n > You might want to check both Jibri & JMS firewall rules (TCP 5222)." + T7=0 +else + echo -e "Connection succeeded! \xE2\x9C\x94\n" + T7=1 +fi + +TEST_TOTAL=$(awk "BEGIN{ print $T1 + $T2 + $T3 + $T4 + $T5 + $T6 + $T6_1 + $T7 }") echo " ############################## \ -Score: $TEST_TOTAL out of 6.1 +Score: $TEST_TOTAL out of 7.1 ############################## " echo -e "\nJibri Test complete, thanks for testing.\n" From 1f38da7a19d7b90284cd6ebbc95923359ad5bd32 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Thu, 17 Jun 2021 01:27:51 -0500 Subject: [PATCH 3/6] Fix test number --- tools/test-jibri-env.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/test-jibri-env.sh b/tools/test-jibri-env.sh index b6f1ccf..ae87a22 100644 --- a/tools/test-jibri-env.sh +++ b/tools/test-jibri-env.sh @@ -219,7 +219,7 @@ T6_1=0 fi #T7 -echo -e "\n#5 -- Check for open communication port among Jibri and JMS --\n" +echo -e "\n#7 -- Check for open communication port among Jibri and JMS --\n" nc -z -v -w5 $JMS_DOMAIN 5222 if [ "$?" -ne 0 ]; then echo -e "Connection failed! \xE2\x9C\x96\n > You might want to check both Jibri & JMS firewall rules (TCP 5222)." From 9ca66a568e495e55a8b7e1967724d6b6c11cf9d3 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Thu, 17 Jun 2021 02:29:08 -0500 Subject: [PATCH 4/6] Remove secuential jibri node nickname in favor of machine-id Also use short machine ID as hostname --- add-jibri-node.sh | 35 ++++++++--------------------------- 1 file changed, 8 insertions(+), 27 deletions(-) diff --git a/add-jibri-node.sh b/add-jibri-node.sh index 5cdd7fb..56273be 100644 --- a/add-jibri-node.sh +++ b/add-jibri-node.sh @@ -62,6 +62,7 @@ NJN_USER_PASS="$(tr -dc "a-zA-Z0-9#_*=" < /dev/urandom | fold -w 32 | head -n1)" 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)" ### 1_VAR_DEF # sed limiters for add-jibri-node.sh variables @@ -78,14 +79,9 @@ check_var() { fi } -if [ -z "$LAST" ]; then - echo "There is an error on the LAST definition, please report." - exit -elif [ "$LAST" = "TBD" ]; then - ADDUP=$((START + 1)) -else - ADDUP=$((LAST + 1)) -fi +#Change in favor of machine-id identifier +crontab -l | { cat; echo "@reboot sed -i \"/[[:space:]]control-muc/,/[[:space:]]control-login/{s|nickname = .*|nickname = \\\"$(cat /etc/machine-id)\\\"|}\" /etc/jitsi/jibri/jibri.conf"; } | crontab - +crontab -l echo " #----------------------------------------------------------------------- @@ -183,8 +179,8 @@ else fi # Rename hostname for each jibri node -hostnamectl set-hostname "jbnode${ADDUP}.${MAIN_SRV_DOMAIN}" -sed -i "1i 127.0.0.1 jbnode${ADDUP}.${MAIN_SRV_DOMAIN}" /etc/hosts +hostnamectl set-hostname "jbnode_${SHORT_ID}.${MAIN_SRV_DOMAIN}" +sed -i "1i 127.0.0.1 jbnode_${SHORT_ID}.${MAIN_SRV_DOMAIN}" /etc/hosts # Jitsi-Meet Repo echo "Add Jitsi repo" @@ -413,7 +409,7 @@ jibri { control-muc { domain = "internal.auth.$MAIN_SRV_DOMAIN" room-name = "$JibriBrewery" - nickname = "Live-$ADDUP" + nickname = "machine-id" } // The login information for the control MUC @@ -539,11 +535,6 @@ systemctl daemon-reload systemctl enable remote_jnsync.service systemctl start remote_jnsync.service -echo "Writing last node number..." -sed -i "$(var_dlim 0_VAR),$(var_dlim 1_VAR){s|LAST=.*|LAST=$ADDUP|}" 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: $(awk -F 'LETS:' '/LETS/{print$2}' add-jibri-node.sh|head -n1)" - #Enable jibri services systemctl enable jibri systemctl enable jibri-xorg @@ -551,25 +542,15 @@ systemctl enable jibri-icewm check_snd_driver -echo -e "\nSending updated add-jibri-node.sh file to main server sync user...\n" -cp $PWD/add-jibri-node.sh /tmp -sudo -u $NJN_USER scp /tmp/add-jibri-node.sh $MJS_USER@$MAIN_SRV_DOMAIN:/home/$MJS_USER/ -rm $PWD/add-jibri-node.sh /tmp/add-jibri-node.sh - echo " ######################################################################## Node addition complete!! - IMPORTANT: - The updated version of this file has been sent to the main server - at the sync user home directory, please use that one in order to - install new nodes. For security reason this version has been deleted - from this very node. - For customized support: http://switnet.net ######################################################################## " + echo "Rebooting in..." secs=$((15)) while [ $secs -gt 0 ]; do From 29af218d58ccda0ad15c36b52b1d0e2cf1e79674 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Thu, 17 Jun 2021 02:35:22 -0500 Subject: [PATCH 5/6] Place warning about mandatory reboot. --- add-jibri-node.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/add-jibri-node.sh b/add-jibri-node.sh index 56273be..b6ee47e 100644 --- a/add-jibri-node.sh +++ b/add-jibri-node.sh @@ -550,8 +550,8 @@ echo " ######################################################################## " - -echo "Rebooting in..." +echo "Make sure to reboot, it's necessary before *any* usage. +Rebooting in..." secs=$((15)) while [ $secs -gt 0 ]; do echo -ne "$secs\033[0K\r" From 848f69908a25a68888cd13c261df460f79731518 Mon Sep 17 00:00:00 2001 From: Ark74 Date: Thu, 17 Jun 2021 02:42:23 -0500 Subject: [PATCH 6/6] Replace secuential jvb hostname naming with machine id Thus removing any need to sync the incremental ADDUP variable. --- add-jvb2-node.sh | 49 +++++------------------------------------------- 1 file changed, 5 insertions(+), 44 deletions(-) diff --git a/add-jvb2-node.sh b/add-jvb2-node.sh index 37d08e2..34fdb46 100644 --- a/add-jvb2-node.sh +++ b/add-jvb2-node.sh @@ -63,10 +63,8 @@ JITSI_REPO=$(apt-cache policy | awk '/jitsi/&&/stable/{print$3}' | awk -F / 'NR= JVB2_CONF="/etc/jitsi/videobridge/config" JVB2_NCONF="/etc/jitsi/videobridge/jvb.conf" JVB2_SIP="/etc/jitsi/videobridge/sip-communicator.properties" +SHORT_ID="$(awk '{print substr($0,0,7)}' /etc/machine-id)" #PUBLIC_IP="$(dig -4 @resolver1.opendns.com ANY myip.opendns.com +short)" -NJN_RAND_TAIL="$(tr -dc "a-zA-Z0-9" < /dev/urandom | fold -w 4 | head -n1)" -NJN_USER="jvbnode${ADDUP}_${NJN_RAND_TAIL}" -NJN_USER_PASS="$(tr -dc "a-zA-Z0-9#_*=" < /dev/urandom | fold -w 32 | head -n1)" #GITHUB_RAW="https://raw.githubusercontent.com" #GIT_REPO="switnet-ltd/quick-jibri-installer" ### 1_VAR_DEF @@ -85,15 +83,6 @@ check_var() { fi } -if [ -z "$LAST" ]; then - echo "There is an error on the LAST definition, please report." - exit -elif [ "$LAST" = "TBD" ]; then - ADDUP=$((START + 1)) -else - ADDUP=$((LAST + 1)) -fi - #Check server and node OS if [ ! "$THIS_SRV_DIST" = "$MAIN_SRV_DIST" ]; then echo "Please use the same OS for the JVB2 setup on both servers." @@ -107,7 +96,7 @@ echo "Verifying System Resources:" if [ "$(nproc --all)" -lt 4 ];then echo " Warning!: The system do not meet the CPU recomendations for a JVB node for heavy loads. ->> We recommend 4 cores/threads for JVB2! +>> We recommend 4 cores/threads or above for JVB2! " CPU_MIN="N" else @@ -119,7 +108,7 @@ mem_available=$(grep MemTotal /proc/meminfo| grep -o '[0-9]\+') if [ ${mem_available} -lt 7700000 ]; then echo " Warning!: The system do not meet the CPU recomendations for a JVB node for heavy loads. ->> We recommend 8GB RAM for JVB2! +>> We recommend 8GB RAM or above for JVB2! " MEM_MIN="N" else @@ -171,8 +160,8 @@ check_var MUC_JID "$MUC_JID" check_var MAIN_SRV_DOMAIN "$MAIN_SRV_DOMAIN" # Rename hostname for each jvb2 node -hostnamectl set-hostname "jvb${ADDUP}.${MAIN_SRV_DOMAIN}" -sed -i "1i 127.0.0.1 jvb${ADDUP}.${MAIN_SRV_DOMAIN}" /etc/hosts +hostnamectl set-hostname "jvb_${SHORT_ID}.${MAIN_SRV_DOMAIN}" +sed -i "1i 127.0.0.1 jvb_${SHORT_ID}.${MAIN_SRV_DOMAIN}" /etc/hosts # Jitsi-Meet Repo echo "Add Jitsi repo" @@ -297,42 +286,14 @@ cat << JVB2 >> $JVB2_NCONF } JVB2 -echo -e "\n---- Create random nodesync user ----" -useradd -m -g jitsi $NJN_USER -echo "$NJN_USER:$NJN_USER_PASS" | chpasswd - -echo -e "\n---- We'll connect to main server ----" -read -n 1 -s -r -p "Press any key to continue..."$'\n' -sudo su $NJN_USER -c "ssh-keygen -t rsa -f ~/.ssh/id_rsa -b 4096 -o -a 100 -q -N ''" -echo "Remote pass: $MJS_USER_PASS" -ssh-keyscan -t rsa $MAIN_SRV_DOMAIN >> ~/.ssh/known_hosts -ssh $MJS_USER@$MAIN_SRV_DOMAIN sh -c "'cat >> .ssh/authorized_keys'" < /home/$NJN_USER/.ssh/id_rsa.pub -sudo su $NJN_USER -c "ssh-keyscan -t rsa $MAIN_SRV_DOMAIN >> /home/$NJN_USER/.ssh/known_hosts" - -echo "Writing last node number..." -sed -i "$(var_dlim 0_VAR),$(var_dlim 1_VAR){s|LAST=.*|LAST=$ADDUP|}" add-jvb2-node.sh -sed -i "$(var_dlim 0_LAST),$(var_dlim 1_LAST){s|LETS: .*|LETS: $(date -R)|}" add-jvb2-node.sh -echo "Last file edition at: $(grep "LETS:" add-jvb2-node.sh|head -n1|awk -F'LETS:' '{print$2}')" - #Enable jvb2 services systemctl enable jitsi-videobridge2.service systemctl restart jitsi-videobridge2.service -echo -e "\nSending updated add-jvb2-node.sh file to main server sync user...\n" -cp $PWD/add-jvb2-node.sh /tmp -sudo -u $NJN_USER scp /tmp/add-jvb2-node.sh $MJS_USER@$MAIN_SRV_DOMAIN:/home/$MJS_USER/ -rm $PWD/add-jvb2-node.sh /tmp/add-jvb2-node.sh - echo " ######################################################################## Node addition complete!! - IMPORTANT: - The updated version of this file has been sent to the main server - at the sync user home directory, please use that one in order to - install new nodes. For security reason this version has been deleted - from this very node. - For customized support: http://switnet.net ######################################################################## "