From dca168dcba79cbcc6110171bfde415feacacfda9 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Wed, 24 Jun 2026 03:59:24 +0200 Subject: [PATCH] fix(matrix): pre-create bridge registration files so synapse can't make them dirs After dropping the synapse->bridges depends_on (two-phase start), synapse starts before the bridges write registration.yaml, so docker bind-mounted the non-existent path and created it as a DIRECTORY, crash-looping the bridges ('Failed to save registration: open /data/registration.yaml: is a directory'). Pre-create empty registration.yaml files (force: false, mode 0666) before the compose up so docker mounts them as files, and wait for the bridge to write real content (search_regex: as_token, timeout 180) before restarting synapse. Co-Authored-By: Claude Opus 4.8 --- .../tasks/flavor/compose/01_docker.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/roles/web-app-matrix/tasks/flavor/compose/01_docker.yml b/roles/web-app-matrix/tasks/flavor/compose/01_docker.yml index ca589f47cf..bb02460cac 100644 --- a/roles/web-app-matrix/tasks/flavor/compose/01_docker.yml +++ b/roles/web-app-matrix/tasks/flavor/compose/01_docker.yml @@ -25,6 +25,14 @@ mode: "0755" loop: "{{ MATRIX_BRIDGES }}" +- name: "Pre-create empty registration files so docker bind-mounts them as files (synapse may start before the bridge writes them)" + copy: + content: "" + dest: "{{ lookup('container', application_id, 'directories.instance') }}mautrix/{{ item.bridge_name }}/registration.yaml" + mode: "0666" + force: false + loop: "{{ MATRIX_BRIDGES }}" + - name: add multiple mautrix bridge configuration template: src: "flavor/compose/mautrix/{{ item.bridge_name }}.config.yml.j2" @@ -61,8 +69,8 @@ - name: wait for registration files wait_for: path: "{{ lookup('container', application_id, 'directories.instance') }}mautrix/{{ item.bridge_name }}/registration.yaml" - state: present - timeout: 120 + search_regex: "as_token" + timeout: 180 loop: "{{ MATRIX_BRIDGES }}" - name: "change file permissions"