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.
 
 

60 line
3.4 KiB

  1. #jinja2: lstrip_blocks: True
  2. [Unit]
  3. Description=Synapse reverse-proxy companion
  4. {% for service in matrix_synapse_reverse_proxy_companion_systemd_required_services_list %}
  5. Requires={{ service }}
  6. After={{ service }}
  7. {% endfor %}
  8. {% for service in matrix_synapse_reverse_proxy_companion_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-synapse-reverse-proxy-companion 2>/dev/null || true'
  16. ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-synapse-reverse-proxy-companion 2>/dev/null || true'
  17. ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \
  18. --rm \
  19. --name=matrix-synapse-reverse-proxy-companion \
  20. --log-driver=none \
  21. --user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
  22. --cap-drop=ALL \
  23. --read-only \
  24. --tmpfs=/tmp:rw,noexec,nosuid,size={{ matrix_synapse_reverse_proxy_companion_tmp_directory_size_mb }}m \
  25. {% if matrix_synapse_reverse_proxy_companion_synapse_cache_enabled %}
  26. --tmpfs=/tmp/synapse-cache:rw,noexec,nosuid,size={{ matrix_synapse_reverse_proxy_companion_tmp_cache_directory_size_mb }}m\
  27. {% endif %}
  28. --network={{ matrix_synapse_reverse_proxy_companion_container_network }} \
  29. {% if matrix_synapse_reverse_proxy_companion_container_client_api_host_bind_port %}
  30. -p {{ matrix_synapse_reverse_proxy_companion_container_client_api_host_bind_port }}:8008 \
  31. {% endif %}
  32. {% if matrix_synapse_reverse_proxy_companion_container_federation_api_host_bind_port %}
  33. -p {{ matrix_synapse_reverse_proxy_companion_container_federation_api_host_bind_port }}:8048 \
  34. {% endif %}
  35. --mount type=bind,src={{ matrix_synapse_reverse_proxy_companion_base_path }}/nginx.conf,dst=/etc/nginx/nginx.conf,ro \
  36. --mount type=bind,src={{ matrix_synapse_reverse_proxy_companion_confd_path }},dst=/etc/nginx/conf.d,ro \
  37. --label-file={{ matrix_synapse_reverse_proxy_companion_base_path }}/labels \
  38. {% for arg in matrix_synapse_reverse_proxy_companion_container_arguments %}
  39. {{ arg }} \
  40. {% endfor %}
  41. {{ matrix_synapse_reverse_proxy_companion_container_image }}
  42. {% for network in matrix_synapse_reverse_proxy_companion_container_additional_networks %}
  43. ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} network connect {{ network }} matrix-synapse-reverse-proxy-companion
  44. {% endfor %}
  45. ExecStart={{ devture_systemd_docker_base_host_command_docker }} start --attach matrix-synapse-reverse-proxy-companion
  46. 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-synapse-reverse-proxy-companion 2>/dev/null || true'
  47. ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-synapse-reverse-proxy-companion 2>/dev/null || true'
  48. ExecReload={{ devture_systemd_docker_base_host_command_docker }} exec matrix-synapse-reverse-proxy-companion /usr/sbin/nginx -s reload
  49. Restart=always
  50. RestartSec=30
  51. SyslogIdentifier=matrix-synapse-reverse-proxy-companion
  52. [Install]
  53. WantedBy=multi-user.target