Matrix Docker Ansible eploy
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 

63 Zeilen
3.1 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. [Service]
  7. Type=simple
  8. Environment="HOME={{ matrix_systemd_unit_home_path }}"
  9. ExecStartPre=-{{ matrix_host_command_docker }} kill {{ matrix_synapse_worker_container_name }}
  10. ExecStartPre=-{{ matrix_host_command_docker }} rm {{ matrix_synapse_worker_container_name }}
  11. # Intentional delay, so that the homeserver can manage to start.
  12. ExecStartPre={{ matrix_host_command_sleep }} 5
  13. ExecStart={{ matrix_host_command_docker }} run --rm --name {{ matrix_synapse_worker_container_name }} \
  14. --log-driver=none \
  15. --user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
  16. --cap-drop=ALL \
  17. --read-only \
  18. --tmpfs=/tmp:rw,noexec,nosuid,size={{ matrix_synapse_tmp_directory_size_mb }}m \
  19. --network={{ matrix_docker_network }} \
  20. {% if matrix_synapse_worker_details.port != 0 %}
  21. --health-cmd 'curl -fSs http://localhost:{{ matrix_synapse_worker_details.port }}/health || exit 1' \
  22. {% else %}
  23. --no-healthcheck \
  24. {% endif %}
  25. {% if matrix_synapse_workers_enabled and matrix_synapse_workers_container_host_bind_address %}
  26. {% if matrix_synapse_worker_details.port != 0 %}
  27. -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 }} \
  28. {% endif %}
  29. {% if matrix_synapse_worker_details.metrics_port != 0 %}
  30. -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 }} \
  31. {% endif %}
  32. {% endif %}
  33. --mount type=bind,src={{ matrix_synapse_config_dir_path }},dst=/data,ro \
  34. --mount type=bind,src={{ matrix_synapse_storage_path }},dst=/matrix-media-store-parent,bind-propagation=slave \
  35. {% for volume in matrix_synapse_container_additional_volumes %}
  36. -v {{ volume.src }}:{{ volume.dst }}:{{ volume.options }} \
  37. {% endfor %}
  38. {% for arg in matrix_synapse_container_extra_arguments %}
  39. {{ arg }} \
  40. {% endfor %}
  41. {{ matrix_synapse_docker_image }} \
  42. run -m synapse.app.{{ matrix_synapse_worker_details.type }} -c /data/homeserver.yaml -c /data/{{ matrix_synapse_worker_config_file_name }}
  43. ExecStop=-{{ matrix_host_command_docker }} kill {{ matrix_synapse_worker_container_name }}
  44. ExecStop=-{{ matrix_host_command_docker }} rm {{ matrix_synapse_worker_container_name }}
  45. ExecReload={{ matrix_host_command_docker }} exec {{ matrix_synapse_worker_container_name }} /bin/sh -c 'kill -HUP 1'
  46. Restart=always
  47. RestartSec=30
  48. SyslogIdentifier={{ matrix_synapse_worker_container_name }}
  49. # Intentionally not making this WantedBy=matrix-synapse.service,
  50. # as matrix.synapse.service already has `Wants=` lines.
  51. # Also, WantedBy will trigger the creation of some `matrix-synapse.service.wants/` directory,
  52. # which we'd have to clean, etc. Better not.
  53. [Install]
  54. WantedBy=multi-user.target