Matrix Docker Ansible eploy
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

74 строки
3.6 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={{ devture_systemd_docker_base_systemd_unit_home_path }}"
  15. ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} kill matrix-dendrite 2>/dev/null || true'
  16. ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-dendrite 2>/dev/null || true'
  17. {% if (devture_postgres_identifier + '.service') in matrix_dendrite_systemd_required_services_list %}
  18. # Dendrite is too quick to start in relation to its 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. ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \
  23. --rm \
  24. --name=matrix-dendrite \
  25. --log-driver=none \
  26. --user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
  27. --cap-drop=ALL \
  28. --read-only \
  29. --tmpfs=/tmp:rw,noexec,nosuid,size={{ matrix_dendrite_tmp_directory_size_mb }}m \
  30. --network={{ matrix_dendrite_container_network }} \
  31. {% if matrix_dendrite_container_http_host_bind_address and matrix_dendrite_http_bind_port %}
  32. -p {{ matrix_dendrite_container_http_host_bind_address }}:{{ matrix_dendrite_http_bind_port }} \
  33. {% endif %}
  34. {% if matrix_dendrite_container_https_host_bind_address and matrix_dendrite_https_bind_port %}
  35. -p {{ matrix_dendrite_container_https_host_bind_address }}:{{ matrix_dendrite_https_bind_port }} \
  36. {% endif %}
  37. --mount type=bind,src={{ matrix_dendrite_config_dir_path }},dst=/data,ro \
  38. --mount type=bind,src={{ matrix_dendrite_storage_path }},dst=/matrix-media-store-parent,bind-propagation=slave \
  39. --mount type=bind,src={{ matrix_dendrite_nats_storage_path }},dst=/matrix-nats-store,bind-propagation=slave \
  40. {% for volume in matrix_dendrite_container_additional_volumes %}
  41. -v {{ volume.src }}:{{ volume.dst }}:{{ volume.options }} \
  42. {% endfor %}
  43. {% for arg in matrix_dendrite_container_arguments %}
  44. {{ arg }} \
  45. {% endfor %}
  46. {{ matrix_dendrite_docker_image }} \
  47. -config /data/dendrite.yaml \
  48. {{ matrix_dendrite_process_extra_arguments|join(' ') }} \
  49. {% if matrix_dendrite_http_bind_address %}
  50. -http-bind-address {{ matrix_dendrite_http_bind_address }}
  51. {% endif %}
  52. {% if matrix_dendrite_https_bind_address %}
  53. -https-bind-address {{ matrix_dendrite_https_bind_address }}
  54. {% endif %}
  55. {% for network in matrix_dendrite_container_additional_networks %}
  56. ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} network connect {{ network }} matrix-dendrite
  57. {% endfor %}
  58. ExecStart={{ devture_systemd_docker_base_host_command_docker }} start --attach matrix-dendrite
  59. ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} kill matrix-dendrite 2>/dev/null || true'
  60. ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-dendrite 2>/dev/null || true'
  61. ExecReload={{ devture_systemd_docker_base_host_command_docker }} exec matrix-dendrite /bin/sh -c 'kill -HUP 1'
  62. Restart=always
  63. RestartSec=30
  64. SyslogIdentifier=matrix-dendrite
  65. [Install]
  66. WantedBy=multi-user.target