Matrix Docker Ansible eploy
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 

66 řádky
3.0 KiB

  1. #jinja2: lstrip_blocks: "True"
  2. [Unit]
  3. Description=Dendrite server
  4. {% for service in matrix_dendrite_systemd_required_services_list %}
  5. Requires={{ service }}
  6. After={{ service }}
  7. {% endfor %}
  8. {% for service in matrix_dendrite_systemd_wanted_services_list %}
  9. Wants={{ service }}
  10. {% endfor %}
  11. DefaultDependencies=no
  12. [Service]
  13. Type=simple
  14. Environment="HOME={{ matrix_systemd_unit_home_path }}"
  15. ExecStartPre=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} kill matrix-dendrite 2>/dev/null || true'
  16. ExecStartPre=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} rm matrix-dendrite 2>/dev/null || true'
  17. {% if 'matrix-postgres.service' in matrix_dendrite_systemd_required_services_list %}
  18. # Dendrite is too quick to start in relation to its matrix-postgres dependency.
  19. # Delay Dendrite startup to avoid failing with: "failed to connect to accounts db" ("pq: the database system is starting up").
  20. ExecStartPre={{ matrix_host_command_sleep }} 5
  21. {% endif %}
  22. ExecStart={{ matrix_host_command_docker }} run --rm --name matrix-dendrite \
  23. --log-driver=none \
  24. --user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
  25. --cap-drop=ALL \
  26. --read-only \
  27. --tmpfs=/tmp:rw,noexec,nosuid,size={{ matrix_dendrite_tmp_directory_size_mb }}m \
  28. --network={{ matrix_docker_network }} \
  29. {% if matrix_dendrite_container_http_host_bind_address and matrix_dendrite_http_bind_port %}
  30. -p {{ matrix_dendrite_container_http_host_bind_address }}:{{ matrix_dendrite_http_bind_port }} \
  31. {% endif %}
  32. {% if matrix_dendrite_container_https_host_bind_address and matrix_dendrite_https_bind_port %}
  33. -p {{ matrix_dendrite_container_https_host_bind_address }}:{{ matrix_dendrite_https_bind_port }} \
  34. {% endif %}
  35. --mount type=bind,src={{ matrix_dendrite_config_dir_path }},dst=/data,ro \
  36. --mount type=bind,src={{ matrix_dendrite_storage_path }},dst=/matrix-media-store-parent,bind-propagation=slave \
  37. --mount type=bind,src={{ matrix_dendrite_nats_storage_path }},dst=/matrix-nats-store,bind-propagation=slave \
  38. {% for volume in matrix_dendrite_container_additional_volumes %}
  39. -v {{ volume.src }}:{{ volume.dst }}:{{ volume.options }} \
  40. {% endfor %}
  41. {% for arg in matrix_dendrite_container_extra_arguments %}
  42. {{ arg }} \
  43. {% endfor %}
  44. {{ matrix_dendrite_docker_image }} \
  45. -config /data/dendrite.yaml \
  46. {% if matrix_dendrite_http_bind_address %}
  47. -http-bind-address {{ matrix_dendrite_http_bind_address }}
  48. {% endif %}
  49. {% if matrix_dendrite_https_bind_address %}
  50. -https-bind-address {{ matrix_dendrite_https_bind_address }}
  51. {% endif %}
  52. {{ matrix_dendrite_process_extra_arguments|join(' ') }}
  53. ExecStop=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} kill matrix-dendrite 2>/dev/null || true'
  54. ExecStop=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} rm matrix-dendrite 2>/dev/null || true'
  55. ExecReload={{ matrix_host_command_docker }} exec matrix-dendrite /bin/sh -c 'kill -HUP 1'
  56. Restart=always
  57. RestartSec=30
  58. SyslogIdentifier=matrix-dendrite
  59. [Install]
  60. WantedBy=multi-user.target