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.
 
 

48 lines
2.1 KiB

  1. #jinja2: lstrip_blocks: "True"
  2. [Unit]
  3. Description=Matrix Element server
  4. {% for service in matrix_client_element_systemd_required_services_list %}
  5. Requires={{ service }}
  6. After={{ service }}
  7. {% endfor %}
  8. DefaultDependencies=no
  9. PartOf=matrix.target
  10. [Service]
  11. Type=simple
  12. Environment="HOME={{ matrix_systemd_unit_home_path }}"
  13. ExecStartPre=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} stop matrix-client-element 2>/dev/null'
  14. ExecStartPre=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} rm matrix-client-element 2>/dev/null'
  15. ExecStart={{ matrix_host_command_docker }} run --rm --name matrix-client-element \
  16. --log-driver=none \
  17. --user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
  18. --cap-drop=ALL \
  19. --read-only \
  20. --network={{ matrix_docker_network }} \
  21. {% if matrix_client_element_container_http_host_bind_port %}
  22. -p {{ matrix_client_element_container_http_host_bind_port }}:8080 \
  23. {% endif %}
  24. --tmpfs=/tmp:rw,noexec,nosuid,size=10m \
  25. --mount type=bind,src={{ matrix_client_element_data_path }}/nginx.conf,dst=/etc/nginx/nginx.conf,ro \
  26. --mount type=bind,src={{ matrix_client_element_data_path }}/config.json,dst=/app/config.json,ro \
  27. --mount type=bind,src={{ matrix_client_element_data_path }}/config.json,dst=/app/config.{{ matrix_server_fqn_element }}.json,ro \
  28. {% if matrix_client_element_embedded_pages_home_path is not none %}
  29. --mount type=bind,src={{ matrix_client_element_data_path }}/home.html,dst=/app/home.html,ro \
  30. {% endif %}
  31. --mount type=bind,src={{ matrix_client_element_data_path }}/welcome.html,dst=/app/welcome.html,ro \
  32. {% for arg in matrix_client_element_container_extra_arguments %}
  33. {{ arg }} \
  34. {% endfor %}
  35. {{ matrix_client_element_docker_image }}
  36. ExecStop=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} stop matrix-client-element 2>/dev/null'
  37. ExecStop=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} rm matrix-client-element 2>/dev/null'
  38. Restart=always
  39. RestartSec=30
  40. SyslogIdentifier=matrix-client-element
  41. [Install]
  42. WantedBy=matrix.target