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.
 
 

53 lines
2.4 KiB

  1. #jinja2: lstrip_blocks: "True"
  2. [Unit]
  3. Description=Maubot
  4. {% for service in matrix_bot_maubot_systemd_required_services_list %}
  5. Requires={{ service }}
  6. After={{ service }}
  7. {% endfor %}
  8. {% for service in matrix_bot_maubot_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 --time={{ devture_systemd_docker_base_container_stop_grace_time_seconds }} matrix-bot-maubot 2>/dev/null || true'
  16. ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-bot-maubot 2>/dev/null || true'
  17. ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \
  18. --rm \
  19. --name=matrix-bot-maubot \
  20. --log-driver=none \
  21. --user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
  22. --read-only \
  23. --cap-drop=ALL \
  24. --mount type=bind,src={{ matrix_bot_maubot_config_path }},dst=/config,ro \
  25. --mount type=bind,src={{ matrix_bot_maubot_data_path }},dst=/data \
  26. --label-file={{ matrix_bot_maubot_base_path }}/labels \
  27. {% for arg in matrix_bot_maubot_container_extra_arguments %}
  28. {{ arg }} \
  29. {% endfor %}
  30. --network={{ matrix_bot_maubot_container_network }} \
  31. {% if matrix_bot_maubot_container_management_interface_http_bind_port %}
  32. -p {{ matrix_bot_maubot_container_management_interface_http_bind_port }}:{{ matrix_bot_maubot_server_port }} \
  33. {% endif %}
  34. {{ matrix_bot_maubot_docker_image }} \
  35. python3 -m maubot -c /config/config.yaml --no-update
  36. {% for network in matrix_bot_maubot_container_additional_networks %}
  37. ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} network connect {{ network }} matrix-bot-maubot
  38. {% endfor %}
  39. ExecStart={{ devture_systemd_docker_base_host_command_docker }} start --attach matrix-bot-maubot
  40. 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-bot-maubot 2>/dev/null || true'
  41. ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-bot-maubot 2>/dev/null || true'
  42. Restart=always
  43. RestartSec=30
  44. SyslogIdentifier=matrix-bot-maubot
  45. [Install]
  46. WantedBy=multi-user.target