Matrix Docker Ansible eploy
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 

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