Major rework, comply with shellcheck #80

Merged
Ark74 merged 28 commits from unstable into master 2022-05-21 01:07:03 +00:00
20 changed files with 1078 additions and 1051 deletions

View File

@ -119,4 +119,4 @@ Feel free to use our `test-jibri-env.sh` tool to find some details on your curre
Please note: This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY. Please note: This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY.
SwITNet Ltd © - 2021, https://switnet.net/ SwITNet Ltd © - 2022, https://switnet.net/

View File

@ -1,26 +1,19 @@
#!/bin/bash #!/bin/bash
# Jibri Node Aggregator # Jibri Node Aggregator
# SwITNet Ltd © - 2021, https://switnet.net/ # SwITNet Ltd © - 2022, https://switnet.net/
# GPLv3 or later. # GPLv3 or later.
### 0_LAST EDITION TIME STAMP ### ### 0_LAST EDITION TIME STAMP ###
# LETS: AUTOMATED_EDITION_TIME # LETS: AUTOMATED_EDITION_TIME
### 1_LAST EDITION ### ### 1_LAST EDITION ###
#Make sure the file name is the required one
if [ ! "$(basename $0)" = "add-jibri-node.sh" ]; then
echo "For most cases naming won't matter, for this one it does."
echo "Please use the original name for this script: \`add-jibri-node.sh', and run again."
exit
fi
while getopts m: option while getopts m: option
do do
case "${option}" case "${option}"
in in
m) MODE=${OPTARG};; m) MODE=${OPTARG};;
\?) echo "Usage: sudo ./add_jibri_node.sh [-m debug]" && exit;; \?) echo "Usage: sudo bash ./$0 [-m debug]" && exit;;
esac esac
done done
#DEBUG #DEBUG
@ -28,6 +21,13 @@ if [ "$MODE" = "debug" ]; then
set -x set -x
fi fi
#Make sure the file name is the required one
if [ ! "$(basename "$0")" = "add-jibri-node.sh" ]; then
echo "For most cases naming won't matter, for this one it does."
echo "Please use the original name for this script: \`add-jibri-node.sh', and run again."
exit
fi
#Check admin rights #Check admin rights
if ! [ "$(id -u)" = 0 ]; then if ! [ "$(id -u)" = 0 ]; then
echo "You need to be root or have sudo privileges!" echo "You need to be root or have sudo privileges!"
@ -55,7 +55,7 @@ CHD_VER="$(curl -sL https://chromedriver.storage.googleapis.com/LATEST_RELEASE)"
GOOGL_REPO="/etc/apt/sources.list.d/dl_google_com_linux_chrome_deb.list" GOOGL_REPO="/etc/apt/sources.list.d/dl_google_com_linux_chrome_deb.list"
GOOGLE_ACTIVE_REPO=$(apt-cache policy | awk '/chrome/{print$3}' | awk -F "/" 'NR==1{print$2}') GOOGLE_ACTIVE_REPO=$(apt-cache policy | awk '/chrome/{print$3}' | awk -F "/" 'NR==1{print$2}')
GCMP_JSON="/etc/opt/chrome/policies/managed/managed_policies.json" GCMP_JSON="/etc/opt/chrome/policies/managed/managed_policies.json"
PUBLIC_IP="$(dig -4 @resolver1.opendns.com ANY myip.opendns.com +short)" #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_RAND_TAIL="$(tr -dc "a-zA-Z0-9" < /dev/urandom | fold -w 4 | head -n1)"
NJN_USER="jbnode${ADDUP}_${NJN_RAND_TAIL}" NJN_USER="jbnode${ADDUP}_${NJN_RAND_TAIL}"
NJN_USER_PASS="$(tr -dc "a-zA-Z0-9#_*=" < /dev/urandom | fold -w 32 | head -n1)" NJN_USER_PASS="$(tr -dc "a-zA-Z0-9#_*=" < /dev/urandom | fold -w 32 | head -n1)"
@ -68,7 +68,7 @@ JIBRI_XORG_CONF="/etc/jitsi/jibri/xorg-video-dummy.conf"
# sed limiters for add-jibri-node.sh variables # sed limiters for add-jibri-node.sh variables
var_dlim() { var_dlim() {
grep -n $1 add-jibri-node.sh|head -n1|cut -d ":" -f1 grep -n "$1" add-jibri-node.sh|head -n1|cut -d ":" -f1
} }
check_var() { check_var() {
@ -89,19 +89,19 @@ echo "
# Checking initial necessary variables... # Checking initial necessary variables...
#-----------------------------------------------------------------------" #-----------------------------------------------------------------------"
JMS_DATA=($MAIN_SRV_DIST \ JMS_DATA=("$MAIN_SRV_DIST" \
$MAIN_SRV_REPO \ "$MAIN_SRV_REPO" \
$MAIN_SRV_DOMAIN \ "$MAIN_SRV_DOMAIN" \
$JibriBrewery \ "$JibriBrewery" \
$JB_NAME \ "$JB_NAME" \
$JB_AUTH_PASS \ "$JB_AUTH_PASS" \
$JB_REC_PASS \ "$JB_REC_PASS" \
$MJS_USER \ "$MJS_USER" \
$MJS_USER_PASS \ "$MJS_USER_PASS" \
$JIBRI_RES_CONF \ "$JIBRI_RES_CONF" \
$JIBRI_RES_XORG_CONF) "$JIBRI_RES_XORG_CONF")
JMS_EVAL=${JMS_DATA[0]} JMS_EVAL="${JMS_DATA[0]}"
for i in "${JMS_DATA[@]}"; do for i in "${JMS_DATA[@]}"; do
if [[ "$JMS_EVAL" != "$i" ]]; then if [[ "$JMS_EVAL" != "$i" ]]; then
ALL_TBD="no" ALL_TBD="no"
@ -152,7 +152,7 @@ else
fi fi
### Test RAM size (8GB min) ### ### Test RAM size (8GB min) ###
mem_available=$(grep MemTotal /proc/meminfo| grep -o '[0-9]\+') mem_available=$(grep MemTotal /proc/meminfo| grep -o '[0-9]\+')
if [ ${mem_available} -lt 7700000 ]; then if [ "${mem_available}" -lt 7700000 ]; then
echo " echo "
Warning!: The system do not meet the minimum RAM 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! >> We recommend 8GB RAM for Jibri!
@ -190,7 +190,7 @@ sed -i "1i 127.0.0.1 jbnode_${SHORT_ID}.${MAIN_SRV_DOMAIN}" /etc/hosts
# Jitsi-Meet Repo # Jitsi-Meet Repo
echo "Add Jitsi repo" echo "Add Jitsi repo"
if [ -z "$JITSI_REPO" ]; then if [ -z "$JITSI_REPO" ]; then
echo "deb http://download.jitsi.org $MAIN_SRV_REPO/" > /etc/apt/sources.list.d/jitsi-$MAIN_SRV_REPO.list echo "deb http://download.jitsi.org $MAIN_SRV_REPO/" > /etc/apt/sources.list.d/jitsi-"$MAIN_SRV_REPO".list
wget -qO - https://download.jitsi.org/jitsi-key.gpg.key | apt-key add - wget -qO - https://download.jitsi.org/jitsi-key.gpg.key | apt-key add -
elif [ ! "$JITSI_REPO" = "$MAIN_SRV_REPO" ]; then elif [ ! "$JITSI_REPO" = "$MAIN_SRV_REPO" ]; then
echo "Main and node servers repository don't match, extiting.." echo "Main and node servers repository don't match, extiting.."
@ -235,7 +235,7 @@ else
# Your audio driver might not be able to load. # Your audio driver might not be able to load.
# We'll check the state of this Jibri with our 'test-jibri-env.sh' tool. # We'll check the state of this Jibri with our 'test-jibri-env.sh' tool.
#-----------------------------------------------------------------------" #-----------------------------------------------------------------------"
curl -s $TEST_JIBRI_ENV > /tmp/test-jibri-env.sh curl -s "$TEST_JIBRI_ENV" > /tmp/test-jibri-env.sh
#Test tool #Test tool
if [ "$MODE" = "debug" ]; then if [ "$MODE" = "debug" ]; then
bash /tmp/test-jibri-env.sh -m debug bash /tmp/test-jibri-env.sh -m debug
@ -248,14 +248,14 @@ fi
} }
echo "# Check and Install HWE kernel if possible..." echo "# Check and Install HWE kernel if possible..."
HWE_VIR_MOD=$(apt-cache madison linux-image-generic-hwe-$(lsb_release -sr) 2>/dev/null|head -n1|grep -c "hwe-$(lsb_release -sr)") HWE_VIR_MOD="$(apt-cache madison linux-image-generic-hwe-"$(lsb_release -sr)" 2>/dev/null|head -n1|grep -c hwe-"$(lsb_release -sr)")"
if [ "$HWE_VIR_MOD" = "1" ]; then if [ "$HWE_VIR_MOD" = "1" ]; then
apt-get -y install \ apt-get -y install \
linux-image-generic-hwe-$(lsb_release -sr) linux-image-generic-hwe-"$(lsb_release -sr)"
else else
apt-get -y install \ apt-get -y install \
linux-image-generic \ linux-image-generic \
linux-modules-extra-$(uname -r) linux-modules-extra-"$(uname -r)"
fi fi
echo " echo "
@ -273,7 +273,7 @@ if [ "$GOOGLE_ACTIVE_REPO" = "main" ]; then
else else
echo "Installing Google Chrome Stable" echo "Installing Google Chrome Stable"
wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add - wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add -
echo "deb http://dl.google.com/linux/chrome/deb/ stable main" | tee $GOOGL_REPO echo "deb http://dl.google.com/linux/chrome/deb/ stable main" | tee "$GOOGL_REPO"
fi fi
apt-get -q2 update apt-get -q2 update
apt-get install -y google-chrome-stable apt-get install -y google-chrome-stable
@ -283,7 +283,7 @@ if [ -f /usr/local/bin/chromedriver ]; then
echo "Chromedriver already installed." echo "Chromedriver already installed."
else else
echo "Installing Chromedriver" echo "Installing Chromedriver"
wget -q https://chromedriver.storage.googleapis.com/$CHD_VER/chromedriver_linux64.zip -O /tmp/chromedriver_linux64.zip wget -q https://chromedriver.storage.googleapis.com/"$CHD_VER"/chromedriver_linux64.zip -O /tmp/chromedriver_linux64.zip
unzip /tmp/chromedriver_linux64.zip -d /usr/local/bin/ unzip /tmp/chromedriver_linux64.zip -d /usr/local/bin/
chown root:root /usr/local/bin/chromedriver chown root:root /usr/local/bin/chromedriver
chmod 0755 /usr/local/bin/chromedriver chmod 0755 /usr/local/bin/chromedriver
@ -305,18 +305,18 @@ echo "
Remove Chrome warning... Remove Chrome warning...
" "
mkdir -p /etc/opt/chrome/policies/managed mkdir -p /etc/opt/chrome/policies/managed
echo '{ "CommandLineFlagSecurityWarningsEnabled": false }' > $GCMP_JSON echo '{ "CommandLineFlagSecurityWarningsEnabled": false }' > "$GCMP_JSON"
# Recording directory # Recording directory
if [ ! -d $DIR_RECORD ]; then if [ ! -d "$DIR_RECORD" ]; then
mkdir $DIR_RECORD mkdir "$DIR_RECORD"
fi fi
chown -R jibri:jibri $DIR_RECORD chown -R jibri:jibri "$DIR_RECORD"
cat << REC_DIR > $REC_DIR cat << REC_DIR > "$REC_DIR"
#!/bin/bash #!/bin/bash
RECORDINGS_DIR=$DIR_RECORD RECORDINGS_DIR="$DIR_RECORD"
echo "This is a dummy finalize script" > /tmp/finalize.out echo "This is a dummy finalize script" > /tmp/finalize.out
echo "The script was invoked with recordings directory $RECORDINGS_DIR." >> /tmp/finalize.out echo "The script was invoked with recordings directory $RECORDINGS_DIR." >> /tmp/finalize.out
@ -341,12 +341,12 @@ fi
exit 0 exit 0
REC_DIR REC_DIR
chown jibri:jibri $REC_DIR chown jibri:jibri "$REC_DIR"
chmod +x $REC_DIR chmod +x "$REC_DIR"
## New Jibri Config (2020) ## New Jibri Config (2020)
mv $JIBRI_CONF ${JIBRI_CONF}-dpkg-file mv "$JIBRI_CONF" "${JIBRI_CONF}"-dpkg-file
cat << NEW_CONF > $JIBRI_CONF cat << NEW_CONF > "$JIBRI_CONF"
// New XMPP environment config. // New XMPP environment config.
jibri { jibri {
streaming { streaming {
@ -459,25 +459,25 @@ jibri {
NEW_CONF NEW_CONF
#Jibri xorg resolution #Jibri xorg resolution
sed -i "s|[[:space:]]Virtual .*|Virtual $JIBRI_RES_XORG_CONF|" $JIBRI_XORG_CONF sed -i "s|[[:space:]]Virtual .*|Virtual $JIBRI_RES_XORG_CONF|" "$JIBRI_XORG_CONF"
echo -e "\n---- Create random nodesync user ----" echo -e "\n---- Create random nodesync user ----"
useradd -m -g jibri $NJN_USER useradd -m -g jibri "$NJN_USER"
echo "$NJN_USER:$NJN_USER_PASS" | chpasswd echo "$NJN_USER:$NJN_USER_PASS" | chpasswd
echo -e "\n---- We'll connect to main server ----" echo -e "\n---- We'll connect to main server ----"
read -n 1 -s -r -p "Press any key to continue..."$'\n' 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 ''" sudo su "$NJN_USER" -c "ssh-keygen -t rsa -f ~/.ssh/id_rsa -b 4096 -o -a 100 -q -N ''"
#Workaround for jibri to do cleaning. #Workaround for jibri to do cleaning.
install -m 0600 -o jibri /home/$NJN_USER/.ssh/id_rsa /home/jibri/jbsync.pem install -m 0600 -o jibri /home/"$NJN_USER"/.ssh/id_rsa /home/jibri/jbsync.pem
sudo su jibri -c "install -D /dev/null /home/jibri/.ssh/known_hosts" sudo su jibri -c "install -D /dev/null /home/jibri/.ssh/known_hosts"
sudo su jibri -c "ssh-keyscan -t rsa $MAIN_SRV_DOMAIN >> /home/jibri/.ssh/known_hosts" sudo su jibri -c "ssh-keyscan -t rsa $MAIN_SRV_DOMAIN >> /home/jibri/.ssh/known_hosts"
echo -e "\n\n##################\nRemote pass: $MJS_USER_PASS\n################## \n\n" echo -e "\n\n##################\nRemote pass: $MJS_USER_PASS\n################## \n\n"
ssh-keyscan -t rsa $MAIN_SRV_DOMAIN >> ~/.ssh/known_hosts 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 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" sudo su "$NJN_USER" -c "ssh-keyscan -t rsa $MAIN_SRV_DOMAIN >> /home/$NJN_USER/.ssh/known_hosts"
echo -e "\n---- Setup Log system ----" echo -e "\n---- Setup Log system ----"
cat << INOT_RSYNC > /etc/jitsi/jibri/remote-jbsync.sh cat << INOT_RSYNC > /etc/jitsi/jibri/remote-jbsync.sh
@ -486,21 +486,21 @@ cat << INOT_RSYNC > /etc/jitsi/jibri/remote-jbsync.sh
# Log process # Log process
exec 3>&1 4>&2 exec 3>&1 4>&2
trap 'exec 2>&4 1>&3' 0 1 2 3 trap 'exec 2>&4 1>&3' 0 1 2 3
exec 1>/var/log/$NJN_USER/remote_jnsync.log 2>&1 exec 1>/var/log/"$NJN_USER"/remote_jnsync.log 2>&1
# Run sync # Run sync
while true; do while true; do
inotifywait -t 60 -r -e modify,attrib,close_write,move,delete $DIR_RECORD inotifywait -t 60 -r -e modify,attrib,close_write,move,delete "$DIR_RECORD"
sudo su $NJN_USER -c "rsync -Aax --info=progress2 --remove-source-files --exclude '.*/' $DIR_RECORD/ $MJS_USER@$MAIN_SRV_DOMAIN:$DIR_RECORD" sudo su "$NJN_USER" -c "rsync -Aax --info=progress2 --remove-source-files --exclude '.*/' $DIR_RECORD/ $MJS_USER@$MAIN_SRV_DOMAIN:$DIR_RECORD"
find $DIR_RECORD -depth -type d -empty -not -path $DIR_RECORD -delete find "$DIR_RECORD" -depth -type d -empty -not -path "$DIR_RECORD" -delete
done done
INOT_RSYNC INOT_RSYNC
mkdir /var/log/$NJN_USER mkdir /var/log/"$NJN_USER"
cat << LOG_ROT > /etc/logrotate.d/$NJN_USER cat << LOG_ROT > /etc/logrotate.d/"$NJN_USER"
/var/log/$NJN_USER/*.log { /var/log/"$NJN_USER"/*.log {
monthly monthly
missingok missingok
rotate 12 rotate 12
@ -561,7 +561,7 @@ echo "
echo "Make sure to reboot, it's necessary before *any* usage. echo "Make sure to reboot, it's necessary before *any* usage.
Rebooting in..." Rebooting in..."
secs=$((15)) secs=$((15))
while [ $secs -gt 0 ]; do while [ "$secs" -gt 0 ]; do
echo -ne "$secs\033[0K\r" echo -ne "$secs\033[0K\r"
sleep 1 sleep 1
: $((secs--)) : $((secs--))

View File

@ -1,26 +1,19 @@
#!/bin/bash #!/bin/bash
# JVB2 Node Aggregator # JVB2 Node Aggregator
# SwITNet Ltd © - 2021, https://switnet.net/ # SwITNet Ltd © - 2022, https://switnet.net/
# GPLv3 or later. # GPLv3 or later.
### 0_LAST EDITION TIME STAMP ### ### 0_LAST EDITION TIME STAMP ###
# LETS: AUTOMATED_EDITION_TIME # LETS: AUTOMATED_EDITION_TIME
### 1_LAST EDITION ### ### 1_LAST EDITION ###
#Make sure the file name is the required one
if [ ! "$(basename $0)" = "add-jvb2-node.sh" ]; then
echo "For most cases naming won't matter, for this one it does."
echo "Please use the original name for this script: \`add-jvb2-node.sh', and run again."
exit
fi
while getopts m: option while getopts m: option
do do
case "${option}" case "${option}"
in in
m) MODE=${OPTARG};; m) MODE=${OPTARG};;
\?) echo "Usage: sudo ./add-jvb2-node.sh [-m debug]" && exit;; \?) echo "Usage: sudo bash ./$0 [-m debug]" && exit;;
esac esac
done done
#DEBUG #DEBUG
@ -28,6 +21,14 @@ if [ "$MODE" = "debug" ]; then
set -x set -x
fi fi
#Make sure the file name is the required one
if [ ! "$(basename "$0")" = "add-jvb2-node.sh" ]; then
echo "For most cases naming won't matter, for this one it does."
echo "Please use the original name for this script: \`add-jvb2-node.sh', and run again."
exit
fi
#Check admin rights #Check admin rights
if ! [ "$(id -u)" = 0 ]; then if ! [ "$(id -u)" = 0 ]; then
echo "You need to be root or have sudo privileges!" echo "You need to be root or have sudo privileges!"
@ -53,10 +54,10 @@ SHARD_DOMAIN=TBD
SHARD_PASS=TBD SHARD_PASS=TBD
MUC_JID=TBD MUC_JID=TBD
MJS_USER=TBD #MJS_USER=TBD
MJS_USER_PASS=TBD #MJS_USER_PASS=TBD
START=0 #START=0
LAST=TBD #LAST=TBD
THIS_SRV_DIST=$(lsb_release -sc) THIS_SRV_DIST=$(lsb_release -sc)
JITSI_REPO=$(apt-cache policy | awk '/jitsi/&&/stable/{print$3}' | awk -F / 'NR==1{print$1}') JITSI_REPO=$(apt-cache policy | awk '/jitsi/&&/stable/{print$3}' | awk -F / 'NR==1{print$1}')
@ -71,7 +72,7 @@ SHORT_ID="$(awk '{print substr($0,0,7)}' /etc/machine-id)"
# sed limiters for add-jvb2-node.sh variables # sed limiters for add-jvb2-node.sh variables
var_dlim() { var_dlim() {
grep -n $1 add-jvb2-node.sh|head -n1|cut -d ":" -f1 grep -n "$1" add-jvb2-node.sh|head -n1|cut -d ":" -f1
} }
check_var() { check_var() {
@ -105,7 +106,7 @@ else
fi fi
### Test RAM size (8GB min) ### ### Test RAM size (8GB min) ###
mem_available=$(grep MemTotal /proc/meminfo| grep -o '[0-9]\+') mem_available=$(grep MemTotal /proc/meminfo| grep -o '[0-9]\+')
if [ ${mem_available} -lt 7700000 ]; then if [ "${mem_available}" -lt 7700000 ]; then
echo " echo "
Warning!: The system do not meet the CPU recomendations for a JVB node for heavy loads. Warning!: The system do not meet the CPU recomendations for a JVB node for heavy loads.
>> We recommend 8GB RAM or above for JVB2! >> We recommend 8GB RAM or above for JVB2!
@ -141,7 +142,7 @@ echo "
#-----------------------------------------------------------------------" #-----------------------------------------------------------------------"
check_var JVB_HOSTNNAME "$JVB_HOSTNAME" check_var JVB_HOSTNNAME "$JVB_HOSTNAME"
if [ -z $JVB_HOST ]; then if [ -z "$JVB_HOST" ]; then
echo "JVB_HOST is empty, but it may be ok for it to be empty, skipping empty test." echo "JVB_HOST is empty, but it may be ok for it to be empty, skipping empty test."
else else
check_var JVB_HOST "$JVB_HOST" check_var JVB_HOST "$JVB_HOST"
@ -166,7 +167,7 @@ sed -i "1i 127.0.0.1 jvb_${SHORT_ID}.${MAIN_SRV_DOMAIN}" /etc/hosts
# Jitsi-Meet Repo # Jitsi-Meet Repo
echo "Add Jitsi repo" echo "Add Jitsi repo"
if [ -z "$JITSI_REPO" ]; then if [ -z "$JITSI_REPO" ]; then
echo "deb http://download.jitsi.org $MAIN_SRV_REPO/" > /etc/apt/sources.list.d/jitsi-$MAIN_SRV_REPO.list echo "deb http://download.jitsi.org $MAIN_SRV_REPO/" > /etc/apt/sources.list.d/jitsi-"$MAIN_SRV_REPO".list
wget -qO - https://download.jitsi.org/jitsi-key.gpg.key | apt-key add - wget -qO - https://download.jitsi.org/jitsi-key.gpg.key | apt-key add -
elif [ ! "$JITSI_REPO" = "$MAIN_SRV_REPO" ]; then elif [ ! "$JITSI_REPO" = "$MAIN_SRV_REPO" ]; then
echo "Main and node servers repository don't match, extiting.." echo "Main and node servers repository don't match, extiting.."
@ -193,14 +194,14 @@ apt-get -y install \
wget wget
echo "# Check and Install HWE kernel if possible..." echo "# Check and Install HWE kernel if possible..."
HWE_VIR_MOD=$(apt-cache madison linux-modules-extra-virtual-hwe-$(lsb_release -sr) 2>/dev/null|head -n1|grep -c "extra-virtual-hwe") 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 [ "$HWE_VIR_MOD" == "1" ]; then if [ "$HWE_VIR_MOD" == "1" ]; then
apt-get -y install \ apt-get -y install \
linux-image-generic-hwe-$(lsb_release -sr) \ linux-image-generic-hwe-"$(lsb_release -sr)" \
linux-modules-extra-virtual-hwe-$(lsb_release -sr) linux-modules-extra-virtual-hwe-"$(lsb_release -sr)"
else else
apt-get -y install \ apt-get -y install \
linux-modules-extra-$(uname -r) linux-modules-extra-"$(uname -r)"
fi fi
echo " echo "

View File

@ -9,7 +9,7 @@
####################################################### #######################################################
#Check if user is root #Check if user is root
if ! [ $(id -u) = 0 ]; then if ! [ "$(id -u)" = 0 ]; then
echo "You need to be root or have sudo privileges!" echo "You need to be root or have sudo privileges!"
exit 0 exit 0
fi fi
@ -22,17 +22,17 @@ echo '
by Software, IT & Networks Ltd by Software, IT & Networks Ltd
' '
JIGASI_CONFIG=/etc/jitsi/jigasi/config JIGASI_CONFIG="/etc/jitsi/jigasi/config"
GC_API_JSON=/opt/gc-sdk/GCTranscriptAPI.json GC_API_JSON="/opt/gc-sdk/GCTranscriptAPI.json"
DOMAIN=$(ls /etc/prosody/conf.d/ | grep -v localhost | awk -F'.cfg' '{print $1}' | awk '!NF || !seen[$0]++') DOMAIN="$(find /etc/prosody/conf.d/ -name \*.lua|awk -F'.cfg' '!/localhost/{print $1}'|xargs basename)"
MEET_CONF=/etc/jitsi/meet/${DOMAIN}-config.js MEET_CONF="/etc/jitsi/meet/${DOMAIN}-config.js"
JIG_SIP_CONF=/etc/jitsi/jigasi/config JIG_SIP_CONF="/etc/jitsi/jigasi/config"
JIG_SIP_PROP=/etc/jitsi/jigasi/sip-communicator.properties JIG_SIP_PROP="/etc/jitsi/jigasi/sip-communicator.properties"
JIC_SIP_PROP=/etc/jitsi/jicofo/sip-communicator.properties JIC_SIP_PROP="/etc/jitsi/jicofo/sip-communicator.properties"
JIG_TRANSC_PASWD="$(tr -dc "a-zA-Z0-9#*=" < /dev/urandom | fold -w 8 | head -n1)" JIG_TRANSC_PASWD="$(tr -dc "a-zA-Z0-9#*=" < /dev/urandom | fold -w 8 | head -n1)"
JIG_TRANSC_PASWD_B64="$(echo -n "$JIG_TRANSC_PASWD" | base64)" JIG_TRANSC_PASWD_B64="$(echo -n "$JIG_TRANSC_PASWD" | base64)"
DIST=$(lsb_release -sc) DIST="$(lsb_release -sc)"
CHECK_GC_REPO=$(apt-cache policy | grep http | grep cloud-sdk | head -n1 | awk '{print $3}' | awk -F '/' '{print $1}') CHECK_GC_REPO="$(apt-cache policy | grep http | grep cloud-sdk | head -n1 | awk '{print $3}' | awk -F '/' '{print $1}')"
install_gc_repo() { install_gc_repo() {
if [ "$CHECK_GC_REPO" = "cloud-sdk-$DIST" ]; then if [ "$CHECK_GC_REPO" = "cloud-sdk-$DIST" ]; then
@ -66,7 +66,7 @@ do
fi fi
done done
if [ $SETUP_TYPE = 1 ]; then if [ "$SETUP_TYPE" = 1 ]; then
### Start of new project configuration - Google SDK ### Start of new project configuration - Google SDK
#Setup option 1 - Google Cloud SDK #Setup option 1 - Google Cloud SDK
echo "Once logged on Google Cloud SDK, please create a new project (last option)." echo "Once logged on Google Cloud SDK, please create a new project (last option)."
@ -79,14 +79,14 @@ gcloud auth application-default login
# Start Google Cloud Configuration - Application Service # Start Google Cloud Configuration - Application Service
GC_MEMBER=transcript GC_MEMBER=transcript
echo "Checking if project exist..." echo "Checking if project exist..."
PROJECT_GC_ID=$(gcloud projects list | grep $GC_PROJECT_NAME | awk '{print$3}') PROJECT_GC_ID="$(gcloud projects list | grep "$GC_PROJECT_NAME" | awk '{print$3}')"
while [ -z $PROJECT_GC_ID ] while [ -z "$PROJECT_GC_ID" ]
do do
read -p "Enter the project name you just created for Jigasi Speech-to-Text"$'\n' -r GC_PROJECT_NAME read -p "Enter the project name you just created for Jigasi Speech-to-Text"$'\n' -r GC_PROJECT_NAME
if [ -z PROJECT_GC_ID ]; then if [ -z "$PROJECT_GC_ID" ]; then
echo "Please check your project name," echo "Please check your project name,"
echo "There is no project listed with the provided name: $GC_PROJECT_NAME" echo "There is no project listed with the provided name: $GC_PROJECT_NAME"
PROJECT_GC_ID=$(gcloud projects list | grep $GC_PROJECT_NAME | awk '{print$3}') PROJECT_GC_ID="$(gcloud projects list | grep "$GC_PROJECT_NAME" | awk '{print$3}')"
fi fi
done done
echo "Your $GC_PROJECT_NAME ID's project is: $PROJECT_GC_ID" echo "Your $GC_PROJECT_NAME ID's project is: $PROJECT_GC_ID"
@ -102,18 +102,18 @@ do
CHECK_BILLING="$(gcloud services enable speech.googleapis.com 2>/dev/null)" CHECK_BILLING="$(gcloud services enable speech.googleapis.com 2>/dev/null)"
if [[ $? -eq 1 ]]; then if [[ $? -eq 1 ]]; then
echo "Seems you haven't enabled billing for this project: $GC_PROJECT_NAME" echo "Seems you haven't enabled billing for this project: $GC_PROJECT_NAME"
exho " For that go to: https://console.developers.google.com/project/$PROJECT_GC_ID/settings echo " For that go to: https://console.developers.google.com/project/$PROJECT_GC_ID/settings
" "
read -p "Press Enter to continue" read -rp "Press Enter to continue"
CHECK_BILLING="$(gcloud services enable speech.googleapis.com 2>/dev/null)" CHECK_BILLING="$(gcloud services enable speech.googleapis.com 2>/dev/null)"
fi fi
done done
echo "Billing account seems setup, continuing..." echo "Billing account seems setup, continuing..."
gcloud iam service-accounts create $GC_MEMBER gcloud iam service-accounts create "$GC_MEMBER"
gcloud projects add-iam-policy-binding $GC_PROJECT_NAME \ gcloud projects add-iam-policy-binding "$GC_PROJECT_NAME" \
--member serviceAccount:$GC_MEMBER@$GC_PROJECT_NAME.iam.gserviceaccount.com \ --member serviceAccount:"$GC_MEMBER"@"$GC_PROJECT_NAME".iam.gserviceaccount.com \
--role roles/editor --role roles/editor
echo "Setup credentials:" echo "Setup credentials:"
@ -133,7 +133,7 @@ fi
echo "Setting up JSON key file..." echo "Setting up JSON key file..."
sleep 2 sleep 2
mkdir /opt/gc-sdk/ mkdir /opt/gc-sdk/
cat << KEY_JSON > $GC_API_JSON cat << KEY_JSON > "$GC_API_JSON"
# #
# Paste below this comment your GC JSON key for the service account: # Paste below this comment your GC JSON key for the service account:
# $GC_MEMBER@$GC_PROJECT_NAME.iam.gserviceaccount.com # $GC_MEMBER@$GC_PROJECT_NAME.iam.gserviceaccount.com
@ -143,11 +143,11 @@ cat << KEY_JSON > $GC_API_JSON
# These comment lines will be deleted afterwards. # These comment lines will be deleted afterwards.
# #
KEY_JSON KEY_JSON
chmod 644 $GC_API_JSON chmod 644 "$GC_API_JSON"
nano $GC_API_JSON nano "$GC_API_JSON"
sed -i '/^#/d' $GC_API_JSON sed -i '/^#/d' "$GC_API_JSON"
CHECK_JSON_KEY="$(cat $GC_API_JSON | python -m json.tool 2>/dev/null)" CHECK_JSON_KEY="$(cat "$GC_API_JSON" | python -m json.tool 2>/dev/null)"
while [[ $? -eq 1 ]] while [[ $? -eq 1 ]]
do do
CHECK_JSON_KEY="$(cat $GC_API_JSON | python -m json.tool 2>/dev/null)" CHECK_JSON_KEY="$(cat $GC_API_JSON | python -m json.tool 2>/dev/null)"
@ -169,7 +169,7 @@ echo "Installing Jigasi, your SIP credentials will be asked. (mandatory)"
apt-get -y install jigasi apt-get -y install jigasi
#apt-mark hold jigasi #apt-mark hold jigasi
cat << JIGASI_CONF >> $JIGASI_CONFIG cat << JIGASI_CONF >> "$JIGASI_CONFIG"
GOOGLE_APPLICATION_CREDENTIALS=$GC_API_JSON GOOGLE_APPLICATION_CREDENTIALS=$GC_API_JSON
@ -179,24 +179,24 @@ echo "Your Google Cloud credentials are at $GC_API_JSON"
echo "Setting up Jigasi transcript with current platform..." echo "Setting up Jigasi transcript with current platform..."
#Connect callcontrol #Connect callcontrol
sed -i "s|// call_control:|call_control:|" $MEET_CONF sed -i "s|// call_control:|call_control:|" "$MEET_CONF"
sed -i "s|// transcribingEnabled|transcribingEnabled|" $MEET_CONF sed -i "s|// transcribingEnabled|transcribingEnabled|" "$MEET_CONF"
sed -i "/transcribingEnabled/ s|false|true|" $MEET_CONF sed -i "/transcribingEnabled/ s|false|true|" "$MEET_CONF"
#siptest2siptest@domain.con #siptest2siptest@domain.con
#changed from conference to internal.auth from jibri #changed from conference to internal.auth from jibri
sed -i "s|siptest|siptest@internal.auth.$DOMAIN|" $JIG_SIP_PROP sed -i "s|siptest|siptest@internal.auth.$DOMAIN|" "$JIG_SIP_PROP"
#Disable component in favor of MUC #Disable component in favor of MUC
if [ $(grep -c nocomponent $JIG_SIP_CONF) != 0 ]; then if [ "$(grep -c nocomponent "$JIG_SIP_CONF")" != 0 ]; then
echo "Jigasi component is already disabled." echo "Jigasi component is already disabled."
else else
echo "Disabling jigasi component in favor of MUC" echo "Disabling jigasi component in favor of MUC"
sed -i "s|JIGASI_OPTS=.*|JIGASI_OPTS=\"--nocomponent=true\"|" $JIG_SIP_CONF sed -i "s|JIGASI_OPTS=.*|JIGASI_OPTS=\"--nocomponent=true\"|" "$JIG_SIP_CONF"
fi fi
#Setup XMPP #Setup XMPP
cat << ACC1_XMPP >> $JIG_SIP_PROP cat << ACC1_XMPP >> "$JIG_SIP_PROP"
# XMPP account used for control # XMPP account used for control
net.java.sip.communicator.impl.protocol.jabber.acc1=acc1 net.java.sip.communicator.impl.protocol.jabber.acc1=acc1
@ -265,30 +265,30 @@ org.jitsi.jigasi.xmpp.acc.ALLOW_NON_SECURE=true
ACC1_XMPP ACC1_XMPP
#Enable transcription config #Enable transcription config
sed -i "/ENABLE_TRANSCRIPTION/ s|#||" $JIG_SIP_PROP sed -i "/ENABLE_TRANSCRIPTION/ s|#||" "$JIG_SIP_PROP"
sed -i "/ENABLE_TRANSCRIPTION/ s|false|true|" $JIG_SIP_PROP sed -i "/ENABLE_TRANSCRIPTION/ s|false|true|" "$JIG_SIP_PROP"
sed -i "/ENABLE_SIP/ s|#||" $JIG_SIP_PROP sed -i "/ENABLE_SIP/ s|#||" "$JIG_SIP_PROP"
sed -i "/ENABLE_SIP/ s|true|false|" $JIG_SIP_PROP sed -i "/ENABLE_SIP/ s|true|false|" "$JIG_SIP_PROP"
#Transcript format #Transcript format
sed -i "/SAVE_JSON/ s|# ||" $JIG_SIP_PROP sed -i "/SAVE_JSON/ s|# ||" "$JIG_SIP_PROP"
sed -i "/SEND_JSON/ s|# ||" $JIG_SIP_PROP sed -i "/SEND_JSON/ s|# ||" "$JIG_SIP_PROP"
sed -i "/SAVE_TXT/ s|# ||" $JIG_SIP_PROP sed -i "/SAVE_TXT/ s|# ||" "$JIG_SIP_PROP"
sed -i "/SEND_TXT/ s|# ||" $JIG_SIP_PROP sed -i "/SEND_TXT/ s|# ||" "$JIG_SIP_PROP"
#sed -i "/SEND_TXT/ s|false|true|" $JIG_SIP_PROP #sed -i "/SEND_TXT/ s|false|true|" $JIG_SIP_PROP
#Allow to connect other than same server only. #Allow to connect other than same server only.
sed -i \ sed -i \
"/xmpp.acc.SERVER_ADDRESS/ s|org.jitsi.jigasi.xmpp.acc.SERVER_ADDRESS=.*|org.jitsi.jigasi.xmpp.acc.SERVER_ADDRESS=$DOMAIN|" \ "/xmpp.acc.SERVER_ADDRESS/ s|org.jitsi.jigasi.xmpp.acc.SERVER_ADDRESS=.*|org.jitsi.jigasi.xmpp.acc.SERVER_ADDRESS=$DOMAIN|" \
$JIG_SIP_PROP "$JIG_SIP_PROP"
#Remember to study how to use LE or what's needed #ToDo #Remember to study how to use LE or what's needed #ToDo
sed -i "/ALWAYS_TRUST_MODE_ENABLED/ s|# ||" $JIG_SIP_PROP sed -i "/ALWAYS_TRUST_MODE_ENABLED/ s|# ||" "$JIG_SIP_PROP"
prosodyctl register jigasi auth.$DOMAIN $JIG_TRANSC_PASWD prosodyctl register jigasi auth."$DOMAIN" "$JIG_TRANSC_PASWD"
#Set Brewery #Set Brewery
cat << JIG_JIC >> $JIC_SIP_PROP cat << JIG_JIC >> "$JIC_SIP_PROP"
org.jitsi.jicofo.jigasi.BREWERY=JigasiBreweryRoom@internal.auth.$DOMAIN org.jitsi.jicofo.jigasi.BREWERY=JigasiBreweryRoom@internal.auth.$DOMAIN
JIG_JIC JIG_JIC

View File

@ -6,11 +6,11 @@
while getopts m: option while getopts m: option
do do
case "${option}" case "${option}"
in in
m) MODE=${OPTARG};; m) MODE=${OPTARG};;
\?) echo "Usage: sudo ./etherpad-docker.sh [-m debug]" && exit;; \?) echo "Usage: sudo bash ./$0 [-m debug]" && exit;;
esac esac
done done
#DEBUG #DEBUG
@ -18,7 +18,7 @@ if [ "$MODE" = "debug" ]; then
set -x set -x
fi fi
if ! [ $(id -u) = 0 ]; then if ! [ "$(id -u)" = 0 ]; then
echo "You need to be root or have sudo privileges!" echo "You need to be root or have sudo privileges!"
exit 0 exit 0
fi fi
@ -35,14 +35,14 @@ check_apt_policy() {
apt-cache policy 2>/dev/null| awk "/$1/{print \$3}" | awk -F '/' 'NR==1{print$2}' apt-cache policy 2>/dev/null| awk "/$1/{print \$3}" | awk -F '/' 'NR==1{print$2}'
} }
install_ifnot() { install_ifnot() {
if [ "$(dpkg-query -W -f='${Status}' $1 2>/dev/null | grep -c "ok installed")" == "1" ]; then if [ "$(dpkg-query -W -f='${Status}' "$1" 2>/dev/null | grep -c "ok installed")" == "1" ]; then
echo " $1 is installed, skipping..." echo " $1 is installed, skipping..."
else else
echo -e "\n---- Installing $1 ----" echo -e "\n---- Installing $1 ----"
apt-get -yq2 install $1 apt-get -yq2 install "$1"
fi fi
} }
DOMAIN="$(ls /etc/prosody/conf.d/ | awk -F'.cfg' '!/localhost/{print $1}' | awk '!NF || !seen[$0]++')" DOMAIN="$(find /etc/prosody/conf.d/ -name \*.lua|awk -F'.cfg' '!/localhost/{print $1}'|xargs basename)"
MEET_CONF="/etc/jitsi/meet/$DOMAIN-config.js" MEET_CONF="/etc/jitsi/meet/$DOMAIN-config.js"
WS_CONF="/etc/nginx/sites-available/$DOMAIN.conf" WS_CONF="/etc/nginx/sites-available/$DOMAIN.conf"
PSGVER="$(apt-cache madison postgresql|awk -F'[ +]' 'NR==1{print $3}')" PSGVER="$(apt-cache madison postgresql|awk -F'[ +]' 'NR==1{print $3}')"
@ -65,7 +65,7 @@ read -p "Set your etherpad docker admin password: " -r ETHERPAD_ADMIN_PASS
# Install required packages # Install required packages
install_ifnot docker-ce install_ifnot docker-ce
install_ifnot postgresql-$PSGVER install_ifnot postgresql-"$PSGVER"
# Create DB # Create DB
echo -e "> Creating postgresql database for container...\n" echo -e "> Creating postgresql database for container...\n"
@ -100,37 +100,36 @@ fi
# Tune webserver for Jitsi App control # Tune webserver for Jitsi App control
if [ $(grep -c "etherpad" $WS_CONF) != 0 ]; then if [ "$(grep -c etherpad "$WS_CONF")" != 0 ]; then
echo "> Webserver seems configured, skipping..." echo "> Webserver seems configured, skipping..."
elif [ -f $WS_CONF ]; then elif [ -f "$WS_CONF" ]; then
echo "> Setting up webserver configuration file..." echo "> Setting up webserver configuration file..."
sed -i "/# ensure all static content can always be found first/i \ \ \ \ #Etherpad block" $WS_CONF sed -i "/# ensure all static content can always be found first/i \ \ \ \ #Etherpad block" "$WS_CONF"
sed -i "/# ensure all static content can always be found first/i \ \ \ \ location \^\~\ \/etherpad\/ {" $WS_CONF sed -i "/# ensure all static content can always be found first/i \ \ \ \ location \^\~\ \/etherpad\/ {" "$WS_CONF"
sed -i "/# ensure all static content can always be found first/i \ \ \ \ \ \ \ \ proxy_pass http:\/\/localhost:9001\/;" $WS_CONF sed -i "/# ensure all static content can always be found first/i \ \ \ \ \ \ \ \ proxy_pass http:\/\/localhost:9001\/;" "$WS_CONF"
sed -i "/# ensure all static content can always be found first/i \ \ \ \ \ \ \ \ proxy_set_header X-Forwarded-For \$remote_addr;" $WS_CONF sed -i "/# ensure all static content can always be found first/i \ \ \ \ \ \ \ \ proxy_set_header X-Forwarded-For \$remote_addr;" "$WS_CONF"
sed -i "/# ensure all static content can always be found first/i \ \ \ \ \ \ \ \ proxy_buffering off;" $WS_CONF sed -i "/# ensure all static content can always be found first/i \ \ \ \ \ \ \ \ proxy_buffering off;" "$WS_CONF"
sed -i "/# ensure all static content can always be found first/i \ \ \ \ \ \ \ \ proxy_set_header Host \$host;" $WS_CONF sed -i "/# ensure all static content can always be found first/i \ \ \ \ \ \ \ \ proxy_set_header Host \$host;" "$WS_CONF"
sed -i "/# ensure all static content can always be found first/i \ \ \ \ }" $WS_CONF sed -i "/# ensure all static content can always be found first/i \ \ \ \ }" "$WS_CONF"
sed -i "/# ensure all static content can always be found first/i \\\n" $WS_CONF sed -i "/# ensure all static content can always be found first/i \\\n" "$WS_CONF"
else else
echo "> No etherpad config done to server file, please report to: echo "> No etherpad config done to server file, please report to:
-> https://github.com/switnet-ltd/quick-jibri-installer/issues" -> https://github.com/switnet-ltd/quick-jibri-installer/issues"
fi fi
# Configure config.js # Configure config.js
if [ $(grep -c "etherpad_base" $WS_CONF) != 0 ]; then if [ "$(grep -c "etherpad_base" "$WS_CONF")" != 0 ]; then
echo -e "> $MEET_CONF seems configured, skipping...\n" echo -e "> $MEET_CONF seems configured, skipping...\n"
else else
echo -e "> Setting etherpad domain at $MEET_CONF...\n" echo -e "> Setting etherpad domain at $MEET_CONF...\n"
sed -i "/ openSharedDocumentOnJoin:/a\ \ \ \ etherpad_base: \'https://$DOMAIN/etherpad/p/\'," $MEET_CONF sed -i "/ openSharedDocumentOnJoin:/a\ \ \ \ etherpad_base: \'https://$DOMAIN/etherpad/p/\'," "$MEET_CONF"
fi fi
echo "> Checking nginx configuration..." echo "> Checking nginx configuration..."
nginx -t 2>/dev/null
if [ $? = 0 ]; then if nginx -t 2>/dev/null ; then
echo -e " -- Docker configuration seems fine, enabling it." echo -e " -- Docker configuration seems fine, enabling it."
systemctl reload nginx # systemctl reload nginx
else else
echo "Please check your configuration, something may be wrong." echo "Please check your configuration, something may be wrong."
echo "Will not try to enable etherpad nginx configuration, please report to: echo "Will not try to enable etherpad nginx configuration, please report to:

View File

@ -8,17 +8,17 @@
# by "mephisto" # by "mephisto"
# #
# Igor Kerstges © - 2021 # Igor Kerstges © - 2021
# SwITNet Ltd © - 2021, https://switnet.net/ # SwITNet Ltd © - 2022, https://switnet.net/
# #
# GPLv3 or later. # GPLv3 or later.
while getopts m: option while getopts m: option
do do
case "${option}" case "${option}"
in in
m) MODE=${OPTARG};; m) MODE=${OPTARG};;
\?) echo "Usage: sudo ./grafana.sh [-m debug]" && exit;; \?) echo "Usage: sudo bash ./$0 [-m debug]" && exit;;
esac esac
done done
#DEBUG #DEBUG
@ -26,7 +26,7 @@ if [ "$MODE" = "debug" ]; then
set -x set -x
fi fi
if ! [ $(id -u) = 0 ]; then if ! [ "$(id -u)" = 0 ]; then
echo "You need to be root or have sudo privileges!" echo "You need to be root or have sudo privileges!"
exit 0 exit 0
fi fi
@ -39,14 +39,14 @@ echo '
by Software, IT & Networks Ltd by Software, IT & Networks Ltd
' '
run_service() { run_service() {
systemctl enable $1 systemctl enable "$1"
systemctl restart $1 systemctl restart "$1"
systemctl status $1 systemctl status "$1"
} }
MAIN_TEL="/etc/telegraf/telegraf.conf" MAIN_TEL="/etc/telegraf/telegraf.conf"
TEL_JIT="/etc/telegraf/telegraf.d/jitsi.conf" TEL_JIT="/etc/telegraf/telegraf.d/jitsi.conf"
GRAFANA_INI="/etc/grafana/grafana.ini" GRAFANA_INI="/etc/grafana/grafana.ini"
DOMAIN="$(ls /etc/prosody/conf.d/ | awk -F'.cfg' '!/localhost/{print $1}' | awk '!NF || !seen[$0]++')" DOMAIN="$(find /etc/prosody/conf.d/ -name \*.lua|awk -F'.cfg' '!/localhost/{print $1}'|xargs basename)"
WS_CONF="/etc/nginx/sites-available/$DOMAIN.conf" WS_CONF="/etc/nginx/sites-available/$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)"
@ -134,16 +134,14 @@ JITSI_TELEGRAF
run_service telegraf run_service telegraf
echo " echo -n "\n# Setup videobridge options\n"
# Setup videobridge options echo '
" # extra options to pass to the JVB daemon
sed -i "s|JVB_OPTS=\"--apis.*|JVB_OPTS=\"--apis=rest,xmpp\"|" /etc/jitsi/videobridge/config JVB_OPTS="--apis=rest,xmpp"' >> /etc/jitsi/videobridge/config
sed -i "s|TRANSPORT=muc|TRANSPORT=muc,colibri|" /etc/jitsi/videobridge/sip-communicator.properties sed -i "s|TRANSPORT=muc|TRANSPORT=muc,colibri|" /etc/jitsi/videobridge/sip-communicator.properties
systemctl restart jitsi-videobridge2 systemctl restart jitsi-videobridge2
echo " echo -e "\n# Setup Grafana nginx domain\n"
# Setup Grafana nginx domain
"
sed -i "s|;protocol =.*|protocol = http|" $GRAFANA_INI sed -i "s|;protocol =.*|protocol = http|" $GRAFANA_INI
sed -i "s|;http_addr =.*|http_addr = localhost|" $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|;http_port =.*|http_port = 3000|" $GRAFANA_INI
@ -162,11 +160,11 @@ while [ $secs -gt 0 ]; do
: $((secs--)) : $((secs--))
done done
if [ -f $WS_CONF ]; then if [ -f "$WS_CONF" ]; then
sed -i "/# ensure all static content can always be found first/i \ \ \ \ location \~ \^\/(grafana\/|grafana\/login) {" $WS_CONF sed -i "/# ensure all static content can always be found first/i \ \ \ \ location \~ \^\/(grafana\/|grafana\/login) {" "$WS_CONF"
sed -i "/# ensure all static content can always be found first/i \ \ \ \ \ \ \ \ proxy_pass http:\/\/localhost:3000;" $WS_CONF sed -i "/# ensure all static content can always be found first/i \ \ \ \ \ \ \ \ proxy_pass http:\/\/localhost:3000;" "$WS_CONF"
sed -i "/# ensure all static content can always be found first/i \ \ \ \ }" $WS_CONF sed -i "/# ensure all static content can always be found first/i \ \ \ \ }" "$WS_CONF"
sed -i "/# ensure all static content can always be found first/i \\\n" $WS_CONF sed -i "/# ensure all static content can always be found first/i \\\n" "$WS_CONF"
systemctl restart nginx systemctl restart nginx
else else
echo "No app configuration done to server file, please report to: echo "No app configuration done to server file, please report to:
@ -206,8 +204,8 @@ grafana_cred="admin:$GRAFANA_PASS"
grafana_datasource="InfluxDB" grafana_datasource="InfluxDB"
ds=(11969); ds=(11969);
for d in "${ds[@]}"; do for d in "${ds[@]}"; do
echo -n "Processing $d: " echo "Processing $d: "
j=$(curl -s -k -u "$grafana_cred" $grafana_host/api/gnet/dashboards/$d | jq .json) 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 -s -k -u "$grafana_cred" -XPOST -H "Accept: application/json" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-d "{ -d "{

View File

@ -1,16 +1,33 @@
#!/bin/bash #!/bin/bash
# Jitsi Meet recurring upgrader and customization keeper # Jitsi Meet recurring upgrader and customization keeper
# for Debian/*buntu binaries. # for Debian/*buntu binaries.
# SwITNet Ltd © - 2021, https://switnet.net/ # SwITNet Ltd © - 2022, https://switnet.net/
# GNU GPLv3 or later. # GNU GPLv3 or later.
while getopts m: option
do
case "${option}"
in
m) MODE=${OPTARG};;
\?) echo "Usage: sudo bash ./$0 [-m debug]" && exit;;
esac
done
#DEBUG
if [ "$MODE" = "debug" ]; then
set -x
fi
Blue='\e[0;34m' Blue='\e[0;34m'
Purple='\e[0;35m' Purple='\e[0;35m'
Green='\e[0;32m' Green='\e[0;32m'
Yellow='\e[0;33m' Yellow='\e[0;33m'
Color_Off='\e[0m' Color_Off='\e[0m'
printwc() {
printf "%b$2%b" "$1" "${Color_Off}"
}
#Check if user is root #Check if user is root
if ! [ $(id -u) = 0 ]; then if ! [ "$(id -u)" = 0 ]; then
echo "You need to be root or have sudo privileges!" echo "You need to be root or have sudo privileges!"
exit 0 exit 0
fi fi
@ -23,28 +40,32 @@ support="https://switnet.net/support"
apt_repo="/etc/apt/sources.list.d" apt_repo="/etc/apt/sources.list.d"
ENABLE_BLESSM="TBD" ENABLE_BLESSM="TBD"
CHD_LTST="$(curl -sL https://chromedriver.storage.googleapis.com/LATEST_RELEASE)" CHD_LTST="$(curl -sL https://chromedriver.storage.googleapis.com/LATEST_RELEASE)"
CHD_LTST_2D="$(echo $CHD_LTST|cut -d "." -f 1,2)" CHD_LTST_2D="$(echo "$CHD_LTST"|cut -d "." -f 1,2)"
CHDB="$(whereis chromedriver | awk '{print$2}')" CHDB="$(whereis chromedriver | awk '{print$2}')"
DOMAIN="$(ls /etc/prosody/conf.d|awk -F'.cfg' '!/localhost/{print $1}' | awk '!NF || !seen[$0]++')" DOMAIN="$(find /etc/prosody/conf.d/ -name \*.lua | \
awk -F'.cfg' '!/localhost/{print $1}' | xargs basename)"
NC_DOMAIN="TBD" NC_DOMAIN="TBD"
JITSI_MEET_PROXY="/etc/nginx/modules-enabled/60-jitsi-meet.conf" JITSI_MEET_PROXY="/etc/nginx/modules-enabled/60-jitsi-meet.conf"
if [ -f $JITSI_MEET_PROXY ];then if [ -f "$JITSI_MEET_PROXY" ];then
PREAD_PROXY=$(grep -nr "preread_server_name" $JITSI_MEET_PROXY | cut -d ":" -f1) PREAD_PROXY="$(grep -nr "preread_server_name" "$JITSI_MEET_PROXY" | cut -d ":" -f1)"
fi fi
INT_CONF="/usr/share/jitsi-meet/interface_config.js" INT_CONF="/usr/share/jitsi-meet/interface_config.js"
INT_CONF_ETC="/etc/jitsi/meet/$DOMAIN-interface_config.js" INT_CONF_ETC="/etc/jitsi/meet/$DOMAIN-interface_config.js"
jibri_packages="$(grep Package /var/lib/apt/lists/download.jitsi.org_*_Packages |sort -u|awk '{print $2}'|sed 's|jigasi||')" read -r -a jibri_packages < <(grep Package /var/lib/apt/lists/download.jitsi.org_*_Packages | \
sort -u | awk '{print $2}' | sed '/jigasi/d' | \
xargs)
AVATAR="$(grep -r avatar /etc/nginx/sites-*/ 2>/dev/null)" AVATAR="$(grep -r avatar /etc/nginx/sites-*/ 2>/dev/null)"
if [ -f $apt_repo/google-chrome.list ]; then if [ -f "$apt_repo"/google-chrome.list ]; then
google_package=$(grep Package /var/lib/apt/lists/dl.google.com_linux_chrome_deb_dists_stable_main_binary-amd64_Packages | sort -u | cut -d ' ' -f2) read -r -a google_package < <(grep Package /var/lib/apt/lists/dl.google.com_*_Packages | \
sort -u | awk '{print $2}' | xargs)
else else
echo "Seems no Google repo installed" echo "Seems no Google repo installed"
fi fi
if [ -z $CHDB ]; then if [ -z "$CHDB" ]; then
echo "Seems no chromedriver installed" echo "Seems no chromedriver installed"
else else
CHD_VER_LOCAL="$($CHDB -v | awk '{print $2}')" CHD_VER_LOCAL="$($CHDB -v | awk '{print $2}')"
CHD_VER_2D="$(echo $CHD_VER_LOCAL|awk '{printf "%.1f\n", $NF}')" CHD_VER_2D="$(echo "$CHD_VER_LOCAL"|awk '{printf "%.1f\n", $NF}')"
fi fi
# True if $1 is greater than $2 # True if $1 is greater than $2
@ -72,21 +93,21 @@ restart_services() {
update_jitsi_repo() { update_jitsi_repo() {
apt-get update -o Dir::Etc::sourcelist="sources.list.d/jitsi-$1.list" \ apt-get update -o Dir::Etc::sourcelist="sources.list.d/jitsi-$1.list" \
-o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0" -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"
apt-get install -qq --only-upgrade $jibri_packages apt-get install -q2 --only-upgrade <<< printf "${jibri_packages[@]}"
} }
update_google_repo() { update_google_repo() {
if [ -f $apt_repo/google-chrome.list ]; then if [ -f "$apt_repo"/google-chrome.list ]; then
apt-get update -o Dir::Etc::sourcelist="sources.list.d/google-chrome.list" \ apt-get update -o Dir::Etc::sourcelist="sources.list.d/google-chrome.list" \
-o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0" -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"
apt-get install -qq --only-upgrade $google_package apt-get install -q2 --only-upgrade <<< printf "${google_package[@]}"
else else
echo "No Google repository found" echo "No Google repository found"
fi fi
} }
GOOGL_VER_2D="$(/usr/bin/google-chrome --version|awk '{printf "%.1f\n", $NF}')" GOOGL_VER_2D="$(/usr/bin/google-chrome --version|awk '{printf "%.1f\n", $NF}')"
upgrade_cd() { upgrade_cd() {
if [ ! -z "$GOOGL_VER_2D" ]; then if [ -n "$GOOGL_VER_2D" ]; then
if version_gt "$GOOGL_VER_2D" "$CHD_VER_2D" ; then if version_gt "$GOOGL_VER_2D" "$CHD_VER_2D" ; then
echo "Upgrading Chromedriver to Google Chromes version" echo "Upgrading Chromedriver to Google Chromes version"
wget -q https://chromedriver.storage.googleapis.com/"$CHD_LTST"/chromedriver_linux64.zip \ wget -q https://chromedriver.storage.googleapis.com/"$CHD_LTST"/chromedriver_linux64.zip \
@ -95,33 +116,38 @@ if [ ! -z "$GOOGL_VER_2D" ]; then
chown root:root "$CHDB" chown root:root "$CHDB"
chmod 0755 "$CHDB" chmod 0755 "$CHDB"
rm -rf /tpm/chromedriver_linux64.zip rm -rf /tpm/chromedriver_linux64.zip
printf "Current version: ${Green} "$($CHDB -v |awk '{print $2}'|awk '{printf "%.1f\n", $NF}')" ${Color_Off} (latest available)\n" printf "Current version: "
printwc "$Green" "$($CHDB -v |awk '{print $2}'|awk '{printf "%.1f\n", $NF}')"
echo -e " (latest available)\n"
elif [ "$GOOGL_VER_2D" = "$CHD_LTST_2D" ]; then elif [ "$GOOGL_VER_2D" = "$CHD_LTST_2D" ]; then
echo "No need to upgrade Chromedriver" echo "No need to upgrade Chromedriver"
printf "Current version: ${Green} $CHD_VER_2D ${Color_Off}\n" printf "Current version: "
printwc "$Green" "$CHD_VER_2D\n"
fi fi
else else
printf "${Yellow} -> No Google Chrome versión to match, leaving untouched.${Color_Off}\n" printwc "${Yellow}" " -> No Google Chrome versión to match, leaving untouched.\n"
fi fi
} }
check_lst_cd() { check_lst_cd() {
printf "${Purple}Checking for the latest Chromedriver${Color_Off}\n" printwc "${Purple}" "Checking for the latest Chromedriver\n"
if [ -f $CHDB ]; then if [ -f "$CHDB" ]; then
printf "Current installed Chromedriver: ${Yellow} $CHD_VER_2D ${Color_Off}\n" printf "Current installed Chromedriver: "
printf "Current installed Google Chrome: ${Green} $GOOGL_VER_2D ${Color_Off}\n" printwc "${Yellow}" "$CHD_VER_2D\n"
printf "Current installed Google Chrome: "
printwc "${Green}" "$GOOGL_VER_2D\n"
upgrade_cd upgrade_cd
else else
printf "${Yellow} -> Seems there is no Chromedriver installed${Color_Off}\n" printwc "${Yellow}" " -> Seems there is no Chromedriver installed\n"
fi fi
} }
printf "${Blue}Update & upgrade Jitsi and components${Color_Off}\n" printwc "${Blue}" "Update & upgrade Jitsi and components\n"
if [ -f $apt_repo/jitsi-unstable.list ]; then if [ -f "$apt_repo"/jitsi-unstable.list ]; then
update_jitsi_repo unstable update_jitsi_repo unstable
update_google_repo update_google_repo
check_lst_cd check_lst_cd
elif [ -f $apt_repo/jitsi-stable.list ]; then elif [ -f "$apt_repo"/jitsi-stable.list ]; then
update_jitsi_repo stable update_jitsi_repo stable
update_google_repo update_google_repo
check_lst_cd check_lst_cd
@ -144,35 +170,33 @@ if [ -f "$INT_CONF_ETC" ]; then
echo "Static interface_config.js exists, skipping modification..." echo "Static interface_config.js exists, skipping modification..."
else else
echo "This setup doesn't have a static interface_config.js, checking changes..." echo "This setup doesn't have a static interface_config.js, checking changes..."
printf "${Purple}========== Setting Static Avatar ==========${Color_Off}\n" printwc "${Purple}" "========== Setting Static Avatar ==========\n"
if [[ -z "$AVATAR" ]]; then if [[ -z "$AVATAR" ]]; then
echo "Moving on..." echo "Moving on..."
else else
echo "Setting Static Avatar" echo "Setting Static Avatar"
sed -i "/RANDOM_AVATAR_URL_PREFIX/ s|false|\'http://$DOMAIN/avatar/\'|" $INT_CONF sed -i "/RANDOM_AVATAR_URL_PREFIX/ s|false|\'http://$DOMAIN/avatar/\'|" "$INT_CONF"
sed -i "/RANDOM_AVATAR_URL_SUFFIX/ s|false|\'.png\'|" $INT_CONF sed -i "/RANDOM_AVATAR_URL_SUFFIX/ s|false|\'.png\'|" "$INT_CONF"
fi fi
printf "${Purple}========== Setting Support Link ==========${Color_Off}\n" printwc "${Purple}" "========== Setting Support Link ==========\n"
if [[ -z $support ]]; then if [[ -z "$support" ]]; then
echo "Moving on..." echo "Moving on..."
else else
echo "Setting Support custom link" echo "Setting Support custom link"
sed -i "s|https://jitsi.org/live|$support|g" $INT_CONF sed -i "s|https://jitsi.org/live|$support|g" "$INT_CONF"
fi fi
printf "${Purple}========== Disable Blur my background ==========${Color_Off}\n" printwc "${Purple}" "========== Disable Blur my background ==========\n"
sed -i "s|'videobackgroundblur', ||" $INT_CONF sed -i "s|'videobackgroundblur', ||" "$INT_CONF"
fi fi
if [ "$NC_DOMAIN" != "TBD" ]; then if [ "$NC_DOMAIN" != "TBD" ]; then
printf "${Purple}========== Enable $NC_DOMAIN for sync client ==========${Color_Off}\n" printwc "${Purple}" "========== Enable $NC_DOMAIN for sync client ==========\n"
if [ -z "$PREAD_PROXY" ]; then if [ -z "$PREAD_PROXY" ]; then
echo " printf "\n Setting up Nextcloud domain on Jitsi Meet turn proxy\n\n"
Setting up Nextcloud domain on Jitsi Meet turn proxy sed -i "/server {/i \ \ map \$ssl_preread_server_name \$upstream {" "$JITSI_MEET_PROXY"
" sed -i "/server {/i \ \ \ \ \ \ $DOMAIN web;" "$JITSI_MEET_PROXY"
sed -i "/server {/i \ \ map \$ssl_preread_server_name \$upstream {" $JITSI_MEET_PROXY sed -i "/server {/i \ \ \ \ \ \ $NC_DOMAIN web;" "$JITSI_MEET_PROXY"
sed -i "/server {/i \ \ \ \ \ \ $DOMAIN web;" $JITSI_MEET_PROXY sed -i "/server {/i \ \ }" "$JITSI_MEET_PROXY"
sed -i "/server {/i \ \ \ \ \ \ $NC_DOMAIN web;" $JITSI_MEET_PROXY
sed -i "/server {/i \ \ }" $JITSI_MEET_PROXY
else else
echo "$NC_DOMAIN seems to be on place, skipping..." echo "$NC_DOMAIN seems to be on place, skipping..."
fi fi
@ -183,6 +207,6 @@ restart_services
# Brandless mode # # Brandless mode #
######################################################################## ########################################################################
if [ "$ENABLE_BLESSM" = "on" ]; then if [ "$ENABLE_BLESSM" = "on" ]; then
bash $PWD/jm-bm.sh bash "$PWD"/jm-bm.sh
fi fi
printf "${Blue}Script completed \o/! ${Color_Off}\n" printwc "${Blue}" "Script completed \o/!\n"

View File

@ -1,10 +1,24 @@
#!/bin/bash #!/bin/bash
# Jitsi Meet brandless mode # Jitsi Meet brandless mode
# for Debian/*buntu binaries. # for Debian/*buntu binaries.
# SwITNet Ltd © - 2021, https://switnet.net/ # SwITNet Ltd © - 2022, https://switnet.net/
# GNU GPLv3 or later. # GNU GPLv3 or later.
DOMAIN="$(ls /etc/prosody/conf.d/ | awk -F'.cfg' '!/localhost/{print $1}' | awk '!NF || !seen[$0]++')" while getopts m: option
do
case "${option}"
in
m) MODE=${OPTARG};;
\?) echo "Usage: sudo bash ./$0 [-m debug]" && exit;;
esac
done
#DEBUG
if [ "$MODE" = "debug" ]; then
set -x
fi
DOMAIN="$(find /etc/prosody/conf.d/ -name \*.lua|awk -F'.cfg' '!/localhost/{print $1}'|xargs basename)"
CSS_FILE="/usr/share/jitsi-meet/css/all.css" CSS_FILE="/usr/share/jitsi-meet/css/all.css"
TITLE_FILE="/usr/share/jitsi-meet/title.html" TITLE_FILE="/usr/share/jitsi-meet/title.html"
INT_CONF="/usr/share/jitsi-meet/interface_config.js" INT_CONF="/usr/share/jitsi-meet/interface_config.js"
@ -21,7 +35,7 @@ MOVILE_APP_NAME="Jitsi Meet"
PART_USER="Participant" PART_USER="Participant"
LOCAL_USER="me" LOCAL_USER="me"
# #
SEC_ROOM="TBD" #SEC_ROOM="TBD"
echo ' echo '
#-------------------------------------------------- #--------------------------------------------------
# Applying Brandless mode # Applying Brandless mode
@ -43,7 +57,7 @@ fi
if [ ! -f "$REC_ICON_PATH" ];then if [ ! -f "$REC_ICON_PATH" ];then
cp images/gnome_record.png "$REC_ICON_PATH" cp images/gnome_record.png "$REC_ICON_PATH"
else else
echo "recording icon exists, skipping copying..." echo "recording icon exists, skipping copying..."
fi fi
#Custom / Remove icons #Custom / Remove icons
@ -53,8 +67,8 @@ sed -i "s|jitsilogo.png|watermark2.png|g" "$TITLE_FILE"
sed -i "s|logo-deep-linking.png|watermark2.png|g" "$BUNDLE_JS" sed -i "s|logo-deep-linking.png|watermark2.png|g" "$BUNDLE_JS"
sed -i "s|jitsiLogo_square.png|gnome_record.png|g" "$BUNDLE_JS" sed -i "s|jitsiLogo_square.png|gnome_record.png|g" "$BUNDLE_JS"
#Disable logo and url #Disable logo and url
if [ -z "$(grep -nr ".leftwatermark{display:none" "$CSS_FILE")" ]; then if ! grep -nr ".leftwatermark{display:none" "$CSS_FILE" ; then
sed -i "s|.leftwatermark{|.leftwatermark{display:none;|" "$CSS_FILE" sed -i "s|.leftwatermark{|.leftwatermark{display:none;|" "$CSS_FILE"
fi fi
#Customize room title #Customize room title

View File

@ -1,14 +1,15 @@
#!/bin/bash #!/bin/bash
# JRA (Jibri Recordings Access) via Nextcloud # JRA (Jibri Recordings Access) via Nextcloud
# SwITNet Ltd © - 2021, https://switnet.net/ # SwITNet Ltd © - 2022, https://switnet.net/
# GPLv3 or later. # GPLv3 or later.
while getopts m: option while getopts m: option
do do
case "${option}" case "${option}"
in in
m) MODE=${OPTARG};; m) MODE=${OPTARG};;
\?) echo "Usage: sudo ./jra_nextcloud.sh [-m debug]" && exit;; \?) echo "Usage: sudo bash ./$0 [-m debug]" && exit;;
esac esac
done done
#DEBUG #DEBUG
@ -16,12 +17,12 @@ if [ "$MODE" = "debug" ]; then
set -x set -x
fi fi
if ! [ $(id -u) = 0 ]; then if ! [ "$(id -u)" = 0 ]; then
echo "You need to be root or have sudo privileges!" echo "You need to be root or have sudo privileges!"
exit 0 exit 0
fi fi
exit_if_not_installed() { exit_if_not_installed() {
if [ "$(dpkg-query -W -f='${Status}' $1 2>/dev/null | grep -c "ok installed")" != "1" ]; then if [ "$(dpkg-query -W -f='${Status}' "$1" 2>/dev/null | grep -c "ok installed")" != "1" ]; then
echo " This instance doesn't have $1 installed, exiting..." echo " This instance doesn't have $1 installed, exiting..."
echo " If you think this is an error, please report to: echo " If you think this is an error, please report to:
-> https://github.com/switnet-ltd/quick-jibri-installer/issues " -> https://github.com/switnet-ltd/quick-jibri-installer/issues "
@ -38,14 +39,14 @@ echo -e '\n
exit_if_not_installed jitsi-meet exit_if_not_installed jitsi-meet
DISTRO_RELEASE="$(lsb_release -sc)" DISTRO_RELEASE="$(lsb_release -sc)"
DOMAIN="$(ls /etc/prosody/conf.d/ | awk -F'.cfg' '!/localhost/{print $1}' | awk '!NF || !seen[$0]++')" DOMAIN="$(find /etc/prosody/conf.d/ -name \*.lua|awk -F'.cfg' '!/localhost/{print $1}'|xargs basename)"
PHP_REPO="$(apt-cache policy | awk '/http/&&/php/{print$2}' | awk -F "/" 'NR==1{print$5}')" PHP_REPO="$(apt-cache policy | awk '/http/&&/php/{print$2}' | awk -F "/" 'NR==1{print$5}')"
PHPVER="7.4" PHPVER="7.4"
PSGVER="$(apt-cache madison postgresql|awk -F'[ +]' 'NR==1{print $3}')" PSGVER="$(apt-cache madison postgresql|awk -F'[ +]' 'NR==1{print $3}')"
PHP_FPM_DIR="/etc/php/$PHPVER/fpm" PHP_FPM_DIR="/etc/php/$PHPVER/fpm"
PHP_INI="$PHP_FPM_DIR/php.ini" PHP_INI="$PHP_FPM_DIR/php.ini"
PHP_CONF="/etc/php/$PHPVER/fpm/pool.d/www.conf" PHP_CONF="/etc/php/$PHPVER/fpm/pool.d/www.conf"
NC_NGINX_SSL_PORT="$(grep "listen 44" /etc/nginx/sites-available/$DOMAIN.conf | awk '{print$2}')" NC_NGINX_SSL_PORT="$(grep "listen 44" /etc/nginx/sites-available/"$DOMAIN".conf | awk '{print$2}')"
NC_REPO="https://download.nextcloud.com/server/releases" NC_REPO="https://download.nextcloud.com/server/releases"
NCVERSION="$(curl -s -m 900 $NC_REPO/ | sed --silent 's/.*href="nextcloud-\([^"]\+\).zip.asc".*/\1/p' | sort --version-sort | tail -1)" NCVERSION="$(curl -s -m 900 $NC_REPO/ | sed --silent 's/.*href="nextcloud-\([^"]\+\).zip.asc".*/\1/p' | sort --version-sort | tail -1)"
STABLEVERSION="nextcloud-$NCVERSION" STABLEVERSION="nextcloud-$NCVERSION"
@ -54,7 +55,7 @@ NC_CONFIG="$NC_PATH/config/config.php"
NC_DB_USER="nextcloud_user" NC_DB_USER="nextcloud_user"
NC_DB="nextcloud_db" NC_DB="nextcloud_db"
NC_DB_PASSWD="$(tr -dc "a-zA-Z0-9#_*=" < /dev/urandom | fold -w 14 | head -n1)" NC_DB_PASSWD="$(tr -dc "a-zA-Z0-9#_*=" < /dev/urandom | fold -w 14 | head -n1)"
DIR_RECORD="$(grep -nr RECORDING /home/jibri/finalize_recording.sh|head -n1|cut -d "=" -f2)" DIR_RECORD="$(awk -F '"' '/RECORDING/{print$2}' /home/jibri/finalize_recording.sh|awk 'NR==1{print$1}')"
REDIS_CONF="/etc/redis/redis.conf" REDIS_CONF="/etc/redis/redis.conf"
JITSI_MEET_PROXY="/etc/nginx/modules-enabled/60-jitsi-meet.conf" JITSI_MEET_PROXY="/etc/nginx/modules-enabled/60-jitsi-meet.conf"
if [ -f $JITSI_MEET_PROXY ];then if [ -f $JITSI_MEET_PROXY ];then
@ -62,30 +63,30 @@ PREAD_PROXY=$(grep -nr "preread_server_name" $JITSI_MEET_PROXY | cut -d ":" -f1)
fi fi
PUBLIC_IP="$(dig +short myip.opendns.com @resolver1.opendns.com)" PUBLIC_IP="$(dig +short myip.opendns.com @resolver1.opendns.com)"
ISO3166_CODE=TBD ISO3166_CODE=TBD
NL="$(printf '\n ')"
while [[ "$ANS_NCD" != "yes" ]] while [[ "$ANS_NCD" != "yes" ]]
do do
read -p "> Please set your domain (or subdomain) here for Nextcloud: (e.g.: cloud.domain.com)"$'\n' -r NC_DOMAIN read -p "> Please set your domain (or subdomain) here for Nextcloud: (e.g.: cloud.domain.com)$NL" -r NC_DOMAIN
if [ -z "$NC_DOMAIN" ];then if [ -z "$NC_DOMAIN" ];then
echo "-- This field is mandatory." echo " - This field is mandatory."
elif [ "$NC_DOMAIN" = "$DOMAIN" ]; then elif [ "$NC_DOMAIN" = "$DOMAIN" ]; then
echo "-- You can not use the same domain for both, Jitsi Meet and JRA via Nextcloud." echo " - You can not use the same domain for both, Jitsi Meet and JRA via Nextcloud."
fi fi
read -p "> Did you mean?: $NC_DOMAIN (yes or no)"$'\n' -r ANS_NCD read -p " > Did you mean?: $NC_DOMAIN (yes or no)$NL" -r ANS_NCD
if [ "$ANS_NCD" = "yes" ]; then if [ "$ANS_NCD" = "yes" ]; then
echo "Alright, let's use $NC_DOMAIN." echo " - Alright, let's use $NC_DOMAIN."
else else
echo "Please try again." echo " - Please try again."
fi fi
done done
#Simple DNS test #Simple DNS test
if [ "$PUBLIC_IP" = "$(dig -4 +short $NC_DOMAIN|awk -v RS='([0-9]+\\.){3}[0-9]+' 'RT{print RT}')" ]; then if [ "$PUBLIC_IP" = "$(dig -4 +short "$NC_DOMAIN"|awk -v RS='([0-9]+\\.){3}[0-9]+' 'RT{print RT}')" ]; then
echo "Server public IP & DNS record for $NC_DOMAIN seems to match, continuing... echo -e "Server public IP & DNS record for $NC_DOMAIN seems to match, continuing...\n\n"
"
else else
echo "Server public IP ($PUBLIC_IP) & DNS record for $NC_DOMAIN don't seem to match." echo "Server public IP ($PUBLIC_IP) & DNS record for $NC_DOMAIN don't seem to match."
echo " > Please check your dns records are applied and updated, otherwise Nextcloud may fail." echo " > Please check your dns records are applied and updated, otherwise Nextcloud may fail."
read -p " > Do you want to continue?: (yes or no)"$'\n' -r DNS_CONTINUE read -p " > Do you want to continue?: (yes or no)$NL" -r DNS_CONTINUE
if [ "$DNS_CONTINUE" = "yes" ]; then if [ "$DNS_CONTINUE" = "yes" ]; then
echo " - We'll continue anyway..." echo " - We'll continue anyway..."
else else
@ -95,49 +96,51 @@ else
fi fi
NC_NGINX_CONF="/etc/nginx/sites-available/$NC_DOMAIN.conf" NC_NGINX_CONF="/etc/nginx/sites-available/$NC_DOMAIN.conf"
while [[ -z "$NC_USER" ]] while [ -z "$NC_USER" ]
do do
read -p "Nextcloud user: " -r NC_USER read -p "Nextcloud user: " -r NC_USER
if [ -z "$NC_USER" ]; then if [ -z "$NC_USER" ]; then
echo "-- This field is mandatory." echo " - This field is mandatory."
fi fi
done done
while [ -z "$NC_PASS" ] || [ ${#NC_PASS} -lt 6 ] while [ -z "$NC_PASS" ] || [ ${#NC_PASS} -lt 6 ]
do do
read -p "Nextcloud user password: " -r NC_PASS read -p "Nextcloud user password: " -r NC_PASS
if [ -z "$NC_PASS" ] || [ ${#NC_PASS} -lt 6 ]; then if [ -z "$NC_PASS" ] || [ ${#NC_PASS} -lt 6 ]; then
echo -e "-- This field is mandatory. \nPlease make sure it's at least 6 characters.\n" echo -e " - This field is mandatory. \nPlease make sure it's at least 6 characters.\n"
fi fi
done done
#Enable HSTS #Enable HSTS
while [[ "$ENABLE_HSTS" != "yes" && "$ENABLE_HSTS" != "no" ]] while [ "$ENABLE_HSTS" != "yes" ] && [ "$ENABLE_HSTS" != "no" ]
do do
read -p "> Do you want to enable HSTS for this domain?: (yes or no) read -p "> Do you want to enable HSTS for this domain?: (yes or no)
Be aware this option apply mid-term effects on the domain, choose \"no\" Be aware this option apply mid-term effects on the domain, choose \"no\"
in case you don't know what you are doing. More at https://hstspreload.org/"$'\n' -r ENABLE_HSTS in case you don't know what you are doing. More at https://hstspreload.org/$NL" -r ENABLE_HSTS
if [ "$ENABLE_HSTS" = "no" ]; then if [ "$ENABLE_HSTS" = "no" ]; then
echo "-- HSTS won't be enabled." echo " - HSTS won't be enabled."
elif [ "$ENABLE_HSTS" = "yes" ]; then elif [ "$ENABLE_HSTS" = "yes" ]; then
echo "-- HSTS will be enabled." echo " - HSTS will be enabled."
fi fi
done done
echo -e "#Default country phone code\n echo -e "#Default country phone code\n
> Starting at Nextcloud 21.x it's required to set a default country phone ISO 3166-1 alpha-2 code.\n > Starting at Nextcloud 21.x it's required to set a default country phone ISO 3166-1 alpha-2 code.\n
>>> https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements <<<\n" >>> https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements <<<\n"
sleep .1
while [ ${#ISO3166_CODE} -gt 2 ]; while [ ${#ISO3166_CODE} -gt 2 ];
do do
echo -e "Some examples might be: Germany > DE | Mexico > MX | Spain > ES | USA > US\n echo -e "Some examples might be: Germany > DE | Mexico > MX | Spain > ES | USA > US\n
Do you want to set such code for your installation?" && \ Do you want to set such code for your installation?"
read -p "Leave empty if you don't want to set any: "$'\n' ISO3166_CODE sleep .1
read -p "Leave empty if you don't want to set any: " -r ISO3166_CODE
if [ ${#ISO3166_CODE} -gt 2 ]; then if [ ${#ISO3166_CODE} -gt 2 ]; then
echo -e "\n-- This code is only 2 characters long, please check your input.\n" echo -e "\n-- This code is only 2 characters long, please check your input.\n"
fi fi
done done
sleep .1
echo -e "\n# Check for jitsi-meet/jibri\n" echo -e "\n# Check for jitsi-meet/jibri\n"
if [ "$(dpkg-query -W -f='${Status}' jibri 2>/dev/null | grep -c "ok installed")" == "1" ] || \ if [ "$(dpkg-query -W -f='${Status}' jibri 2>/dev/null | grep -c "ok installed")" == "1" ] || \
[ -f /etc/prosody/conf.d/$DOMAIN.conf ]; then [ -f /etc/prosody/conf.d/"$DOMAIN".conf ]; then
echo "jitsi meet/jibri is installed, checking version:" echo "jitsi meet/jibri is installed, checking version:"
apt-show-versions jibri apt-show-versions jibri
else else
@ -146,7 +149,7 @@ else
fi fi
exit_ifinstalled() { exit_ifinstalled() {
if [ "$(dpkg-query -W -f='${Status}' $1 2>/dev/null | grep -c "ok installed")" == "1" ]; then if [ "$(dpkg-query -W -f='${Status}' "$1" 2>/dev/null | grep -c "ok installed")" == "1" ]; then
echo " This instance already has $1 installed, exiting..." echo " This instance already has $1 installed, exiting..."
echo " If you think this is an error, please report to: echo " If you think this is an error, please report to:
-> https://github.com/switnet-ltd/quick-jibri-installer/issues " -> https://github.com/switnet-ltd/quick-jibri-installer/issues "
@ -154,11 +157,11 @@ if [ "$(dpkg-query -W -f='${Status}' $1 2>/dev/null | grep -c "ok installed")" =
fi fi
} }
install_ifnot() { install_ifnot() {
if [ "$(dpkg-query -W -f='${Status}' $1 2>/dev/null | grep -c "ok installed")" == "1" ]; then if [ "$(dpkg-query -W -f='${Status}' "$1" 2>/dev/null | grep -c "ok installed")" == "1" ]; then
echo " $1 is installed, skipping..." echo " $1 is installed, skipping..."
else else
echo -e "\n---- Installing $1 ----" echo -e "\n---- Installing $1 ----"
apt-get -yq2 install $1 apt-get -yq2 install "$1"
fi fi
} }
add_php74() { add_php74() {
@ -174,46 +177,46 @@ else
fi fi
} }
#Prevent root folder permission issues #Prevent root folder permission issues
cp $PWD/files/jra-nc-app-ef.json /tmp cp "$PWD"/files/jra-nc-app-ef.json /tmp
exit_ifinstalled postgresql-$PSGVER exit_ifinstalled postgresql-"$PSGVER"
## Install software requirements ## Install software requirements
# PostgresSQL # PostgresSQL
install_ifnot postgresql-$PSGVER install_ifnot postgresql-"$PSGVER"
# PHP 7.4 # PHP 7.4
add_php74 add_php74
apt-get install -y \ apt-get install -y \
imagemagick \ imagemagick \
php$PHPVER-fpm \ php"$PHPVER"-fpm \
php$PHPVER-bcmath \ php"$PHPVER"-bcmath \
php$PHPVER-bz2 \ php"$PHPVER"-bz2 \
php$PHPVER-curl \ php"$PHPVER"-curl \
php$PHPVER-gd \ php"$PHPVER"-gd \
php$PHPVER-gmp \ php"$PHPVER"-gmp \
php$PHPVER-imagick \ php"$PHPVER"-imagick \
php$PHPVER-intl \ php"$PHPVER"-intl \
php$PHPVER-json \ php"$PHPVER"-json \
php$PHPVER-ldap \ php"$PHPVER"-ldap \
php$PHPVER-mbstring \ php"$PHPVER"-mbstring \
php$PHPVER-pgsql \ php"$PHPVER"-pgsql \
php$PHPVER-redis \ php"$PHPVER"-redis \
php$PHPVER-soap \ php"$PHPVER"-soap \
php$PHPVER-xml \ php"$PHPVER"-xml \
php$PHPVER-xmlrpc \ php"$PHPVER"-xmlrpc \
php$PHPVER-zip \ php"$PHPVER"-zip \
redis-server \ redis-server \
unzip unzip
#System related #System related
install_ifnot smbclient install_ifnot smbclient
sed -i "s|.*env\[HOSTNAME\].*|env\[HOSTNAME\] = \$HOSTNAME|" $PHP_CONF sed -i "s|.*env\[HOSTNAME\].*|env\[HOSTNAME\] = \$HOSTNAME|" "$PHP_CONF"
sed -i "s|.*env\[PATH\].*|env\[PATH\] = /usr/local/bin:/usr/bin:/bin|" $PHP_CONF sed -i "s|.*env\[PATH\].*|env\[PATH\] = /usr/local/bin:/usr/bin:/bin|" "$PHP_CONF"
sed -i "s|.*env\[TMP\].*|env\[TMP\] = /tmp|" $PHP_CONF sed -i "s|.*env\[TMP\].*|env\[TMP\] = /tmp|" "$PHP_CONF"
sed -i "s|.*env\[TMPDIR\].*|env\[TMPDIR\] = /tmp|" $PHP_CONF sed -i "s|.*env\[TMPDIR\].*|env\[TMPDIR\] = /tmp|" "$PHP_CONF"
sed -i "s|.*env\[TEMP\].*|env\[TEMP\] = /tmp|" $PHP_CONF sed -i "s|.*env\[TEMP\].*|env\[TEMP\] = /tmp|" "$PHP_CONF"
sed -i "s|;clear_env = no|clear_env = no|" $PHP_CONF sed -i "s|;clear_env = no|clear_env = no|" "$PHP_CONF"
echo " echo "
Tunning PHP.ini... Tunning PHP.ini...
@ -244,14 +247,14 @@ echo "opcache.revalidate_freq=1"
echo "opcache.validate_timestamps=1" echo "opcache.validate_timestamps=1"
} >> "$PHP_INI" } >> "$PHP_INI"
systemctl restart php$PHPVER-fpm.service systemctl restart php"$PHPVER"-fpm.service
#-------------------------------------------------- #--------------------------------------------------
# Create DB user # Create DB user
#-------------------------------------------------- #--------------------------------------------------
echo -e "\n---- Creating the PgSQL DB & User ----" echo -e "\n---- Creating the PgSQL DB & User ----"
cd /tmp cd /tmp || return
sudo -u postgres psql <<DB sudo -u postgres psql <<DB
CREATE DATABASE nextcloud_db; CREATE DATABASE nextcloud_db;
CREATE USER ${NC_DB_USER} WITH ENCRYPTED PASSWORD '${NC_DB_PASSWD}'; CREATE USER ${NC_DB_USER} WITH ENCRYPTED PASSWORD '${NC_DB_PASSWD}';
@ -261,7 +264,7 @@ echo "Done!
" "
#nginx - configuration #nginx - configuration
cat << NC_NGINX > $NC_NGINX_CONF cat << NC_NGINX > "$NC_NGINX_CONF"
#nextcloud config #nextcloud config
upstream php-handler { upstream php-handler {
#server 127.0.0.1:9000; #server 127.0.0.1:9000;
@ -417,9 +420,9 @@ server {
} }
NC_NGINX NC_NGINX
systemctl stop nginx systemctl stop nginx
letsencrypt certonly --standalone --renew-by-default --agree-tos -d $NC_DOMAIN letsencrypt certonly --standalone --renew-by-default --agree-tos -d "$NC_DOMAIN"
if [ -f /etc/letsencrypt/live/$NC_DOMAIN/fullchain.pem ];then if [ -f /etc/letsencrypt/live/"$NC_DOMAIN"/fullchain.pem ];then
ln -s $NC_NGINX_CONF /etc/nginx/sites-available/ ln -s "$NC_NGINX_CONF" /etc/nginx/sites-enabled/
else else
echo "There are issues on getting the SSL certs..." echo "There are issues on getting the SSL certs..."
read -n 1 -s -r -p "Press any key to continue" read -n 1 -s -r -p "Press any key to continue"
@ -428,34 +431,30 @@ nginx -t
systemctl restart nginx systemctl restart nginx
if [ "$ENABLE_HSTS" = "yes" ]; then if [ "$ENABLE_HSTS" = "yes" ]; then
sed -i "s|#add_header Strict-Transport-Security|add_header Strict-Transport-Security|g" $NC_NGINX_CONF sed -i "s|#add_header Strict-Transport-Security|add_header Strict-Transport-Security|g" "$NC_NGINX_CONF"
fi fi
if [ ! -z "$PREAD_PROXY" ]; then if [ -n "$PREAD_PROXY" ]; then
echo " echo "
Setting up Nextcloud domain on Jitsi Meet turn proxy Setting up Nextcloud domain on Jitsi Meet turn proxy
" "
sed -i "/server {/i \ \ map \$ssl_preread_server_name \$upstream {" $JITSI_MEET_PROXY sed -i "/server {/i \ \ map \$ssl_preread_server_name \$upstream {" "$JITSI_MEET_PROXY"
sed -i "/server {/i \ \ \ \ \ \ $DOMAIN web;" $JITSI_MEET_PROXY sed -i "/server {/i \ \ \ \ \ \ $DOMAIN web;" "$JITSI_MEET_PROXY"
sed -i "/server {/i \ \ \ \ \ \ $NC_DOMAIN web;" $JITSI_MEET_PROXY sed -i "/server {/i \ \ \ \ \ \ $NC_DOMAIN web;" "$JITSI_MEET_PROXY"
sed -i "/server {/i \ \ }" $JITSI_MEET_PROXY sed -i "/server {/i \ \ }" "$JITSI_MEET_PROXY"
fi fi
echo " echo -e "\n Latest version to be installed: $STABLEVERSION
Latest version to be installed: $STABLEVERSION (This might take sometime, please be patient...)\n"
(This might take sometime, please be patient...) curl -s "$NC_REPO"/"$STABLEVERSION".zip > /tmp/"$STABLEVERSION".zip
" unzip -q /tmp/"$STABLEVERSION".zip
curl -s $NC_REPO/$STABLEVERSION.zip > /tmp/$STABLEVERSION.zip mv nextcloud "$NC_PATH"
unzip -q /tmp/$STABLEVERSION.zip
mv nextcloud $NC_PATH
chown -R www-data:www-data $NC_PATH chown -R www-data:www-data "$NC_PATH"
chmod -R 755 $NC_PATH chmod -R 755 "$NC_PATH"
echo " echo -e "\nDatabase installation...\n"
Database installation... sudo -u www-data php "$NC_PATH"/occ maintenance:install \
"
sudo -u www-data php $NC_PATH/occ maintenance:install \
--database=pgsql \ --database=pgsql \
--database-name="$NC_DB" \ --database-name="$NC_DB" \
--database-user="$NC_DB_USER" \ --database-user="$NC_DB_USER" \
@ -463,68 +462,58 @@ sudo -u www-data php $NC_PATH/occ maintenance:install \
--admin-user="$NC_USER" \ --admin-user="$NC_USER" \
--admin-pass="$NC_PASS" --admin-pass="$NC_PASS"
echo " echo -e "\nApply custom mods...\n"
Apply custom mods... sed -i "/datadirectory/a \ \ \'skeletondirectory\' => \'\'," "$NC_CONFIG"
" sed -i "/skeletondirectory/a \ \ \'simpleSignUpLink.shown\' => false," "$NC_CONFIG"
sed -i "/datadirectory/a \ \ \'skeletondirectory\' => \'\'," $NC_CONFIG sed -i "/simpleSignUpLink.shown/a \ \ \'knowledgebaseenabled\' => false," "$NC_CONFIG"
sed -i "/skeletondirectory/a \ \ \'simpleSignUpLink.shown\' => false," $NC_CONFIG sed -i "s|http://localhost|http://$NC_DOMAIN|" "$NC_CONFIG"
sed -i "/simpleSignUpLink.shown/a \ \ \'knowledgebaseenabled\' => false," $NC_CONFIG
sed -i "s|http://localhost|http://$NC_DOMAIN|" $NC_CONFIG
echo "Add crontab..." echo -e "\nAdd crontab...\n"
crontab -u www-data -l | { cat; echo "*/5 * * * * php -f $NC_PATH/cron.php"; } | crontab -u www-data - crontab -u www-data -l | { cat; echo "*/5 * * * * php -f $NC_PATH/cron.php"; } | crontab -u www-data -
echo " echo -e "\nAdd memcache support...\n"
Add memcache support... sed -i "s|# unixsocket .*|unixsocket /var/run/redis/redis.sock|g" "$REDIS_CONF"
" sed -i "s|# unixsocketperm .*|unixsocketperm 777|g" "$REDIS_CONF"
sed -i "s|# unixsocket .*|unixsocket /var/run/redis/redis.sock|g" $REDIS_CONF sed -i "s|port 6379|port 0|" "$REDIS_CONF"
sed -i "s|# unixsocketperm .*|unixsocketperm 777|g" $REDIS_CONF
sed -i "s|port 6379|port 0|" $REDIS_CONF
systemctl restart redis-server systemctl restart redis-server
echo "--> Setting config.php..." echo -e "\n--> Setting config.php...\n"
if [ ! -z "$ISO3166_CODE" ]; then if [ -n "$ISO3166_CODE" ]; then
sed -i "/);/i \ \ 'default_phone_region' => '$ISO3166_CODE'," $NC_CONFIG sed -i "/);/i \ \ 'default_phone_region' => '$ISO3166_CODE'," "$NC_CONFIG"
fi fi
sed -i "/);/i \ \ 'filelocking.enabled' => 'true'," $NC_CONFIG sed -i "/);/i \ \ 'filelocking.enabled' => 'true'," "$NC_CONFIG"
sed -i "/);/i \ \ 'memcache.locking' => '\\\OC\\\Memcache\\\Redis'," $NC_CONFIG sed -i "/);/i \ \ 'memcache.locking' => '\\\OC\\\Memcache\\\Redis'," "$NC_CONFIG"
sed -i "/);/i \ \ 'memcache.local' => '\\\OC\\\Memcache\\\Redis'," $NC_CONFIG sed -i "/);/i \ \ 'memcache.local' => '\\\OC\\\Memcache\\\Redis'," "$NC_CONFIG"
sed -i "/);/i \ \ 'memcache.local' => '\\\OC\\\Memcache\\\Redis'," $NC_CONFIG sed -i "/);/i \ \ 'memcache.local' => '\\\OC\\\Memcache\\\Redis'," "$NC_CONFIG"
sed -i "/);/i \ \ 'memcache.distributed' => '\\\OC\\\Memcache\\\Redis'," $NC_CONFIG sed -i "/);/i \ \ 'memcache.distributed' => '\\\OC\\\Memcache\\\Redis'," "$NC_CONFIG"
sed -i "/);/i \ \ 'redis' =>" $NC_CONFIG sed -i "/);/i \ \ 'redis' =>" "$NC_CONFIG"
sed -i "/);/i \ \ \ \ array (" $NC_CONFIG sed -i "/);/i \ \ \ \ array (" "$NC_CONFIG"
sed -i "/);/i \ \ \ \ \ 'host' => '/var/run/redis/redis.sock'," $NC_CONFIG sed -i "/);/i \ \ \ \ \ 'host' => '/var/run/redis/redis.sock'," "$NC_CONFIG"
sed -i "/);/i \ \ \ \ \ 'port' => 0," $NC_CONFIG sed -i "/);/i \ \ \ \ \ 'port' => 0," "$NC_CONFIG"
sed -i "/);/i \ \ \ \ \ 'timeout' => 0," $NC_CONFIG sed -i "/);/i \ \ \ \ \ 'timeout' => 0," "$NC_CONFIG"
sed -i "/);/i \ \ )," $NC_CONFIG sed -i "/);/i \ \ )," "$NC_CONFIG"
echo "Done echo -e "Done\n"
"
echo " echo -e "\nAddding & Setting up Files External App for Local storage...\n"
Addding & Setting up Files External App for Local storage... sudo -u www-data php "$NC_PATH"/occ app:install files_external
" sudo -u www-data php "$NC_PATH"/occ app:enable files_external
sudo -u www-data php $NC_PATH/occ app:install files_external sudo -u www-data php "$NC_PATH"/occ app:disable support
sudo -u www-data php $NC_PATH/occ app:enable files_external sudo -u www-data php "$NC_PATH"/occ files_external:import /tmp/jra-nc-app-ef.json
sudo -u www-data php $NC_PATH/occ app:disable support
sudo -u www-data php $NC_PATH/occ files_external:import /tmp/jra-nc-app-ef.json
usermod -a -G jibri www-data usermod -a -G jibri www-data
chmod -R 770 $DIR_RECORD chmod -R 770 "$DIR_RECORD"
chmod -R g+s $DIR_RECORD chmod -R g+s "$DIR_RECORD"
echo " echo -e "\nFixing possible missing tables...\n\n"
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
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-columns
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 " echo -e "\nAdding trusted domain...\n"
Adding trusted domain... sudo -u www-data php "$NC_PATH"/occ config:system:set trusted_domains 0 --value="$NC_DOMAIN"
"
sudo -u www-data php $NC_PATH/occ config:system:set trusted_domains 0 --value=$NC_DOMAIN
echo "Setting JRA domain on jitsi-updater.sh" echo -e "\nSetting JRA domain on jitsi-updater.sh\n"
cd ~/quick-jibri-installer cd ~/quick-jibri-installer || return
sed -i "s|NC_DOMAIN=.*|NC_DOMAIN=\"$NC_DOMAIN\"|" jitsi-updater.sh sed -i "s|NC_DOMAIN=.*|NC_DOMAIN=\"$NC_DOMAIN\"|" jitsi-updater.sh
echo "Quick Nextcloud installation complete!" echo -e "\nQuick Nextcloud installation complete!\n"

View File

@ -1,20 +1,14 @@
#!/bin/bash #!/bin/bash
# Custom High Performance Jitsi conf # Custom High Performance Jitsi conf
# SwITNet Ltd © - 2021, https://switnet.net/ # SwITNet Ltd © - 2022, https://switnet.net/
# GPLv3 or later. # GPLv3 or later.
#Check if user is root
if ! [ $(id -u) = 0 ]; then
echo "You need to be root or have privileges!"
exit 0
fi
while getopts m: option while getopts m: option
do do
case "${option}" case "${option}"
in in
m) MODE=${OPTARG};; m) MODE=${OPTARG};;
\?) echo "Usage: sudo ./chp-mode.sh [-m debug]" && exit;; \?) echo "Usage: sudo bash ./$0 [-m debug]" && exit;;
esac esac
done done
@ -23,6 +17,12 @@ if [ "$MODE" = "debug" ]; then
set -x set -x
fi fi
#Check if user is root
if ! [ "$(id -u)" = 0 ]; then
echo "You need to be root or have privileges!"
exit 0
fi
wait_seconds() { wait_seconds() {
secs=$(($1)) secs=$(($1))
while [ $secs -gt 0 ]; do while [ $secs -gt 0 ]; do
@ -32,11 +32,11 @@ while [ $secs -gt 0 ]; do
done done
} }
set_once() { set_once() {
if [ -z "$(awk '!/^ *#/ && NF {print}' "$2"|grep $(echo $1|awk -F '=' '{print$1}'))" ]; then if ! grep -q "$(awk '!/^ *#/ && NF {print}' "$2"|grep "$(awk -F '=' '{print$1}' <<< "$1")")" ; then
echo "Setting "$1" on "$2"..." echo "Setting $1 on $2..."
echo "$1" | tee -a "$2" echo "$1" | tee -a "$2"
else else
echo " \"$(echo $1|awk -F '=' '{print$1}')\" seems present, skipping setting this variable" echo " \"$(echo "$1"|awk -F '=' '{print$1}')\" seems present, skipping setting this variable"
fi fi
} }
# True if $1 is greater than $2 # True if $1 is greater than $2
@ -44,7 +44,7 @@ version_gt() { test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1"; }
LTS_REL="$(lsb_release -d | awk '{print$4}')" LTS_REL="$(lsb_release -d | awk '{print$4}')"
DOMAIN="$(ls /etc/prosody/conf.d/ | awk -F'.cfg' '!/localhost/{print $1}' | awk '!NF || !seen[$0]++')" DOMAIN="$(find /etc/prosody/conf.d/ -name \*.lua|awk -F'.cfg' '!/localhost/{print $1}'|xargs basename)"
JVB_LOG_POP="/etc/jitsi/videobridge/logging.properties" JVB_LOG_POP="/etc/jitsi/videobridge/logging.properties"
JVB_RC="/usr/share/jitsi-videobridge/lib/videobridge.rc" JVB_RC="/usr/share/jitsi-videobridge/lib/videobridge.rc"
JICOFO_LOG_POP="/etc/jitsi/videobridge/logging.properties" JICOFO_LOG_POP="/etc/jitsi/videobridge/logging.properties"
@ -54,17 +54,16 @@ MEET_CONF_HP="/etc/jitsi/meet/${DOMAIN}-chp-config.js"
INT_CONF_JS="/etc/jitsi/meet/${DOMAIN}-interface_config.js" INT_CONF_JS="/etc/jitsi/meet/${DOMAIN}-interface_config.js"
INT_CONF_JS_HP="/etc/jitsi/meet/${DOMAIN}-chp-interface_config.js" INT_CONF_JS_HP="/etc/jitsi/meet/${DOMAIN}-chp-interface_config.js"
WS_CONF="/etc/nginx/sites-available/$DOMAIN.conf" WS_CONF="/etc/nginx/sites-available/$DOMAIN.conf"
FSTAB="/etc/fstab"
CHAT_DISABLED="TBD" CHAT_DISABLED="TBD"
if [ -f $MEET_CONF_HP ] || [ -f $INT_CONF_JS_HP ]; then if [ -f "$MEET_CONF_HP" ] || [ -f "$INT_CONF_JS_HP" ]; then
echo " echo "
This script can't be run multiple times on the same system, This script can't be run multiple times on the same system,
idempotence not guaranteed, exiting..." idempotence not guaranteed, exiting..."
exit exit
fi fi
if [ -z $LTS_REL ] || [ -z $DOMAIN ];then if [ -z "$LTS_REL" ] || [ -z "$DOMAIN" ];then
echo "This system isn't suitable to configure." echo "This system isn't suitable to configure."
exit exit
else else
@ -122,7 +121,7 @@ PS3='Select the desired resolution for high performance mode: '
options=("nHD - 640x360" "qHD - 960x540" "HD - 1280x720") options=("nHD - 640x360" "qHD - 960x540" "HD - 1280x720")
select opt in "${options[@]}" select opt in "${options[@]}"
do do
case $opt in case "$opt" in
"nHD - 640x360") "nHD - 640x360")
echo -e "\n > Setting 640x360 resolution.\n" echo -e "\n > Setting 640x360 resolution.\n"
VID_RES="360" VID_RES="360"
@ -152,7 +151,7 @@ while [[ "$CHAT_DISABLED" != "yes" && \
"$CHAT_DISABLED" != "" ]] "$CHAT_DISABLED" != "" ]]
do do
echo "> Do you want to disable jitsi's built-in chat?: (yes or no)" echo "> Do you want to disable jitsi's built-in chat?: (yes or no)"
read -p "(Also you can leave empty to disable)"$'\n' CHAT_DISABLED read -p "(Also you can leave empty to disable)"$'\n' -r CHAT_DISABLED
if [ "$CHAT_DISABLED" = "no" ]; then if [ "$CHAT_DISABLED" = "no" ]; then
echo -e "-- Jitsi's built-in chat will be kept active.\n" echo -e "-- Jitsi's built-in chat will be kept active.\n"
elif [ "$CHAT_DISABLED" = "yes" ] || [ -z "$CHAT_DISABLED" ]; then elif [ "$CHAT_DISABLED" = "yes" ] || [ -z "$CHAT_DISABLED" ]; then
@ -162,149 +161,149 @@ done
## JMS system tune up ## JMS system tune up
if [ "$MODE" = "debug" ]; then if [ "$MODE" = "debug" ]; then
bash $PWD/jms-stu.sh -m debug bash "$PWD"/jms-stu.sh -m debug
else else
bash $PWD/jms-stu.sh bash "$PWD"/jms-stu.sh
fi fi
#JVB2 #JVB2
##Loose up logging ##Loose up logging
# https://community.jitsi.org/t/23641/13 # https://community.jitsi.org/t/23641/13
sed -i "/java.util.logging.FileHandler.level/s|ALL|WARNING|g" $JVB_LOG_POP sed -i "/java.util.logging.FileHandler.level/s|ALL|WARNING|g" "$JVB_LOG_POP"
sed -i "s|^.level=INFO|.level=WARNING|" $JVB_LOG_POP sed -i "s|^.level=INFO|.level=WARNING|" "$JVB_LOG_POP"
sed -i "/VIDEOBRIDGE_MAX_MEMORY=/i \ VIDEOBRIDGE_MAX_MEMORY=8192m" $JVB_RC sed -i "/VIDEOBRIDGE_MAX_MEMORY=/i \ VIDEOBRIDGE_MAX_MEMORY=8192m" "$JVB_RC"
#JICOFO #JICOFO
sed -i "/java.util.logging.FileHandler.level/s|ALL|OFF|g" $JICOFO_LOG_POP sed -i "/java.util.logging.FileHandler.level/s|ALL|OFF|g" "$JICOFO_LOG_POP"
sed -i "s|^.level=INFO|.level=WARNING|" $JICOFO_LOG_POP sed -i "s|^.level=INFO|.level=WARNING|" "$JICOFO_LOG_POP"
#MEET #MEET
sed -i "s|defaultLogLevel:.*|defaultLogLevel: 'error',|" $MEET_LOG_CONF sed -i "s|defaultLogLevel:.*|defaultLogLevel: 'error',|" "$MEET_LOG_CONF"
sed -i "/TraceablePeerConnection.js/s|info|error|" $MEET_LOG_CONF sed -i "/TraceablePeerConnection.js/s|info|error|" "$MEET_LOG_CONF"
sed -i "/CallStats.js/s|info|error|" $MEET_LOG_CONF sed -i "/CallStats.js/s|info|error|" "$MEET_LOG_CONF"
sed -i "/strophe.util.js/s|log|error|" $MEET_LOG_CONF sed -i "/strophe.util.js/s|log|error|" "$MEET_LOG_CONF"
#UX - Room settings and interface #UX - Room settings and interface
## config.js ## config.js
cp $MEET_CONF $MEET_CONF_HP cp "$MEET_CONF" "$MEET_CONF_HP"
sed -i "s|// disableAudioLevels:.*|disableAudioLevels: true,|" $MEET_CONF_HP sed -i "s|// disableAudioLevels:.*|disableAudioLevels: true,|" "$MEET_CONF_HP"
sed -i "s|enableNoAudioDetection:.*|enableNoAudioDetection: false,|" $MEET_CONF_HP sed -i "s|enableNoAudioDetection:.*|enableNoAudioDetection: false,|" "$MEET_CONF_HP"
sed -i "s|enableNoisyMicDetection:.*|enableNoisyMicDetection: false,|" $MEET_CONF_HP sed -i "s|enableNoisyMicDetection:.*|enableNoisyMicDetection: false,|" "$MEET_CONF_HP"
sed -i "s|startAudioMuted:.*|startAudioMuted: 5,|" $MEET_CONF_HP sed -i "s|startAudioMuted:.*|startAudioMuted: 5,|" "$MEET_CONF_HP"
sed -i "s|// startVideoMuted:.*|startVideoMuted: 5,|" $MEET_CONF_HP sed -i "s|// startVideoMuted:.*|startVideoMuted: 5,|" "$MEET_CONF_HP"
sed -i "s|startWithVideoMuted: true,|startWithVideoMuted: false,|" $MEET_CONF_HP sed -i "s|startWithVideoMuted: true,|startWithVideoMuted: false,|" "$MEET_CONF_HP"
sed -i "s|channelLastN:.*|channelLastN: 10,|" $MEET_CONF_HP sed -i "s|channelLastN:.*|channelLastN: 10,|" "$MEET_CONF_HP"
sed -i "s|// enableLayerSuspension:.*|enableLayerSuspension: true,|" $MEET_CONF_HP sed -i "s|// enableLayerSuspension:.*|enableLayerSuspension: true,|" "$MEET_CONF_HP"
sed -i "s|// apiLogLevels:.*|apiLogLevels: \['warn', 'error'],|" $MEET_CONF_HP sed -i "s|// apiLogLevels:.*|apiLogLevels: \['warn', 'error'],|" "$MEET_CONF_HP"
if [ "$VID_RES" = "360" ]; then if [ "$VID_RES" = "360" ]; then
sed -i "/Start QJI/,/End QJI/d" $MEET_CONF_HP sed -i "/Start QJI/,/End QJI/d" "$MEET_CONF_HP"
sed -i "/Enable \/ disable simulcast support/i \/\/ Start QJI - Set resolution and widescreen format" $MEET_CONF_HP sed -i "/Enable \/ disable simulcast support/i \/\/ Start QJI - Set resolution and widescreen format" "$MEET_CONF_HP"
sed -i "/Enable \/ disable simulcast support/i \ \ \ \ resolution: 360," $MEET_CONF_HP sed -i "/Enable \/ disable simulcast support/i \ \ \ \ resolution: 360," "$MEET_CONF_HP"
sed -i "/Enable \/ disable simulcast support/i \ \ \ \ constraints: {" $MEET_CONF_HP sed -i "/Enable \/ disable simulcast support/i \ \ \ \ constraints: {" "$MEET_CONF_HP"
sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ aspectRatio: 16 \/ 9," $MEET_CONF_HP sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ aspectRatio: 16 \/ 9," "$MEET_CONF_HP"
sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ video: {" $MEET_CONF_HP sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ video: {" "$MEET_CONF_HP"
sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ height: {" $MEET_CONF_HP sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ height: {" "$MEET_CONF_HP"
sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ideal: 360," $MEET_CONF_HP sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ideal: 360," "$MEET_CONF_HP"
sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ max: 360," $MEET_CONF_HP sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ max: 360," "$MEET_CONF_HP"
sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ min: 180" $MEET_CONF_HP sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ min: 180" "$MEET_CONF_HP"
sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ }," $MEET_CONF_HP sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ }," "$MEET_CONF_HP"
sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ width: {" $MEET_CONF_HP sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ width: {" "$MEET_CONF_HP"
sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ideal: 640," $MEET_CONF_HP sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ideal: 640," "$MEET_CONF_HP"
sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ max: 640," $MEET_CONF_HP sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ max: 640," "$MEET_CONF_HP"
sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ min: 320" $MEET_CONF_HP sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ min: 320" "$MEET_CONF_HP"
sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ }" $MEET_CONF_HP sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ }" "$MEET_CONF_HP"
sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ }" $MEET_CONF_HP sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ }" "$MEET_CONF_HP"
sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ }," $MEET_CONF_HP sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ }," "$MEET_CONF_HP"
sed -i "/Enable \/ disable simulcast support/i \/\/ End QJI" $MEET_CONF_HP sed -i "/Enable \/ disable simulcast support/i \/\/ End QJI" "$MEET_CONF_HP"
fi fi
if [ "$VID_RES" = "540" ]; then if [ "$VID_RES" = "540" ]; then
sed -i "/Start QJI/,/End QJI/d" $MEET_CONF_HP sed -i "/Start QJI/,/End QJI/d" "$MEET_CONF_HP"
sed -i "/Enable \/ disable simulcast support/i \/\/ Start QJI - Set resolution and widescreen format" $MEET_CONF_HP sed -i "/Enable \/ disable simulcast support/i \/\/ Start QJI - Set resolution and widescreen format" "$MEET_CONF_HP"
sed -i "/Enable \/ disable simulcast support/i \ \ \ \ resolution: 540," $MEET_CONF_HP sed -i "/Enable \/ disable simulcast support/i \ \ \ \ resolution: 540," "$MEET_CONF_HP"
sed -i "/Enable \/ disable simulcast support/i \ \ \ \ constraints: {" $MEET_CONF_HP sed -i "/Enable \/ disable simulcast support/i \ \ \ \ constraints: {" "$MEET_CONF_HP"
sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ aspectRatio: 16 \/ 9," $MEET_CONF_HP sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ aspectRatio: 16 \/ 9," "$MEET_CONF_HP"
sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ video: {" $MEET_CONF_HP sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ video: {" "$MEET_CONF_HP"
sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ height: {" $MEET_CONF_HP sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ height: {" "$MEET_CONF_HP"
sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ideal: 540," $MEET_CONF_HP sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ideal: 540," "$MEET_CONF_HP"
sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ max: 540," $MEET_CONF_HP sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ max: 540," "$MEET_CONF_HP"
sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ min: 180" $MEET_CONF_HP sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ min: 180" "$MEET_CONF_HP"
sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ }," $MEET_CONF_HP sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ }," "$MEET_CONF_HP"
sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ width: {" $MEET_CONF_HP sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ width: {" "$MEET_CONF_HP"
sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ideal: 960," $MEET_CONF_HP sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ideal: 960," "$MEET_CONF_HP"
sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ max: 960," $MEET_CONF_HP sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ max: 960," "$MEET_CONF_HP"
sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ min: 320" $MEET_CONF_HP sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ min: 320" "$MEET_CONF_HP"
sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ }" $MEET_CONF_HP sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ }" "$MEET_CONF_HP"
sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ }" $MEET_CONF_HP sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ }" "$MEET_CONF_HP"
sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ }," $MEET_CONF_HP sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ }," "$MEET_CONF_HP"
sed -i "/Enable \/ disable simulcast support/i \/\/ End QJI" $MEET_CONF_HP sed -i "/Enable \/ disable simulcast support/i \/\/ End QJI" "$MEET_CONF_HP"
fi fi
if [ "$VID_RES" = "720" ]; then if [ "$VID_RES" = "720" ]; then
sed -i "/Start QJI/,/End QJI/d" $MEET_CONF_HP sed -i "/Start QJI/,/End QJI/d" "$MEET_CONF_HP"
sed -i "/Enable \/ disable simulcast support/i \/\/ Start QJI - Set resolution and widescreen format" $MEET_CONF_HP sed -i "/Enable \/ disable simulcast support/i \/\/ Start QJI - Set resolution and widescreen format" "$MEET_CONF_HP"
sed -i "/Enable \/ disable simulcast support/i \ \ \ \ resolution: 720," $MEET_CONF_HP sed -i "/Enable \/ disable simulcast support/i \ \ \ \ resolution: 720," "$MEET_CONF_HP"
sed -i "/Enable \/ disable simulcast support/i \ \ \ \ constraints: {" $MEET_CONF_HP sed -i "/Enable \/ disable simulcast support/i \ \ \ \ constraints: {" "$MEET_CONF_HP"
sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ aspectRatio: 16 \/ 9," $MEET_CONF_HP sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ aspectRatio: 16 \/ 9," "$MEET_CONF_HP"
sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ video: {" $MEET_CONF_HP sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ video: {" "$MEET_CONF_HP"
sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ height: {" $MEET_CONF_HP sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ height: {" "$MEET_CONF_HP"
sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ideal: 720," $MEET_CONF_HP sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ideal: 720," "$MEET_CONF_HP"
sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ max: 720," $MEET_CONF_HP sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ max: 720," "$MEET_CONF_HP"
sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ min: 180" $MEET_CONF_HP sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ min: 180" "$MEET_CONF_HP"
sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ }," $MEET_CONF_HP sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ }," "$MEET_CONF_HP"
sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ width: {" $MEET_CONF_HP sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ width: {" "$MEET_CONF_HP"
sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ideal: 1280," $MEET_CONF_HP sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ideal: 1280," "$MEET_CONF_HP"
sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ max: 1280," $MEET_CONF_HP sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ max: 1280," "$MEET_CONF_HP"
sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ min: 320" $MEET_CONF_HP sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ min: 320" "$MEET_CONF_HP"
sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ }" $MEET_CONF_HP sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ }" "$MEET_CONF_HP"
sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ }" $MEET_CONF_HP sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ }" "$MEET_CONF_HP"
sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ }," $MEET_CONF_HP sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ }," "$MEET_CONF_HP"
sed -i "/Enable \/ disable simulcast support/i \/\/ End QJI" $MEET_CONF_HP sed -i "/Enable \/ disable simulcast support/i \/\/ End QJI" "$MEET_CONF_HP"
fi fi
## interface_config.js ## interface_config.js
cp $INT_CONF_JS $INT_CONF_JS_HP cp "$INT_CONF_JS" "$INT_CONF_JS_HP"
sed -i "s|CONNECTION_INDICATOR_DISABLED:.*|CONNECTION_INDICATOR_DISABLED: true,|" $INT_CONF_JS_HP sed -i "s|CONNECTION_INDICATOR_DISABLED:.*|CONNECTION_INDICATOR_DISABLED: true,|" "$INT_CONF_JS_HP"
sed -i "s|DISABLE_DOMINANT_SPEAKER_INDICATOR:.*|DISABLE_DOMINANT_SPEAKER_INDICATOR: true,|" $INT_CONF_JS_HP sed -i "s|DISABLE_DOMINANT_SPEAKER_INDICATOR:.*|DISABLE_DOMINANT_SPEAKER_INDICATOR: true,|" "$INT_CONF_JS_HP"
sed -i "s|DISABLE_FOCUS_INDICATOR:.*|DISABLE_FOCUS_INDICATOR: false,|" $INT_CONF_JS_HP sed -i "s|DISABLE_FOCUS_INDICATOR:.*|DISABLE_FOCUS_INDICATOR: false,|" "$INT_CONF_JS_HP"
sed -i "s|DISABLE_JOIN_LEAVE_NOTIFICATIONS:.*|DISABLE_JOIN_LEAVE_NOTIFICATIONS: true,|" $INT_CONF_JS_HP sed -i "s|DISABLE_JOIN_LEAVE_NOTIFICATIONS:.*|DISABLE_JOIN_LEAVE_NOTIFICATIONS: true,|" "$INT_CONF_JS_HP"
sed -i "s|DISABLE_VIDEO_BACKGROUND:.*|DISABLE_VIDEO_BACKGROUND: true,|" $INT_CONF_JS_HP sed -i "s|DISABLE_VIDEO_BACKGROUND:.*|DISABLE_VIDEO_BACKGROUND: true,|" "$INT_CONF_JS_HP"
sed -i "s|OPTIMAL_BROWSERS: \[.*|OPTIMAL_BROWSERS: \[ 'chrome', 'chromium', 'electron' \],|" $INT_CONF_JS_HP sed -i "s|OPTIMAL_BROWSERS: \[.*|OPTIMAL_BROWSERS: \[ 'chrome', 'chromium', 'electron' \],|" "$INT_CONF_JS_HP"
sed -i "s|UNSUPPORTED_BROWSERS: .*|UNSUPPORTED_BROWSERS: \[ 'nwjs', 'safari', 'firefox' \],|" $INT_CONF_JS_HP sed -i "s|UNSUPPORTED_BROWSERS: .*|UNSUPPORTED_BROWSERS: \[ 'nwjs', 'safari', 'firefox' \],|" "$INT_CONF_JS_HP"
### Toolbars ### Toolbars
if version_gt "$(apt-show-versions jitsi-meet|awk '{print$2}')" "2.0.5390-3" ; then if version_gt "$(apt-show-versions jitsi-meet|awk '{print$2}')" "2.0.5390-3" ; then
#New toolbar in config.js #New toolbar in config.js
sed -i "/\/\/ toolbarButtons:/i \ \ \ \ toolbarButtons:: \[" $MEET_CONF_HP sed -i "/\/\/ toolbarButtons:/i \ \ \ \ toolbarButtons:: \[" "$MEET_CONF_HP"
sed -i "/\/\/ toolbarButtons:/i \ \ \ \ \ \ \ \ 'microphone', 'camera', 'desktop', 'fullscreen'," $MEET_CONF_HP sed -i "/\/\/ toolbarButtons:/i \ \ \ \ \ \ \ \ 'microphone', 'camera', 'desktop', 'fullscreen'," "$MEET_CONF_HP"
if [ -z "$CHAT_DISABLED" ] || [ "$CHAT_DISABLED" = "yes" ]; then if [ -z "$CHAT_DISABLED" ] || [ "$CHAT_DISABLED" = "yes" ]; then
sed -i "/\/\/ toolbarButtons:/i \ \ \ \ \ \ \ \ 'fodeviceselection', 'hangup', 'profile', 'recording'," $MEET_CONF_HP sed -i "/\/\/ toolbarButtons:/i \ \ \ \ \ \ \ \ 'fodeviceselection', 'hangup', 'profile', 'recording'," "$MEET_CONF_HP"
else else
sed -i "/\/\/ toolbarButtons:/i \ \ \ \ \ \ \ \ 'fodeviceselection', 'hangup', 'profile', 'chat', 'recording'," $MEET_CONF_HP sed -i "/\/\/ toolbarButtons:/i \ \ \ \ \ \ \ \ 'fodeviceselection', 'hangup', 'profile', 'chat', 'recording'," "$MEET_CONF_HP"
fi fi
sed -i "/\/\/ toolbarButtons:/i \ \ \ \ \ \ \ \ 'livestreaming', 'etherpad', 'settings', 'raisehand'," $MEET_CONF_HP sed -i "/\/\/ toolbarButtons:/i \ \ \ \ \ \ \ \ 'livestreaming', 'etherpad', 'settings', 'raisehand'," "$MEET_CONF_HP"
sed -i "/\/\/ toolbarButtons:/i \ \ \ \ \ \ \ \ 'videoquality', 'filmstrip', 'feedback'," $MEET_CONF_HP sed -i "/\/\/ toolbarButtons:/i \ \ \ \ \ \ \ \ 'videoquality', 'filmstrip', 'feedback'," "$MEET_CONF_HP"
sed -i "/\/\/ toolbarButtons:/i \ \ \ \ \ \ \ \ 'tileview', 'download', 'help', 'mute-everyone', 'mute-video-everyone', 'security'" $MEET_CONF_HP sed -i "/\/\/ toolbarButtons:/i \ \ \ \ \ \ \ \ 'tileview', 'download', 'help', 'mute-everyone', 'mute-video-everyone', 'security'" "$MEET_CONF_HP"
sed -i "/\/\/ toolbarButtons:/i \ \ \ \ \]," $MEET_CONF_HP sed -i "/\/\/ toolbarButtons:/i \ \ \ \ \]," "$MEET_CONF_HP"
else else
#Old toolbar in interface.js (soon deprecated on newer versions) #Old toolbar in interface.js (soon deprecated on newer versions)
sed -i "/^\s*TOOLBAR_BUTTONS*\]$/ s|^|//|; /^\s*TOOLBAR_BUTTONS/, /\],$/ s|^|//|" $INT_CONF_JS_HP sed -i "/^\s*TOOLBAR_BUTTONS*\]$/ s|^|//|; /^\s*TOOLBAR_BUTTONS/, /\],$/ s|^|//|" "$INT_CONF_JS_HP"
sed -i "/\/\/ TOOLBAR_BUTTONS/i \ \ \ \ TOOLBAR_BUTTONS: \[" $INT_CONF_JS_HP sed -i "/\/\/ TOOLBAR_BUTTONS/i \ \ \ \ TOOLBAR_BUTTONS: \[" "$INT_CONF_JS_HP"
sed -i "/\/\/ TOOLBAR_BUTTONS/i \ \ \ \ \ \ \ \ 'microphone', 'camera', 'desktop', 'fullscreen'," $INT_CONF_JS_HP sed -i "/\/\/ TOOLBAR_BUTTONS/i \ \ \ \ \ \ \ \ 'microphone', 'camera', 'desktop', 'fullscreen'," "$INT_CONF_JS_HP"
if [ -z "$CHAT_DISABLED" ] || [ "$CHAT_DISABLED" = "yes" ]; then if [ -z "$CHAT_DISABLED" ] || [ "$CHAT_DISABLED" = "yes" ]; then
sed -i "/\/\/ TOOLBAR_BUTTONS/i \ \ \ \ \ \ \ \ 'fodeviceselection', 'hangup', 'profile', 'recording'," $INT_CONF_JS_HP sed -i "/\/\/ TOOLBAR_BUTTONS/i \ \ \ \ \ \ \ \ 'fodeviceselection', 'hangup', 'profile', 'recording'," "$INT_CONF_JS_HP"
else else
sed -i "/\/\/ TOOLBAR_BUTTONS/i \ \ \ \ \ \ \ \ 'fodeviceselection', 'hangup', 'profile', 'chat', 'recording'," $INT_CONF_JS_HP sed -i "/\/\/ TOOLBAR_BUTTONS/i \ \ \ \ \ \ \ \ 'fodeviceselection', 'hangup', 'profile', 'chat', 'recording'," "$INT_CONF_JS_HP"
fi fi
sed -i "/\/\/ TOOLBAR_BUTTONS/i \ \ \ \ \ \ \ \ 'livestreaming', 'etherpad', 'settings', 'raisehand'," $INT_CONF_JS_HP sed -i "/\/\/ TOOLBAR_BUTTONS/i \ \ \ \ \ \ \ \ 'livestreaming', 'etherpad', 'settings', 'raisehand'," "$INT_CONF_JS_HP"
sed -i "/\/\/ TOOLBAR_BUTTONS/i \ \ \ \ \ \ \ \ 'videoquality', 'filmstrip', 'feedback'," $INT_CONF_JS_HP sed -i "/\/\/ TOOLBAR_BUTTONS/i \ \ \ \ \ \ \ \ 'videoquality', 'filmstrip', 'feedback'," "$INT_CONF_JS_HP"
sed -i "/\/\/ TOOLBAR_BUTTONS/i \ \ \ \ \ \ \ \ 'tileview', 'download', 'help', 'mute-everyone', 'mute-video-everyone', 'security'" $INT_CONF_JS_HP sed -i "/\/\/ TOOLBAR_BUTTONS/i \ \ \ \ \ \ \ \ 'tileview', 'download', 'help', 'mute-everyone', 'mute-video-everyone', 'security'" "$INT_CONF_JS_HP"
sed -i "/\/\/ TOOLBAR_BUTTONS/i \ \ \ \ \]," $INT_CONF_JS_HP sed -i "/\/\/ TOOLBAR_BUTTONS/i \ \ \ \ \]," "$INT_CONF_JS_HP"
fi fi
#Check config file #Check config file
echo -e "\n# Checking $MEET_CONF file for errors\n" echo -e "\n# Checking $MEET_CONF file for errors\n"
CHECKJS_MEET_CHP=$(esvalidate $MEET_CONF_HP| cut -d ":" -f2) CHECKJS_MEET_CHP="$(esvalidate "$MEET_CONF_HP"| cut -d ":" -f2)"
if [ -z "$CHECKJS_MEET_CHP" ]; then if [ -z "$CHECKJS_MEET_CHP" ]; then
echo -e "\n# The $MEET_CONF_HP configuration seems correct. =)\n" echo -e "\n# The $MEET_CONF_HP configuration seems correct. =)\n"
else else
@ -313,7 +312,7 @@ echo -e "\n Watch out!, there seems to be an issue on $MEET_CONF_HP line:
Most of the times this is due upstream changes, please report to Most of the times this is due upstream changes, please report to
https://github.com/switnet-ltd/quick-jibri-installer/issues\n" https://github.com/switnet-ltd/quick-jibri-installer/issues\n"
fi fi
CHECKJS_INT_CHP=$(esvalidate $INT_CONF_JS_HP| cut -d ":" -f2) CHECKJS_INT_CHP="$(esvalidate "$INT_CONF_JS_HP"| cut -d ":" -f2)"
if [ -z "$CHECKJS_INT_CHP" ]; then if [ -z "$CHECKJS_INT_CHP" ]; then
echo -e "\n# The $INT_CONF_JS_HP configuration seems correct. =)\n" echo -e "\n# The $INT_CONF_JS_HP configuration seems correct. =)\n"
else else
@ -323,8 +322,8 @@ echo -e "\n Watch out!, there seems to be an issue on $INT_CONF_JS_HP line:
https://github.com/switnet-ltd/quick-jibri-installer/issues\n" https://github.com/switnet-ltd/quick-jibri-installer/issues\n"
fi fi
sed -i "s|$MEET_CONF|$MEET_CONF_HP|g" $WS_CONF sed -i "s|$MEET_CONF|$MEET_CONF_HP|g" "$WS_CONF"
sed -i "s|$INT_CONF_JS|$INT_CONF_JS_HP|" $WS_CONF sed -i "s|$INT_CONF_JS|$INT_CONF_JS_HP|" "$WS_CONF"
nginx -t nginx -t
#systemctl restart nginx #systemctl restart nginx

View File

@ -1,11 +1,25 @@
#!/bin/bash #!/bin/bash
# Custom Selenium Grid-Node fro Jitsi Meet # Custom Selenium Grid-Node fro Jitsi Meet
# Pandian © - https://community.jitsi.org/u/Pandian # Pandian © - https://community.jitsi.org/u/Pandian
# SwITNet Ltd © - 2021, https://switnet.net/ # SwITNet Ltd © - 2022, https://switnet.net/
# GPLv3 or later. # GPLv3 or later.
while getopts m: option
do
case "${option}"
in
m) MODE=${OPTARG};;
\?) echo "Usage: sudo bash ./$0 [-m debug]" && exit;;
esac
done
#DEBUG
if [ "$MODE" = "debug" ]; then
set -x
fi
#Check if user is root #Check if user is root
if ! [ $(id -u) = 0 ]; then if ! [ "$(id -u)" = 0 ]; then
echo "You need to be root or have sudo privileges!" echo "You need to be root or have sudo privileges!"
exit 0 exit 0
fi fi
@ -14,7 +28,7 @@ WAN_IP="$(dig +short myip.opendns.com @resolver1.opendns.com)"
AV_SPACE="$(df -h .|grep -v File|awk '{print$4}'|sed -e 's|G||')" AV_SPACE="$(df -h .|grep -v File|awk '{print$4}'|sed -e 's|G||')"
echo -e "\n-- Make sure you have at least 10GB of disk space available.\n" echo -e "\n-- Make sure you have at least 10GB of disk space available.\n"
if [ $(echo "$AV_SPACE > 9" | bc) -ne 0 ]; then if [ "$(echo "$AV_SPACE > 9" | bc)" -ne 0 ]; then
echo "> Seems we have enough disk space." echo "> Seems we have enough disk space."
else else
echo "> Please meet the minimum required disk space for this installer, exiting..." echo "> Please meet the minimum required disk space for this installer, exiting..."
@ -30,7 +44,7 @@ apt-get install -y \
wget \ wget \
unzip \ unzip \
maven \ maven \
openjdk-8-jdk openjdk-11-jdk
# Docker # Docker
curl -fsSL https://get.docker.com -o get-docker.sh curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh sh get-docker.sh
@ -40,17 +54,17 @@ chmod +x /usr/local/bin/docker-compose
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
# Jitsi Meet Torture # Jitsi Meet Torture
cd /opt cd /opt || exit
git clone https://github.com/jitsi/jitsi-meet-torture git clone https://github.com/jitsi/jitsi-meet-torture
cd jitsi-meet-torture/resources cd jitsi-meet-torture/ || exit
if [ -f FourPeople_1280x720_30.y4m ] ; then if [ -f resources/FourPeople_1280x720_30.y4m ] ; then
echo "FourPeople_1280x720_30.y4m exists" echo "FourPeople_1280x720_30.y4m exists"
else else
echo "FourPeople_1280x720_30.y4m doesn't exists, getting a copy..." echo "FourPeople_1280x720_30.y4m doesn't exists, getting a copy..."
wget -c https://media.xiph.org/video/derf/y4m/FourPeople_1280x720_60.y4m wget -c https://media.xiph.org/video/derf/y4m/FourPeople_1280x720_60.y4m
cp FourPeople_1280x720_60.y4m FourPeople_1280x720_30.y4m mv FourPeople_1280x720_60.y4m resources/
cp resources/FourPeople_1280x720_60.y4m resources/FourPeople_1280x720_30.y4m
fi fi
cd ..
#150 "participants" available #150 "participants" available
## Tested up to 120 with AWS c5.24xlarge ## Tested up to 120 with AWS c5.24xlarge
@ -145,8 +159,8 @@ sudo bash /opt/jitsi-meet-torture/scripts/malleus.sh \\
--hub-url=http://localhost:4444/wd/hub \\ --hub-url=http://localhost:4444/wd/hub \\
--instance-url=https://YOUR.JITSI-MEET-INSTANCE.DOMAIN --instance-url=https://YOUR.JITSI-MEET-INSTANCE.DOMAIN
" "
echo -e "\n-- If using 'hamertesting' as prefix name you can join the room echo -e "\n-- If using 'hamertesting' as prefix name you can join the room
hamertesting0, hamertesting1, hamertestingN hamertesting0, hamertesting1, hamertestingN
according to the 'N' number of conferences you have set to watch the test. according to the 'N' number of conferences you have set to watch the test.
*Beware* for 120 \"participants\" to join video-muted it was necessary at least a c5.24xlarge AWS instance. *Beware* for 120 \"participants\" to join video-muted it was necessary at least a c5.24xlarge AWS instance.

View File

@ -2,49 +2,49 @@
# System-tune-up to remove system software restrictions on a huge load of connections. # System-tune-up to remove system software restrictions on a huge load of connections.
# Be aware that hardware/infrastructure resources are the most common limiters. # Be aware that hardware/infrastructure resources are the most common limiters.
# #
# SwITNet Ltd © - 2021, https://switnet.net/ # SwITNet Ltd © - 2022, https://switnet.net/
# GPLv3 or later. # GPLv3 or later.
#Check if user is root
if ! [ $(id -u) = 0 ]; then
echo "You need to be root or have privileges!"
exit 0
fi
while getopts m: option while getopts m: option
do do
case "${option}" case "${option}"
in in
m) MODE=${OPTARG};; m) MODE=${OPTARG};;
\?) echo "Usage: sudo ./jms-stu.sh [-m debug]" && exit;; \?) echo "Usage: sudo bash ./$0 [-m debug]" && exit;;
esac esac
done done
echo '
#--------------------------------------------------
# Starting system tune up configuration
# for high performance
#--------------------------------------------------
'
#DEBUG #DEBUG
if [ "$MODE" = "debug" ]; then if [ "$MODE" = "debug" ]; then
set -x set -x
fi fi
set_once() { #Check if user is root
if [ -z "$(awk '!/^ *#/ && NF {print}' "$2"|grep $(echo $1|awk -F '=' '{print$1}'))" ]; then if ! [ "$(id -u)" = 0 ]; then
echo "Setting "$1" on "$2"..." echo "You need to be root or have privileges!"
exit 0
fi
echo '
#--------------------------------------------------
# Starting system tune up configuration
# for high performance
#--------------------------------------------------
'
set_once_hash_comment() {
if ! awk '!/^ *#/ && NF {print}' "$2"|grep -q "$(awk -F '=' '{print$1}' <<< "$1")" ; then
echo "Setting $1 on $2..."
echo "$1" | tee -a "$2" echo "$1" | tee -a "$2"
else else
echo " \"$(echo $1|awk -F '=' '{print$1}')\" seems present, skipping setting this variable" echo "\"$(awk -F '=' '{print$1}' <<< "$1")\" seems already present, skipping setting this variable"
fi fi
} }
FSTAB=/etc/fstab FSTAB=/etc/fstab
##Disable swap ##Disable swap
swapoff -a swapoff -a
sed -r '/\sswap\s/s/^#?/#/' -i $FSTAB sed -r '/\sswap\s/s/^#?/#/' -i "$FSTAB"
##Alternative swap tuning (need more documentation). ##Alternative swap tuning (need more documentation).
#vm.swappiness=5 #vm.swappiness=5
@ -56,24 +56,24 @@ sysctl -w net.core.rmem_default=262144
sysctl -w net.core.wmem_default=262144 sysctl -w net.core.wmem_default=262144
sysctl -w net.core.rmem_max=262144 sysctl -w net.core.rmem_max=262144
sysctl -w net.core.wmem_max=262144 sysctl -w net.core.wmem_max=262144
set_once "net.core.rmem_default=262144" "/etc/sysctl.conf" set_once_hash_comment "net.core.rmem_default=262144" "/etc/sysctl.conf"
set_once "net.core.wmem_default=262144" "/etc/sysctl.conf" set_once_hash_comment "net.core.wmem_default=262144" "/etc/sysctl.conf"
set_once "net.core.rmem_max=262144" "/etc/sysctl.conf" set_once_hash_comment "net.core.rmem_max=262144" "/etc/sysctl.conf"
set_once "net.core.wmem_max=262144" "/etc/sysctl.conf" set_once_hash_comment "net.core.wmem_max=262144" "/etc/sysctl.conf"
#system #system
#https://jitsi.github.io/handbook/docs/devops-guide/devops-guide-quickstart #https://jitsi.github.io/handbook/docs/devops-guide/devops-guide-quickstart
set_once "DefaultLimitNOFILE=65000" "/etc/sysctl.conf" set_once_hash_comment "DefaultLimitNOFILE=65000" "/etc/sysctl.conf"
set_once "DefaultLimitNPROC=65000" "/etc/sysctl.conf" set_once_hash_comment "DefaultLimitNPROC=65000" "/etc/sysctl.conf"
set_once "DefaultTasksMax=65000" "/etc/sysctl.conf" set_once_hash_comment "DefaultTasksMax=65000" "/etc/sysctl.conf"
#https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux_for_real_time/7/html/tuning_guide/reduce_tcp_performance_spikes #https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux_for_real_time/7/html/tuning_guide/reduce_tcp_performance_spikes
sysctl -w net.ipv4.tcp_timestamps=0 sysctl -w net.ipv4.tcp_timestamps=0
set_once "net.ipv4.tcp_timestamps=0" "/etc/sysctl.conf" set_once_hash_comment "net.ipv4.tcp_timestamps=0" "/etc/sysctl.conf"
#https://bugzilla.redhat.com/show_bug.cgi?id=1283676 #https://bugzilla.redhat.com/show_bug.cgi?id=1283676
sysctl -w net.core.netdev_max_backlog=100000 sysctl -w net.core.netdev_max_backlog=100000
set_once "net.core.netdev_max_backlog=100000" "/etc/sysctl.conf" set_once_hash_comment "net.core.netdev_max_backlog=100000" "/etc/sysctl.conf"
##nginx ##nginx
sed -i "s|worker_connections.*|worker_connections 2000;|" /etc/nginx/nginx.conf sed -i "s|worker_connections.*|worker_connections 2000;|" /etc/nginx/nginx.conf

View File

@ -1,16 +1,31 @@
#!/bin/bash #!/bin/bash
# JWT Mode Setup # JWT Mode Setup
# SwITNet Ltd © - 2021, https://switnet.net/ # SwITNet Ltd © - 2022, https://switnet.net/
# GPLv3 or later. # GPLv3 or later.
DOMAIN=$(ls /etc/prosody/conf.d/ | grep -v localhost | awk -F'.cfg' '{print $1}' | awk '!NF || !seen[$0]++')
while getopts m: option
do
case "${option}"
in
m) MODE=${OPTARG};;
\?) echo "Usage: sudo bash ./$0 [-m debug]" && exit;;
esac
done
#DEBUG
if [ "$MODE" = "debug" ]; then
set -x
fi
DOMAIN="$(find /etc/prosody/conf.d/ -name \*.lua|awk -F'.cfg' '!/localhost/{print $1}'|xargs basename)"
MEET_CONF="/etc/jitsi/meet/$DOMAIN-config.js" MEET_CONF="/etc/jitsi/meet/$DOMAIN-config.js"
JICOFO_SIP="/etc/jitsi/jicofo/sip-communicator.properties" JICOFO_SIP="/etc/jitsi/jicofo/sip-communicator.properties"
PROSODY_FILE="/etc/prosody/conf.d/$DOMAIN.cfg.lua" PROSODY_FILE="/etc/prosody/conf.d/$DOMAIN.cfg.lua"
PROSODY_SYS="/etc/prosody/prosody.cfg.lua" PROSODY_SYS="/etc/prosody/prosody.cfg.lua"
APP_ID="$(tr -dc "a-zA-Z0-9" < /dev/urandom | fold -w 16 | head -n1)" APP_ID="$(tr -dc "a-zA-Z0-9" < /dev/urandom | fold -w 16 | head -n1)"
SECRET_APP="$(tr -dc "a-zA-Z0-9" < /dev/urandom | fold -w 64 | head -n1)" SECRET_APP="$(tr -dc "a-zA-Z0-9" < /dev/urandom | fold -w 64 | head -n1)"
SRP_STR=$(grep -n "VirtualHost \"$DOMAIN\"" $PROSODY_FILE | head -n1 | cut -d ":" -f1) SRP_STR="$(grep -n "VirtualHost \"$DOMAIN\"" "$PROSODY_FILE" | head -n1 | cut -d ":" -f1)"
SRP_END=$((SRP_STR + 10)) SRP_END="$((SRP_STR + 10))"
## Required openssl for Focal 20.04 ## Required openssl for Focal 20.04
if [ "$(lsb_release -sc)" = "focal" ]; then if [ "$(lsb_release -sc)" = "focal" ]; then
@ -37,26 +52,26 @@ echo "set jitsi-meet-tokens/appsecret password $SECRET_APP" | debconf-set-select
apt-get install -y jitsi-meet-tokens apt-get install -y jitsi-meet-tokens
#Setting up #Setting up
sed -i "s|c2s_require_encryption = true|c2s_require_encryption = false|" $PROSODY_SYS sed -i "s|c2s_require_encryption = true|c2s_require_encryption = false|" "$PROSODY_SYS"
#- #-
sed -i "$SRP_STR,$SRP_END{s|authentication = \"anonymous\"|authentication = \"token\"|}" $PROSODY_FILE sed -i "$SRP_STR,$SRP_END{s|authentication = \"anonymous\"|authentication = \"token\"|}" "$PROSODY_FILE"
sed -i "s|--app_id=\"example_app_id\"|app_id=\"$APP_ID\"|" $PROSODY_FILE sed -i "s|--app_id=\"example_app_id\"|app_id=\"$APP_ID\"|" "$PROSODY_FILE"
sed -i "s|--app_secret=\"example_app_secret\"|app_secret=\"$SECRET_APP\"|" $PROSODY_FILE sed -i "s|--app_secret=\"example_app_secret\"|app_secret=\"$SECRET_APP\"|" "$PROSODY_FILE"
sed -i "/app_secret/a \\\\" $PROSODY_FILE sed -i "/app_secret/a \\\\" "$PROSODY_FILE"
sed -i "/app_secret/a \ \ \ \ allow_empty_token = false" $PROSODY_FILE sed -i "/app_secret/a \ \ \ \ allow_empty_token = false" "$PROSODY_FILE"
sed -i "/app_secret/a \\\\" $PROSODY_FILE sed -i "/app_secret/a \\\\" "$PROSODY_FILE"
sed -i "/app_secret/a \ \ \ \ asap_accepted_issuers = { \"$APP_ID\" }" $PROSODY_FILE sed -i "/app_secret/a \ \ \ \ asap_accepted_issuers = { \"$APP_ID\" }" "$PROSODY_FILE"
sed -i "/app_secret/a \ \ \ \ asap_accepted_audiences = { \"$APP_ID\", \"RocketChat\" }" $PROSODY_FILE sed -i "/app_secret/a \ \ \ \ asap_accepted_audiences = { \"$APP_ID\", \"RocketChat\" }" "$PROSODY_FILE"
sed -i "/app_secret/a \\\\" $PROSODY_FILE sed -i "/app_secret/a \\\\" "$PROSODY_FILE"
sed -i "s|--allow_empty_token =.*|allow_empty_token = false|" $PROSODY_FILE sed -i "s|--allow_empty_token =.*|allow_empty_token = false|" "$PROSODY_FILE"
sed -i 's|--"token_verification"|"token_verification"|' $PROSODY_FILE sed -i 's|--"token_verification"|"token_verification"|' "$PROSODY_FILE"
#Request auth #Request auth
sed -i "s|#org.jitsi.jicofo.auth.URL=EXT_JWT:|org.jitsi.jicofo.auth.URL=EXT_JWT:|" $JICOFO_SIP sed -i "s|#org.jitsi.jicofo.auth.URL=EXT_JWT:|org.jitsi.jicofo.auth.URL=EXT_JWT:|" "$JICOFO_SIP"
sed -i "s|// anonymousdomain: 'guest.example.com'|anonymousdomain: \'guest.$DOMAIN\'|" $MEET_CONF sed -i "s|// anonymousdomain: 'guest.example.com'|anonymousdomain: \'guest.$DOMAIN\'|" "$MEET_CONF"
#Enable jibri recording #Enable jibri recording
cat << REC-JIBRI >> $PROSODY_FILE cat << REC-JIBRI >> "$PROSODY_FILE"
VirtualHost "recorder.$DOMAIN" VirtualHost "recorder.$DOMAIN"
modules_enabled = { modules_enabled = {
@ -67,7 +82,7 @@ VirtualHost "recorder.$DOMAIN"
REC-JIBRI REC-JIBRI
#Setup guests and lobby #Setup guests and lobby
cat << P_SR >> $PROSODY_FILE cat << P_SR >> "$PROSODY_FILE"
-- #Change back lobby - https://community.jitsi.org/t/64769/136 -- #Change back lobby - https://community.jitsi.org/t/64769/136
VirtualHost "guest.$DOMAIN" VirtualHost "guest.$DOMAIN"
authentication = "token" authentication = "token"

File diff suppressed because it is too large Load Diff

View File

@ -3,12 +3,20 @@
# SwITNet Ltd © - 2022, https://switnet.net/ # SwITNet Ltd © - 2022, https://switnet.net/
# GPLv3 or later. # GPLv3 or later.
#### while getopts m: option
# NOTE: Only use this script if you know what you are doing. do
# Under your own risk. case "${option}"
# This program is distributed in the hope that it will be useful, in
# but WITHOUT ANY WARRANTY. m) MODE=${OPTARG};;
#### \?) echo "Usage: sudo bash ./$0 [-m debug]" && exit;;
esac
done
#DEBUG
if [ "$MODE" = "debug" ]; then
set -x
fi
wait_seconds() { wait_seconds() {
secs=$(($1)) secs=$(($1))
while [ $secs -gt 0 ]; do while [ $secs -gt 0 ]; do
@ -18,8 +26,15 @@ while [ $secs -gt 0 ]; do
done done
} }
echo "####
# WARNING: Only use this script if you know what you are doing.
# Under your own risk.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY.
####"
# Check if user is root # Check if user is root
if [ $UID != 0 ]; then if [ "$UID" != 0 ]; then
echo You need to run this script as root or sudo rights! echo You need to run this script as root or sudo rights!
exit 1 exit 1
fi fi
@ -30,36 +45,36 @@ GRUB_FILE="/etc/default/grub"
echo -e "# Check and update HWE kernel if possible...\n" echo -e "# Check and update HWE kernel if possible...\n"
apt-get -q2 update apt-get -q2 update
HWE_VIR_MOD=$(apt-cache madison linux-image-generic-hwe-$(lsb_release -sr) 2>/dev/null|head -n1|grep -c "hwe-$(lsb_release -sr)") HWE_VIR_MOD="$(apt-cache madison linux-image-generic-hwe-"$(lsb_release -sr)" 2>/dev/null|head -n1|grep -c hwe-"$(lsb_release -sr)")"
if [ "$HWE_VIR_MOD" = "1" ]; then if [ "$HWE_VIR_MOD" = "1" ]; then
apt-get -y install \ apt-get -y install \
linux-image-generic-hwe-$(lsb_release -sr) \ linux-image-generic-hwe-"$(lsb_release -sr)" \
linux-tools-generic-hwe-$(lsb_release -sr) linux-tools-generic-hwe-"$(lsb_release -sr)"
else else
apt-get -y install \ apt-get -y install \
linux-image-generic \ linux-image-generic \
linux-modules-extra-$(uname -r) linux-modules-extra-"$(uname -r)"
fi fi
apt-get -y autoremove apt-get -y autoremove
apt-get autoclean apt-get autoclean
#Write update-grub output #Write update-grub output
update-grub > $KERNEL_LOG 2>&1 update-grub > "$KERNEL_LOG" 2>&1
#Get clean output #Get clean output
cat $KERNEL_LOG | awk -F'boot/' '{print$2}'|sed '/^[[:space:]]*$/d' | \ awk -F'boot/' '{print$2}' < "$KERNEL_LOG"|sed '/^[[:space:]]*$/d' | \
tee ${KERNEL_LOG}.tmp tee "$KERNEL_LOG".tmp
mv ${KERNEL_LOG}.tmp $KERNEL_LOG mv "$KERNEL_LOG".tmp "$KERNEL_LOG"
echo -e "Check if AWS kernel is installed.\n" echo -e "Check if AWS kernel is installed.\n"
[ $(grep -wc aws $KERNEL_LOG) = 0 ] && echo "No AWS kernel found, exiting..." && exit [ "$(grep -wc aws "$KERNEL_LOG")" = 0 ] && echo "No AWS kernel found, exiting..." && exit
#Get kernel number #Get kernel number
RAW_KERNEL_NUM="$(grep -Fn generic $KERNEL_LOG|head -n1|cut -d ':' -f1)" RAW_KERNEL_NUM="$(grep -Fn generic "$KERNEL_LOG"|head -n1|cut -d ':' -f1)"
FIXED_KERNEL_NUM="$(awk "BEGIN{ print $RAW_KERNEL_NUM - 1 }")" FIXED_KERNEL_NUM="$(awk "BEGIN{ print $RAW_KERNEL_NUM - 1 }")"
echo -e "Set up GRUB for custom kernel.\n" echo -e "Set up GRUB for custom kernel.\n"
sed -i "s|GRUB_DEFAULT=.*|GRUB_DEFAULT=\"1\>$FIXED_KERNEL_NUM\"|" $GRUB_FILE sed -i "s|GRUB_DEFAULT=.*|GRUB_DEFAULT=\"1\>$FIXED_KERNEL_NUM\"|" "$GRUB_FILE"
echo -e "Saving changes...\n" echo -e "Saving changes...\n"
update-grub update-grub

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# Simple Fail2ban configuration # Simple Fail2ban configuration
# SwITNet Ltd © - 2021, https://switnet.net/ # SwITNet Ltd © - 2022, https://switnet.net/
# GNU GPLv3 or later. # GNU GPLv3 or later.
while getopts m: option while getopts m: option
@ -8,7 +8,7 @@ do
case "${option}" case "${option}"
in in
m) MODE=${OPTARG};; m) MODE=${OPTARG};;
\?) echo "Usage: sudo ./fail2ban_ssh.sh [-m debug]" && exit;; \?) echo "Usage: sudo bash ./$0 [-m debug]" && exit;;
esac esac
done done
@ -18,7 +18,7 @@ set -x
fi fi
#Check if user is root #Check if user is root
if ! [ $(id -u) = 0 ]; then if ! [ "$(id -u)" = 0 ]; then
echo "You need to be root or have sudo privileges!" echo "You need to be root or have sudo privileges!"
exit 0 exit 0
fi fi
@ -27,8 +27,8 @@ apt-get -y install fail2ban
if \ if \
[ -f /var/log/ssh_f2b.log ] && \ [ -f /var/log/ssh_f2b.log ] && \
[ $(grep -c 604800 /etc/fail2ban/jail.local) = "1" ] && \ [ "$(grep -c 604800 /etc/fail2ban/jail.local)" = "1" ] && \
[ $(grep -c ssh_f2b.log /etc/fail2ban/jail.local) = "1"]; then [ "$(grep -c ssh_f2b.log /etc/fail2ban/jail.local)" = "1" ]; then
echo -e "\nFail2ban seems to be already configured.\n" echo -e "\nFail2ban seems to be already configured.\n"
else else
echo -e "\nConfiguring Fail2ban...\n" echo -e "\nConfiguring Fail2ban...\n"

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# Simple Jibri conf updater # Simple Jibri conf updater
# SwITNet Ltd © - 2021, https://switnet.net/ # SwITNet Ltd © - 2022, https://switnet.net/
# GNU GPLv3 or later. # GNU GPLv3 or later.
while getopts m: option while getopts m: option
@ -8,7 +8,7 @@ do
case "${option}" case "${option}"
in in
m) MODE=${OPTARG};; m) MODE=${OPTARG};;
\?) echo "Usage: sudo ./test-jibri-env.sh [-m debug]" && exit;; \?) echo "Usage: sudo bash ./$0 [-m debug]" && exit;;
esac esac
done done
@ -25,7 +25,7 @@ echo -e '
\n' \n'
#Check if user is root #Check if user is root
if ! [ $(id -u) = 0 ]; then if ! [ "$(id -u)" = 0 ]; then
echo "You need to be root or have sudo privileges!" echo "You need to be root or have sudo privileges!"
exit 0 exit 0
fi fi
@ -46,19 +46,19 @@ else
fi fi
if [ -d /etc/prosody/ ];then if [ -d /etc/prosody/ ];then
DOMAIN=$(ls /etc/prosody/conf.d/ | grep -v localhost | awk -F'.cfg' '{print $1}' | awk '!NF || !seen[$0]++') DOMAIN="$(find /etc/prosody/conf.d/ -name \*.lua|awk -F'.cfg' '!/localhost/{print $1}'|xargs basename)"
fi fi
CONF_JSON="/etc/jitsi/jibri/config.json" CONF_JSON="/etc/jitsi/jibri/config.json"
JIBRI_CONF="/etc/jitsi/jibri/jibri.conf" JIBRI_CONF="/etc/jitsi/jibri/jibri.conf"
DIR_RECORD=/var/jbrecord DIR_RECORD="/var/jbrecord"
REC_DIR=/home/jibri/finalize_recording.sh REC_DIR="/home/jibri/finalize_recording.sh"
JibriBrewery=JibriBrewery JibriBrewery="JibriBrewery"
check_read_vars() { check_read_vars() {
echo "Checking $1" echo "Checking $1"
if [ -z "$2" ];then if [ -z "$2" ];then
echo "This variable seems wrong, please check before continue" echo "This variable seems wrong, please check before continue"
exit 1 exit 1
fi fi
} }
restart_services_jibri() { restart_services_jibri() {
@ -73,44 +73,44 @@ fi
} }
#Prevent re-run on completed jibri upgraded instance #Prevent re-run on completed jibri upgraded instance
if [ -f $CONF_JSON_disabled ] && \ if [ -f "$CONF_JSON"_disabled ] && \
[ -f $JIBRI_CONF ] && \ [ -f "$JIBRI_CONF" ] && \
[ -f $JIBRI_CONF-dpkg-file ]; then [ -f "$JIBRI_CONF"-dpkg-file ]; then
echo -e "\n> This jibri config has been upgraded already, we'll exit...\n\nIf you think there maybe an error on checking you current jibri configuration.\nPlease report this to \ echo -e "\n> This jibri config has been upgraded already, we'll exit...\n\nIf you think there maybe an error on checking you current jibri configuration.\nPlease report this to \
https://github.com/switnet-ltd/quick-jibri-installer/issues\n" https://github.com/switnet-ltd/quick-jibri-installer/issues\n"
exit exit
elif [ ! -f $CONF_JSON ] && \ elif [ ! -f "$CONF_JSON" ] && \
[ -f $JIBRI_CONF ] && \ [ -f "$JIBRI_CONF" ] && \
[ -f $JIBRI_CONF-dpkg-file ]; then [ -f "$JIBRI_CONF"-dpkg-file ]; then
echo -e "\n> This jibri seems to be running the latest configuration already, we'll exit...\n\nIf you think there maybe an error on checking you current jibri configuration.\nPlease report this to \ echo -e "\n> This jibri seems to be running the latest configuration already, we'll exit...\n\nIf you think there maybe an error on checking you current jibri configuration.\nPlease report this to \
https://github.com/switnet-ltd/quick-jibri-installer/issues\n" https://github.com/switnet-ltd/quick-jibri-installer/issues\n"
exit exit
elif [ -f $CONF_JSON ] && \ elif [ -f "$CONF_JSON" ] && \
[ -f $JIBRI_CONF ]; then [ -f "$JIBRI_CONF" ]; then
echo -e "\n> This jibri config seems to be candidate for upgrading, we'll continue...\nIf you think there maybe an error on checking you current jibri configuration.\nPlease report this to \ echo -e "\n> This jibri config seems to be candidate for upgrading, we'll continue...\nIf you think there maybe an error on checking you current jibri configuration.\nPlease report this to \
https://github.com/switnet-ltd/quick-jibri-installer/issues\n" https://github.com/switnet-ltd/quick-jibri-installer/issues\n"
fi fi
#Read missing variables #Read missing variables
if [ -f $CONF_JSON ]; then if [ -f "$CONF_JSON" ]; then
echo "Reading current config.json file..." echo "Reading current config.json file..."
if [ -z $DOMAIN ]; then if [ -z "$DOMAIN" ]; then
DOMAIN=$(jq .xmpp_environments[0].xmpp_domain $CONF_JSON|cut -d '"' -f2) DOMAIN="$(jq .xmpp_environments[0].xmpp_domain $CONF_JSON|cut -d '"' -f2)"
fi fi
JB_NAME=$(jq .xmpp_environments[0].name $CONF_JSON|cut -d '"' -f2) JB_NAME="$(jq .xmpp_environments[0].name $CONF_JSON|cut -d '"' -f2)"
JB_AUTH_PASS=$(jq .xmpp_environments[0].control_login.password $CONF_JSON|cut -d '"' -f2) JB_AUTH_PASS="$(jq .xmpp_environments[0].control_login.password $CONF_JSON|cut -d '"' -f2)"
JB_REC_PASS=$(jq .xmpp_environments[0].call_login.password $CONF_JSON|cut -d '"' -f2) JB_REC_PASS="$(jq .xmpp_environments[0].call_login.password $CONF_JSON|cut -d '"' -f2)"
JB_NICKN=$(jq .xmpp_environments[0].control_muc.nickname $CONF_JSON|cut -d '"' -f2) JB_NICKN="$(jq .xmpp_environments[0].control_muc.nickname $CONF_JSON|cut -d '"' -f2)"
else else
echo "Can't find the instance config.json file, exiting..." echo "Can't find the instance config.json file, exiting..."
exit exit
fi fi
check_read_vars "Jibri Name" $JB_NAME check_read_vars "Jibri Name" "$JB_NAME"
check_read_vars "(Main server) Domain" $DOMAIN check_read_vars "(Main server) Domain" "$DOMAIN"
check_read_vars "Control login passwd" $JB_AUTH_PASS check_read_vars "Control login passwd" "$JB_AUTH_PASS"
check_read_vars "Call login passwd" $JB_REC_PASS check_read_vars "Call login passwd" "$JB_REC_PASS"
check_read_vars "Jibri Node nickname" $JB_NICKN check_read_vars "Jibri Node nickname" "$JB_NICKN"
if [ "$MODE" = "debug" ]; then if [ "$MODE" = "debug" ]; then
echo "$JB_NAME" echo "$JB_NAME"
@ -122,10 +122,10 @@ fi
#Backup and setup new conf file #Backup and setup new conf file
echo -e "Backing up config.json for historical purposes at:\n ${CONF_JSON}_disabled" echo -e "Backing up config.json for historical purposes at:\n ${CONF_JSON}_disabled"
mv $CONF_JSON ${CONF_JSON}_disabled mv "$CONF_JSON" "${CONF_JSON}"_disabled
mv $JIBRI_CONF ${JIBRI_CONF}-dpkg-file mv "$JIBRI_CONF" "${JIBRI_CONF}"-dpkg-file
cat << NEW_CONF > $JIBRI_CONF cat << NEW_CONF > "$JIBRI_CONF"
// New XMPP environment config. // New XMPP environment config.
jibri { jibri {
recording { recording {
@ -195,13 +195,13 @@ jibri {
NEW_CONF NEW_CONF
echo "Check final jibri.conf file:" echo "Check final jibri.conf file:"
cat $JIBRI_CONF cat "$JIBRI_CONF"
read -n 1 -s -r -p "Press any key to continue..."$'\n' read -n 1 -s -r -p "Press any key to continue..."
restart_services_jibri restart_services_jibri
systemctl status jibri systemctl status jibri
if [ -f /var/log/jitsi/jicofo.log ]; then if [ -f /var/log/jitsi/jicofo.log ]; then
echo -e "Checking for jicofo recognizing \"Live\" jibri node..." echo -e "Checking for jicofo recognizing \"Live\" jibri node..."
tail -n 10 | grep Live tail -n 10 | grep Live
fi fi

View File

@ -1,24 +1,24 @@
#!/bin/bash #!/bin/bash
# Simple Jibri resolution enhancer # Simple Jibri resolution enhancer
# SwITNet Ltd © - 2021, https://switnet.net/ # SwITNet Ltd © - 2022, https://switnet.net/
# GNU GPLv3 or later. # GNU GPLv3 or later.
while getopts m: option while getopts m: option
do do
case "${option}" case "${option}"
in in
m) MODE=${OPTARG};; m) MODE=${OPTARG};;
\?) echo "Usage: sudo ./jibri-resolution-enhancer.sh [-m debug]" && exit;; \?) echo "Usage: sudo bash ./$0 [-m debug]" && exit;;
esac esac
done done
#DEBUG #DEBUG
if [ "$MODE" = "debug" ]; then if [ "$MODE" = "debug" ]; then
set -x set -x
fi fi
#Check if user is root #Check if user is root
if ! [ $(id -u) = 0 ]; then if ! [ "$(id -u)" = 0 ]; then
echo "You need to be root or have sudo privileges!" echo "You need to be root or have sudo privileges!"
exit 0 exit 0
fi fi
@ -46,15 +46,15 @@ if [ -f "$JIBRI_OPT/jibri-res_enh.jar" ] && \
fi fi
mkdir /tmp/jibri mkdir /tmp/jibri
cd /tmp/jibri cd /tmp/jibri || exit
#Get md5sum for current jibri installed. #Get md5sum for current jibri installed.
apt-get download jibri=$INSTALLED_JIBRI_VERSION apt-get download jibri="$INSTALLED_JIBRI_VERSION"
ar x jibri_*.deb ar x jibri_*.deb
tar xvf data.tar.xz tar xvf data.tar.xz
UPSTREAM_DEB_JAR_SUM="$(md5sum 2>/dev/null /tmp/jibri/opt/jitsi/jibri/jibri.jar |awk '{print$1}')" UPSTREAM_DEB_JAR_SUM="$(md5sum 2>/dev/null /tmp/jibri/opt/jitsi/jibri/jibri.jar |awk '{print$1}')"
if [ -z $UPSTREAM_DEB_JAR_SUM ]; then if [ -z "$UPSTREAM_DEB_JAR_SUM" ]; then
echo "Not possible to continue, exiting..." echo "Not possible to continue, exiting..."
exit exit
fi fi
@ -63,11 +63,11 @@ fi
apt-get -y install devscripts \ apt-get -y install devscripts \
git \ git \
maven \ maven \
openjdk-8-jdk openjdk-11-jdk
#Build repository #Build repository
git clone https://github.com/jitsi/jibri $JIBRI_ENH_PATH git clone https://github.com/jitsi/jibri "$JIBRI_ENH_PATH"
cd $JIBRI_ENH_PATH cd "$JIBRI_ENH_PATH" || exit
# Default values # Default values
## videoEncodePreset - "veryfast" || h264ConstantRateFactor - 25 ## videoEncodePreset - "veryfast" || h264ConstantRateFactor - 25
@ -77,18 +77,18 @@ sed -i "/videoEncodePreset/s|String =.*|String = \"medium\",|" src/main/kotlin/
sed -i "/h264ConstantRateFactor/s|Int =.*|Int = 17,|" src/main/kotlin/org/jitsi/jibri/capture/ffmpeg/FfmpegCapturer.kt sed -i "/h264ConstantRateFactor/s|Int =.*|Int = 17,|" src/main/kotlin/org/jitsi/jibri/capture/ffmpeg/FfmpegCapturer.kt
mvn package mvn package
JIBRI_JAR="$(ls -Sh $JIBRI_ENH_PATH/target|awk '/dependencies/&&/.jar/{print}'|awk 'NR==1{print}')" JIBRI_JAR="$(find "$JIBRI_ENH_PATH" -name \*.jar|awk '/dependencies/{print}'|awk 'NR==1{print}')"
cp $JIBRI_ENH_PATH/target/$JIBRI_JAR $JIBRI_ENH_PATH/target/jibri.jar cp "$JIBRI_ENH_PATH"/target/"$JIBRI_JAR" "$JIBRI_ENH_PATH"/target/jibri.jar
# Backing up default binaries # Backing up default binaries
if [ "$UPSTREAM_DEB_JAR_SUM" = "$(md5sum 2>/dev/null $JIBRI_OPT/jibri.jar|awk '{print$1}')" ]; then if [ "$UPSTREAM_DEB_JAR_SUM" = "$(md5sum 2>/dev/null $JIBRI_OPT/jibri.jar|awk '{print$1}')" ]; then
cp $JIBRI_OPT/jibri.jar $JIBRI_OPT/jibri-dpkg-package.jar cp "$JIBRI_OPT"/jibri.jar "$JIBRI_OPT"/jibri-dpkg-package.jar
fi fi
# Migrate original to enhanced jibri # Migrate original to enhanced jibri
cp $JIBRI_ENH_PATH/target/jibri.jar $JIBRI_OPT/jibri-res_enh.jar cp "$JIBRI_ENH_PATH"/target/jibri.jar "$JIBRI_OPT"/jibri-res_enh.jar
if [ -f $JIBRI_OPT/jibri-dpkg-package.jar ];then if [ -f "$JIBRI_OPT"/jibri-dpkg-package.jar ];then
cp $JIBRI_OPT/jibri-res_enh.jar $JIBRI_OPT/jibri.jar cp "$JIBRI_OPT"/jibri-res_enh.jar "$JIBRI_OPT"/jibri.jar
fi fi
JIBRI_RES_ENH_HASH="$(md5sum 2>/dev/null $JIBRI_OPT/jibri-res_enh.jar|awk '{print$1}')" JIBRI_RES_ENH_HASH="$(md5sum 2>/dev/null $JIBRI_OPT/jibri-res_enh.jar|awk '{print$1}')"
@ -99,12 +99,12 @@ if [ "$JIBRI_RES_ENH_HASH" = "$USED_JIBRI_HASH" ]; then
else else
echo "Something went wrong, restoring default package..." echo "Something went wrong, restoring default package..."
if [ "$(md5sum 2>/dev/null $JIBRI_OPT/jibri-dpkg-package.jar|awk '{print$1}')" = "$UPSTREAM_DEB_JAR_SUM" ]; then if [ "$(md5sum 2>/dev/null $JIBRI_OPT/jibri-dpkg-package.jar|awk '{print$1}')" = "$UPSTREAM_DEB_JAR_SUM" ]; then
cp $JIBRI_OPT/jibri-dpkg-package.jar $JIBRI_OPT/jibri.jar cp "$JIBRI_OPT"/jibri-dpkg-package.jar "$JIBRI_OPT"/jibri.jar
CLEAN="true" CLEAN="true"
else else
if [ -f /tmp/jibri/opt/jitsi/jibri/jibri.jar ]; then if [ -f /tmp/jibri/opt/jitsi/jibri/jibri.jar ]; then
echo "Restoring from upstream package..." echo "Restoring from upstream package..."
cp /tmp/jibri/opt/jitsi/jibri/jibri.jar $JIBRI_OPT/jibri.jar cp /tmp/jibri/opt/jitsi/jibri/jibri.jar "$JIBRI_OPT"/jibri.jar
CLEAN="true" CLEAN="true"
else else
echo "Wow, someone took the time to avoid restoration, please manually review your changes." echo "Wow, someone took the time to avoid restoration, please manually review your changes."
@ -115,7 +115,7 @@ else
fi fi
if [ "$CLEAN" = "true" ]; then if [ "$CLEAN" = "true" ]; then
rm -r /tmp/jibri rm -r /tmp/jibri
rm -r $JIBRI_ENH_PATH rm -r "$JIBRI_ENH_PATH"
rm /opt/jitsi/jibri/jibri-res_enh.jar rm /opt/jitsi/jibri/jibri-res_enh.jar
fi fi

View File

@ -1,24 +1,24 @@
#!/bin/bash #!/bin/bash
#Start over #Start over
# SwITNet Ltd © - 2021, https://switnet.net/ # SwITNet Ltd © - 2022, https://switnet.net/
# GPLv3 or later. # GPLv3 or later.
while getopts m: option while getopts m: option
do do
case "${option}" case "${option}"
in in
m) MODE=${OPTARG};; m) MODE=${OPTARG};;
\?) echo "Usage: sudo ./start-over.sh [-m debug]" && exit;; \?) echo "Usage: sudo bash ./$0 [-m debug]" && exit;;
esac esac
done done
#DEBUG #DEBUG
if [ "$MODE" = "debug" ]; then if [ "$MODE" = "debug" ]; then
set -x set -x
fi fi
#Check if user is root #Check if user is root
if ! [ $(id -u) = 0 ]; then if ! [ "$(id -u)" = 0 ]; then
echo "You need to be root or have sudo privileges!" echo "You need to be root or have sudo privileges!"
exit 0 exit 0
fi fi
@ -32,16 +32,16 @@ while [ $secs -gt 0 ]; do
done done
} }
remove_residuals() { remove_residuals() {
if [ -d $1 ]; then if [ -d "$1" ]; then
rm -r $1 rm -r "$1"
fi fi
} }
purge_debconf() { purge_debconf() {
echo PURGE | debconf-communicate $1 echo PURGE | debconf-communicate "$1"
} }
remove_services() { remove_services() {
systemctl disable $1 systemctl disable "$1"
systemctl stop $1 systemctl stop "$1"
} }
echo -e ' echo -e '
######################################################################## ########################################################################
@ -50,8 +50,8 @@ echo -e '
by Software, IT & Networks Ltd by Software, IT & Networks Ltd
\n' \n'
SYNC_USER="$(ls /home|awk '/jbsync/{print}')" SYNC_USER="$(find /home -maxdepth 1 -type d |awk '/jbsync/{print}')"
DOMAIN="$(ls /etc/prosody/conf.d/ | awk -F'.cfg' '!/localhost/{print $1}' | awk '!NF || !seen[$0]++')" DOMAIN="$(find /etc/prosody/conf.d/ -name \*.lua|awk -F'.cfg' '!/localhost/{print $1}'|xargs basename)"
echo "We are about to remove and clean all the jitsi-meet platform bits and pieces... 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." Please make sure you have backed up anything you don't want to loose."
@ -118,7 +118,7 @@ remove_residuals /usr/share/jitsi-*
#Clean /etc/hosts #Clean /etc/hosts
sed -i "/$DOMAIN/d" /etc/hosts sed -i "/$DOMAIN/d" /etc/hosts
#Purging debconf db echo "#Purging debconf db"
purge_debconf jicofo purge_debconf jicofo
purge_debconf jigasi purge_debconf jigasi
purge_debconf jitsi-meet purge_debconf jitsi-meet
@ -128,8 +128,8 @@ purge_debconf jitsi-meet-web-config
purge_debconf jitsi-videobridge2 purge_debconf jitsi-videobridge2
#Remove unused users & groups #Remove unused users & groups
if [ ! -z $SYNC_USER ]; then if [ -n "$SYNC_USER" ]; then
deluser --remove-home $SYNC_USER deluser --remove-home "$SYNC_USER"
fi fi
if [ -d /home/jibri ]; then if [ -d /home/jibri ]; then
deluser --remove-home jibri deluser --remove-home jibri

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# Simple Jibri Env tester # Simple Jibri Env tester
# SwITNet Ltd © - 2021, https://switnet.net/ # SwITNet Ltd © - 2022, https://switnet.net/
# GNU GPLv3 or later. # GNU GPLv3 or later.
while getopts m: option while getopts m: option
@ -8,7 +8,7 @@ do
case "${option}" case "${option}"
in in
m) MODE=${OPTARG};; m) MODE=${OPTARG};;
\?) echo "Usage: sudo ./test-jibri-env.sh [-m debug]" && exit;; \?) echo "Usage: sudo bash ./$0 [-m debug]" && exit;;
esac esac
done done
@ -25,7 +25,7 @@ echo -e '
\n' \n'
#Check if user is root #Check if user is root
if ! [ $(id -u) = 0 ]; then if ! [ "$(id -u)" = 0 ]; then
echo "You need to be root or have sudo privileges!" echo "You need to be root or have sudo privileges!"
exit 0 exit 0
fi fi
@ -39,30 +39,30 @@ check_google_binaries() {
if [ -z "$2" ]; then if [ -z "$2" ]; then
echo "Warning: No $1 doesn't seem installed" echo "Warning: No $1 doesn't seem installed"
else else
echo $2 echo "$2"
fi fi
} }
# True if $1 is greater than $2 # True if $1 is greater than $2
version_gt() { test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1"; } version_gt() { test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1"; }
JITSI_REPO=$(apt-cache policy | grep http | grep jitsi | grep stable | awk '{print $3}' | head -n 1 | cut -d "/" -f1) JITSI_REPO="$(apt-cache policy | grep http | grep jitsi | grep stable | awk '{print $3}' | head -n 1 | cut -d "/" -f1)"
SND_AL_MODULE=$(lsmod | awk '{print$1}'| grep snd_aloop) 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)") 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" CONF_JSON="/etc/jitsi/jibri/config.json"
JIBRI_CONF="/etc/jitsi/jibri/jibri.conf" JIBRI_CONF="/etc/jitsi/jibri/jibri.conf"
JMS_DOMAIN="$(awk -F '"' '/xmpp-domain/{print$2}' $JIBRI_CONF)" JMS_DOMAIN="$(awk -F '"' '/xmpp-domain/{print$2}' "$JIBRI_CONF")"
CHDB="$(whereis chromedriver | awk '{print$2}')" CHDB="$(whereis chromedriver | awk '{print$2}')"
CHD_VER_LOCAL="$($CHDB --version 2>/dev/null| awk '{print$1,$2}')" CHD_VER_LOCAL="$($CHDB --version 2>/dev/null| awk '{print$1,$2}')"
GOOGL_VER_LOCAL="$(/usr/bin/google-chrome --version 2>/dev/null)" GOOGL_VER_LOCAL="$(/usr/bin/google-chrome --version 2>/dev/null)"
CHD_VER_2D="$(echo $CHD_VER_LOCAL|awk '{print$2}'|cut -d "." -f 1,2)" CHD_VER_2D="$(echo "$CHD_VER_LOCAL"|awk '{print$2}'|cut -d "." -f 1,2)"
GOOGL_VER_2D="$(echo $GOOGL_VER_LOCAL|awk '{print$3}'|cut -d "." -f 1,2)" GOOGL_VER_2D="$(echo "$GOOGL_VER_LOCAL"|awk '{print$3}'|cut -d "." -f 1,2)"
CHD_LTST="$(curl -sL https://chromedriver.storage.googleapis.com/LATEST_RELEASE)" CHD_LTST="$(curl -sL https://chromedriver.storage.googleapis.com/LATEST_RELEASE)"
CHD_LTST_2D="$(echo $CHD_LTST|cut -d "." -f 1,2)" CHD_LTST_2D="$(echo "$CHD_LTST"|cut -d "." -f 1,2)"
#T1 #T1
echo -e "\n#1 -- Check repository --\n" echo -e "\n#1 -- Check repository --\n"
if [ -z $JITSI_REPO ]; then if [ -z "$JITSI_REPO" ]; then
echo "No repository detected, wait whaaaat?..." echo "No repository detected, wait whaaaat?..."
while [[ "$CONT_TEST" != "yes" && "$CONT_TEST" != "no" ]] while [[ "$CONT_TEST" != "yes" && "$CONT_TEST" != "no" ]]
do do
@ -103,7 +103,7 @@ echo -e "\n#3 -- Check Google Chrome/driver software. --\n"
check_google_binaries "Google Chrome" "$GOOGL_VER_LOCAL" check_google_binaries "Google Chrome" "$GOOGL_VER_LOCAL"
check_google_binaries "Chromedriver" "$CHD_VER_LOCAL" check_google_binaries "Chromedriver" "$CHD_VER_LOCAL"
if [ ! -z "$CHD_VER_LOCAL" ] && [ ! -z "$GOOGL_VER_LOCAL" ]; then if [ -n "$CHD_VER_LOCAL" ] && [ -n "$GOOGL_VER_LOCAL" ]; then
# Chrome upgrade process # Chrome upgrade process
if [ "$(apt-show-versions google-chrome-stable | grep -c "uptodate")" = "1" ]; then if [ "$(apt-show-versions google-chrome-stable | grep -c "uptodate")" = "1" ]; then
echo -e "Google Chrome is already up to date: \xE2\x9C\x94" echo -e "Google Chrome is already up to date: \xE2\x9C\x94"
@ -112,17 +112,17 @@ if [ ! -z "$CHD_VER_LOCAL" ] && [ ! -z "$GOOGL_VER_LOCAL" ]; then
apt-get -yq install --only-upgrade google-chrome-stable apt-get -yq install --only-upgrade google-chrome-stable
fi fi
# Only upgrade chromedriver if it's on a lower version, not just a different one. # Only upgrade chromedriver if it's on a lower version, not just a different one.
if [ $CHD_VER_2D = $GOOGL_VER_2D ]; then if [ "$CHD_VER_2D" = "$GOOGL_VER_2D" ]; then
echo -e "\nChromedriver version seems according to Google Chrome: \xE2\x9C\x94" echo -e "\nChromedriver version seems according to Google Chrome: \xE2\x9C\x94"
T3=1 T3=1
elif version_gt "$GOOGL_VER_2D" "$CHD_VER_2D" && \ elif version_gt "$GOOGL_VER_2D" "$CHD_VER_2D" && \
[ "$GOOGL_VER_2D" = "$CHD_LTST_2D" ]; then [ "$GOOGL_VER_2D" = "$CHD_LTST_2D" ]; then
echo -e "\nAttempting Chromedriver update!" echo -e "\nAttempting Chromedriver update!"
wget -q https://chromedriver.storage.googleapis.com/$CHD_LTST/chromedriver_linux64.zip \ wget -q https://chromedriver.storage.googleapis.com/"$CHD_LTST"/chromedriver_linux64.zip \
-O /tmp/chromedriver_linux64.zip -O /tmp/chromedriver_linux64.zip
unzip -o /tmp/chromedriver_linux64.zip -d /usr/local/bin/ unzip -o /tmp/chromedriver_linux64.zip -d /usr/local/bin/
chown root:root $CHDB chown root:root "$CHDB"
chmod 0755 $CHDB chmod 0755 "$CHDB"
rm -rf /tpm/chromedriver_linux64.zip rm -rf /tpm/chromedriver_linux64.zip
if [ "$($CHDB -v | awk '{print $2}'|cut -d "." -f 1,2)" = "$GOOGL_VER_2D" ]; then if [ "$($CHDB -v | awk '{print $2}'|cut -d "." -f 1,2)" = "$GOOGL_VER_2D" ]; then
echo "Successful update" echo "Successful update"
@ -140,24 +140,24 @@ fi
#T4 #T4
echo -e "\n#4 -- Test kernel modules --\n" echo -e "\n#4 -- Test kernel modules --\n"
if [ -z $SND_AL_MODULE ]; then if [ -z "$SND_AL_MODULE" ]; then
#First make sure the recommended kernel is installed. #First make sure the recommended kernel is installed.
if [ "$HWE_VIR_MOD" = "1" ]; then if [ "$HWE_VIR_MOD" = "1" ]; then
apt-get -y install \ apt-get -y install \
linux-image-generic-hwe-$(lsb_release -sr) linux-image-generic-hwe-"$(lsb_release -sr)"
else else
apt-get -y install \ apt-get -y install \
linux-image-generic \ linux-image-generic \
linux-modules-extra-$(uname -r) linux-modules-extra-"$(uname -r)"
fi fi
echo -e "\nNo module snd_aloop detected. \xE2\x9C\x96 <== IMPORTANT! \nCurrent kernel: $(uname -r)\n" echo -e "\nNo module snd_aloop detected. \xE2\x9C\x96 <== IMPORTANT! \nCurrent kernel: $(uname -r)\n"
echo -e "\nIf you just installed a new kernel, \ echo -e "\nIf you just installed a new kernel, \
please try rebooting.\nFor now wait 'til the end of the recommended kernel installation." please try rebooting.\nFor now wait 'til the end of the recommended kernel installation."
echo "# Check and Install HWE kernel if possible..." echo "# Check and Install HWE kernel if possible..."
if uname -r | grep -q aws;then if uname -r | grep -q aws;then
KNL_HWE="$(apt-cache madison linux-image-generic-hwe-$(lsb_release -sr)|awk 'NR==1{print$3}'|cut -d "." -f1-4)" KNL_HWE="$(apt-cache madison linux-image-generic-hwe-"$(lsb_release -sr)"|awk 'NR==1{print$3}'|cut -d "." -f1-4)"
KNL_MENU="$(awk -F\' '/menuentry / {print $2}' /boot/grub/grub.cfg|awk '!/recovery/&&/generic/{print$3,$4}'|grep $KNL_HWE)" KNL_MENU="$(awk -F\' '/menuentry / {print $2}' /boot/grub/grub.cfg|awk '!/recovery/&&/generic/{print$3,$4}'|grep "$KNL_HWE")"
if [ ! -z "$KNL_MENU" ];then if [ -n "$KNL_MENU" ];then
echo -e "\nSeems you are using an AWS kernel \xE2\x9C\x96 <== IMPORTANT! \nYou might consider modify your grub (/etc/default/grub) to use the following:" && \ echo -e "\nSeems you are using an AWS kernel \xE2\x9C\x96 <== IMPORTANT! \nYou might consider modify your grub (/etc/default/grub) to use the following:" && \
echo -e "\n > $KNL_MENU" echo -e "\n > $KNL_MENU"
fi fi
@ -172,8 +172,8 @@ fi
echo -e "\n#5 -- Test .asoundrc file --\n" echo -e "\n#5 -- Test .asoundrc file --\n"
ASRC_MASTER="https://raw.githubusercontent.com/jitsi/jibri/master/resources/debian-package/etc/jitsi/jibri/asoundrc" ASRC_MASTER="https://raw.githubusercontent.com/jitsi/jibri/master/resources/debian-package/etc/jitsi/jibri/asoundrc"
ASRC_INSTALLED="/home/jibri/.asoundrc" ASRC_INSTALLED="/home/jibri/.asoundrc"
ASRC_MASTER_MD5SUM=$(curl -sL $ASRC_MASTER | md5sum | cut -d ' ' -f 1) ASRC_MASTER_MD5SUM="$(curl -sL "$ASRC_MASTER" | md5sum | cut -d ' ' -f 1)"
ASRC_INSTALLED_MD5SUM=$(md5sum $ASRC_INSTALLED | cut -d ' ' -f 1) ASRC_INSTALLED_MD5SUM="$(md5sum "$ASRC_INSTALLED" | cut -d ' ' -f 1)"
if [ "$ASRC_MASTER_MD5SUM" == "$ASRC_INSTALLED_MD5SUM" ]; then if [ "$ASRC_MASTER_MD5SUM" == "$ASRC_INSTALLED_MD5SUM" ]; then
echo -e "Seems to be using the latest asoundrc file available. \xE2\x9C\x94" echo -e "Seems to be using the latest asoundrc file available. \xE2\x9C\x94"
@ -187,20 +187,20 @@ fi
echo -e "\n#6 -- Old or new config --\n" echo -e "\n#6 -- Old or new config --\n"
echo -e "What config version is this using?" echo -e "What config version is this using?"
if [ -f ${CONF_JSON}_disabled ] && \ if [ -f "${CONF_JSON}"_disabled ] && \
[ -f $JIBRI_CONF ] && \ [ -f "$JIBRI_CONF" ] && \
[ -f $JIBRI_CONF-dpkg-file ]; then [ -f "$JIBRI_CONF"-dpkg-file ]; then
echo -e "\n> This jibri config has been upgraded already. \xE2\x9C\x94 \n\nIf you think there maybe an error on checking you current jibri configuration.\nPlease report this to \ echo -e "\n> This jibri config has been upgraded already. \xE2\x9C\x94 \n\nIf you think there maybe an error on checking you current jibri configuration.\nPlease report this to \
https://github.com/switnet-ltd/quick-jibri-installer/issues\n" https://github.com/switnet-ltd/quick-jibri-installer/issues\n"
T6=1 T6=1
elif [ ! -f $CONF_JSON ] && \ elif [ ! -f "$CONF_JSON" ] && \
[ -f $JIBRI_CONF ] && \ [ -f "$JIBRI_CONF" ] && \
[ -f ${JIBRI_CONF}-dpkg-file ]; then [ -f "${JIBRI_CONF}"-dpkg-file ]; then
echo -e "\n> This jibri seems to be running the latest configuration already. \xE2\x9C\x94 \n\nIf you think there maybe an error on checking you current jibri configuration.\nPlease report this to \ echo -e "\n> This jibri seems to be running the latest configuration already. \xE2\x9C\x94 \n\nIf you think there maybe an error on checking you current jibri configuration.\nPlease report this to \
https://github.com/switnet-ltd/quick-jibri-installer/issues\n" https://github.com/switnet-ltd/quick-jibri-installer/issues\n"
T6=1 T6=1
elif [ -f ${CONF_JSON} ] && \ elif [ -f "${CONF_JSON}" ] && \
[ -f $JIBRI_CONF ]; then [ -f "$JIBRI_CONF" ]; then
echo -e "\n> This jibri config seems to be candidate for upgrading. \xE2\x9C\x96 \nIf you think there maybe an error on checking you current jibri configuration.\nPlease report this to \ echo -e "\n> This jibri config seems to be candidate for upgrading. \xE2\x9C\x96 \nIf you think there maybe an error on checking you current jibri configuration.\nPlease report this to \
https://github.com/switnet-ltd/quick-jibri-installer/issues\n" https://github.com/switnet-ltd/quick-jibri-installer/issues\n"
T6=0 T6=0
@ -220,8 +220,7 @@ fi
#T7 #T7
echo -e "\n#7 -- 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 ! nc -z -v -w5 "$JMS_DOMAIN" 5222 ; then
if [ "$?" -ne 0 ]; then
echo -e "Connection failed! \xE2\x9C\x96\n > You might want to check both Jibri & JMS firewall rules (TCP 5222)." echo -e "Connection failed! \xE2\x9C\x96\n > You might want to check both Jibri & JMS firewall rules (TCP 5222)."
T7=0 T7=0
else else