From 018aeed5e9777deee33aa1bd5394572235b46bdd Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Tue, 19 Mar 2019 09:16:30 +0200 Subject: [PATCH] Add support for mounting additional volumes to matrix-coturn --- roles/matrix-coturn/defaults/main.yml | 6 ++++++ .../templates/systemd/matrix-coturn.service.j2 | 3 +++ 2 files changed, 9 insertions(+) diff --git a/roles/matrix-coturn/defaults/main.yml b/roles/matrix-coturn/defaults/main.yml index 4ae29a342..7edd559bc 100644 --- a/roles/matrix-coturn/defaults/main.yml +++ b/roles/matrix-coturn/defaults/main.yml @@ -17,6 +17,12 @@ matrix_coturn_config_path: "{{ matrix_coturn_base_path }}/turnserver.conf" # List of systemd services that matrix-coturn.service depends on matrix_coturn_systemd_required_services_list: ['docker.service'] +# A list of additional "volumes" to mount in the container. +# This list gets populated dynamically at runtime. You can provide a different default value, +# if you wish to mount your own files into the container. +# Contains definition objects like this: `{"src": "/outside", "dst": "/inside", "options": "rw|ro|slave|.."} +matrix_coturn_container_additional_volumes: [] + # A shared secret (between Synapse and Coturn) used for authentication. # You can put any string here, but generating a strong one is preferred (e.g. `pwgen -s 64 1`). matrix_coturn_turn_static_auth_secret: "" diff --git a/roles/matrix-coturn/templates/systemd/matrix-coturn.service.j2 b/roles/matrix-coturn/templates/systemd/matrix-coturn.service.j2 index 59f18e53e..5cf569c2b 100644 --- a/roles/matrix-coturn/templates/systemd/matrix-coturn.service.j2 +++ b/roles/matrix-coturn/templates/systemd/matrix-coturn.service.j2 @@ -20,6 +20,9 @@ ExecStart=/usr/bin/docker run --rm --name matrix-coturn \ -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_coturn_config_path }}:/turnserver.conf:ro \ + {% for volume in matrix_coturn_container_additional_volumes %} + -v {{ volume.src }}:{{ volume.dst }}:{{ volume.options }} \ + {% endfor %} {{ matrix_coturn_docker_image }} \ -c /turnserver.conf ExecStop=-/usr/bin/docker kill matrix-coturn