Switching from from avhost/docker-matrix (silviof/docker-matrix) to matrixdotorg/synapse. The avhost/docker-matrix (silviof/docker-matrix) image used to bundle in the coturn STUN/TURN server, so as part of the move, we're separating this to a separately-ran service (matrix-coturn.service, powered by instrumentisto/coturn-docker-image)development
parent
3af3ef48fc
commit
b3e62126db
@ -0,0 +1,42 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
- name: Fail if Coturn secret is missing
|
||||||
|
fail:
|
||||||
|
msg: "You need to set a secret in the matrix_coturn_turn_static_auth_secret variable"
|
||||||
|
when: "matrix_coturn_turn_static_auth_secret == ''"
|
||||||
|
|
||||||
|
- name: Ensure Coturn image is pulled
|
||||||
|
docker_image:
|
||||||
|
name: "{{ docker_coturn_image }}"
|
||||||
|
|
||||||
|
- name: Ensure Coturn configuration path exists
|
||||||
|
file:
|
||||||
|
path: "{{ matrix_coturn_base_path }}"
|
||||||
|
state: directory
|
||||||
|
mode: 0750
|
||||||
|
owner: "{{ matrix_user_username }}"
|
||||||
|
group: "{{ matrix_user_username }}"
|
||||||
|
|
||||||
|
- name: Ensure turnserver.conf installed
|
||||||
|
template:
|
||||||
|
src: "{{ role_path }}/templates/coturn/turnserver.conf.j2"
|
||||||
|
dest: "{{ matrix_coturn_config_path }}"
|
||||||
|
mode: 0644
|
||||||
|
|
||||||
|
- name: Ensure matrix-coturn.service installed
|
||||||
|
template:
|
||||||
|
src: "{{ role_path }}/templates/systemd/matrix-coturn.service.j2"
|
||||||
|
dest: "/etc/systemd/system/matrix-coturn.service"
|
||||||
|
mode: 0644
|
||||||
|
|
||||||
|
- name: Allow access to Coturn ports in firewalld
|
||||||
|
firewalld:
|
||||||
|
port: "{{ item }}"
|
||||||
|
state: enabled
|
||||||
|
immediate: yes
|
||||||
|
permanent: yes
|
||||||
|
with_items:
|
||||||
|
- '3478/tcp' # STUN
|
||||||
|
- '3478/udp' # STUN
|
||||||
|
- "{{ matrix_coturn_turn_udp_min_port }}-{{ matrix_coturn_turn_udp_max_port }}/udp" # TURN
|
||||||
|
when: ansible_os_family == 'RedHat'
|
@ -0,0 +1,15 @@
|
|||||||
|
lt-cred-mech
|
||||||
|
use-auth-secret
|
||||||
|
static-auth-secret={{ matrix_coturn_turn_static_auth_secret }}
|
||||||
|
realm=turn.{{ hostname_matrix }}
|
||||||
|
cert=/matrix-config/{{ hostname_matrix }}.tls.crt
|
||||||
|
pkey=/matrix-config/{{ hostname_matrix }}.tls.key
|
||||||
|
dh-file=/matrix-config/{{ hostname_matrix }}.tls.dh
|
||||||
|
cipher-list="HIGH"
|
||||||
|
min-port={{ matrix_coturn_turn_udp_min_port }}
|
||||||
|
max-port={{ matrix_coturn_turn_udp_max_port }}
|
||||||
|
external-ip={{ matrix_coturn_turn_external_ip_address }}
|
||||||
|
log-file=stdout
|
||||||
|
pidfile=/var/tmp/turnserver.pid
|
||||||
|
userdb=/var/tmp/turnserver.db
|
||||||
|
no-cli
|
@ -0,0 +1,25 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Matrix Coturn server
|
||||||
|
After=docker.service
|
||||||
|
Requires=docker.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
ExecStartPre=-/usr/bin/docker kill matrix-coturn
|
||||||
|
ExecStartPre=-/usr/bin/docker rm matrix-coturn
|
||||||
|
ExecStart=/usr/bin/docker run --rm --name matrix-coturn \
|
||||||
|
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
|
||||||
|
-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_config_dir_path }}:/matrix-config:ro \
|
||||||
|
-v {{ matrix_coturn_config_path }}:/turnserver.conf:ro \
|
||||||
|
{{ docker_coturn_image }} \
|
||||||
|
-c /turnserver.conf
|
||||||
|
ExecStop=-/usr/bin/docker kill matrix-coturn
|
||||||
|
ExecStop=-/usr/bin/docker rm matrix-coturn
|
||||||
|
Restart=always
|
||||||
|
RestartSec=30
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
Loading…
Reference in new issue