Skip to content

Commit 487bcca

Browse files
committed
jvb: try to use the correct IP as the default server ID
This hopefully fixes WS issues on environment with multiple networks such as Docker Swarm.
1 parent 9e982fe commit 487bcca

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

jvb/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ ARG BASE_TAG=latest
33
FROM ${JITSI_REPO}/base-java:${BASE_TAG}
44

55
RUN apt-dpkg-wrap apt-get update && \
6-
apt-dpkg-wrap apt-get install -y jitsi-videobridge2 jq curl iproute2 && \
6+
apt-dpkg-wrap apt-get install -y jitsi-videobridge2 jq curl iproute2 dnsutils && \
77
apt-cleanup
88

99
COPY rootfs/ /

jvb/rootfs/defaults/jvb.conf

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1+
{{ $COLIBRI_REST_ENABLED := .Env.COLIBRI_REST_ENABLED | default "false" | toBool }}
12
{{ $ENABLE_COLIBRI_WEBSOCKET := .Env.ENABLE_COLIBRI_WEBSOCKET | default "1" | toBool }}
23
{{ $ENABLE_OCTO := .Env.ENABLE_OCTO | default "0" | toBool }}
34
{{ $JVB_TCP_PORT := .Env.JVB_TCP_PORT | default "4443" }}
45
{{ $JVB_TCP_MAPPED_PORT := .Env.JVB_TCP_MAPPED_PORT | default $JVB_TCP_PORT }}
56
{{ $PUBLIC_URL_DOMAIN := .Env.PUBLIC_URL | default "https://localhost:8443" | trimPrefix "https://" | trimSuffix "/" -}}
6-
{{ $WS_DOMAIN := .Env.JVB_WS_DOMAIN | default $PUBLIC_URL_DOMAIN -}}
7-
{{ $WS_SERVER_ID := .Env.JVB_WS_SERVER_ID | default .Env.LOCAL_ADDRESS -}}
8-
{{ $COLIBRI_REST_ENABLED := .Env.COLIBRI_REST_ENABLED | default "false" | toBool }}
97
{{ $SHUTDOWN_REST_ENABLED := .Env.SHUTDOWN_REST_ENABLED | default "false" | toBool }}
8+
{{ $WS_DOMAIN := .Env.JVB_WS_DOMAIN | default $PUBLIC_URL_DOMAIN -}}
9+
{{ $WS_SERVER_ID := .Env.JVB_WS_SERVER_ID | default .Env.JVB_WS_SERVER_ID_FALLBACK -}}
1010

1111
videobridge {
1212
ice {
@@ -84,7 +84,6 @@ ice4j {
8484
enabled = false
8585
{{ end -}}
8686
}
87-
8887
static-mappings = [
8988
{{ if .Env.DOCKER_HOST_ADDRESS -}}
9089
{

jvb/rootfs/etc/cont-init.d/10-config

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
#!/usr/bin/with-contenv bash
22

3-
export LOCAL_ADDRESS=$(ip addr show dev "$(ip route|awk '/^default/ { print $5 }')" | grep -oP '(?<=inet\s)\d+(\.\d+){3}')
4-
export SENTRY_RELEASE="${SENTRY_RELEASE:-$(apt-cache policy jitsi-videobridge2 | sed -n '/Installed/p' | sed -e 's/[^:]*: //')}"
5-
63
if [[ -z $JVB_AUTH_PASSWORD ]]; then
74
echo 'FATAL ERROR: JVB auth password must be set'
85
exit 1
@@ -14,6 +11,16 @@ if [[ "$JVB_AUTH_PASSWORD" == "$OLD_JVB_AUTH_PASSWORD" ]]; then
1411
exit 1
1512
fi
1613

14+
# On environments like Swarm the IP address used by the default gateway need not be
15+
# the one used for inter-container traffic. Use that one for our fallback ID.
16+
XMPP_SERVER_IP=$(dig +short ${XMPP_SERVER})
17+
export JVB_WS_SERVER_ID_FALLBACK=$(ip route get ${XMPP_SERVER_IP} | grep -oP '(?<=src ).*' | awk '{ print $1 '})
18+
19+
# Local IP for the ice4j mapping harvester.
20+
export LOCAL_ADDRESS=$(ip route get 1 | grep -oP '(?<=src ).*' | awk '{ print $1 '})
21+
22+
export SENTRY_RELEASE="${SENTRY_RELEASE:-$(apt-cache policy jitsi-videobridge2 | sed -n '/Installed/p' | sed -e 's/[^:]*: //')}"
23+
1724
if [[ -f /config/custom-sip-communicator.properties ]]; then
1825
cat /config/custom-sip-communicator.properties > /config/sip-communicator.properties
1926
fi

0 commit comments

Comments
 (0)