Matrix Docker Ansible eploy
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

61 lines
2.5 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. DefaultDependencies=no
  9. PartOf=matrix.target
  10. [Service]
  11. Type=simple
  12. Environment="HOME={{ matrix_systemd_unit_home_path }}"
  13. ExecStartPre=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} stop matrix-coturn 2>/dev/null'
  14. ExecStartPre=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} rm matrix-coturn 2>/dev/null'
  15. ExecStart={{ matrix_host_command_docker }} run --rm --name matrix-coturn \
  16. --log-driver=none \
  17. --user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
  18. --cap-drop=ALL \
  19. --cap-add=NET_BIND_SERVICE \
  20. --entrypoint=turnserver \
  21. --read-only \
  22. --tmpfs=/var/tmp:rw,noexec,nosuid,size=100m \
  23. --network={{ matrix_coturn_docker_network }} \
  24. {% if matrix_coturn_container_stun_plain_host_bind_port != '' %}
  25. -p {{ matrix_coturn_container_stun_plain_host_bind_port }}:3478 \
  26. -p {{ matrix_coturn_container_stun_plain_host_bind_port }}:3478/udp \
  27. {% endif %}
  28. {% if matrix_coturn_container_stun_tls_host_bind_port != '' %}
  29. -p {{ matrix_coturn_container_stun_tls_host_bind_port }}:5349 \
  30. -p {{ matrix_coturn_container_stun_tls_host_bind_port }}:5349/udp \
  31. {% endif %}
  32. {% if matrix_coturn_container_turn_range_listen_interface is not none %}
  33. -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 \
  34. {% endif %}
  35. --mount type=bind,src={{ matrix_coturn_config_path }},dst=/turnserver.conf,ro \
  36. {% for volume in matrix_coturn_container_additional_volumes %}
  37. -v {{ volume.src }}:{{ volume.dst }}:{{ volume.options }} \
  38. {% endfor %}
  39. {% for arg in matrix_coturn_container_extra_arguments %}
  40. {{ arg }} \
  41. {% endfor %}
  42. {{ matrix_coturn_docker_image }} \
  43. -c /turnserver.conf
  44. ExecStop=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} stop matrix-coturn 2>/dev/null'
  45. ExecStop=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} rm matrix-coturn 2>/dev/null'
  46. # This only reloads certificates (not other configuration).
  47. # See: https://github.com/coturn/coturn/pull/236
  48. ExecReload={{ matrix_host_command_docker }} exec matrix-coturn kill -USR2 1
  49. Restart=always
  50. RestartSec=30
  51. SyslogIdentifier=matrix-coturn
  52. [Install]
  53. WantedBy=matrix.target