5.4.3 #35

Merged
Ark74 merged 7 commits from unstable into master 2021-04-12 15:55:14 +00:00
1 changed files with 138 additions and 111 deletions
Showing only changes of commit 7f13eeafb3 - Show all commits

View File

@ -9,18 +9,18 @@
#Make sure the file name is the required one #Make sure the file name is the required one
if [ ! "$(basename $0)" = "add-jibri-node.sh" ]; then if [ ! "$(basename $0)" = "add-jibri-node.sh" ]; then
echo "For most cases naming won't matter, for this one it does." 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." echo "Please use the original name for this script: \`add-jibri-node.sh', and run again."
exit exit
fi 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 ./add_jibri_node.sh [-m debug]" && exit;;
esac esac
done done
#DEBUG #DEBUG
@ -66,33 +66,75 @@ TEST_JIBRI_ENV="$GITHUB_RAW/$GIT_REPO/unstable/tools/test-jibri-env.sh"
# 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() {
if [ -z "$2" ]; then if [ "$2" = "TBD" ]; then
echo -e "Check if variable $1 is set: \xE2\x9C\x96 \nExiting..." echo -e "Check if variable $1 is set: \xE2\x9C\x96"
exit exit
else else
echo -e "Check if variable $1 is set: \xE2\x9C\x94" echo -e "Check if variable $1 is set: \xE2\x9C\x94"
fi fi
} }
if [ -z "$LAST" ]; then if [ -z "$LAST" ]; then
echo "There is an error on the LAST definition, please report." echo "There is an error on the LAST definition, please report."
exit exit
elif [ "$LAST" = "TBD" ]; then elif [ "$LAST" = "TBD" ]; then
ADDUP=$((START + 1)) ADDUP=$((START + 1))
else else
ADDUP=$((LAST + 1)) ADDUP=$((LAST + 1))
fi fi
echo "
#-----------------------------------------------------------------------
# Checking initial necessary variables...
#-----------------------------------------------------------------------"
JMS_DATA=($MAIN_SRV_DIST \
$MAIN_SRV_REPO \
$MAIN_SRV_DOMAIN \
$JibriBrewery \
$JB_NAME \
$JB_AUTH_PASS \
$JB_REC_PASS \
$MJS_USER \
$MJS_USER_PASS)
JMS_EVAL=${JMS_DATA[0]}
for i in "${JMS_DATA[@]}"; do
if [[ "$JMS_EVAL" != "$i" ]]; then
ALL_TBD="no"
break
fi
done
if [ "$ALL_TBD" = "no" ];then
echo -e "Good, seems this is not a vanilla copy of add-jibri-node.sh,
let's check variables ...\n"
else
echo -e "You seem to be using a vanilla copy of the add-jibri-node.sh.
> Please use the content (or apply the changes) of add-jibri-node.sh from
the main Jitsi server installation folder, as it contains necessary data.\n"
exit
fi
check_var MAIN_SRV_DIST "$MAIN_SRV_DIST"
check_var MAIN_SRV_REPO "$MAIN_SRV_REPO"
check_var MAIN_SRV_DOMAIN "$MAIN_SRV_DOMAIN"
check_var JibriBrewery "$JibriBrewery"
check_var JB_NAME "$JB_NAME"
check_var JB_AUTH_PASS "$JB_AUTH_PASS"
check_var JB_REC_PASS "$JB_REC_PASS"
check_var MJS_USER "$MJS_USER"
check_var MJS_USER_PASS "$MJS_USER_PASS"
#Check server and node OS #Check server and node OS
if [ ! "$THIS_SRV_DIST" = "$MAIN_SRV_DIST" ]; then if [ ! "$THIS_SRV_DIST" = "$MAIN_SRV_DIST" ]; then
echo "Please use the same OS for the jibri setup on both servers." echo "Please use the same OS for the jibri setup on both servers."
echo "This server is based on: $THIS_SRV_DIST" echo "This server is based on: $THIS_SRV_DIST"
echo "The main server record claims is based on: $MAIN_SRV_DIST" echo "The main server record claims is based on: $MAIN_SRV_DIST"
exit exit
fi fi
#Check system resources #Check system resources
@ -140,21 +182,6 @@ else
done done
fi fi
echo "
#-----------------------------------------------------------------------
# Checking initial necessary variables...
#-----------------------------------------------------------------------"
check_var MAIN_SRV_DIST "$MAIN_SRV_DIST"
check_var MAIN_SRV_REPO "$MAIN_SRV_REPO"
check_var MAIN_SRV_DOMAIN "$MAIN_SRV_DOMAIN"
check_var JibriBrewery "$JibriBrewery"
check_var JB_NAME "$JB_NAME"
check_var JB_AUTH_PASS "$JB_AUTH_PASS"
check_var JB_REC_PASS "$JB_REC_PASS"
check_var MJS_USER "$MJS_USER"
check_var MJS_USER_PASS "$MJS_USER_PASS"
# Rename hostname for each jibri node # Rename hostname for each jibri node
hostnamectl set-hostname "jbnode${ADDUP}.${MAIN_SRV_DOMAIN}" hostnamectl set-hostname "jbnode${ADDUP}.${MAIN_SRV_DOMAIN}"
sed -i "1i 127.0.0.1 jbnode${ADDUP}.${MAIN_SRV_DOMAIN}" /etc/hosts sed -i "1i 127.0.0.1 jbnode${ADDUP}.${MAIN_SRV_DOMAIN}" /etc/hosts
@ -162,15 +189,15 @@ sed -i "1i 127.0.0.1 jbnode${ADDUP}.${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.."
exit exit
elif [ "$JITSI_REPO" = "$MAIN_SRV_REPO" ]; then elif [ "$JITSI_REPO" = "$MAIN_SRV_REPO" ]; then
echo "Main and node servers repository match, continuing..." echo "Main and node servers repository match, continuing..."
else else
echo "Jitsi $JITSI_REPO repository already installed" echo "Jitsi $JITSI_REPO repository already installed"
fi fi
# Requirements # Requirements
@ -179,30 +206,30 @@ apt-get update -q2
apt-get dist-upgrade -yq2 apt-get dist-upgrade -yq2
apt-get -y install \ apt-get -y install \
apt-show-versions \ apt-show-versions \
bmon \ bmon \
curl \ curl \
ffmpeg \ ffmpeg \
git \ git \
htop \ htop \
inotify-tools \ inotify-tools \
jq \ jq \
rsync \ rsync \
ssh \ ssh \
unzip \ unzip \
wget wget
check_snd_driver() { check_snd_driver() {
echo -e "\n# Checking ALSA - Loopback module..." echo -e "\n# Checking ALSA - Loopback module..."
echo "snd-aloop" | tee -a /etc/modules echo "snd-aloop" | tee -a /etc/modules
modprobe snd-aloop modprobe snd-aloop
if [ "$(lsmod | grep snd_aloop | head -n 1 | cut -d " " -f1)" = "snd_aloop" ]; then if [ "$(lsmod | grep snd_aloop | head -n 1 | cut -d " " -f1)" = "snd_aloop" ]; then
echo " echo "
#----------------------------------------------------------------------- #-----------------------------------------------------------------------
# Audio driver seems - OK. # Audio driver seems - OK.
#-----------------------------------------------------------------------" #-----------------------------------------------------------------------"
else else
echo " echo "
#----------------------------------------------------------------------- #-----------------------------------------------------------------------
# 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.
@ -241,25 +268,25 @@ apt-get -y install \
echo "# Installing Google Chrome / ChromeDriver" echo "# Installing Google Chrome / ChromeDriver"
if [ "$GOOGLE_ACTIVE_REPO" = "main" ]; then if [ "$GOOGLE_ACTIVE_REPO" = "main" ]; then
echo "Google repository already set." echo "Google repository already set."
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
rm -rf /etc/apt/sources.list.d/dl_google_com_linux_chrome_deb.list rm -rf /etc/apt/sources.list.d/dl_google_com_linux_chrome_deb.list
if [ -f /usr/local/bin/chromedriver ]; then 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
rm -rf /tpm/chromedriver_linux64.zip rm -rf /tpm/chromedriver_linux64.zip
fi fi
echo " echo "
@ -333,57 +360,57 @@ jibri {
xmpp { xmpp {
environments = [ environments = [
{ {
// A user-friendly name for this environment // A user-friendly name for this environment
name = "$JB_NAME" name = "$JB_NAME"
// A list of XMPP server hosts to which we'll connect // A list of XMPP server hosts to which we'll connect
xmpp-server-hosts = [ "$MAIN_SRV_DOMAIN" ] xmpp-server-hosts = [ "$MAIN_SRV_DOMAIN" ]
// The base XMPP domain // The base XMPP domain
xmpp-domain = "$MAIN_SRV_DOMAIN" xmpp-domain = "$MAIN_SRV_DOMAIN"
// The MUC we'll join to announce our presence for // The MUC we'll join to announce our presence for
// recording and streaming services // recording and streaming services
control-muc { control-muc {
domain = "internal.auth.$MAIN_SRV_DOMAIN" domain = "internal.auth.$MAIN_SRV_DOMAIN"
room-name = "$JibriBrewery" room-name = "$JibriBrewery"
nickname = "Live-$ADDUP" nickname = "Live-$ADDUP"
} }
// The login information for the control MUC // The login information for the control MUC
control-login { control-login {
domain = "auth.$MAIN_SRV_DOMAIN" domain = "auth.$MAIN_SRV_DOMAIN"
username = "jibri" username = "jibri"
password = "$JB_AUTH_PASS" password = "$JB_AUTH_PASS"
} }
// An (optional) MUC configuration where we'll // An (optional) MUC configuration where we'll
// join to announce SIP gateway services // join to announce SIP gateway services
// sip-control-muc { // sip-control-muc {
// domain = "domain" // domain = "domain"
// room-name = "room-name" // room-name = "room-name"
// nickname = "nickname" // nickname = "nickname"
// } // }
// The login information the selenium web client will use // The login information the selenium web client will use
call-login { call-login {
domain = "recorder.$MAIN_SRV_DOMAIN" domain = "recorder.$MAIN_SRV_DOMAIN"
username = "recorder" username = "recorder"
password = "$JB_REC_PASS" password = "$JB_REC_PASS"
} }
// The value we'll strip from the room JID domain to derive // The value we'll strip from the room JID domain to derive
// the call URL // the call URL
strip-from-room-domain = "conference." strip-from-room-domain = "conference."
// How long Jibri sessions will be allowed to last before // How long Jibri sessions will be allowed to last before
// they are stopped. A value of 0 allows them to go on // they are stopped. A value of 0 allows them to go on
// indefinitely // indefinitely
usage-timeout = 0 hour usage-timeout = 0 hour
// Whether or not we'll automatically trust any cert on // Whether or not we'll automatically trust any cert on
// this XMPP domain // this XMPP domain
trust-all-xmpp-certs = true trust-all-xmpp-certs = true
} }
] ]
} }