Skip to content

Commit b277926

Browse files
sapkrasaghul
authored andcommitted
jvb: make colibri websocket endpoints dynamic for multiple jvbs
1 parent 991f695 commit b277926

File tree

4 files changed

+11
-13
lines changed

4 files changed

+11
-13
lines changed

jvb/rootfs/defaults/sip-communicator.properties

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ org.jitsi.videobridge.TCP_HARVESTER_PORT={{ .Env.JVB_TCP_PORT }}
44
{{ if .Env.JVB_STUN_SERVERS }}
55
org.ice4j.ice.harvest.STUN_MAPPING_HARVESTER_ADDRESSES={{ .Env.JVB_STUN_SERVERS }}
66
{{ end }}
7+
{{ if .Env.DOCKER_HOST_ADDRESS }}
8+
org.ice4j.ice.harvest.NAT_HARVESTER_LOCAL_ADDRESS={{ .Env.LOCAL_ADDRESS }}
9+
org.ice4j.ice.harvest.NAT_HARVESTER_PUBLIC_ADDRESS={{ .Env.DOCKER_HOST_ADDRESS }}
10+
{{ end }}
711
{{ $JVB_TCP_PORT := .Env.JVB_TCP_PORT | default "4443" }}
812
{{ $JVB_TCP_MAPPED_PORT := .Env.JVB_TCP_MAPPED_PORT | default $JVB_TCP_PORT }}
913
{{ if not (eq $JVB_TCP_PORT $JVB_TCP_MAPPED_PORT) }}
@@ -28,5 +32,6 @@ org.jitsi.videobridge.rest.COLIBRI_WS_DISABLE=false
2832
org.jitsi.videobridge.rest.jetty.port=9090
2933
org.jitsi.videobridge.rest.COLIBRI_WS_DOMAIN={{ $WS_DOMAIN }}
3034
org.jitsi.videobridge.rest.COLIBRI_WS_TLS=true
35+
org.jitsi.videobridge.rest.COLIBRI_WS_SERVER_ID={{ .Env.LOCAL_ADDRESS }}
3136

3237
org.jitsi.videobridge.rest.private.jetty.host=0.0.0.0

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
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+
35
if [[ -z $JVB_AUTH_PASSWORD ]]; then
46
echo 'FATAL ERROR: JVB auth password must be set'
57
exit 1

jvb/rootfs/etc/services.d/jvb/run

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,7 @@
11
#!/usr/bin/with-contenv bash
22

3-
JAVA_SYS_PROPS="-Dnet.java.sip.communicator.SC_HOME_DIR_LOCATION=/ -Dnet.java.sip.communicator.SC_HOME_DIR_NAME=config -Djava.util.logging.config.file=/config/logging.properties"
4-
5-
if [[ ! -z "$DOCKER_HOST_ADDRESS" ]]; then
6-
LOCAL_ADDRESS=$(ip route get "$DOCKER_HOST_ADDRESS" | head -n1 | cut -d " " -f7)
7-
JAVA_SYS_PROPS="$JAVA_SYS_PROPS -Dorg.ice4j.ice.harvest.NAT_HARVESTER_LOCAL_ADDRESS=$LOCAL_ADDRESS -Dorg.ice4j.ice.harvest.NAT_HARVESTER_PUBLIC_ADDRESS=$DOCKER_HOST_ADDRESS"
8-
fi
3+
export JAVA_SYS_PROPS="-Dnet.java.sip.communicator.SC_HOME_DIR_LOCATION=/ -Dnet.java.sip.communicator.SC_HOME_DIR_NAME=config -Djava.util.logging.config.file=/config/logging.properties"
94

105
DAEMON=/usr/share/jitsi-videobridge/jvb.sh
11-
DEFAULT_DAEMON_OPTS="none"
12-
13-
DAEMON_OPTS=${JVB_ENABLE_APIS:=$DEFAULT_DAEMON_OPTS}
14-
15-
exec s6-setuidgid jvb /bin/bash -c "JAVA_SYS_PROPS=\"$JAVA_SYS_PROPS\" exec $DAEMON --apis=${DAEMON_OPTS}"
166

7+
exec s6-setuidgid jvb /bin/bash -c "exec $DAEMON --apis=${JVB_ENABLE_APIS:="none"}"

web/rootfs/defaults/meet.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ location ~ ^/(libs|css|static|images|fonts|lang|sounds|connection_optimization|.
3535
}
3636

3737
# colibri (JVB) websockets
38-
location ~ ^/colibri-ws/default-id/(.*) {
39-
proxy_pass http://jvb.meet.jitsi:9090/colibri-ws/default-id/$1$is_args$args;
38+
location ~ ^/colibri-ws/([a-zA-Z0-9-\.]+)/(.*) {
39+
proxy_pass http://$1:9090/colibri-ws/$1/$2$is_args$args;
4040
proxy_http_version 1.1;
4141
proxy_set_header Upgrade $http_upgrade;
4242
proxy_set_header Connection "upgrade";

0 commit comments

Comments
 (0)