Matrix Docker Ansible eploy
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

56 lines
2.2 KiB

  1. #jinja2: lstrip_blocks: "True"
  2. [Unit]
  3. Description=Matrix Coturn server
  4. {% for service in matrix_coturn_systemd_required_services_list %}
  5. Requires={{ service }}
  6. After={{ service }}
  7. {% endfor %}
  8. [Service]
  9. Type=simple
  10. ExecStartPre=-{{ matrix_host_command_docker }} kill matrix-coturn
  11. ExecStartPre=-{{ matrix_host_command_docker }} rm matrix-coturn
  12. ExecStart={{ matrix_host_command_docker }} run --rm --name matrix-coturn \
  13. --log-driver=none \
  14. --user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
  15. --cap-drop=ALL \
  16. --entrypoint=turnserver \
  17. --read-only \
  18. --tmpfs=/var/tmp:rw,noexec,nosuid,size=100m \
  19. --network={{ matrix_coturn_docker_network }} \
  20. {% if matrix_coturn_container_stun_plain_host_bind_port != '' %}
  21. -p {{ matrix_coturn_container_stun_plain_host_bind_port }}:3478 \
  22. -p {{ matrix_coturn_container_stun_plain_host_bind_port }}:3478/udp \
  23. {% endif %}
  24. {% if matrix_coturn_container_stun_tls_host_bind_port != '' %}
  25. -p {{ matrix_coturn_container_stun_tls_host_bind_port }}:5349 \
  26. -p {{ matrix_coturn_container_stun_tls_host_bind_port }}:5349/udp \
  27. {% endif %}
  28. {% if matrix_coturn_container_turn_range_listen_interface is not none %}
  29. -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 \
  30. {% endif %}
  31. -v {{ matrix_coturn_config_path }}:/turnserver.conf:ro \
  32. {% for volume in matrix_coturn_container_additional_volumes %}
  33. -v {{ volume.src }}:{{ volume.dst }}:{{ volume.options }} \
  34. {% endfor %}
  35. {% for arg in matrix_coturn_container_extra_arguments %}
  36. {{ arg }} \
  37. {% endfor %}
  38. {{ matrix_coturn_docker_image }} \
  39. -c /turnserver.conf
  40. ExecStop=-{{ matrix_host_command_docker }} kill matrix-coturn
  41. ExecStop=-{{ matrix_host_command_docker }} rm matrix-coturn
  42. # This only reloads certificates (not other configuration).
  43. # See: https://github.com/coturn/coturn/pull/236
  44. ExecReload={{ matrix_host_command_docker }} exec matrix-coturn kill -USR2 1
  45. Restart=always
  46. RestartSec=30
  47. SyslogIdentifier=matrix-coturn
  48. [Install]
  49. WantedBy=multi-user.target