Matrix Docker Ansible eploy
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 

54 linhas
2.4 KiB

  1. #jinja2: lstrip_blocks: "True"
  2. [Unit]
  3. Description=Matrix baibot bot
  4. {% for service in matrix_bot_baibot_systemd_required_services_list %}
  5. Requires={{ service }}
  6. After={{ service }}
  7. {% endfor %}
  8. {% for service in matrix_bot_baibot_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 -t {{ devture_systemd_docker_base_container_stop_grace_time_seconds }} matrix-bot-baibot 2>/dev/null || true'
  16. ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-bot-baibot 2>/dev/null || true'
  17. {#
  18. We mount a tmpfs at /tmp, because the bot may write temporary files there
  19. (see its `src/agent/provider/openai_compat/controller.rs`).
  20. #}
  21. ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \
  22. --rm \
  23. --name=matrix-bot-baibot \
  24. --log-driver=none \
  25. --user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
  26. --cap-drop=ALL \
  27. --read-only \
  28. --network={{ matrix_bot_baibot_container_network }} \
  29. --env-file={{ matrix_bot_baibot_config_path }}/env \
  30. --mount type=bind,src={{ matrix_bot_baibot_config_path }}/config.yml,dst=/app/config.yml,ro \
  31. --mount type=bind,src={{ matrix_bot_baibot_data_path }},dst=/data \
  32. --tmpfs=/tmp:rw,noexec,nosuid,size=1024m \
  33. {% for arg in matrix_bot_baibot_container_extra_arguments %}
  34. {{ arg }} \
  35. {% endfor %}
  36. {{ matrix_bot_baibot_container_image }}
  37. {% for network in matrix_bot_baibot_container_additional_networks %}
  38. ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} network connect {{ network }} matrix-bot-baibot
  39. {% endfor %}
  40. ExecStart={{ devture_systemd_docker_base_host_command_docker }} start --attach matrix-bot-baibot
  41. 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-bot-baibot 2>/dev/null || true'
  42. ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-bot-baibot 2>/dev/null || true'
  43. Restart=always
  44. RestartSec=30
  45. SyslogIdentifier=matrix-bot-baibot
  46. [Install]
  47. WantedBy=multi-user.target