mirror of
https://github.com/spantaleev/matrix-docker-ansible-deploy.git
synced 2024-11-17 12:44:53 +00:00
e018663ba4
Switching from doing "post-start" loop hacks to running the container in 3 steps: `create` + potentially connect to additional networks + `start`. This way, the container would be connected to all its networks even at the very beginning of its life.
56 lines
3.1 KiB
Django/Jinja
Executable File
56 lines
3.1 KiB
Django/Jinja
Executable File
#jinja2: lstrip_blocks: "True"
|
|
[Unit]
|
|
Description=Synapse reverse-proxy companion
|
|
{% for service in matrix_synapse_reverse_proxy_companion_systemd_required_services_list %}
|
|
Requires={{ service }}
|
|
After={{ service }}
|
|
{% endfor %}
|
|
{% for service in matrix_synapse_reverse_proxy_companion_systemd_wanted_services_list %}
|
|
Wants={{ service }}
|
|
{% endfor %}
|
|
DefaultDependencies=no
|
|
|
|
[Service]
|
|
Type=simple
|
|
Environment="HOME={{ devture_systemd_docker_base_systemd_unit_home_path }}"
|
|
ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} kill matrix-synapse-reverse-proxy-companion 2>/dev/null || true'
|
|
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'
|
|
|
|
ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \
|
|
--rm \
|
|
--name=matrix-synapse-reverse-proxy-companion \
|
|
--log-driver=none \
|
|
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
|
|
--cap-drop=ALL \
|
|
--read-only \
|
|
--tmpfs=/tmp:rw,noexec,nosuid,size={{ matrix_synapse_reverse_proxy_companion_tmp_directory_size_mb }}m \
|
|
{% if matrix_synapse_reverse_proxy_companion_synapse_cache_enabled %}
|
|
--tmpfs=/tmp/synapse-cache:rw,noexec,nosuid,size={{ matrix_synapse_reverse_proxy_companion_tmp_cache_directory_size_mb }}m\
|
|
{% endif %}
|
|
--network={{ matrix_synapse_reverse_proxy_companion_container_network }} \
|
|
{% if matrix_synapse_reverse_proxy_companion_container_client_api_host_bind_port %}
|
|
-p {{ matrix_synapse_reverse_proxy_companion_container_client_api_host_bind_port }}:8008 \
|
|
{% endif %}
|
|
{% if matrix_synapse_reverse_proxy_companion_container_federation_api_host_bind_port %}
|
|
-p {{ matrix_synapse_reverse_proxy_companion_container_federation_api_host_bind_port }}:8048 \
|
|
{% endif %}
|
|
--mount type=bind,src={{ matrix_synapse_reverse_proxy_companion_base_path }}/nginx.conf,dst=/etc/nginx/nginx.conf,ro \
|
|
--mount type=bind,src={{ matrix_synapse_reverse_proxy_companion_confd_path }},dst=/etc/nginx/conf.d,ro \
|
|
{{ matrix_synapse_reverse_proxy_companion_container_image }}
|
|
|
|
{% for network in matrix_synapse_reverse_proxy_companion_container_additional_networks %}
|
|
ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} network connect {{ network }} matrix-synapse-reverse-proxy-companion
|
|
{% endfor %}
|
|
|
|
ExecStart={{ devture_systemd_docker_base_host_command_docker }} start --attach matrix-synapse-reverse-proxy-companion
|
|
|
|
ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} kill matrix-synapse-reverse-proxy-companion 2>/dev/null || true'
|
|
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'
|
|
ExecReload={{ devture_systemd_docker_base_host_command_docker }} exec matrix-synapse-reverse-proxy-companion /usr/sbin/nginx -s reload
|
|
Restart=always
|
|
RestartSec=30
|
|
SyslogIdentifier=matrix-synapse-reverse-proxy-companion
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|