#!bin/bash # Activating Debug mode echo "Press CTRL+C to proceed." trap "pkill -f 'sleep 1h'" INT trap "set +x ; sleep 1h ; set -x" DEBUG clear echo " ***********************************************" echo " * *" echo " * WELCOME TO THE CLUSTERMEET INSTALLER *" echo " * powered by clusteres.com *" echo " * *" echo " ***********************************************" echo " " echo " " echo " " echo "Before executing this script, make sure to meet the following requisites:" echo " 1. Properly configure OPNsense: Alias, Forward NAT Rule UDP, Real Server, BackendPool, Condition, Rule, PublicServer" echo " 2. Replace favicon.ico, watermark.png, background.png for company ones in images/ folder" echo " 3. \$COMPANYSUBDOMAIN CNAME record in cloudflare pointing to ragnar.zh.com.pa" echo "" echo "" echo "WARNING: Execute this script only once!" echo "" read -r -p "Do you want to continue installing this Jitsi Meet server? Choose \"No\" to Cancel and Exit [y/N]: " response case $response in [yY][eE][sS]|[yY]) echo "Starting Jitsi Meet installation..." ;; *) exit 1 ;; esac # source the user data file containing the variables source ~/ClusterMeetConfigurator/.env LOCALIP=`ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p'` PUBLICIP=`curl icanhazip.com` # Update repos and install dependencies apt update apt install apt-transport-https # Change the hostname hostnamectl set-hostname $COMPANYSUBDOMAIN # Add record to hosts file echo "$PUBLICIP $COMPANYSUBDOMAIN.$COMPANYDOMAIN $COMPANYSUBDOMAIN" >> /etc/hosts # Download jitsi repo and update curl https://download.jitsi.org/jitsi-key.gpg.key | sudo sh -c 'gpg --dearmor > /usr/share/keyrings/jitsi-keyring.gpg' echo 'deb [signed-by=/usr/share/keyrings/jitsi-keyring.gpg] https://download.jitsi.org stable/' | sudo tee /etc/apt/sources.list.d/jitsi-stable.list > /dev/null apt update # Install jitsi meet apt install jitsi-meet # Add SSL certificates from letsencrypt /usr/share/jitsi-meet/scripts/install-letsencrypt-cert.sh # Adapting config to work properly behind NAT echo "org.jitsi.videobridge.SINGLE_PORT_HARVESTER_PORT=$UDPPORT org.ice4j.ice.harvest.NAT_HARVESTER_LOCAL_ADDRESS=$LOCALIP org.ice4j.ice.harvest.NAT_HARVESTER_PUBLIC_ADDRESS=$PUBLICIP" >> /etc/jitsi/videobridge/sip-communicator.properties sed -i 's/org.ice4j.ice.harvest.STUN_MAPPING_HARVESTER_ADDRESSES/#org.ice4j.ice.harvest.STUN_MAPPING_HARVESTER_ADDRESSES/g' /etc/jitsi/videobridge/sip-communicator.properties rm -rf /etc/nginx/modules-enabled/60-jitsi-meet.conf sed -i "s/4444/443/g" >> "/etc/nginx/sites-available/$COMPANYSUBDOMAIN.$COMPANYDOMAIN.conf" read -r -p "Do you want to customize this Jitsi Meet server? Choose \"No\" to Cancel and Exit [y/N]: " response case $response in [yY][eE][sS]|[yY]) echo "Starting Jitsi Customization..." /bin/bash ~/ClusterMeetConfigurator/configure.sh ;; *) echo "Bye" exit 1 ;; esac