From 49923bd1a041790a927d63587823221449a0340e Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Thu, 29 Apr 2021 19:00:06 +0200 Subject: [PATCH] Update to 2021-04-29 19:00 --- roles/jitsi/defaults/main.yml | 17 +++++++++++------ roles/jitsi/tasks/conf.yml | 5 +++++ roles/jitsi/tasks/directories.yml | 5 +++++ roles/jitsi/tasks/facts.yml | 18 ++++++++++++++++++ .../templates/jicofo/sip-communicator.properties.j2 | 2 ++ roles/jitsi/templates/jitsi-confmapper.service.j2 | 1 + roles/jitsi/templates/jitsi-jicofo.service.j2 | 1 + roles/jitsi/templates/jitsi-jigasi.service.j2 | 1 + roles/jitsi/templates/prosody.cfg.lua.j2 | 5 +++++ roles/jitsi_jibri/meta/main.yml | 1 + roles/jitsi_jibri/tasks/conf.yml | 9 +++++++-- roles/jitsi_jibri/tasks/directories.yml | 3 ++- roles/jitsi_jibri/tasks/install.yml | 2 -- roles/jitsi_jibri/templates/jibri.conf.j2 | 8 ++++++++ .../jitsi_jibri/templates/jitsi-jibri-xorg.service.j2 | 3 ++- roles/jitsi_jibri/templates/jitsi-jibri.service.j2 | 4 +++- roles/jitsi_jibri/templates/nginx.conf.j2 | 5 +++++ 17 files changed, 77 insertions(+), 13 deletions(-) create mode 100644 roles/jitsi_jibri/templates/nginx.conf.j2 diff --git a/roles/jitsi/defaults/main.yml b/roles/jitsi/defaults/main.yml index ae33be8..5d07fa4 100644 --- a/roles/jitsi/defaults/main.yml +++ b/roles/jitsi/defaults/main.yml @@ -68,9 +68,7 @@ jitsi_meet_conf_base: domain: "{{ jitsi_domain }}" muc: conference.{{ jitsi_domain }} bosh: '//{{ jitsi_domain }}/http-bind' - # websocket support is broken on prosody 0.11.7 when running lua 5.1 (on EL7), so disable it for now so it fallback to BOSH - # websocket: wss://{{ jitsi_domain }}/xmpp-websocket - websocket: False + websocket: wss://{{ jitsi_domain }}/xmpp-websocket clientNode: http://jitsi.org/jitsimeet focusUserJid: "{{ jitsi_jicofo_xmpp_user }}@{{ jitsi_auth_domain }}" disableAudioLevels: True @@ -95,7 +93,7 @@ jitsi_meet_conf_base: localRecording: enabled: True p2p: - enabled: True + enabled: False useStunTurn: True stunServers: "{{ jitsi_stun_servers }}" preferH264: True @@ -144,7 +142,7 @@ jitsi_meet_interface_conf_base: - hangup - profile - chat - #- recording + - recording #- livestreaming - etherpad - sharedvideo @@ -270,6 +268,13 @@ jitsi_confmapper_conf_base: host: 0.0.0.0 expire_seconds: 86400 id_max_length: 4 - db_file: "{{ jitsi_root_dir }}/data/confmapper.sqlite" + db_file: "{{ jitsi_root_dir }}/data/confmapper/confmapper.sqlite" jitsi_confmapper_conf_extra: {} jitsi_confmapper_conf: "{{ jitsi_confmapper_conf_base | combine(jitsi_confmapper_conf_extra, recursive=True) }}" + +# This is for Jibri integration +jitsi_jibri_xmpp_user: jibri +# jitsi_jibri_xmpp_pass: s3cr3t. +jitsi_jibri_recorder_xmpp_user: recorder +# jitsi_jibri_recorder_xmpp_pass: p@ssw0rd + diff --git a/roles/jitsi/tasks/conf.yml b/roles/jitsi/tasks/conf.yml index 2078412..9a20acf 100644 --- a/roles/jitsi/tasks/conf.yml +++ b/roles/jitsi/tasks/conf.yml @@ -20,6 +20,11 @@ pass: "{{ jitsi_jicofo_xmpp_pass }}" - user: "{{ jitsi_jigasi_xmpp_user }}" pass: "{{ jitsi_jigasi_xmpp_pass }}" + - user: "{{ jitsi_jibri_xmpp_user }}" + pass: "{{ jitsi_jibri_xmpp_pass }}" + + - name: Register recorder XMPP account + command: prosodyctl register {{ jitsi_jibri_recorder_xmpp_user }} recorder.{{ jitsi_domain }} '{{ jitsi_jibri_recorder_xmpp_pass }}' - name: add focus component in focus user roster command: prosodyctl mod_roster_command subscribe focus.{{ jitsi_domain }} {{ jitsi_jicofo_xmpp_user }}@{{ jitsi_auth_domain }} diff --git a/roles/jitsi/tasks/directories.yml b/roles/jitsi/tasks/directories.yml index eae4058..478010e 100644 --- a/roles/jitsi/tasks/directories.yml +++ b/roles/jitsi/tasks/directories.yml @@ -21,6 +21,7 @@ - dir: "{{ jitsi_root_dir }}/src/meet" owner: "{{ jitsi_user }}" - dir: "{{ jitsi_root_dir }}/videobridge" + - dir: "{{ jitsi_root_dir }}/jibri" - dir: "{{ jitsi_root_dir }}/jicofo" - dir: "{{ jitsi_root_dir }}/jigasi" - dir: "{{ jitsi_root_dir }}/meet" @@ -28,6 +29,8 @@ mode: 700 - dir: "{{ jitsi_root_dir }}/archives" mode: 700 + - dir: "{{ jitsi_root_dir }}/etc/" + mode: 755 - dir: "{{ jitsi_root_dir }}/etc/videobridge" owner: "{{ jitsi_user }}" group: "{{ jitsi_user }}" @@ -42,6 +45,8 @@ mode: 700 - dir: "{{ jitsi_root_dir }}/etc/confmapper" - dir: "{{ jitsi_root_dir }}/data" + mode: 755 + - dir: "{{ jitsi_root_dir }}/data/confmapper" owner: "{{ jitsi_user }}" group: "{{ jitsi_user }}" mode: 700 diff --git a/roles/jitsi/tasks/facts.yml b/roles/jitsi/tasks/facts.yml index fe36135..2c0cd6b 100644 --- a/roles/jitsi/tasks/facts.yml +++ b/roles/jitsi/tasks/facts.yml @@ -40,6 +40,24 @@ when: jitsi_jigasi_xmpp_pass is not defined tags: jitsi +- name: Generate a random password for jibri XMPP account + block: + - import_tasks: ../includes/get_rand_pass.yml + vars: + - pass_file: "{{ jitsi_root_dir }}/meta/ansible_jibri_xmpp_pass" + - set_fact: jitsi_jibri_xmpp_pass={{ rand_pass }} + when: jitsi_jibri_xmpp_pass is not defined + tags: jitsi + +- name: Generate a random password for recorder XMPP account + block: + - import_tasks: ../includes/get_rand_pass.yml + vars: + - pass_file: "{{ jitsi_root_dir }}/meta/ansible_jibri_recorder_xmpp_pass" + - set_fact: jitsi_jibri_recorder_xmpp_pass={{ rand_pass }} + when: jitsi_jibri_recorder_xmpp_pass is not defined + tags: jitsi + - name: Set certificate path set_fact: jitsi_cert_path='/etc/prosody/certs/jitsi.crt' when: jitsi_cert_path is not defined diff --git a/roles/jitsi/templates/jicofo/sip-communicator.properties.j2 b/roles/jitsi/templates/jicofo/sip-communicator.properties.j2 index e25516c..408f75e 100644 --- a/roles/jitsi/templates/jicofo/sip-communicator.properties.j2 +++ b/roles/jitsi/templates/jicofo/sip-communicator.properties.j2 @@ -7,3 +7,5 @@ org.jitsi.jicofo.BRIDGE_MUC=JvbBrewery@internal.{{ jitsi_auth_domain }} {% if jitsi_jigasi %} org.jitsi.jicofo.jigasi.BREWERY=JigasiBrewery@internal.{{ jitsi_auth_domain }} {% endif %} +org.jitsi.jicofo.jibri.BREWERY=JibriBrewery@internal.{{ jitsi_auth_domain }} +org.jitsi.jicofo.jibri.PENDING_TIMEOUT=90 diff --git a/roles/jitsi/templates/jitsi-confmapper.service.j2 b/roles/jitsi/templates/jitsi-confmapper.service.j2 index 8a0c0d9..627abd2 100644 --- a/roles/jitsi/templates/jitsi-confmapper.service.j2 +++ b/roles/jitsi/templates/jitsi-confmapper.service.j2 @@ -14,6 +14,7 @@ Restart=on-failure StartLimitInterval=0 RestartSec=30 ExecStart={{ jitsi_root_dir }}/confmapper/daemon.py +SyslogIdentifier=confmapper [Install] WantedBy=multi-user.target diff --git a/roles/jitsi/templates/jitsi-jicofo.service.j2 b/roles/jitsi/templates/jitsi-jicofo.service.j2 index 43c6b3e..eb8c966 100644 --- a/roles/jitsi/templates/jitsi-jicofo.service.j2 +++ b/roles/jitsi/templates/jitsi-jicofo.service.j2 @@ -24,6 +24,7 @@ ExecStart=/opt/jitsi/jicofo/jicofo.sh \ --user_name=${JICOFO_USER} \ --user_password=${JICOFO_USER_PASS} \ ${JICOFO_OPT} +SyslogIdentifier=jicofo [Install] WantedBy=multi-user.target diff --git a/roles/jitsi/templates/jitsi-jigasi.service.j2 b/roles/jitsi/templates/jitsi-jigasi.service.j2 index eebd69f..40c10f7 100644 --- a/roles/jitsi/templates/jitsi-jigasi.service.j2 +++ b/roles/jitsi/templates/jitsi-jigasi.service.j2 @@ -20,6 +20,7 @@ ExecStart=/opt/jitsi/jigasi/jigasi.sh \ --configdirname=jigasi \ --nocomponent=true \ ${JIGASI_OPT} +SyslogIdentifier=jigasi [Install] WantedBy=multi-user.target diff --git a/roles/jitsi/templates/prosody.cfg.lua.j2 b/roles/jitsi/templates/prosody.cfg.lua.j2 index e328861..250aeb3 100644 --- a/roles/jitsi/templates/prosody.cfg.lua.j2 +++ b/roles/jitsi/templates/prosody.cfg.lua.j2 @@ -75,6 +75,11 @@ VirtualHost "{{ jitsi_auth_domain }}" authentication = "internal_hashed" c2s_require_encryption = false +VirtualHost "recorder.{{ jitsi_domain }}" + modules_enabled = { "ping"; } + authentication = "internal_hashed" + c2s_require_encryption = false + Component "conference.{{ jitsi_domain }}" "muc" storage = "memory" modules_enabled = { "ping"; } diff --git a/roles/jitsi_jibri/meta/main.yml b/roles/jitsi_jibri/meta/main.yml index 2ee28b7..3d5f20a 100644 --- a/roles/jitsi_jibri/meta/main.yml +++ b/roles/jitsi_jibri/meta/main.yml @@ -3,3 +3,4 @@ dependencies: - role: repo_rpmfusion # For ffmpeg - role: repo_google_chrome # For, well, Google Chrome ;-) + - role: nginx # For nginx, to expose recordings diff --git a/roles/jitsi_jibri/tasks/conf.yml b/roles/jitsi_jibri/tasks/conf.yml index 08589f0..cebbd78 100644 --- a/roles/jitsi_jibri/tasks/conf.yml +++ b/roles/jitsi_jibri/tasks/conf.yml @@ -41,9 +41,14 @@ - name: Configure snd-aloop to be loaded on boot copy: content: snd-aloop - dest: /etc/modules-load/jibri.conf + dest: /etc/modules-load.d/jibri.conf tags: jitsi - name: Configure asound - template: asound.conf.j2 dest={{ jitsi_root_dir }}/jibri/.asoundrc owner={{ jitsi_jibri_user }} + template: src=asound.conf.j2 dest={{ jitsi_root_dir }}/jibri/.asoundrc owner={{ jitsi_jibri_user }} + tags: jitsi + +- name: Configure nginx to serve recordings + template: src=nginx.conf.j2 dest=/etc/nginx/ansible_location.d/10-jitsi-jibri.conf + notify: reload nginx tags: jitsi diff --git a/roles/jitsi_jibri/tasks/directories.yml b/roles/jitsi_jibri/tasks/directories.yml index 123f975..3dabaa6 100644 --- a/roles/jitsi_jibri/tasks/directories.yml +++ b/roles/jitsi_jibri/tasks/directories.yml @@ -13,5 +13,6 @@ mode: 750 - dir: "{{ jitsi_root_dir }}/data/recordings" owner: "{{ jitsi_jibri_user }}" - mode: 700 + group: nginx + mode: 750 tags: jitsi diff --git a/roles/jitsi_jibri/tasks/install.yml b/roles/jitsi_jibri/tasks/install.yml index a87cad4..7c11d14 100644 --- a/roles/jitsi_jibri/tasks/install.yml +++ b/roles/jitsi_jibri/tasks/install.yml @@ -9,7 +9,6 @@ - ffmpeg - curl - alsa-utils - - icewm - xdotool #- xorg-x11-drv-void - xorg-x11-drv-dummy @@ -71,7 +70,6 @@ loop: - jibri - jibri-xorg - - jibri-icewm register: jitsi_jibri_unit notify: restart jitsi-jibri tags: jitsi diff --git a/roles/jitsi_jibri/templates/jibri.conf.j2 b/roles/jitsi_jibri/templates/jibri.conf.j2 index 02fda94..2bf5949 100644 --- a/roles/jitsi_jibri/templates/jibri.conf.j2 +++ b/roles/jitsi_jibri/templates/jibri.conf.j2 @@ -47,6 +47,14 @@ jibri { ".*" ] } + ffmpeg { + resolution = "1024x768" + + // The audio source that will be used to capture audio on Linux + audio-source = "alsa" + // The audio device that will be used to capture audio on Linux + audio-device = "plug:bsnoop" + } chrome { // The flags which will be passed to chromium when launching flags = [ diff --git a/roles/jitsi_jibri/templates/jitsi-jibri-xorg.service.j2 b/roles/jitsi_jibri/templates/jitsi-jibri-xorg.service.j2 index 559a067..e39718f 100644 --- a/roles/jitsi_jibri/templates/jitsi-jibri-xorg.service.j2 +++ b/roles/jitsi_jibri/templates/jitsi-jibri-xorg.service.j2 @@ -3,6 +3,7 @@ Description=Jibri Xorg Process After=network.target [Service] +Type=simple User={{ jitsi_jibri_user }} Group={{ jitsi_jibri_user }} Environment=DISPLAY=:0 @@ -12,7 +13,7 @@ ExecReload=/bin/kill -HUP $MAINPID KillMode=process Restart=on-failure RestartPreventExitStatus=255 -Type=simple +SyslogIdentifier=jibri-xorg [Install] WantedBy=jitsi-jibri.service jitsi-jibri-icewm.service diff --git a/roles/jitsi_jibri/templates/jitsi-jibri.service.j2 b/roles/jitsi_jibri/templates/jitsi-jibri.service.j2 index c8fec54..06aed1e 100644 --- a/roles/jitsi_jibri/templates/jitsi-jibri.service.j2 +++ b/roles/jitsi_jibri/templates/jitsi-jibri.service.j2 @@ -1,6 +1,7 @@ [Unit] Description=Jitsi Broadcasting Infrastructure After=network.target +Requires=jitsi-jibri-xorg.service [Service] Type=simple @@ -8,10 +9,11 @@ SuccessExitStatus=143 User={{ jitsi_jibri_user }} Group={{ jitsi_jibri_user }} PrivateTmp=true -Restart=on-failure +Restart=always StartLimitInterval=0 RestartSec=30 ExecStart=/bin/java -Dconfig.file={{ jitsi_root_dir }}/etc/jibri/jibri.conf -jar {{ jitsi_root_dir }}/jibri/jibri.jar +SyslogIdentifier=jibri [Install] WantedBy=multi-user.target diff --git a/roles/jitsi_jibri/templates/nginx.conf.j2 b/roles/jitsi_jibri/templates/nginx.conf.j2 new file mode 100644 index 0000000..f83db22 --- /dev/null +++ b/roles/jitsi_jibri/templates/nginx.conf.j2 @@ -0,0 +1,5 @@ +# Serve recordings through nginx +location ~* /recordings/.+\.mp4 { + alias /opt/jitsi/data/recordings; + add_header Content-disposition "attachment"; +}