Enable TURN support and UDP for STUN

development
Slavi Pantaleev 7 years ago
parent 7b980525a4
commit 13eaee2463

@ -58,15 +58,27 @@
line: '\1user: "{{ matrix_postgres_connection_username }}"\n\1password: "{{ matrix_postgres_connection_password }}"\n\1database: "homeserver"\n\1host: "postgres"\n\1cp_min: 5\n\1cp_max: 10' line: '\1user: "{{ matrix_postgres_connection_username }}"\n\1password: "{{ matrix_postgres_connection_password }}"\n\1database: "homeserver"\n\1host: "postgres"\n\1cp_min: 5\n\1cp_max: 10'
backrefs: yes backrefs: yes
- name: Augment Matrix config (configure Coturn)
lineinfile: "dest={{ matrix_synapse_data_path }}/turnserver.conf"
args:
regexp: "^{{ item.variable }}="
line: '{{ item.variable }}={{ item.value }}'
with_items:
- {'variable': 'min-port', 'value': "{{ matrix_coturn_turn_udp_min_port }}"}
- {'variable': 'max-port', 'value': "{{ matrix_coturn_turn_udp_max_port }}"}
- {'variable': 'external-ip', 'value': "{{ matrix_coturn_turn_external_ip_address }}"}
- name: Allow access to Matrix ports in firewalld - name: Allow access to Matrix ports in firewalld
firewalld: firewalld:
port: "{{ item }}/tcp" port: "{{ item }}"
state: enabled state: enabled
immediate: yes immediate: yes
permanent: yes permanent: yes
with_items: with_items:
- 3478 # Coturn - '8448/tcp' # Matrix federation
- 8448 # Matrix federation - '3478/tcp' # STUN
- '3478/udp' # STUN
- "{{ matrix_coturn_turn_udp_min_port }}-{{ matrix_coturn_turn_udp_max_port }}/udp" # TURN
- name: Ensure matrix-synapse.service installed - name: Ensure matrix-synapse.service installed
template: template:

@ -14,6 +14,8 @@ ExecStart=/usr/bin/docker run --rm --name matrix-synapse \
--link matrix-postgres:postgres \ --link matrix-postgres:postgres \
-p 8448:8448 \ -p 8448:8448 \
-p 3478:3478 \ -p 3478:3478 \
-p 3478:3478/udp \
-p {{ matrix_coturn_turn_udp_min_port }}-{{ matrix_coturn_turn_udp_max_port }}:{{ matrix_coturn_turn_udp_min_port }}-{{ matrix_coturn_turn_udp_max_port }}/udp \
-v {{ matrix_synapse_data_path }}:/data \ -v {{ matrix_synapse_data_path }}:/data \
-v {{ ssl_certs_path }}:/acmetool-certs \ -v {{ ssl_certs_path }}:/acmetool-certs \
{{ docker_matrix_image }} {{ docker_matrix_image }}

@ -38,4 +38,10 @@ docker_riot_image: "silviof/matrix-riot-docker"
# Specifies when to restart the Matrix services so that # Specifies when to restart the Matrix services so that
# a new SSL certificate could go into effect (UTC time). # a new SSL certificate could go into effect (UTC time).
matrix_services_restart_cron_time_definition: "15 4 3 * *" matrix_services_restart_cron_time_definition: "15 4 3 * *"
# UDP port-range to use for TURN
matrix_coturn_turn_udp_min_port: 49152
matrix_coturn_turn_udp_max_port: 49172
matrix_coturn_turn_external_ip_address: "{{ ansible_host }}"

Loading…
Cancel
Save