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.
This commit is contained in:
Saúl Ibarra Corretgé
2022-09-26 20:44:40 +02:00
parent 723acc20ef
commit c53de728ce
4 changed files with 19 additions and 6 deletions

View File

@@ -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 -}}
]
}

View File

@@ -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})