Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: allow multiple videobridges #55

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 12 additions & 45 deletions defaults/main.yml → meet/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
---

jitsi_meet_packages:
- jitsi-meet
- jicofo
- jitsi-meet-prosody
- jitsi-meet-web
- jitsi-meet-web-config
- jitsi-videobridge2

jitsi_meet_server_name: "meet.example.com"
jitsi_meet_videobridge_port: 5347

## single server vs scalable setup
jitsi_meet_single_instance: True
jitsi_meet_videobridge_instances:
- name: 'default-id'
ip: 127.0.0.1

jitsi_meet_jicofo_user: focus
jitsi_meet_jicofo_port: 5347

Expand Down Expand Up @@ -67,56 +71,19 @@ jitsi_meet_title_favicon: images/favicon.ico?v=1

jitsi_meet_debsums_ignore_custom_assets: false

# Octo
jitsi_meet_octo_enabled: False
jitsi_meet_octo_selection_strategy: "RegionBasedBridgeSelectionStrategy"

## Logging
jitsi_meet_logrotate_retained_days: 7
jitsi_meet_loglevel: "WARNING"
jitsi_meet_videobridge_loglevel: "{{ jitsi_meet_loglevel }}"
jitsi_meet_jicofo_loglevel: "{{ jitsi_meet_loglevel }}"
jitsi_meet_jicofo_logging_properties: |
handlers= java.util.logging.ConsoleHandler
#handlers= java.util.logging.ConsoleHandler, com.agafua.syslog.SyslogHandler

java.util.logging.ConsoleHandler.level = {{ jitsi_meet_jicofo_loglevel }}
java.util.logging.ConsoleHandler.formatter = org.jitsi.utils.logging2.JitsiLogFormatter

net.java.sip.communicator.util.ScLogFormatter.programname=JVB

.level= {{ jitsi_meet_jicofo_loglevel }}

org.jitsi.videobridge.xmpp.ComponentImpl.level=FINE

# All of the INFO level logs from MediaStreamImpl are unnecessary in the context of jitsi-videobridge.
org.jitsi.impl.neomedia.MediaStreamImpl.level=WARNING

# Syslog(uncomment handler to use)
com.agafua.syslog.SyslogHandler.transport = udp
com.agafua.syslog.SyslogHandler.facility = local0
com.agafua.syslog.SyslogHandler.port = 514
com.agafua.syslog.SyslogHandler.hostname = localhost
com.agafua.syslog.SyslogHandler.formatter = org.jitsi.utils.logging2.JitsiLogFormatter
com.agafua.syslog.SyslogHandler.escapeNewlines = false

# to disable double timestamps in syslog uncomment next line
#net.java.sip.communicator.util.ScLogFormatter.disableTimestamp=true

# time series logging
java.util.logging.SimpleFormatter.format= %5$s%n
java.util.logging.FileHandler.level = ALL
java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter
java.util.logging.FileHandler.pattern = /tmp/jvb-series.log
java.util.logging.FileHandler.limit = 200000000
java.util.logging.FileHandler.count = 1
java.util.logging.FileHandler.append = false

timeseries.level=OFF
timeseries.org.jitsi.videobridge.cc.vp8.level=ALL
timeseries.useParentHandlers = false
timeseries.handlers = java.util.logging.FileHandler

# Disable nginx access log per default
jitsi_meet_nginx_access_log: "off"
jitsi_meet_nginx_error_log: /var/log/nginx/error.log

jitsi_meet_nginx_ssl_preset: "intermediate"
jitsi_meet_nginx_ssl_presets:
modern:
Expand Down
File renamed without changes.
10 changes: 10 additions & 0 deletions meet/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
galaxy_info:
role_name: meet
dependencies:
- role: systemli.apt_repositories
vars:
apt_repositories:
- preset: jitsi
name: download_jitsi_org
packages: "{{ jitsi_meet_packages }}"
58 changes: 21 additions & 37 deletions tasks/jitsi-meet.yml → meet/tasks/jitsi-meet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
value: "{{ item.value }}"
vtype: "{{ item.vtype }}"
loop:
- name: jitsi-videobridge2
question: jitsi-videobridge/jvb-hostname
value: "{{ jitsi_meet_server_name }}"
vtype: string
- name: jitsi-meet-web-config
question: jitsi-meet/cert-choice
value: "{{ jitsi_meet_cert_choice }}"
Expand All @@ -27,22 +23,25 @@
question: jitsi-meet-prosody/turn-secret
value: "{{ jitsi_meet_turn_secret }}"
vtype: string
- name: jitsi-meet-prosody
question: jitsi-videobridge/jvb-hostname
value: "{{ jitsi_meet_server_name }}"
vtype: string
- name: jitsi-videobridge2
question: jitsi-videobridge/jvb-hostname
value: "{{ jitsi_meet_server_name }}"
vtype: string
- name: jitsi-meet
question: jitsi-meet/jvb-serve
value: "{{ jitsi_meet_single_instance | to_json }}"
vtype: boolean

- name: Install jitsi-meet
apt:
pkg: "{{ jitsi_meet_packages }}"
install_recommends: no
state: present

- name: Copy sip-communicator.properties
template:
src: videobridge/sip-communicator.properties.j2
dest: /etc/jitsi/videobridge/sip-communicator.properties
owner: jvb
group: jitsi
mode: 0640
notify: restart jitsi-videobridge2

- name: Copy jicofo config
template:
src: jicofo/config.j2
Expand All @@ -52,44 +51,29 @@
mode: 0640
notify: restart jicofo

- name: Copy Jicofo log.properties
copy:
content: "{{ jitsi_meet_jicofo_logging_properties }}"
dest: /etc/jitsi/jicofo/logging.properties
- name: Copy jicofo sip-communicator.properties
template:
src: jicofo/sip-communicator.properties.j2
dest: /etc/jitsi/jicofo/sip-communicator.properties
owner: jicofo
group: jitsi
mode: 0640
notify: restart jicofo

- name: Copy jitsi-videobridge2 config
template:
src: videobridge/config.j2
dest: /etc/jitsi/videobridge/config
owner: jvb
group: jitsi
mode: 0640
notify: restart jitsi-videobridge2

- name: Copy jitsi-videobridge2 log.properties
- name: Copy Jicofo logging.properties
template:
src: videobridge/logging.properties.j2
dest: /etc/jitsi/videobridge/logging.properties
owner: jvb
src: jicofo/logging.properties.j2
dest: /etc/jitsi/jicofo/logging.properties
owner: jicofo
group: jitsi
mode: 0640
notify: restart jitsi-videobridge2
notify: restart jicofo

- name: Copy jitsi meet config
template:
mode: 0644
src: meet-config.js.j2
dest: "/etc/jitsi/meet/{{ jitsi_meet_server_name }}-config.js"

- name: Enable jitsi-videobridge2
service:
name: jitsi-videobridge2
enabled: yes

- name: Enable jicofo
service:
name: jicofo
Expand Down
5 changes: 0 additions & 5 deletions tasks/main.yml → meet/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@
- jitsi_meet_turn_secret
when: jitsi_meet_base_secret is defined

- name: Derive videobridge nickname
set_fact:
jitsi_meet_videobridge_muc_nickname: "{{ (jitsi_meet_base_secret | string + 'jvb_muc_nick') | to_uuid }}"
when: jitsi_meet_base_secret is defined

- import_tasks: jitsi-meet.yml
- import_tasks: prosody.yml
- import_tasks: ui_customization.yml
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,9 @@ JICOFO_AUTH_PASSWORD={{ jitsi_meet_jicofo_password }}
JICOFO_OPTS=""

# adds java system props that are passed to jicofo (default are for home and logging config file)
JAVA_SYS_PROPS="-Dnet.java.sip.communicator.SC_HOME_DIR_LOCATION=/etc/jitsi -Dnet.java.sip.communicator.SC_HOME_DIR_NAME=jicofo -Dnet.java.sip.communicator.SC_LOG_DIR_LOCATION=/var/log/jitsi -Djava.util.logging.config.file=/etc/jitsi/jicofo/logging.properties"
JAVA_SYS_PROPS=" \
-Dnet.java.sip.communicator.SC_HOME_DIR_LOCATION=/etc/jitsi \
-Dnet.java.sip.communicator.SC_HOME_DIR_NAME=jicofo \
-Dnet.java.sip.communicator.SC_LOG_DIR_LOCATION=/var/log/jitsi \
-Djava.util.logging.config.file=/etc/jitsi/jicofo/logging.properties \
"
50 changes: 50 additions & 0 deletions meet/templates/jicofo/logging.properties.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
handlers= java.util.logging.ConsoleHandler

# Handlers with XMPP debug enabled:
#handlers= java.util.logging.ConsoleHandler, org.jitsi.impl.protocol.xmpp.log.XmppPacketsFileHandler

# Handlers with syslog enabled:
#handlers= java.util.logging.ConsoleHandler, com.agafua.syslog.SyslogHandler

java.util.logging.ConsoleHandler.level = {{ jitsi_meet_jicofo_loglevel }}
java.util.logging.ConsoleHandler.formatter = org.jitsi.utils.logging2.JitsiLogFormatter
java.util.logging.ConsoleHandler.filter = org.jitsi.impl.protocol.xmpp.log.ExcludeXmppPackets

net.java.sip.communicator.util.ScLogFormatter.programname=Jicofo
.level= {{ jitsi_meet_jicofo_loglevel }}

# To enable XMPP packets logging add XmppPacketsFileHandler to the handlers property
org.jitsi.impl.protocol.xmpp.log.PacketDebugger.level=ALL
org.jitsi.impl.protocol.xmpp.log.XmppPacketsFileHandler.pattern=/var/log/jitsi/jicofo-xmpp.log
org.jitsi.impl.protocol.xmpp.log.XmppPacketsFileHandler.append=true
org.jitsi.impl.protocol.xmpp.log.XmppPacketsFileHandler.limit=200000000
org.jitsi.impl.protocol.xmpp.log.XmppPacketsFileHandler.count=3

# Syslog (uncomment handler to use)
com.agafua.syslog.SyslogHandler.transport = udp
com.agafua.syslog.SyslogHandler.facility = local0
com.agafua.syslog.SyslogHandler.port = 514
com.agafua.syslog.SyslogHandler.hostname = localhost
com.agafua.syslog.SyslogHandler.formatter = org.jitsi.utils.logging2.JitsiLogFormatter
com.agafua.syslog.SyslogHandler.escapeNewlines = false
com.agafua.syslog.SyslogHandler.filter = org.jitsi.impl.protocol.xmpp.log.ExcludeXmppPackets

# to disable double timestamps in syslog uncomment next line
#net.java.sip.communicator.util.ScLogFormatter.disableTimestamp=true

# time series logging
java.util.logging.SimpleFormatter.format= %5$s%n
java.util.logging.FileHandler.level = ALL
java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter
java.util.logging.FileHandler.pattern = /tmp/jvb-series.log
java.util.logging.FileHandler.limit = 200000000
java.util.logging.FileHandler.count = 1
java.util.logging.FileHandler.append = false

timeseries.level=OFF
timeseries.org.jitsi.videobridge.cc.vp8.level=ALL
timeseries.useParentHandlers = false
timeseries.handlers = java.util.logging.FileHandler

# uncomment to see how Jicofo talks to the JVB
#org.jitsi.impl.protocol.xmpp.colibri.level=ALL
6 changes: 6 additions & 0 deletions meet/templates/jicofo/sip-communicator.properties.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[email protected].{{ jitsi_meet_server_name }}

{% if jitsi_meet_octo_enabled -%}
org.jitsi.jicofo.BridgeSelector.BRIDGE_SELECTION_STRATEGY={{ jitsi_meet_octo_selection_strategy }}
org.jitsi.jicofo.SHORT_ID=1
{% endif -%}
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ var config = {
//

testing: {
{% if jitsi_meet_octo_enabled -%}
octo: {
probability: 1
},
{% endif -%}
// P2P test mode disables automatic switching to P2P when there are 2
// participants in the conference.
p2pTestMode: false
Expand Down Expand Up @@ -380,8 +385,8 @@ var config = {
// the user region as seen by the server.
deploymentInfo: {
// shard: "shard1",
// region: "europe",
// userRegion: "asia"
region: "{{ jitsi_meet_octo_region }}",
userRegion: "{{ jitsi_meet_octo_region }}"
},

// Decides whether the start/stop recording audio notifications should play on record.
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,16 @@ server {
tcp_nodelay on;
}

# colibri (JVB) websockets for jvb1
location ~ ^/colibri-ws/default-id/(.*) {
proxy_pass http://127.0.0.1:9090/colibri-ws/default-id/$1$is_args$args;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
tcp_nodelay on;
}
# colibri (JVB) websockets
{% for videobridge in jitsi_meet_videobridge_instances -%}
location ~ ^/colibri-ws/{{ videobridge.name }}/(.*) {
proxy_pass http://{{ videobridge.ip }}:9090/colibri-ws/{{ videobridge.name }}/$1$is_args$args;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
tcp_nodelay on;
}
{% endfor -%}

location ~ ^/([^/?&:'"]+)$ {
try_files $uri @root_path;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ turncredentials = {

cross_domain_bosh = false;
consider_bosh_secure = true;
https_ports = { } -- https is proxied through nginx

VirtualHost "{{ jitsi_meet_server_name }}"
-- enabled = false -- Remove this line to enable this host
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
-- Example: admins = { "[email protected]", "[email protected]" }
admins = { }

network_backend = "epoll"

-- Enable use of libevent for better performance under high load
-- For more information see: https://prosody.im/doc/libevent
--use_libevent = true
Expand Down
File renamed without changes.
8 changes: 2 additions & 6 deletions meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,5 @@ galaxy_info:
notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/
dependencies:
- role: systemli.apt_repositories
vars:
apt_repositories:
- preset: jitsi
name: download_jitsi_org
packages: "{{ jitsi_meet_packages }}"
- role: jitsi_meet/meet
- role: jitsi_meet/videobridge
34 changes: 34 additions & 0 deletions videobridge/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
# Global
jitsi_meet_server_name: "meet.example.com"
jitsi_meet_config_stun_servers:
- meet-jit-si-turnrelay.jitsi.net:443
jitsi_meet_jicofo_user: focus

# Videobridge
jitsi_meet_videobridge_port: 5347

## single server vs scalable setup
jitsi_meet_single_instance: True
jitsi_meet_videobridge_prosody_server_ip: "localhost"
jitsi_meet_videobridge_muc_nickname: "{{ jitsi_meet_single_instance | ternary('jvb1', ansible_hostname) }}"
_jitsi_meet_apt_repositories_pin_packages:
- jicofo
- jitsi-meet-prosody
- jitsi-meet-web
- jitsi-meet-web-config
jitsi_meet_apt_repositories_pin_packages: "{{ ['jitsi-videobridge2'] + (jitsi_meet_single_instance | ternary(_jitsi_meet_apt_repositories_pin_packages, [])) }}"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is ugly, but works.


# Octo
jitsi_meet_octo_enabled: False
jitsi_meet_octo_private_ip: "{{ ansible_default_ipv4.address }}"
jitsi_meet_octo_public_ip: "{{ ansible_default_ipv4.address }}"
jitsi_meet_octo_region: region1

## The packet rate (pps) at which we'll consider the bridge overloaded
jitsi_meet_videobridge_load_threshold: 50000
## The packet rate (pps) at which we'll consider the bridge 'underloaded' enough to start recovery
jitsi_meet_videobridge_recovery_threshold: 40000

## Logging
jitsi_meet_videobridge_loglevel: "WARNING"
5 changes: 5 additions & 0 deletions videobridge/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
- name: restart jitsi-videobridge2
service:
name: jitsi-videobridge2
state: restarted
Loading