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.
 
 

56 lines
2.6 KiB

  1. {#
  2. SPDX-FileCopyrightText: 2024 MDAD Team and contributors
  3. SPDX-License-Identifier: AGPL-3.0-or-later
  4. #}
  5. #jinja2: lstrip_blocks: "True"
  6. [Unit]
  7. Description=Matrix Authentication Service
  8. {% for service in matrix_authentication_service_systemd_required_services_list %}
  9. Requires={{ service }}
  10. After={{ service }}
  11. {% endfor %}
  12. {% for service in matrix_authentication_service_systemd_wanted_services_list %}
  13. Wants={{ service }}
  14. {% endfor %}
  15. DefaultDependencies=no
  16. [Service]
  17. Type=simple
  18. Environment="HOME={{ devture_systemd_docker_base_systemd_unit_home_path }}"
  19. ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} stop --time={{ devture_systemd_docker_base_container_stop_grace_time_seconds }} matrix-authentication-service 2>/dev/null || true'
  20. ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-authentication-service 2>/dev/null || true'
  21. ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \
  22. --rm \
  23. --name=matrix-authentication-service \
  24. --log-driver=none \
  25. --user={{ matrix_authentication_service_uid }}:{{ matrix_authentication_service_gid }} \
  26. --cap-drop=ALL \
  27. --read-only \
  28. --network={{ matrix_authentication_service_container_network }} \
  29. --env-file={{ matrix_authentication_service_config_path }}/env \
  30. --label-file={{ matrix_authentication_service_config_path }}/labels \
  31. --mount type=bind,src={{ matrix_authentication_service_config_path }}/config.yaml,dst=/config.yaml,ro \
  32. --mount type=bind,src={{ matrix_authentication_service_data_keys_path }},dst=/keys,ro \
  33. {% for arg in matrix_authentication_service_container_extra_arguments %}
  34. {{ arg }} \
  35. {% endfor %}
  36. {{ matrix_authentication_service_container_image }}
  37. {% for network in matrix_authentication_service_container_additional_networks %}
  38. ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} network connect {{ network }} matrix-authentication-service
  39. {% endfor %}
  40. ExecStart={{ devture_systemd_docker_base_host_command_docker }} start --attach matrix-authentication-service
  41. ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} stop --time={{ devture_systemd_docker_base_container_stop_grace_time_seconds }} matrix-authentication-service 2>/dev/null || true'
  42. ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-authentication-service 2>/dev/null || true'
  43. Restart=always
  44. RestartSec=30
  45. SyslogIdentifier=matrix-authentication-service
  46. [Install]
  47. WantedBy=multi-user.target