Improve Redis support by mounting read-write redis-session.ini into the container
Related to https://github.com/nextcloud/docker/issues/763 Fixes https://github.com/mother-of-all-self-hosting/ansible-role-nextcloud/issues/4
This commit is contained in:
parent
c5707fbe2d
commit
74845395e3
4 changed files with 30 additions and 6 deletions
|
@ -24,6 +24,7 @@ nextcloud_systemd_required_services_list_custom: []
|
|||
nextcloud_base_path: "{{ nextcloud_base_path }}/nextcloud"
|
||||
nextcloud_config_path: "{{ nextcloud_base_path }}/config"
|
||||
nextcloud_data_path: "{{ nextcloud_base_path }}/data"
|
||||
nextcloud_redis_session_ini_path: "{{ nextcloud_base_path }}/redis-session.ini"
|
||||
nextcloud_customized_container_src_path: "{{ nextcloud_base_path }}/customized-container-src"
|
||||
|
||||
# SVG support for imagick can be setup like this:
|
||||
|
|
|
@ -1,17 +1,28 @@
|
|||
---
|
||||
|
||||
- name: Ensure Nextcloud path exists
|
||||
- name: Ensure Nextcloud paths exists
|
||||
ansible.builtin.file:
|
||||
path: "{{ item.path }}"
|
||||
state: directory
|
||||
state: "{{ item.state }}"
|
||||
mode: 0700
|
||||
owner: "{{ nextcloud_uid }}"
|
||||
group: "{{ nextcloud_gid }}"
|
||||
with_items:
|
||||
- {path: "{{ nextcloud_base_path }}", when: true}
|
||||
- {path: "{{ nextcloud_config_path }}", when: true}
|
||||
- {path: "{{ nextcloud_data_path }}", when: true}
|
||||
- {path: "{{ nextcloud_customized_container_src_path }}", when: "{{ nextcloud_container_image_customizations_enabled }}"}
|
||||
- path: "{{ nextcloud_base_path }}"
|
||||
state: directory
|
||||
when: true
|
||||
- path: "{{ nextcloud_config_path }}"
|
||||
state: directory
|
||||
when: true
|
||||
- path: "{{ nextcloud_data_path }}"
|
||||
state: directory
|
||||
when: true
|
||||
- path: "{{ nextcloud_customized_container_src_path }}"
|
||||
state: directory
|
||||
when: "{{ nextcloud_container_image_customizations_enabled }}"
|
||||
- path: "{{ nextcloud_redis_session_ini_path }}"
|
||||
state: "{{ 'touch' if nextcloud_redis_is_configured else 'absent' }}"
|
||||
when: true
|
||||
when: item.when | bool
|
||||
|
||||
- name: Ensure Nextcloud support files installed
|
||||
|
|
|
@ -12,6 +12,13 @@ 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'
|
||||
|
||||
{#
|
||||
`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
|
||||
#}
|
||||
ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \
|
||||
--rm \
|
||||
--name={{ nextcloud_identifier }}-server \
|
||||
|
@ -21,6 +28,9 @@ ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \
|
|||
--cap-drop=ALL \
|
||||
--read-only \
|
||||
--mount type=bind,src={{ nextcloud_data_path }},dst=/var/www/html \
|
||||
{% 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 %}
|
||||
{% for mount in nextcloud_container_additional_mounts %}
|
||||
--mount {{ mount }} \
|
||||
{% endfor %}
|
||||
|
|
|
@ -1 +1,3 @@
|
|||
nextcloud_url: "{{ nextcloud_scheme }}://{{ nextcloud_hostname }}{{ nextcloud_path_prefix }}"
|
||||
|
||||
nextcloud_redis_is_configured: "{{ nextcloud_redis_hostname != '' }}"
|
||||
|
|
Loading…
Reference in a new issue