# Jitsi Autoscaling Setup
## Existing Jitsi Meet Server (cls-vm1)
### 1. Update firewall rules
```
ufw allow 5222/tcp
ufw reload
```
### 2. Update Prosody version to v0.11
```
echo deb http://packages.prosody.im/debian $(lsb_release -sc) main | sudo tee -a /etc/apt/sources.list
wget https://prosody.im/files/prosody-debian-packages.key -O- | sudo apt-key add -
sudo apt-get update
sudo apt-get install prosody
```
### 3. Configure Prosody
You will need to adapt the following files (see the files in [example-config-files/scalable](https://github.com/jitsi/jitsi-meet/tree/master/doc/example-config-files/scalable))
* `/etc/prosody/prosody.cfg.lua`: [prosody.cfg.lua.scalable.example](https://github.com/jitsi/jitsi-meet/blob/master/doc/example-config-files/scalable/prosody.cfg.lua.scalable.example)
* `/etc/prosody/conf.avail/elmo-room-dev-01.apps.bcstechnology.com.au.cfg.lua`: [meet.example.com.cfg.lua.scalable.example](https://github.com/jitsi/jitsi-meet/blob/master/doc/example-config-files/scalable/meet.example.com.cfg.lua.scalable.example)
### 4. Configure Jicofo
You will need to adapt the following files (see the files in [example-config-files/scalable](https://github.com/jitsi/jitsi-meet/tree/master/doc/example-config-files/scalable))
* `/etc/jitsi/jicofo/config` (hostname, jicofo_secret, jicofo_password): [jicofo_config.scalable.example](https://github.com/jitsi/jitsi-meet/blob/master/doc/example-config-files/scalable/jicofo_config.scalable.example)
* `/etc/jitsi/jicofo/sip-communicator.properties` (hostname): [jicofo_config.scalable.example](https://github.com/jitsi/jitsi-meet/blob/master/doc/example-config-files/scalable/jicofo_sip-communicator.properties.scalable.example)
### 5. Restart Prosody and Jicofo
`service prosody restart && service jicofo restart`
---
---
---
## New Video Bridge Server Configuration (cls-vm2, cls-vm3, etc)
### 1. Set the debconf variables
```
cat << EOF | debconf-set-selections
jitsi-videobridge jitsi-videobridge/jvb-hostname string elmo-room-dev-01.apps.bcstechnology.com.au
EOF
```
### 2. Open firewall ports
```
ufw status
ufw allow ssh
ufw allow 443/tcp
ufw allow 4443/tcp
ufw allow 10000:20000/udp
ufw enable
```
### 3. Install Jitsi Video Bridge
```
echo 'deb https://download.jitsi.org stable/' >> /etc/apt/sources.list.d/jitsi-stable.list
wget -qO - https://download.jitsi.org/jitsi-key.gpg.key | apt-key add -
apt-get install apt-transport-https
apt update
apt upgrade
apt -y install jitsi-videobridge2
```
### 3. Paste this into `/etc/jitsi/videobridge/config`
```
# Jitsi Videobridge settings
# sets the XMPP domain (default: none)
JVB_HOSTNAME=elmo-room-dev-01.apps.bcstechnology.com.au
# sets the hostname of the XMPP server (default: domain if set, localhost otherwise)
JVB_HOST=
# sets the port of the XMPP server (default: 5275)
JVB_PORT=5347
# sets the shared secret used to authenticate to the XMPP server
JVB_SECRET=gb006DER
# extra options to pass to the JVB daemon
JVB_OPTS="--apis=,"
# adds java system props that are passed to jvb (default are for home and logging config file)
JAVA_SYS_PROPS="-Dconfig.file=/etc/jitsi/videobridge/jvb.conf -Dnet.java.sip.communicator.SC_HOME_DIR_LOCATION=/etc/jitsi -Dnet.java.sip.communicator.SC_HOME_DIR_NAME=videobridge -Dnet.java.sip.communicator.SC_LOG_DIR_LOCATION=/var/log/jitsi -Djava.util.logging.config.file=/etc/jitsi/videobridge/logging.properties"
```
### 4. Paste this into `/etc/jitsi/videobridge/sip-communicator.properties`
#### IMPORTANT: retain the value of `org.jitsi.videobridge.xmpp.user.shard-1.`
```
org.ice4j.ice.harvest.DISABLE_AWS_HARVESTER=true
org.jitsi.videobridge.DISABLE_TCP_HARVESTER=true
#org.ice4j.ice.harvest.STUN_MAPPING_HARVESTER_ADDRESSES=meet-jit-si-turnrelay.jitsi.net:443
org.jitsi.jicofo.ALWAYS_TRUST_MODE_ENABLED=true
org.jitsi.videobridge.ENABLE_REST_SHUTDOWN=true
org.jitsi.videobridge.ENABLE_STATISTICS=true
org.jitsi.videobridge.STATISTICS_TRANSPORT=muc,colibri,rest
#org.jitsi.videobridge.STATISTICS_TRANSPORT=muc
org.jitsi.videobridge.STATISTICS_INTERVAL=5000
org.jitsi.videobridge.xmpp.user.shard-1.HOSTNAME=elmo-room-dev-01.apps.bcstechnology.com.au
org.jitsi.videobridge.xmpp.user.shard-1.DOMAIN=auth.elmo-room-dev-01.apps.bcstechnology.com.au
org.jitsi.videobridge.xmpp.user.shard-1.USERNAME=jvb
org.jitsi.videobridge.xmpp.user.shard-1.PASSWORD=gb006DER
org.jitsi.videobridge.xmpp.user.shard-1.MUC_JIDS=JvbBrewery@internal.auth.elmo-room-dev-01.apps.bcstechnology.com.a
u
org.jitsi.videobridge.xmpp.user.shard-1.MUC_NICKNAME=98edcab0-6c02-4181-9ac5-382ac042da7b
org.jitsi.videobridge.xmpp.user.shard-1.DISABLE_CERTIFICATE_VERIFICATION=true
```
### 4. Restart Jitsi Video Bridge
`service jitsi-videobridge2 restart`