How to achievable of Jitsi Meet Ubuntu Server Setup Multiple Jibri Docker Instances

Install Jitsi Meet using the above steps

Jitsi Meet Server edit prosody file using below command, Change my.domain.com to Jitsi server URL

nano /etc/prosody/conf.d/my.domain.com.cfg.lua

Update the below changes in the file, Change MY.DOMAIN.COM to Jitsi server URL

Component "internal.auth.MY.DOMAIN.COM" "muc"
storage = "memory"
modules_enabled = {
      "ping";
    }
    admins = { "focus@auth.MY.DOMAIN.COM", "jvb@auth.MY.DOMAIN.COM", "jibri@auth.MY.DOMAIN.COM" }
    muc_room_locking = false
    muc_room_default_public_jids = true
    muc_room_cache_size = 1000
    c2s_require_encryption = false

VirtualHost "recorder.MY.DOMAIN.COM"
    modules_enabled = {
        "ping";
    }
    authentication = "internal_plain"
    c2s_require_encryption = false
    allow_empty_token = true

Save the file and run the below command

nano /etc/jitsi/jicofo/sip-communicator.properties

Add the below lines to the file and save the file, change my.domain.com to your Jitsi server URL

org.jitsi.jicofo.jibri.BREWERY=JibriBrewery@internal.auth.my.domain.com
org.jitsi.jicofo.jibri.PENDING_TIMEOUT=90

After that run the below command, change the domain and password to your domain and password

prosodyctl register jibri auth.my.domain.com niceAndLongPassword123
prosodyctl register recorder recorder.my.domain.com niceAndLongPassword123
sudo systemctl restart {prosody,jicofo,jitsi-videobridge2,nginx}

In the Jibri server, install docker-compose using the below link

After that, run the below command to Jibri server


echo "options snd-aloop enable=1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 index=0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31" > /etc/modprobe.d/alsa-loopback.conf

echo "snd-aloop">>/etc/modules
modprobe snd-aloop
lsmod | grep snd_aloop
reboot

ls -alh /proc/asound
docker pull jitsi/jibri
cd ~
mkdir jibri-docker1
cd jibri-docker1
mkdir config
mkdir recordings
nano .env

Add below text to .env file, Also change .env file as per your credential and domain name

# JIBRI CONFIG
# Internal XMPP domain for authenticated services
XMPP_AUTH_DOMAIN=auth.MY.DOMAIN.COM

# XMPP domain for the internal MUC used for jibri, jigasi and jvb pools
XMPP_INTERNAL_MUC_DOMAIN=internal.auth.MY.DOMAIN.COM

# XMPP domain for the jibri recorder
XMPP_RECORDER_DOMAIN=recorder.MY.DOMAIN.COM

# Internal XMPP server
XMPP_SERVER=MY.DOMAIN.COM

# Internal XMPP domain
XMPP_DOMAIN=MY.DOMAIN.COM

# XMPP user for Jibri client connections
JIBRI_XMPP_USER=jibri

# XMPP password for Jibri client connections
JIBRI_XMPP_PASSWORD=YOUR_JIBRI_USER_PASSWORD

# MUC name for the Jibri pool
JIBRI_BREWERY_MUC=jibribrewery

# XMPP recorder user for Jibri client connections
JIBRI_RECORDER_USER=recorder

# XMPP recorder password for Jibri client connections
JIBRI_RECORDER_PASSWORD=YOUR_RECORDER_USER_PASSWORD

# Directory for recordings inside Jibri container
JIBRI_RECORDING_DIR=/config/recordings

# The finalizing script. Will run after recording is complete
JIBRI_FINALIZE_RECORDING_SCRIPT_PATH=/config/finalize.sh

# Public Jitsi Meet Server URL
PUBLIC_URL=https://MY.DOMAIN.COM

# When jibri gets a request to start a service for a room, the room
# jid will look like: roomName@optional.prefixes.subdomain.xmpp_domain
# We'll build the url for the call by transforming that into:
# https://xmpp_domain/subdomain/roomName
# So if there are any prefixes in the jid (like jitsi meet, which
# has its participants join a muc at conference.xmpp_domain) then
# list that prefix here so it can be stripped out to generate
# the call url correctly

JIBRI_STRIP_DOMAIN_JID=conference

# Directory for logs inside Jibri container
JIBRI_LOGS_DIR=/config/logs

DISPLAY=:0=

Save the file by pressing Ctrl + o then press Enter key then press Ctrl + x

Enter the below command to add jibri.yml

nano jibri.yml

Add the below text to the file and save the file

services:
    jibri:
        image: jitsi/jibri
        restart: ${RESTART_POLICY}
        volumes:
            - /dev/shm:/dev/shm
            - /root/jibri-docker1/config:/home/jibri
            - /root/jibri-docker1/config:/config
        cap_add:
            - SYS_ADMIN
            - NET_BIND_SERVICE
        devices:
            - /dev/snd:/dev/snd
        environment:
            - PUBLIC_URL
            - XMPP_AUTH_DOMAIN
            - XMPP_INTERNAL_MUC_DOMAIN
            - XMPP_RECORDER_DOMAIN
            - XMPP_SERVER
            - XMPP_DOMAIN
            - JIBRI_XMPP_USER
            - JIBRI_XMPP_PASSWORD
            - JIBRI_BREWERY_MUC
            - JIBRI_RECORDER_USER
            - JIBRI_RECORDER_PASSWORD
            - JIBRI_RECORDING_DIR
            - JIBRI_FINALIZE_RECORDING_SCRIPT_PATH
            - JIBRI_STRIP_DOMAIN_JID
            - JIBRI_LOGS_DIR
            - DISPLAY=:0
            - TZ

After that run the below command

cd config
nano .asoundrc

Add the below text and save the file

pcm.amix {
  type dmix
  ipc_key 219345
  slave.pcm "hw:Loopback,0,0"
}

pcm.asnoop {
  type dsnoop
  ipc_key 219346
  slave.pcm "hw:Loopback_1,1,0"
}
pcm.aduplex {
  type asym
  playback.pcm "amix"
  capture.pcm "asnoop"
}

pcm.bmix {
  type dmix
  ipc_key 219347
  slave.pcm "hw:Loopback_1,0,0"
}

pcm.bsnoop {
  type dsnoop
  ipc_key 219348
  slave.pcm "hw:Loopback,1,0"
}

pcm.bduplex {
  type asym
  playback.pcm "bmix"
  capture.pcm "bsnoop"
}

pcm.pjsua {
  type plug
  slave.pcm "bduplex"
}

pcm.!default {
  type plug
  slave.pcm "aduplex"
}

After that run the below command

nano finalize.sh

Add the below text and save the file

RECORDINGS_DIR=/config/recordings
VIDEO_FILE_PATH=$(find $RECORDINGS_DIR -name *.mp4)
mkdir -p /home/jibri/recordings
mv $VIDEO_FILE_PATH /home/jibri/recordings

After that run, the below commands

cd ..
chmod -R 777 ~/jibri-docker1
docker-compose -f jibri.yml up -d
docker logs jibri-docker1_jibri_1

Same way for next Jibri instance, Create a folder jibri-docker2 and .asoundrc change text like below

cp -r ~/jibri-docker1 ~/jibri-docker2
nano ~/jibri-docker2/config/.asoundrc

Add the below text and save the file.

pcm.amix {
  type dmix
  ipc_key 219345
  slave.pcm "hw:Loopback_2,0,0"
}
pcm.asnoop {
  type dsnoop
  ipc_key 219346
  slave.pcm "hw:Loopback_3,1,0"
}
pcm.aduplex {
  type asym
  playback.pcm "amix"
  capture.pcm "asnoop"
}
pcm.bmix {
  type dmix
  ipc_key 219347
  slave.pcm "hw:Loopback_3,0,0"
}
pcm.bsnoop {
  type dsnoop
  ipc_key 219348
  slave.pcm "hw:Loopback_2,1,0"
}
pcm.bduplex {
  type asym
  playback.pcm "bmix"
  capture.pcm "bsnoop"
}

pcm.pjsua {
  type plug
  slave.pcm "bduplex"
}

pcm.!default {
  type plug
  slave.pcm "aduplex"
}
nano ~/jibri-docker2/jibri.yml

Change path /root/jibri-docker1/config to /root/jibri-docker2/config

cd ~/jibri-docker2
chmod -R 777 ~/jibri-docker2
docker-compose -f jibri.yml up -d
docker logs jibri-docker2_jibri_1

Credits and references
https://community.jitsi.org/t/setup-guide-jitsi-meet-native-multiple-6-jibri-docker-instances-working-on-the-same-aws-server/94181

Leave a Reply