Matrix Docker Ansible eploy
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

70 lines
3.4 KiB

  1. #jinja2: lstrip_blocks: "True"
  2. [Unit]
  3. Description=Matrix Element Web server
  4. {% for service in matrix_client_element_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-client-element 2>/dev/null || true'
  13. ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-client-element 2>/dev/null || true'
  14. {#
  15. The custom healthcheck command is a patch until https://github.com/element-hq/element-web/pull/29471
  16. lands in a release.
  17. #}
  18. ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \
  19. --rm \
  20. --name=matrix-client-element \
  21. --log-driver=none \
  22. --user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
  23. --cap-drop=ALL \
  24. --read-only \
  25. --network={{ matrix_client_element_container_network }} \
  26. {% if matrix_client_element_container_http_host_bind_port %}
  27. -p {{ matrix_client_element_container_http_host_bind_port }}:{{ matrix_client_element_container_port }} \
  28. {% endif %}
  29. --label-file={{ matrix_client_element_data_path }}/labels \
  30. --env-file={{ matrix_client_element_data_path }}/env \
  31. --tmpfs=/tmp:rw,noexec,nosuid,size=10m \
  32. --tmpfs=/var/cache/nginx:rw,mode=777 \
  33. --tmpfs=/var/run:rw,mode=777 \
  34. --tmpfs=/tmp/element-web-config:rw,mode=777 \
  35. --tmpfs=/etc/nginx/conf.d:rw,mode=777 \
  36. --mount type=bind,src={{ matrix_client_element_data_path }}/config.json,dst=/app/config.json,ro \
  37. --mount type=bind,src={{ matrix_client_element_data_path }}/config.json,dst=/app/config.{{ matrix_server_fqn_element }}.json,ro \
  38. {% if matrix_client_element_location_sharing_enabled %}
  39. --mount type=bind,src={{ matrix_client_element_data_path }}/map_style.json,dst=/app/map_style.json,ro \
  40. {% endif %}
  41. {% if matrix_client_element_embedded_pages_home_path is not none %}
  42. --mount type=bind,src={{ matrix_client_element_data_path }}/home.html,dst=/app/home.html,ro \
  43. {% endif %}
  44. --mount type=bind,src={{ matrix_client_element_data_path }}/welcome.html,dst=/app/welcome.html,ro \
  45. {% if matrix_client_element_container_healthcheck_cmd %}
  46. --health-cmd="{{ matrix_client_element_container_healthcheck_cmd }}" \
  47. {% endif %}
  48. {% for arg in matrix_client_element_container_extra_arguments %}
  49. {{ arg }} \
  50. {% endfor %}
  51. {{ matrix_client_element_docker_image }}
  52. {% for network in matrix_client_element_container_additional_networks %}
  53. ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} network connect {{ network }} matrix-client-element
  54. {% endfor %}
  55. ExecStart={{ devture_systemd_docker_base_host_command_docker }} start --attach matrix-client-element
  56. 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-client-element 2>/dev/null || true'
  57. ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-client-element 2>/dev/null || true'
  58. Restart=always
  59. RestartSec=30
  60. SyslogIdentifier=matrix-client-element
  61. [Install]
  62. WantedBy=multi-user.target