Matrix Docker Ansible eploy
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 

79 wiersze
4.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={{ 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 }} stop -t {{ devture_systemd_docker_base_container_stop_grace_time_seconds }} 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 (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. --label-file={{ matrix_dendrite_base_path }}/labels \
  41. {% for volume in matrix_dendrite_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_dendrite_container_arguments %}
  45. {{ arg }} \
  46. {% endfor %}
  47. {{ matrix_dendrite_docker_image }} \
  48. -config /data/dendrite.yaml \
  49. {{ matrix_dendrite_process_extra_arguments|join(' ') }} \
  50. {% if matrix_dendrite_http_bind_address %}
  51. -http-bind-address {{ matrix_dendrite_http_bind_address }}
  52. {% endif %}
  53. {% if matrix_dendrite_https_bind_address %}
  54. -https-bind-address {{ matrix_dendrite_https_bind_address }}
  55. {% endif %}
  56. {% for network in matrix_dendrite_container_additional_networks %}
  57. ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} network connect {{ network }} matrix-dendrite
  58. {% endfor %}
  59. ExecStart={{ devture_systemd_docker_base_host_command_docker }} start --attach matrix-dendrite
  60. {% if matrix_dendrite_systemd_service_post_start_delay_seconds != 0 %}
  61. ExecStartPost=-{{ matrix_host_command_sleep }} {{ matrix_dendrite_systemd_service_post_start_delay_seconds }}
  62. {% endif %}
  63. 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-dendrite 2>/dev/null || true'
  64. ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-dendrite 2>/dev/null || true'
  65. ExecReload={{ devture_systemd_docker_base_host_command_docker }} exec matrix-dendrite /bin/sh -c 'kill -HUP 1'
  66. Restart=always
  67. RestartSec=30
  68. SyslogIdentifier=matrix-dendrite
  69. [Install]
  70. WantedBy=multi-user.target