Script for Autoscaling JVB

Hi All,

In order to allow autoscaling of JVB, there are a few steps required:

Signalling server:

  1. Add mod_admin_rest module in prosody module folder /usr/lib/prosody/modules/mod_admin_rest.lua. (https://github.com/wltsmrz/mod_admin_rest)
  2. Modify /etc/prosody/prosody.cfg.lua and add an admin account (e.g. admin@meet.jit.si) and enable admin_rest module.
  3. Reload prosody.
  4. Open port 5280 access to the JVB instances.

JVB image server:
4. On a fresh install of JVB2, modify /usr/share/jitsi-videobridge/jvb.sh and add the following lines on top

RAND=`openssl rand -hex 5`
USERNAME=jvb$RAND
BRIDGE=bridge$RAND
JVB_SECRET=`openssl rand -hex 10`
NICKNAME=`uuidgen`
LOCAL_ADDRESS=`hostname -I | awk '{print $1}'`
PUBLIC_ADDRESS=`curl ifconfig.me`
sed -i "s/\(JVB_SECRET=\).*\$/\1${JVB_SECRET}/" /etc/jitsi/videobridge/config
sed -i "s/\(org.jitsi.videobridge.xmpp.user.shard.USERNAME=\).*\$/\1${USERNAME}/" /etc/jitsi/videobridge/sip-communicator.properties
sed -i "s/\(org.jitsi.videobridge.xmpp.user.shard.PASSWORD=\).*\$/\1${JVB_SECRET}/" /etc/jitsi/videobridge/sip-communicator.properties
sed -i "s/\(org.jitsi.videobridge.xmpp.user.shard.MUC_NICKNAME=\).*\$/\1${NICKNAME}/" /etc/jitsi/videobridge/sip-communicator.properties
sed -i "s/\(org.ice4j.ice.harvest.NAT_HARVESTER_LOCAL_ADDRESS=\).*\$/\1${LOCAL_ADDRESS}/" /etc/jitsi/videobridge/sip-communicator.properties
sed -i "s/\(org.ice4j.ice.harvest.NAT_HARVESTER_PUBLIC_ADDRESS=\).*\$/\1${PUBLIC_ADDRESS}/" /etc/jitsi/videobridge/sip-communicator.properties
sed -i "s/\(org.jitsi.videobridge.octo.BIND_ADDRESS=\).*\$/\1${LOCAL_ADDRESS}/" /etc/jitsi/videobridge/sip-communicator.properties
sed -i "s/\(org.jitsi.videobridge.octo.PUBLIC_ADDRESS=\).*\$/\1${PUBLIC_ADDRESS}/" /etc/jitsi/videobridge/sip-communicator.properties
sed -i "s/\(org.jitsi.videobridge.REGION=\).*\$/\1${BRIDGE}/" /etc/jitsi/videobridge/sip-communicator.properties
URL="http://meet.jit.si:5280/admin_rest/user/$USERNAME"
curl --location --request POST $URL --header 'Content-Type: application/json' --header 'Host: auth.meet.jit.si' --header 'Authorization: Basic YWRtaW5AbWVldC5qaXQuc2k6cGFzc3dvcmQ=' --data '{"password":"'"$JVB_SECRET"'"}'

What this does is generate a random JVB username and password and register to prosody by a webservice call.

We have implented this and it is working well for us. Additionally, make sure that jvb2 is setup properly before modifying jvb.sh, things such as updating ca cert should be in place.

Regards,
Anthony

You can use same jvb username and password just different nickname, that way you create the username and password once.

Thanks for the tip!