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 <noreply@anthropic.com>
This commit is contained in:
kevinveenbirkenbachandClaude Opus 4.8 committed 2026-06-24 04:00:21 +02:00
1 parent f57dda89db
commit dca168dcba
1 file changed
+10 -2
@@ -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"