2023-03-17 10:34:15 +01:00
|
|
|
[Unit]
|
|
|
|
Description=Nextcloud Server ({{ nextcloud_identifier }}-server)
|
|
|
|
{% for service in nextcloud_systemd_required_services_list %}
|
|
|
|
Requires={{ service }}
|
|
|
|
After={{ 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 {{ nextcloud_identifier }}-server 2>/dev/null || true'
|
|
|
|
ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm {{ nextcloud_identifier }}-server 2>/dev/null || true'
|
|
|
|
|
2023-04-03 09:19:13 +02:00
|
|
|
{#
|
|
|
|
`redis-session.ini` is mounted from the host, because the container's entrypoint tries to modify `/usr/local/etc/php/conf.d/redis-session.ini`
|
|
|
|
during startup when Redis is enabled and it can't do it on a `--read-only` filesystem.
|
|
|
|
See:
|
|
|
|
- https://github.com/nextcloud/docker/issues/763
|
|
|
|
- https://github.com/nextcloud/docker/blob/289f0bb8a3f1bd24d1633bbd01798c5476368827/26/apache/entrypoint.sh#L75-L100
|
|
|
|
#}
|
2023-03-17 10:34:15 +01:00
|
|
|
ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \
|
|
|
|
--rm \
|
|
|
|
--name={{ nextcloud_identifier }}-server \
|
|
|
|
--log-driver=none \
|
|
|
|
--network={{ nextcloud_container_network }} \
|
|
|
|
--user={{ nextcloud_uid }}:{{ nextcloud_gid }} \
|
|
|
|
--cap-drop=ALL \
|
|
|
|
--read-only \
|
|
|
|
--mount type=bind,src={{ nextcloud_data_path }},dst=/var/www/html \
|
2023-04-03 09:19:13 +02:00
|
|
|
{% if nextcloud_redis_is_configured %}
|
|
|
|
--mount type=bind,src={{ nextcloud_redis_session_ini_path }},dst=/usr/local/etc/php/conf.d/redis-session.ini \
|
|
|
|
{% endif %}
|
2023-03-17 10:34:15 +01:00
|
|
|
{% for mount in nextcloud_container_additional_mounts %}
|
|
|
|
--mount {{ mount }} \
|
|
|
|
{% endfor %}
|
|
|
|
--tmpfs=/tmp:rw,noexec,nosuid,size=512m \
|
|
|
|
--tmpfs=/var/run/apache2:rw,noexec,nosuid,size=128m \
|
|
|
|
{% if nextcloud_container_http_host_bind_port %}
|
|
|
|
-p {{ nextcloud_container_http_host_bind_port }}:80 \
|
|
|
|
{% endif %}
|
|
|
|
--env-file={{ nextcloud_config_path }}/env \
|
|
|
|
--label-file={{ nextcloud_config_path }}/labels \
|
|
|
|
{% if nextcloud_container_memory_limit != '' %}
|
|
|
|
--memory={{ nextcloud_container_memory_limit }} \
|
|
|
|
{% endif %}
|
|
|
|
{% if nextcloud_container_memory_swap_limit != '' %}
|
|
|
|
--memory-swap={{ nextcloud_container_memory_swap_limit }} \
|
|
|
|
{% endif %}
|
|
|
|
{% for arg in nextcloud_container_extra_arguments %}
|
|
|
|
{{ arg }} \
|
|
|
|
{% endfor %}
|
|
|
|
{{ nextcloud_container_image_final }}
|
|
|
|
|
|
|
|
{% for network in nextcloud_container_additional_networks %}
|
|
|
|
ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} network connect {{ network }} {{ nextcloud_identifier }}-server
|
|
|
|
{% endfor %}
|
|
|
|
|
|
|
|
ExecStart={{ devture_systemd_docker_base_host_command_docker }} start --attach {{ nextcloud_identifier }}-server
|
|
|
|
|
|
|
|
ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} kill {{ nextcloud_identifier }}-server 2>/dev/null || true'
|
|
|
|
ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm {{ nextcloud_identifier }}-server 2>/dev/null || true'
|
|
|
|
Restart=always
|
|
|
|
RestartSec=30
|
|
|
|
SyslogIdentifier={{ nextcloud_identifier }}-server
|
|
|
|
|
|
|
|
[Install]
|
|
|
|
WantedBy=multi-user.target
|