jibri: add jibri service
This commit is contained in:
committed by
Saúl Ibarra Corretgé
parent
af305af880
commit
ffa017b74d
48
jibri/Dockerfile
Normal file
48
jibri/Dockerfile
Normal file
@@ -0,0 +1,48 @@
|
||||
ARG JITSI_REPO=jitsi
|
||||
FROM ${JITSI_REPO}/base-java
|
||||
|
||||
ARG CHROME_RELEASE=latest
|
||||
ARG CHROMEDRIVER_MAJOR_RELEASE=latest
|
||||
|
||||
RUN \
|
||||
apt-dpkg-wrap apt-get update \
|
||||
&& apt-dpkg-wrap apt-get install -y jibri \
|
||||
&& apt-cleanup
|
||||
|
||||
RUN \
|
||||
[ "${CHROME_RELEASE}" = "latest" ] \
|
||||
&& curl -4s https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
|
||||
&& echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list \
|
||||
&& apt-dpkg-wrap apt-get update \
|
||||
&& apt-dpkg-wrap apt-get install -y google-chrome-stable \
|
||||
&& apt-cleanup \
|
||||
|| true
|
||||
|
||||
RUN \
|
||||
[ "${CHROME_RELEASE}" != "latest" ] \
|
||||
&& curl -4so /tmp/google-chrome-stable_${CHROME_RELEASE}_amd64.deb http://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_RELEASE}_amd64.deb \
|
||||
&& apt-dpkg-wrap apt-get update \
|
||||
&& apt-dpkg-wrap apt-get install -y /tmp/google-chrome-stable_${CHROME_RELEASE}_amd64.deb \
|
||||
&& apt-cleanup \
|
||||
|| true
|
||||
|
||||
RUN \
|
||||
[ "${CHROMEDRIVER_MAJOR_RELEASE}" = "latest" ] \
|
||||
&& CHROMEDRIVER_RELEASE="$(curl -4Ls https://chromedriver.storage.googleapis.com/LATEST_RELEASE)" \
|
||||
|| CHROMEDRIVER_RELEASE="$(curl -4Ls https://chromedriver.storage.googleapis.com/LATEST_RELEASE_${CHROMEDRIVER_MAJOR_RELEASE})" \
|
||||
&& curl -4Ls https://chromedriver.storage.googleapis.com/${CHROMEDRIVER_RELEASE}/chromedriver_linux64.zip \
|
||||
| zcat >> /usr/bin/chromedriver \
|
||||
&& chmod +x /usr/bin/chromedriver \
|
||||
&& chromedriver --version
|
||||
|
||||
RUN \
|
||||
[ "$JITSI_RELEASE" = "unstable" ] \
|
||||
&& apt-dpkg-wrap apt-get update \
|
||||
&& apt-dpkg-wrap apt-get install -y jitsi-upload-integrations \
|
||||
&& apt-cleanup \
|
||||
|| true
|
||||
|
||||
COPY rootfs/ /
|
||||
|
||||
VOLUME /config
|
||||
|
||||
4
jibri/Makefile
Normal file
4
jibri/Makefile
Normal file
@@ -0,0 +1,4 @@
|
||||
build:
|
||||
docker build $(BUILD_ARGS) -t $(JITSI_REPO)/jibri .
|
||||
|
||||
.PHONY: build
|
||||
58
jibri/rootfs/defaults/config.json
Normal file
58
jibri/rootfs/defaults/config.json
Normal file
@@ -0,0 +1,58 @@
|
||||
{
|
||||
"recording_directory":"{{ .Env.JIBRI_RECORDING_DIR }}",
|
||||
// The path to the script which will be run on completed recordings
|
||||
"finalize_recording_script_path": "{{ .Env.JIBRI_FINALIZE_RECORDING_SCRIPT_PATH }}",
|
||||
"xmpp_environments": [
|
||||
{
|
||||
// A friendly name for this environment which can be used
|
||||
// for logging, stats, etc.
|
||||
"name": "prod environment",
|
||||
// The hosts of the XMPP servers to connect to as part of
|
||||
// this environment
|
||||
"xmpp_server_hosts": [
|
||||
"{{ .Env.XMPP_SERVER }}"
|
||||
],
|
||||
"xmpp_domain": "{{ .Env.XMPP_DOMAIN }}",
|
||||
// Jibri will login to the xmpp server as a privileged user
|
||||
"control_login": {
|
||||
"domain": "{{ .Env.XMPP_AUTH_DOMAIN }}",
|
||||
// The credentials for logging in
|
||||
"username": "{{ .Env.JIBRI_XMPP_USER }}",
|
||||
"password": "{{ .Env.JIBRI_XMPP_PASSWORD }}"
|
||||
},
|
||||
// Using the control_login information above, Jibri will join
|
||||
// a control muc as a means of announcing its availability
|
||||
// to provide services for a given environment
|
||||
"control_muc": {
|
||||
"domain": "{{ .Env.XMPP_INTERNAL_MUC_DOMAIN }}",
|
||||
"room_name": "{{ .Env.JIBRI_BREWERY_MUC }}",
|
||||
// MUST be unic for every instanse
|
||||
"nickname": "jibri-instanse-{{ .Env.JIBRI_INSTANCE_ID }}"
|
||||
},
|
||||
// All participants in a call join a muc so they can exchange
|
||||
// information. Jibri can be instructed to join a special muc
|
||||
// with credentials to give it special abilities (e.g. not being
|
||||
// displayed to other users like a normal participant)
|
||||
"call_login": {
|
||||
"domain": "{{ .Env.XMPP_RECORDER_DOMAIN }}",
|
||||
"username": "{{ .Env.JIBRI_RECORDER_USER }}",
|
||||
"password": "{{ .Env.JIBRI_RECORDER_PASSWORD }}"
|
||||
},
|
||||
// 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
|
||||
"room_jid_domain_string_to_strip_from_start": "{{ .Env.JIBRI_STRIP_DOMAIN_JID }}.",
|
||||
// The amount of time, in minutes, a service is allowed to continue.
|
||||
// Once a service has been running for this long, it will be
|
||||
// stopped (cleanly). A value of 0 means an indefinite amount
|
||||
// of time is allowed
|
||||
"usage_timeout": "0"
|
||||
}
|
||||
]
|
||||
}
|
||||
33
jibri/rootfs/defaults/logging.properties
Normal file
33
jibri/rootfs/defaults/logging.properties
Normal file
@@ -0,0 +1,33 @@
|
||||
handlers = java.util.logging.FileHandler, java.util.logging.ConsoleHandler
|
||||
|
||||
java.util.logging.FileHandler.level = FINE
|
||||
java.util.logging.FileHandler.pattern = {{ .Env.JIBRI_LOGS_DIR }}/log.%g.txt
|
||||
java.util.logging.FileHandler.formatter = net.java.sip.communicator.util.ScLogFormatter
|
||||
java.util.logging.FileHandler.count = 10
|
||||
java.util.logging.FileHandler.limit = 10000000
|
||||
|
||||
org.jitsi.jibri.capture.ffmpeg.util.FfmpegFileHandler.level = FINE
|
||||
org.jitsi.jibri.capture.ffmpeg.util.FfmpegFileHandler.pattern = {{ .Env.JIBRI_LOGS_DIR }}/ffmpeg.%g.txt
|
||||
org.jitsi.jibri.capture.ffmpeg.util.FfmpegFileHandler.formatter = net.java.sip.communicator.util.ScLogFormatter
|
||||
org.jitsi.jibri.capture.ffmpeg.util.FfmpegFileHandler.count = 10
|
||||
org.jitsi.jibri.capture.ffmpeg.util.FfmpegFileHandler.limit = 10000000
|
||||
|
||||
org.jitsi.jibri.sipgateway.pjsua.util.PjsuaFileHandler.level = FINE
|
||||
org.jitsi.jibri.sipgateway.pjsua.util.PjsuaFileHandler.pattern = {{ .Env.JIBRI_LOGS_DIR }}/pjsua.%g.txt
|
||||
org.jitsi.jibri.sipgateway.pjsua.util.PjsuaFileHandler.formatter = net.java.sip.communicator.util.ScLogFormatter
|
||||
org.jitsi.jibri.sipgateway.pjsua.util.PjsuaFileHandler.count = 10
|
||||
org.jitsi.jibri.sipgateway.pjsua.util.PjsuaFileHandler.limit = 10000000
|
||||
|
||||
org.jitsi.jibri.selenium.util.BrowserFileHandler.level = FINE
|
||||
org.jitsi.jibri.selenium.util.BrowserFileHandler.pattern = {{ .Env.JIBRI_LOGS_DIR }}/browser.%g.txt
|
||||
org.jitsi.jibri.selenium.util.BrowserFileHandler.formatter = net.java.sip.communicator.util.ScLogFormatter
|
||||
org.jitsi.jibri.selenium.util.BrowserFileHandler.count = 10
|
||||
org.jitsi.jibri.selenium.util.BrowserFileHandler.limit = 10000000
|
||||
|
||||
java.util.logging.ConsoleHandler.level = FINE
|
||||
java.util.logging.ConsoleHandler.formatter = net.java.sip.communicator.util.ScLogFormatter
|
||||
|
||||
org.jitsi.level = FINE
|
||||
|
||||
org.glassfish.level = INFO
|
||||
org.osgi.level = INFO
|
||||
38
jibri/rootfs/etc/cont-init.d/10-config
Normal file
38
jibri/rootfs/etc/cont-init.d/10-config
Normal file
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
|
||||
# DISPLAY is necessary for start
|
||||
[ -z "${DISPLAY}" ] \
|
||||
&& ( echo -e "\e[31mERROR: Please set DISPLAY variable.\e[39m"; kill 1; exit 1 )
|
||||
|
||||
# check loaded snd_aloop module and exit if is not loaded on the host
|
||||
[ -z "$(lsmod | grep -om1 snd_aloop)" ] \
|
||||
&& ( echo -e "\e[31mERROR: Please load snd-aloop module on the docker host.\e[39m"; kill 1; exit 1 )
|
||||
|
||||
# get host's audio group id
|
||||
host_audio_group="$(stat -c %g /dev/snd/pcmC0D0p)"
|
||||
# try to create group with this id. If group with the id already exists, just skip
|
||||
groupadd -g ${host_audio_group} jibri-audio >/dev/null 2>&1
|
||||
# include user to the group by id
|
||||
usermod -aG ${host_audio_group} jibri
|
||||
|
||||
# script for finalizing must have executing bit.
|
||||
[ ! -z "${JIBRI_FINALIZE_RECORDING_SCRIPT_PATH}" ] \
|
||||
&& [ ! -x "${JIBRI_FINALIZE_RECORDING_SCRIPT_PATH}" ] \
|
||||
&& chmod +x ${JIBRI_FINALIZE_RECORDING_SCRIPT_PATH}
|
||||
|
||||
# set rundom jibri nickname for the instance if is not set
|
||||
[ -z "${JIBRI_INSTANCE_ID}" ] && export JIBRI_INSTANCE_ID=$(date +%N)
|
||||
|
||||
# always recreate configs
|
||||
tpl /defaults/config.json > /etc/jitsi/jibri/config.json
|
||||
tpl /defaults/logging.properties > /etc/jitsi/jibri/logging.properties
|
||||
|
||||
# make recording dir
|
||||
[ -z "${JIBRI_RECORDING_DIR}" ] && export JIBRI_RECORDING_DIR=/config/recordings
|
||||
mkdir -p ${JIBRI_RECORDING_DIR}
|
||||
chown -R jibri ${JIBRI_RECORDING_DIR}
|
||||
|
||||
# make logs dir
|
||||
[ -z "${JIBRI_LOGS_DIR}" ] && export JIBRI_LOGS_DIR=/config/logs
|
||||
mkdir -p ${JIBRI_LOGS_DIR}
|
||||
chown -R jibri ${JIBRI_LOGS_DIR}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"CommandLineFlagSecurityWarningsEnabled": false
|
||||
}
|
||||
|
||||
5
jibri/rootfs/etc/services.d/10-xorg/run
Normal file
5
jibri/rootfs/etc/services.d/10-xorg/run
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
|
||||
DAEMON="/usr/bin/Xorg -nocursor -noreset +extension RANDR +extension RENDER -logfile /tmp/xorg.log -config /etc/jitsi/jibri/xorg-video-dummy.conf ${DISPLAY}"
|
||||
exec s6-setuidgid jibri /bin/bash -c "exec $DAEMON"
|
||||
|
||||
5
jibri/rootfs/etc/services.d/20-icewm/run
Normal file
5
jibri/rootfs/etc/services.d/20-icewm/run
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
|
||||
DAEMON="/usr/bin/icewm-session"
|
||||
exec s6-setuidgid jibri /bin/bash -c "exec $DAEMON"
|
||||
|
||||
8
jibri/rootfs/etc/services.d/30-jibri/run
Normal file
8
jibri/rootfs/etc/services.d/30-jibri/run
Normal file
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
|
||||
# we have to set it, otherwise chrome won't find ~/.asoundrc file
|
||||
HOME=/home/jibri
|
||||
|
||||
DAEMON=/opt/jitsi/jibri/launch.sh
|
||||
exec s6-setuidgid jibri /bin/bash -c "exec $DAEMON"
|
||||
|
||||
Reference in New Issue
Block a user