From 360361e5ea40ba509cae94ca7c33aa9304410ed8 Mon Sep 17 00:00:00 2001 From: Aaron van Meerten Date: Tue, 19 Mar 2024 07:46:34 -0500 Subject: [PATCH] jibri: move xmpp config for easier override (#1748) * jibri: move xmpp config for easier override * fix order of operations --- jibri/rootfs/defaults/jibri.conf | 80 +------------------------- jibri/rootfs/defaults/xmpp.conf | 77 +++++++++++++++++++++++++ jibri/rootfs/etc/cont-init.d/10-config | 1 + 3 files changed, 80 insertions(+), 78 deletions(-) create mode 100644 jibri/rootfs/defaults/xmpp.conf diff --git a/jibri/rootfs/defaults/jibri.conf b/jibri/rootfs/defaults/jibri.conf index ac357a8..993052f 100644 --- a/jibri/rootfs/defaults/jibri.conf +++ b/jibri/rootfs/defaults/jibri.conf @@ -1,29 +1,12 @@ -{{ $JIBRI_XMPP_USER := .Env.JIBRI_XMPP_USER | default "jibri" -}} -{{ $JIBRI_RECORDER_USER := .Env.JIBRI_RECORDER_USER | default "recorder" -}} -{{ $JIBRI_USAGE_TIMEOUT := .Env.JIBRI_USAGE_TIMEOUT | default "0" -}} {{ $JIBRI_RECORDING_RESOLUTION := .Env.JIBRI_RECORDING_RESOLUTION | default "1280x720" -}} {{ $JIBRI_RECORDING_VIDEO_ENCODE_PRESET := .Env.JIBRI_RECORDING_VIDEO_ENCODE_PRESET | default "veryfast" -}} {{ $JIBRI_RECORDING_CONSTANT_RATE_FACTOR := .Env.JIBRI_RECORDING_CONSTANT_RATE_FACTOR | default 25 -}} {{ $JIBRI_RECORDING_FRAMERATE := .Env.JIBRI_RECORDING_FRAMERATE | default 30 -}} {{ $JIBRI_RECORDING_QUEUE_SIZE := .Env.JIBRI_RECORDING_QUEUE_SIZE | default 4096 -}} {{ $JIBRI_RECORDING_STREAMING_MAX_BITRATE := .Env.JIBRI_RECORDING_STREAMING_MAX_BITRATE | default 2976 -}} -{{ $JIBRI_BREWERY_MUC := .Env.JIBRI_BREWERY_MUC | default "jibribrewery" -}} {{ $JIBRI_SINGLE_USE_MODE := .Env.JIBRI_SINGLE_USE_MODE | default "false" -}} -{{ $XMPP_AUTH_DOMAIN := .Env.XMPP_AUTH_DOMAIN | default "auth.meet.jitsi" -}} -{{ $XMPP_DOMAIN := .Env.XMPP_DOMAIN | default "meet.jitsi" -}} -{{ $XMPP_INTERNAL_MUC_DOMAIN := .Env.XMPP_INTERNAL_MUC_DOMAIN | default "internal-muc.meet.jitsi" -}} -{{ $XMPP_MUC_DOMAIN := .Env.XMPP_MUC_DOMAIN | default "muc.meet.jitsi" -}} -{{ $XMPP_MUC_DOMAIN_PREFIX := (split "." $XMPP_MUC_DOMAIN)._0 -}} -{{ $JIBRI_STRIP_DOMAIN_JID := .Env.JIBRI_STRIP_DOMAIN_JID | default $XMPP_MUC_DOMAIN_PREFIX -}} -{{ $XMPP_RECORDER_DOMAIN := .Env.XMPP_RECORDER_DOMAIN | default "recorder.meet.jitsi" -}} -{{ $XMPP_TRUST_ALL_CERTS := .Env.XMPP_TRUST_ALL_CERTS | default "true" | toBool -}} -{{ $XMPP_PORT := .Env.XMPP_PORT | default "5222" -}} -{{ $XMPP_SERVER := .Env.XMPP_SERVER | default "xmpp.meet.jitsi" -}} -{{ $XMPP_SERVERS := splitList "," $XMPP_SERVER -}} {{ $STATSD_HOST := .Env.JIBRI_STATSD_HOST | default "localhost" -}} {{ $STATSD_PORT := .Env.JIBRI_STATSD_PORT | default "8125" -}} -{{/* assign env from context, preserve during range when . is re-assigned */}} -{{ $ENV := .Env -}} jibri { // A unique identifier for this Jibri @@ -45,67 +28,6 @@ jibri { {{ end -}} } {{ end -}} - xmpp { - // See example_xmpp_envs.conf for an example of what is expected here - environments = [ -{{ range $index, $element := $XMPP_SERVERS -}} -{{ $SERVER := splitn ":" 2 $element }} - { - // A user-friendly name for this environment - name = "{{ $ENV.XMPP_ENV_NAME }}-{{$index}}" - - // A list of XMPP server hosts to which we'll connect - xmpp-server-hosts = [ - "{{ $SERVER._0 }}" - ] - - // The base XMPP domain - xmpp-domain = "{{ $XMPP_DOMAIN }}" - - {{ if $ENV.PUBLIC_URL -}} - // An (optional) base url the Jibri will join if it is set - base-url = "{{ $ENV.PUBLIC_URL }}" - {{ end -}} - - // The MUC we'll join to announce our presence for - // recording and streaming services - control-muc { - domain = "{{ $XMPP_INTERNAL_MUC_DOMAIN }}" - room-name = "{{ $JIBRI_BREWERY_MUC }}" - nickname = "{{ $ENV.JIBRI_INSTANCE_ID }}" - } - - // The login information for the control MUC - control-login { - domain = "{{ $XMPP_AUTH_DOMAIN }}" - port = "{{ $SERVER._1 | default $XMPP_PORT }}" - username = "{{ $JIBRI_XMPP_USER }}" - password = "{{ $ENV.JIBRI_XMPP_PASSWORD }}" - } - - // The login information the selenium web client will use - call-login { - domain = "{{ $XMPP_RECORDER_DOMAIN }}" - username = "{{ $JIBRI_RECORDER_USER }}" - password = "{{ $ENV.JIBRI_RECORDER_PASSWORD }}" - } - - // The value we'll strip from the room JID domain to derive - // the call URL - strip-from-room-domain = "{{ $JIBRI_STRIP_DOMAIN_JID }}." - - // How long Jibri sessions will be allowed to last before - // they are stopped. A value of 0 allows them to go on - // indefinitely - usage-timeout = "{{ $JIBRI_USAGE_TIMEOUT }}" - - // Whether or not we'll automatically trust any cert on - // this XMPP domain - trust-all-xmpp-certs = {{ $XMPP_TRUST_ALL_CERTS }} - } -{{ end }} - ] - } } recording { recordings-directory = "{{ .Env.JIBRI_RECORDING_DIR | default "/config/recordings" }}" @@ -162,3 +84,5 @@ jibri { } {{ end -}} } + +include "xmpp.conf" diff --git a/jibri/rootfs/defaults/xmpp.conf b/jibri/rootfs/defaults/xmpp.conf new file mode 100644 index 0000000..c8e58f3 --- /dev/null +++ b/jibri/rootfs/defaults/xmpp.conf @@ -0,0 +1,77 @@ +{{ $JIBRI_BREWERY_MUC := .Env.JIBRI_BREWERY_MUC | default "jibribrewery" -}} +{{ $XMPP_MUC_DOMAIN := .Env.XMPP_MUC_DOMAIN | default "muc.meet.jitsi" -}} +{{ $XMPP_MUC_DOMAIN_PREFIX := (split "." $XMPP_MUC_DOMAIN)._0 -}} +{{ $JIBRI_STRIP_DOMAIN_JID := .Env.JIBRI_STRIP_DOMAIN_JID | default $XMPP_MUC_DOMAIN_PREFIX -}} +{{ $JIBRI_RECORDER_USER := .Env.JIBRI_RECORDER_USER | default "recorder" -}} +{{ $JIBRI_USAGE_TIMEOUT := .Env.JIBRI_USAGE_TIMEOUT | default "0" -}} +{{ $JIBRI_XMPP_USER := .Env.JIBRI_XMPP_USER | default "jibri" -}} +{{ $XMPP_AUTH_DOMAIN := .Env.XMPP_AUTH_DOMAIN | default "auth.meet.jitsi" -}} +{{ $XMPP_DOMAIN := .Env.XMPP_DOMAIN | default "meet.jitsi" -}} +{{ $XMPP_INTERNAL_MUC_DOMAIN := .Env.XMPP_INTERNAL_MUC_DOMAIN | default "internal-muc.meet.jitsi" -}} +{{ $XMPP_RECORDER_DOMAIN := .Env.XMPP_RECORDER_DOMAIN | default "recorder.meet.jitsi" -}} +{{ $XMPP_TRUST_ALL_CERTS := .Env.XMPP_TRUST_ALL_CERTS | default "true" | toBool -}} +{{ $XMPP_PORT := .Env.XMPP_PORT | default "5222" -}} +{{ $XMPP_SERVER := .Env.XMPP_SERVER | default "xmpp.meet.jitsi" -}} +{{ $XMPP_SERVERS := splitList "," $XMPP_SERVER -}} +{{/* assign env from context, preserve during range when . is re-assigned */}} +{{ $ENV := .Env -}} + +jibri.api.xmpp.environments = [ + // See example_xmpp_envs.conf for an example of what is expected here +{{ range $index, $element := $XMPP_SERVERS -}} +{{ $SERVER := splitn ":" 2 $element }} + { + // A user-friendly name for this environment + name = "{{ $ENV.XMPP_ENV_NAME }}-{{$index}}" + + // A list of XMPP server hosts to which we'll connect + xmpp-server-hosts = [ + "{{ $SERVER._0 }}" + ] + + // The base XMPP domain + xmpp-domain = "{{ $XMPP_DOMAIN }}" + + {{ if $ENV.PUBLIC_URL -}} + // An (optional) base url the Jibri will join if it is set + base-url = "{{ $ENV.PUBLIC_URL }}" + {{ end -}} + + // The MUC we'll join to announce our presence for + // recording and streaming services + control-muc { + domain = "{{ $XMPP_INTERNAL_MUC_DOMAIN }}" + room-name = "{{ $JIBRI_BREWERY_MUC }}" + nickname = "{{ $ENV.JIBRI_INSTANCE_ID }}" + } + + // The login information for the control MUC + control-login { + domain = "{{ $XMPP_AUTH_DOMAIN }}" + port = "{{ $SERVER._1 | default $XMPP_PORT }}" + username = "{{ $JIBRI_XMPP_USER }}" + password = "{{ $ENV.JIBRI_XMPP_PASSWORD }}" + } + + // The login information the selenium web client will use + call-login { + domain = "{{ $XMPP_RECORDER_DOMAIN }}" + username = "{{ $JIBRI_RECORDER_USER }}" + password = "{{ $ENV.JIBRI_RECORDER_PASSWORD }}" + } + + // The value we'll strip from the room JID domain to derive + // the call URL + strip-from-room-domain = "{{ $JIBRI_STRIP_DOMAIN_JID }}." + + // How long Jibri sessions will be allowed to last before + // they are stopped. A value of 0 allows them to go on + // indefinitely + usage-timeout = "{{ $JIBRI_USAGE_TIMEOUT }}" + + // Whether or not we'll automatically trust any cert on + // this XMPP domain + trust-all-xmpp-certs = {{ $XMPP_TRUST_ALL_CERTS }} + } +{{ end }} +] diff --git a/jibri/rootfs/etc/cont-init.d/10-config b/jibri/rootfs/etc/cont-init.d/10-config index 9d3b1f5..7f9a0ce 100644 --- a/jibri/rootfs/etc/cont-init.d/10-config +++ b/jibri/rootfs/etc/cont-init.d/10-config @@ -69,6 +69,7 @@ fi # always recreate configs tpl /defaults/jibri.conf > /etc/jitsi/jibri/jibri.conf +tpl /defaults/xmpp.conf > /etc/jitsi/jibri/xmpp.conf tpl /defaults/logging.properties > /etc/jitsi/jibri/logging.properties tpl /defaults/xorg-video-dummy.conf > /etc/jitsi/jibri/xorg-video-dummy.conf