From 8353627e4c3800c5ec600e2566b0c0f0a10ca69a Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Mon, 29 Jun 2026 19:39:20 +0300 Subject: [PATCH] matrix-base: make Synology shared-mount volume configurable Replace the hardcoded /volume1 path with a matrix_base_synology_volume_path variable (defaulting to /volume1), used both by the setup-time prerequisites task and by the boot-fix recovery script. This keeps the path consistent with the rest of the configuration and lets users on a non-default Docker storage volume override it. Co-Authored-By: Claude Opus 4.8 (1M context) --- roles/custom/matrix-base/defaults/main.yml | 5 +++++ .../matrix-base/tasks/setup_synology_prerequisites.yml | 4 ++-- .../matrix-base/templates/bin/matrix-synology-boot-fix.j2 | 8 ++++---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/roles/custom/matrix-base/defaults/main.yml b/roles/custom/matrix-base/defaults/main.yml index aeca3512c..9a3c4c457 100644 --- a/roles/custom/matrix-base/defaults/main.yml +++ b/roles/custom/matrix-base/defaults/main.yml @@ -210,6 +210,11 @@ matrix_synology_user_password: "" # system Python interpreter (ansible_python_interpreter) on the remote host. matrix_base_synology_requests_version_constraint: "requests<2.32" +# Synology volume that needs shared mount propagation so that Docker +# bind-propagation=slave mounts (used by matrix-synapse for its media store) +# work correctly. Defaults to /volume1 (DSM's default Docker storage volume). +matrix_base_synology_volume_path: "/volume1" + matrix_base_data_path: "/matrix" matrix_base_data_path_mode: "750" diff --git a/roles/custom/matrix-base/tasks/setup_synology_prerequisites.yml b/roles/custom/matrix-base/tasks/setup_synology_prerequisites.yml index 8332fed29..c95757214 100644 --- a/roles/custom/matrix-base/tasks/setup_synology_prerequisites.yml +++ b/roles/custom/matrix-base/tasks/setup_synology_prerequisites.yml @@ -13,8 +13,8 @@ # step. The boot-fix service handles this on every subsequent reboot. # noqa command-instead-of-module: ansible.builtin.mount does not support # changing mount propagation (--make-shared); command is the only option here. -- name: Ensure /volume1 has shared mount propagation (Synology) - ansible.builtin.command: mount --make-shared /volume1 # noqa command-instead-of-module +- name: Ensure the Synology volume has shared mount propagation + ansible.builtin.command: mount --make-shared {{ matrix_base_synology_volume_path }} # noqa command-instead-of-module changed_when: false - ansible.builtin.include_tasks: "{{ role_path }}/tasks/setup_synology_boot_fix.yml" diff --git a/roles/custom/matrix-base/templates/bin/matrix-synology-boot-fix.j2 b/roles/custom/matrix-base/templates/bin/matrix-synology-boot-fix.j2 index 37d5d978b..9970c17a2 100755 --- a/roles/custom/matrix-base/templates/bin/matrix-synology-boot-fix.j2 +++ b/roles/custom/matrix-base/templates/bin/matrix-synology-boot-fix.j2 @@ -8,7 +8,7 @@ # This script runs after multi-user.target (outside Container Manager's dependency # chain) and does two things: # -# 1. Makes /volume1 mount-shared so Docker bind-propagation=slave mounts work. +# 1. Makes {{ matrix_base_synology_volume_path }} mount-shared so Docker bind-propagation=slave mounts work. # Inserting this into the systemd chain Before=pkg-ContainerManager-dockerd.service # causes Container Manager to detect a broken dependency and prompt for repair, # so it must run here instead, after Docker is already up. @@ -32,12 +32,12 @@ if ! {{ devture_systemd_docker_base_host_command_docker }} info >/dev/null 2>&1; exit 1 fi -# Make /volume1 shared so Docker bind-propagation=slave mounts work correctly. +# Make {{ matrix_base_synology_volume_path }} shared so Docker bind-propagation=slave mounts work correctly. # Must run after Docker is up to avoid interfering with Container Manager's # integrity checks, but before matrix-synapse (and any other service using # bind-propagation=slave) creates its containers. -/bin/mount --make-shared /volume1 -echo "matrix-synology-boot-fix: /volume1 set to shared mount propagation" +/bin/mount --make-shared {{ matrix_base_synology_volume_path }} +echo "matrix-synology-boot-fix: {{ matrix_base_synology_volume_path }} set to shared mount propagation" # Start any enabled matrix-*.service that is inactive or failed. # Both states indicate the service did not come up at boot — either skipped by