2019-05-07 21:23:35 +02:00
|
|
|
#jinja2: lstrip_blocks: "True"
|
2018-05-25 20:58:53 +02:00
|
|
|
[Unit]
|
|
|
|
Description=Matrix Coturn server
|
2019-01-16 18:05:48 +02:00
|
|
|
{% for service in matrix_coturn_systemd_required_services_list %}
|
|
|
|
Requires={{ service }}
|
|
|
|
After={{ service }}
|
|
|
|
{% endfor %}
|
2020-12-10 11:36:39 +02:00
|
|
|
DefaultDependencies=no
|
2018-05-25 20:58:53 +02:00
|
|
|
|
|
|
|
[Service]
|
|
|
|
Type=simple
|
2021-01-15 00:21:55 +02:00
|
|
|
Environment="HOME={{ matrix_systemd_unit_home_path }}"
|
2021-01-27 10:22:46 +02:00
|
|
|
ExecStartPre=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} kill matrix-coturn 2>/dev/null'
|
|
|
|
ExecStartPre=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} rm matrix-coturn 2>/dev/null'
|
2019-03-19 10:24:39 +02:00
|
|
|
|
2020-05-27 18:53:52 +02:00
|
|
|
ExecStart={{ matrix_host_command_docker }} run --rm --name matrix-coturn \
|
2018-09-26 08:11:19 +02:00
|
|
|
--log-driver=none \
|
2018-05-25 20:58:53 +02:00
|
|
|
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
|
2019-01-28 11:22:54 +02:00
|
|
|
--cap-drop=ALL \
|
2021-04-19 17:16:26 +02:00
|
|
|
--cap-add=NET_BIND_SERVICE \
|
2019-03-19 10:24:39 +02:00
|
|
|
--entrypoint=turnserver \
|
2019-01-29 18:52:02 +02:00
|
|
|
--read-only \
|
|
|
|
--tmpfs=/var/tmp:rw,noexec,nosuid,size=100m \
|
2019-03-18 17:36:00 +02:00
|
|
|
--network={{ matrix_coturn_docker_network }} \
|
2019-12-20 12:21:43 +02:00
|
|
|
{% if matrix_coturn_container_stun_plain_host_bind_port != '' %}
|
|
|
|
-p {{ matrix_coturn_container_stun_plain_host_bind_port }}:3478 \
|
|
|
|
-p {{ matrix_coturn_container_stun_plain_host_bind_port }}:3478/udp \
|
|
|
|
{% endif %}
|
|
|
|
{% if matrix_coturn_container_stun_tls_host_bind_port != '' %}
|
|
|
|
-p {{ matrix_coturn_container_stun_tls_host_bind_port }}:5349 \
|
|
|
|
-p {{ matrix_coturn_container_stun_tls_host_bind_port }}:5349/udp \
|
|
|
|
{% endif %}
|
|
|
|
{% if matrix_coturn_container_turn_range_listen_interface is not none %}
|
|
|
|
-p {{ matrix_coturn_container_turn_range_listen_interface }}{{ ':' if matrix_coturn_container_turn_range_listen_interface else '' }}{{ 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 \
|
|
|
|
{% endif %}
|
2020-11-25 10:49:59 +02:00
|
|
|
--mount type=bind,src={{ matrix_coturn_config_path }},dst=/turnserver.conf,ro \
|
2019-03-19 09:16:30 +02:00
|
|
|
{% for volume in matrix_coturn_container_additional_volumes %}
|
|
|
|
-v {{ volume.src }}:{{ volume.dst }}:{{ volume.options }} \
|
|
|
|
{% endfor %}
|
2019-04-30 16:35:18 +02:00
|
|
|
{% for arg in matrix_coturn_container_extra_arguments %}
|
|
|
|
{{ arg }} \
|
|
|
|
{% endfor %}
|
2018-11-01 08:46:47 +02:00
|
|
|
{{ matrix_coturn_docker_image }} \
|
2018-05-25 20:58:53 +02:00
|
|
|
-c /turnserver.conf
|
2019-03-19 10:24:39 +02:00
|
|
|
|
2021-01-27 10:22:46 +02:00
|
|
|
ExecStop=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} kill matrix-coturn 2>/dev/null'
|
|
|
|
ExecStop=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} rm matrix-coturn 2>/dev/null'
|
2019-03-19 10:24:39 +02:00
|
|
|
|
|
|
|
# This only reloads certificates (not other configuration).
|
|
|
|
# See: https://github.com/coturn/coturn/pull/236
|
2020-05-27 18:53:52 +02:00
|
|
|
ExecReload={{ matrix_host_command_docker }} exec matrix-coturn kill -USR2 1
|
2019-03-19 10:24:39 +02:00
|
|
|
|
2018-05-25 20:58:53 +02:00
|
|
|
Restart=always
|
|
|
|
RestartSec=30
|
2019-05-16 02:41:45 +02:00
|
|
|
SyslogIdentifier=matrix-coturn
|
2018-05-25 20:58:53 +02:00
|
|
|
|
|
|
|
[Install]
|
|
|
|
WantedBy=multi-user.target
|