Matrix Docker Ansible eploy
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 

69 satır
4.2 KiB

  1. #jinja2: lstrip_blocks: "True"
  2. [Unit]
  3. Description=Synapse worker ({{ matrix_synapse_worker_container_name }})
  4. AssertPathExists={{ matrix_synapse_config_dir_path }}/{{ matrix_synapse_worker_config_file_name }}
  5. After=matrix-synapse.service
  6. Requires=matrix-synapse.service
  7. [Service]
  8. Type=simple
  9. Environment="HOME={{ devture_systemd_docker_base_systemd_unit_home_path }}"
  10. 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_synapse_worker_container_name }} 2>/dev/null || true'
  11. ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm {{ matrix_synapse_worker_container_name }} 2>/dev/null || true'
  12. ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \
  13. --rm \
  14. --name={{ matrix_synapse_worker_container_name }} \
  15. --log-driver=none \
  16. --user={{ matrix_synapse_uid }}:{{ matrix_synapse_gid }} \
  17. --cap-drop=ALL \
  18. --read-only \
  19. --tmpfs=/tmp:rw,noexec,nosuid,size={{ matrix_synapse_tmp_directory_size_mb }}m \
  20. --network={{ matrix_synapse_container_network }} \
  21. {% if matrix_synapse_worker_details.port != 0 and matrix_synapse_worker_details.webserving %}
  22. --health-cmd 'curl -fSs http://localhost:{{ matrix_synapse_worker_details.port }}/health || exit 1' \
  23. {% else %}
  24. --no-healthcheck \
  25. {% endif %}
  26. {% if matrix_synapse_workers_enabled and matrix_synapse_workers_container_host_bind_address %}
  27. {% if matrix_synapse_worker_details.port != 0 %}
  28. -p {{ '' if matrix_synapse_workers_container_host_bind_address == '*' else (matrix_synapse_workers_container_host_bind_address + ':') }}{{ matrix_synapse_worker_details.port }}:{{ matrix_synapse_worker_details.port }} \
  29. {% endif %}
  30. {% if matrix_synapse_worker_details.metrics_port != 0 %}
  31. -p {{ '' if matrix_synapse_workers_container_host_bind_address == '*' else (matrix_synapse_workers_container_host_bind_address + ':') }}{{ matrix_synapse_worker_details.metrics_port }}:{{ matrix_synapse_worker_details.metrics_port }} \
  32. {% endif %}
  33. {% endif %}
  34. --mount type=bind,src={{ matrix_synapse_config_dir_path }},dst=/data,ro \
  35. --mount type=bind,src={{ matrix_synapse_storage_path }},dst=/matrix-media-store-parent,bind-propagation=slave \
  36. {% for volume in matrix_synapse_container_additional_volumes %}
  37. --mount type={{ volume.type | default('bind' if '/' in volume.src else 'volume') }},src={{ volume.src }},dst={{ volume.dst }}{{ (',' + volume.options) if volume.options else '' }} \
  38. {% endfor %}
  39. --label-file={{ matrix_synapse_base_path }}/{{ matrix_synapse_worker_labels_file_name }} \
  40. {% for arg in matrix_synapse_container_arguments %}
  41. {{ arg }} \
  42. {% endfor %}
  43. {{ matrix_synapse_docker_image_final }} \
  44. run -m synapse.app.{{ matrix_synapse_worker_details.app }} -c /data/homeserver.yaml -c /data/{{ matrix_synapse_worker_config_file_name }}
  45. {% for network in matrix_synapse_container_additional_networks %}
  46. ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} network connect {{ network }} {{ matrix_synapse_worker_container_name }}
  47. {% endfor %}
  48. ExecStart={{ devture_systemd_docker_base_host_command_docker }} start --attach {{ matrix_synapse_worker_container_name }}
  49. 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_synapse_worker_container_name }} 2>/dev/null || true'
  50. ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm {{ matrix_synapse_worker_container_name }} 2>/dev/null || true'
  51. ExecReload={{ devture_systemd_docker_base_host_command_docker }} exec {{ matrix_synapse_worker_container_name }} /bin/sh -c 'kill -HUP 1'
  52. Restart=always
  53. RestartSec=30
  54. SyslogIdentifier={{ matrix_synapse_worker_container_name }}
  55. # Intentionally not making this WantedBy=matrix-synapse.service,
  56. # as matrix.synapse.service already has `Wants=` lines.
  57. # Also, WantedBy will trigger the creation of some `matrix-synapse.service.wants/` directory,
  58. # which we'd have to clean, etc. Better not.
  59. [Install]
  60. WantedBy=multi-user.target