From 93734eb7251fde1d4fd9b0504d70977caaea9af5 Mon Sep 17 00:00:00 2001 From: Warren Bailey Date: Tue, 18 Oct 2022 15:04:14 +0100 Subject: [PATCH] add mapping for jvb to hostname/ip --- roles/matrix-nginx-proxy/defaults/main.yml | 6 ++++++ .../templates/nginx/conf.d/matrix-jitsi.conf.j2 | 13 +++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/roles/matrix-nginx-proxy/defaults/main.yml b/roles/matrix-nginx-proxy/defaults/main.yml index 7cdc0c921..63c9d553a 100644 --- a/roles/matrix-nginx-proxy/defaults/main.yml +++ b/roles/matrix-nginx-proxy/defaults/main.yml @@ -646,3 +646,9 @@ matrix_nginx_proxy_synapse_cache_proxy_cache_valid_time: "24h" # http://nginx.org/en/docs/ngx_core_module.html#worker_connections matrix_nginx_proxy_worker_processes: auto matrix_nginx_proxy_worker_connections: 1024 + +# A mapping of JVB ids to hostname for additional jvb blocks to add to Jitsi's server configuration (matrix-jitsi.conf) +matrix_nginx_proxy_proxy_jitsi_additional_jvbs_enabled: false +matrix_nginx_proxy_proxy_jitsi_additional_jvbs: + - jvb-2: 192.168.0.1 + - jvb-3: 192.168.0.2 diff --git a/roles/matrix-nginx-proxy/templates/nginx/conf.d/matrix-jitsi.conf.j2 b/roles/matrix-nginx-proxy/templates/nginx/conf.d/matrix-jitsi.conf.j2 index ba4a2c5b4..f5019b1d4 100644 --- a/roles/matrix-nginx-proxy/templates/nginx/conf.d/matrix-jitsi.conf.j2 +++ b/roles/matrix-nginx-proxy/templates/nginx/conf.d/matrix-jitsi.conf.j2 @@ -53,13 +53,15 @@ tcp_nodelay on; } - + {% if matrix_nginx_proxy_proxy_jitsi_additional_jvbs_enabled %} + {% for jvb in matrix_nginx_proxy_proxy_jitsi_additional_jvbs %} + {% for id in jvb %} # colibri (JVB) websockets for additional JVBs - location ~ ^/colibri-ws/([a-zA-Z0-9-\.]+)/(.*) { - proxy_pass http://$1:9090/colibri-ws/$1/$2$is_args$args; + location ~ ^/colibri-ws/{{ id }}/(.*) { + proxy_pass http://{{ jvb[id] }}:9090/colibri-ws/{{ id }}/$2$is_args$args; proxy_set_header Host $host; - proxy_set_header X-Forwarded-For {{ matrix_nginx_proxy_x_forwarded_for }}; + proxy_set_header X-Forwarded-For {{ matrix_nginx_proxy_x_forwarded_for }}; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; @@ -67,6 +69,9 @@ tcp_nodelay on; } + {% endfor %} + {% endfor %} + {% endif %} # XMPP websocket location = /xmpp-websocket {