Remove secuential jibri node nickname in favor of machine-id

Also use short machine ID as hostname
This commit is contained in:
Luis Guzmán 2021-06-17 02:29:08 -05:00
parent 1f38da7a19
commit 9ca66a568e
1 changed files with 8 additions and 27 deletions

View File

@ -62,6 +62,7 @@ NJN_USER_PASS="$(tr -dc "a-zA-Z0-9#_*=" < /dev/urandom | fold -w 32 | head -n1)"
GITHUB_RAW="https://raw.githubusercontent.com" GITHUB_RAW="https://raw.githubusercontent.com"
GIT_REPO="switnet-ltd/quick-jibri-installer" GIT_REPO="switnet-ltd/quick-jibri-installer"
TEST_JIBRI_ENV="$GITHUB_RAW/$GIT_REPO/unstable/tools/test-jibri-env.sh" TEST_JIBRI_ENV="$GITHUB_RAW/$GIT_REPO/unstable/tools/test-jibri-env.sh"
SHORT_ID="$(awk '{print substr($0,0,7)}' /etc/machine-id)"
### 1_VAR_DEF ### 1_VAR_DEF
# sed limiters for add-jibri-node.sh variables # sed limiters for add-jibri-node.sh variables
@ -78,14 +79,9 @@ check_var() {
fi fi
} }
if [ -z "$LAST" ]; then #Change in favor of machine-id identifier
echo "There is an error on the LAST definition, please report." crontab -l | { cat; echo "@reboot sed -i \"/[[:space:]]control-muc/,/[[:space:]]control-login/{s|nickname = .*|nickname = \\\"$(cat /etc/machine-id)\\\"|}\" /etc/jitsi/jibri/jibri.conf"; } | crontab -
exit crontab -l
elif [ "$LAST" = "TBD" ]; then
ADDUP=$((START + 1))
else
ADDUP=$((LAST + 1))
fi
echo " echo "
#----------------------------------------------------------------------- #-----------------------------------------------------------------------
@ -183,8 +179,8 @@ else
fi fi
# Rename hostname for each jibri node # Rename hostname for each jibri node
hostnamectl set-hostname "jbnode${ADDUP}.${MAIN_SRV_DOMAIN}" hostnamectl set-hostname "jbnode_${SHORT_ID}.${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_${SHORT_ID}.${MAIN_SRV_DOMAIN}" /etc/hosts
# Jitsi-Meet Repo # Jitsi-Meet Repo
echo "Add Jitsi repo" echo "Add Jitsi repo"
@ -413,7 +409,7 @@ jibri {
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 = "machine-id"
} }
// The login information for the control MUC // The login information for the control MUC
@ -539,11 +535,6 @@ systemctl daemon-reload
systemctl enable remote_jnsync.service systemctl enable remote_jnsync.service
systemctl start remote_jnsync.service systemctl start remote_jnsync.service
echo "Writing last node number..."
sed -i "$(var_dlim 0_VAR),$(var_dlim 1_VAR){s|LAST=.*|LAST=$ADDUP|}" add-jibri-node.sh
sed -i "$(var_dlim 0_LAST),$(var_dlim 1_LAST){s|LETS: .*|LETS: $(date -R)|}" add-jibri-node.sh
echo "Last file edition at: $(awk -F 'LETS:' '/LETS/{print$2}' add-jibri-node.sh|head -n1)"
#Enable jibri services #Enable jibri services
systemctl enable jibri systemctl enable jibri
systemctl enable jibri-xorg systemctl enable jibri-xorg
@ -551,25 +542,15 @@ systemctl enable jibri-icewm
check_snd_driver check_snd_driver
echo -e "\nSending updated add-jibri-node.sh file to main server sync user...\n"
cp $PWD/add-jibri-node.sh /tmp
sudo -u $NJN_USER scp /tmp/add-jibri-node.sh $MJS_USER@$MAIN_SRV_DOMAIN:/home/$MJS_USER/
rm $PWD/add-jibri-node.sh /tmp/add-jibri-node.sh
echo " echo "
######################################################################## ########################################################################
Node addition complete!! Node addition complete!!
IMPORTANT:
The updated version of this file has been sent to the main server
at the sync user home directory, please use that one in order to
install new nodes. For security reason this version has been deleted
from this very node.
For customized support: http://switnet.net For customized support: http://switnet.net
######################################################################## ########################################################################
" "
echo "Rebooting in..." echo "Rebooting in..."
secs=$((15)) secs=$((15))
while [ $secs -gt 0 ]; do while [ $secs -gt 0 ]; do