From c53de728cedf54edcbb94e104b3a45fd029f8b9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Mon, 26 Sep 2022 20:44:40 +0200 Subject: [PATCH] jvb: add JVB_ADVERTISE_IPS, deprecating DOCKER_HOST_ADDRESS The new variable has a better purposed name, and supports a comma separated list of IPs instead of a single one, which should help those running split-horizon setups. --- docker-compose.yml | 1 + env.example | 5 +++-- jvb/rootfs/defaults/jvb.conf | 11 +++++++---- jvb/rootfs/etc/cont-init.d/10-config | 8 ++++++++ 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index ec81ca1..f1f6a1d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -308,6 +308,7 @@ services: - ENABLE_COLIBRI_WEBSOCKET - ENABLE_OCTO - ENABLE_MULTI_STREAM + - JVB_ADVERTISE_IPS - JVB_ADVERTISE_PRIVATE_CANDIDATES - JVB_AUTH_USER - JVB_AUTH_PASSWORD diff --git a/env.example b/env.example index 4595f10..81f3b0f 100644 --- a/env.example +++ b/env.example @@ -30,10 +30,11 @@ TZ=UTC # Public URL for the web service (required) #PUBLIC_URL=https://meet.example.com -# IP address of the Docker host +# Media IP addresses to advertise by the JVB +# This setting deprecates DOCKER_HOST_ADDRESS, and supports a comma separated list of IPs # See the "Running behind NAT or on a LAN environment" section in the Handbook: # https://jitsi.github.io/handbook/docs/devops-guide/devops-guide-docker#running-behind-nat-or-on-a-lan-environment -#DOCKER_HOST_ADDRESS=192.168.1.1 +#JVB_ADVERTISE_IPS=192.168.1.1,1.2.3.4 # diff --git a/jvb/rootfs/defaults/jvb.conf b/jvb/rootfs/defaults/jvb.conf index 2d3b457..998ae49 100644 --- a/jvb/rootfs/defaults/jvb.conf +++ b/jvb/rootfs/defaults/jvb.conf @@ -8,6 +8,8 @@ {{ $JVB_BREWERY_MUC := .Env.JVB_BREWERY_MUC | default "jvbbrewery" -}} {{ $JVB_MUC_NICKNAME := .Env.JVB_MUC_NICKNAME | default .Env.HOSTNAME -}} {{ $JVB_ADVERTISE_PRIVATE_CANDIDATES := .Env.JVB_ADVERTISE_PRIVATE_CANDIDATES | default "true" | toBool -}} +{{ $JVB_ADVERTISE_IPS := .Env.JVB_ADVERTISE_IPS | default "" -}} +{{ $JVB_IPS := splitList "," $JVB_ADVERTISE_IPS -}} {{ $PUBLIC_URL_DOMAIN := .Env.PUBLIC_URL | default "https://localhost:8443" | trimPrefix "https://" | trimSuffix "/" -}} {{ $SHUTDOWN_REST_ENABLED := .Env.SHUTDOWN_REST_ENABLED | default "false" | toBool -}} {{ $WS_DOMAIN := .Env.JVB_WS_DOMAIN | default $PUBLIC_URL_DOMAIN -}} @@ -96,11 +98,12 @@ ice4j { {{ end -}} } static-mappings = [ -{{ if .Env.DOCKER_HOST_ADDRESS -}} +{{ range $index, $element := $JVB_IPS -}} { - local-address = "{{ .Env.LOCAL_ADDRESS }}" - public-address = "{{ .Env.DOCKER_HOST_ADDRESS }}" - } + local-address = "{{ $ENV.LOCAL_ADDRESS }}" + public-address = "{{ $element }}" + name = "ip-{{ $index }}" + }, {{ end -}} ] } diff --git a/jvb/rootfs/etc/cont-init.d/10-config b/jvb/rootfs/etc/cont-init.d/10-config index d3b1047..62beddf 100644 --- a/jvb/rootfs/etc/cont-init.d/10-config +++ b/jvb/rootfs/etc/cont-init.d/10-config @@ -13,6 +13,14 @@ fi [ -z "${XMPP_SERVER}" ] && export XMPP_SERVER=xmpp.meet.jitsi +# Migration from DOCKER_HOST_ADDRESS to JVB_ADVERTISE_IPS +if [[ -z "${JVB_ADVERTISE_IPS}" ]]; then + if [[ ! -z "${DOCKER_HOST_ADDRESS}" ]]; then + echo "WARNING: DOCKER_HOST_ADDRESS is deprecated, migrate to JVB_ADVERTISE_IPS" + export JVB_ADVERTISE_IPS=${DOCKER_HOST_ADDRESS} + fi +fi + # On environments like Swarm the IP address used by the default gateway need not be # the one used for inter-container traffic. Use that one for our fallback ID. XMPP_SERVER_IP=$(dig +short +search ${XMPP_SERVER})