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.
 
 

71 linhas
3.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. [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 -t {{ 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. ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \
  15. --rm \
  16. --name=matrix-coturn \
  17. --log-driver=none \
  18. --user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
  19. --cap-drop=ALL \
  20. --cap-add=NET_BIND_SERVICE \
  21. --entrypoint=turnserver \
  22. --read-only \
  23. --tmpfs=/var/tmp:rw,noexec,nosuid,size=100m \
  24. --network={{ matrix_coturn_container_network }} \
  25. {% if matrix_coturn_container_stun_plain_host_bind_port_tcp != '' %}
  26. -p {{ matrix_coturn_container_stun_plain_host_bind_port_tcp }}:3478 \
  27. {% endif %}
  28. {% if matrix_coturn_container_stun_plain_host_bind_port_udp != '' %}
  29. -p {{ matrix_coturn_container_stun_plain_host_bind_port_udp }}:3478/udp \
  30. {% endif %}
  31. {% if matrix_coturn_container_stun_tls_host_bind_port_tcp != '' %}
  32. -p {{ matrix_coturn_container_stun_tls_host_bind_port_tcp }}:5349 \
  33. {% endif %}
  34. {% if matrix_coturn_container_stun_tls_host_bind_port_udp != '' %}
  35. -p {{ matrix_coturn_container_stun_tls_host_bind_port_udp }}:5349/udp \
  36. {% endif %}
  37. {% if matrix_coturn_container_turn_range_listen_interface is not in [none, 'none'] %}
  38. -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 \
  39. {% endif %}
  40. --mount type=bind,src={{ matrix_coturn_config_path }},dst=/turnserver.conf,ro \
  41. {% for volume in matrix_coturn_container_additional_volumes %}
  42. --mount type={{ volume.type | default('bind' if '/' in volume.src else 'volume') }},src={{ volume.src }},dst={{ volume.dst }}{{ (',' + volume.options) if volume.options else '' }} \
  43. {% endfor %}
  44. {% for arg in matrix_coturn_container_extra_arguments %}
  45. {{ arg }} \
  46. {% endfor %}
  47. {{ matrix_coturn_docker_image }} \
  48. -c /turnserver.conf
  49. {% for network in matrix_coturn_container_additional_networks %}
  50. ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} network connect {{ network }} matrix-coturn
  51. {% endfor %}
  52. ExecStart={{ devture_systemd_docker_base_host_command_docker }} start --attach matrix-coturn
  53. ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} stop -t {{ devture_systemd_docker_base_container_stop_grace_time_seconds }} matrix-coturn 2>/dev/null || true'
  54. ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-coturn 2>/dev/null || true'
  55. # This only reloads certificates (not other configuration).
  56. # See: https://github.com/coturn/coturn/pull/236
  57. ExecReload={{ devture_systemd_docker_base_host_command_docker }} exec matrix-coturn kill -USR2 1
  58. Restart=always
  59. RestartSec=30
  60. SyslogIdentifier=matrix-coturn
  61. [Install]
  62. WantedBy=multi-user.target