Matrix Docker Ansible eploy
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 

59 行
2.5 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 Draupnir bot
  8. {% for service in matrix_bot_draupnir_systemd_wanted_services_list %}
  9. Requires={{ service }}
  10. After={{ service }}
  11. {% endfor %}
  12. {% for service in matrix_bot_draupnir_systemd_required_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-bot-draupnir 2>/dev/null || true'
  20. ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-bot-draupnir 2>/dev/null || true'
  21. ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \
  22. --rm \
  23. --name=matrix-bot-draupnir \
  24. --log-driver=none \
  25. --user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
  26. --cap-drop=ALL \
  27. --read-only \
  28. --network={{ matrix_bot_draupnir_container_network }} \
  29. {% if matrix_bot_draupnir_container_http_host_bind_port %}
  30. -p {{ matrix_bot_draupnir_container_http_host_bind_port }}:8080 \
  31. {% endif %}
  32. --label-file={{ matrix_bot_draupnir_base_path }}/labels \
  33. --mount type=bind,src={{ matrix_bot_draupnir_config_path }},dst=/data/config,ro \
  34. --mount type=bind,src={{ matrix_bot_draupnir_data_path }},dst=/data \
  35. {% for arg in matrix_bot_draupnir_container_extra_arguments %}
  36. {{ arg }} \
  37. {% endfor %}
  38. {{ matrix_bot_draupnir_docker_image }} \
  39. bot --draupnir-config /data/config/production.yaml
  40. {% for network in matrix_bot_draupnir_container_additional_networks %}
  41. ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} network connect {{ network }} matrix-bot-draupnir
  42. {% endfor %}
  43. ExecStart={{ devture_systemd_docker_base_host_command_docker }} start --attach matrix-bot-draupnir
  44. 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-draupnir 2>/dev/null || true'
  45. ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-bot-draupnir 2>/dev/null || true'
  46. Restart=always
  47. RestartSec=30
  48. SyslogIdentifier=matrix-bot-draupnir
  49. [Install]
  50. WantedBy=multi-user.target