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.
 
 

52 lines
2.3 KiB

  1. #jinja2: lstrip_blocks: "True"
  2. [Unit]
  3. Description=Matrix Mautrix wsproxy bridge
  4. {% for service in matrix_mautrix_wsproxy_systemd_required_services_list %}
  5. Requires={{ service }}
  6. After={{ service }}
  7. {% endfor %}
  8. {% for service in matrix_mautrix_wsproxy_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 }} kill matrix-mautrix-wsproxy 2>/dev/null'
  16. ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-mautrix-wsproxy 2>/dev/null'
  17. # Intentional delay, so that the homeserver (we likely depend on) can manage to start.
  18. ExecStartPre={{ matrix_host_command_sleep }} 5
  19. ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create --rm --name matrix-mautrix-wsproxy \
  20. --log-driver=none \
  21. --user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
  22. --cap-drop=ALL \
  23. --network={{ matrix_docker_network }} \
  24. {% if matrix_mautrix_wsproxy_bind_port %}
  25. -p {{ matrix_mautrix_wsproxy_port }}:29331 \
  26. {% endif %}
  27. --mount type=bind,src={{ matrix_mautrix_wsproxy_config_path }},dst=/data \
  28. --label-file={{ matrix_mautrix_wsproxy_base_path }}/wsproxy-labels \
  29. {% for arg in matrix_mautrix_wsproxy_container_extra_arguments %}
  30. {{ arg }} \
  31. {% endfor %}
  32. {{ matrix_mautrix_wsproxy_docker_image }} \
  33. /usr/bin/mautrix-wsproxy -config /data/config.yaml
  34. {% for network in matrix_mautrix_wsproxy_container_additional_networks %}
  35. ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} network connect {{ network }} matrix-mautrix-wsproxy
  36. {% endfor %}
  37. ExecStart={{ devture_systemd_docker_base_host_command_docker }} start --attach matrix-mautrix-wsproxy
  38. ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} kill matrix-mautrix-wsproxy 2>/dev/null'
  39. ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-mautrix-wsproxy 2>/dev/null'
  40. Restart=always
  41. RestartSec=30
  42. SyslogIdentifier=matrix-mautrix-wsproxy
  43. [Install]
  44. WantedBy=multi-user.target