mirror of
https://github.com/spantaleev/matrix-docker-ansible-deploy.git
synced 2026-09-19 06:10:10 +00:00
Fix the sqlite database URI for the mautrix-meta bridges
Both roles derived `..._appservice_database_uri` as `'sqlite:///' + <path>`.
mautrix-go hands that string to go-sqlite3 as a filename rather than parsing it
as a URL, so the bridge cannot open its database and dies at startup:
FTL Failed to initialize database
error="... unable to open database file: no such file or directory"
Every other mautrix bridge role here passes the bare in-container path.
This has stayed hidden because group_vars/matrix_servers selects postgres
whenever postgres is enabled, which is the default - so almost nobody reaches
the sqlite branch. Anyone who does gets a bridge that never starts.
Found by the mautrix-meta-messenger Molecule scenario, which runs sqlite
deliberately. The scenario's override is dropped and its assertion now compares
the rendered URI against the path the role defines, so the derived value is
what is under test rather than the scenario's own.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SEH3vxYSQ5SV4N5z61eyGT
This commit is contained in:
co-authored by
Claude Opus 5
parent
dc092d3545
commit
0500127456
@@ -139,7 +139,7 @@ matrix_bridge_mautrix_meta_instagram_appservice_database_type: "{{ matrix_bridge
|
|||||||
matrix_bridge_mautrix_meta_instagram_appservice_database_uri: |-
|
matrix_bridge_mautrix_meta_instagram_appservice_database_uri: |-
|
||||||
{{
|
{{
|
||||||
{
|
{
|
||||||
'sqlite3-fk-wal': ('sqlite:///' + matrix_bridge_mautrix_meta_instagram_sqlite_database_path_in_container),
|
'sqlite3-fk-wal': matrix_bridge_mautrix_meta_instagram_sqlite_database_path_in_container,
|
||||||
'postgres': matrix_bridge_mautrix_meta_instagram_database_connection_string,
|
'postgres': matrix_bridge_mautrix_meta_instagram_database_connection_string,
|
||||||
}[matrix_bridge_mautrix_meta_instagram_database_engine]
|
}[matrix_bridge_mautrix_meta_instagram_database_engine]
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ matrix_bridge_mautrix_meta_messenger_appservice_database_type: "{{ matrix_bridge
|
|||||||
matrix_bridge_mautrix_meta_messenger_appservice_database_uri: |-
|
matrix_bridge_mautrix_meta_messenger_appservice_database_uri: |-
|
||||||
{{
|
{{
|
||||||
{
|
{
|
||||||
'sqlite3-fk-wal': ('sqlite:///' + matrix_bridge_mautrix_meta_messenger_sqlite_database_path_in_container),
|
'sqlite3-fk-wal': matrix_bridge_mautrix_meta_messenger_sqlite_database_path_in_container,
|
||||||
'postgres': matrix_bridge_mautrix_meta_messenger_database_connection_string,
|
'postgres': matrix_bridge_mautrix_meta_messenger_database_connection_string,
|
||||||
}[matrix_bridge_mautrix_meta_messenger_database_engine]
|
}[matrix_bridge_mautrix_meta_messenger_database_engine]
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -40,19 +40,12 @@ provisioner:
|
|||||||
# database engine the bridge can talk to is not what this proves.
|
# database engine the bridge can talk to is not what this proves.
|
||||||
matrix_bridge_mautrix_meta_messenger_database_engine: sqlite3-fk-wal
|
matrix_bridge_mautrix_meta_messenger_database_engine: sqlite3-fk-wal
|
||||||
|
|
||||||
# The URI is overridden because the one the role derives for
|
# The URI the role derives for `sqlite3-fk-wal` is deliberately NOT
|
||||||
# `sqlite3-fk-wal` does not work: it builds `sqlite:///` + the
|
# overridden here. It used to build `sqlite:///` + the in-container path,
|
||||||
# in-container path, and the bridge hands that to go-sqlite3 as a plain
|
# which go-sqlite3 takes as a plain filename rather than parsing as a URL,
|
||||||
# filename rather than parsing it as a URL, so it dies at startup with
|
# so the bridge died at startup with `unable to open database file`. This
|
||||||
# `unable to open database file: no such file or directory`. The value
|
# scenario is what caught it. Leaving the role's own value in place is
|
||||||
# below is the shape the other mautrix roles here use (a bare path;
|
# what keeps it caught.
|
||||||
# compare matrix-bridge-mautrix-signal, which adds the same _txlock the
|
|
||||||
# bridge warns about when it is missing).
|
|
||||||
#
|
|
||||||
# The playbook picks postgres whenever postgres is enabled, which is the
|
|
||||||
# default, so nothing normally reaches this code path. Left as an
|
|
||||||
# override rather than a fix: that is a consumer-visible default.
|
|
||||||
matrix_bridge_mautrix_meta_messenger_appservice_database_uri: "/data/mautrix-meta.db?_txlock=immediate"
|
|
||||||
|
|
||||||
# Appservice tokens. These are what the bridge and homeserver would
|
# Appservice tokens. These are what the bridge and homeserver would
|
||||||
# authenticate to each other with; here they only have to reach the
|
# authenticate to each other with; here they only have to reach the
|
||||||
|
|||||||
@@ -149,18 +149,18 @@
|
|||||||
matrix_bridge_mautrix_meta_messenger_meta_mode=facebook-tor
|
matrix_bridge_mautrix_meta_messenger_meta_mode=facebook-tor
|
||||||
success_msg: "The rendered configuration reflects the Meta mode the scenario selected"
|
success_msg: "The rendered configuration reflects the Meta mode the scenario selected"
|
||||||
|
|
||||||
# sqlite3-fk-wal was chosen in molecule.yml. The URI is a scenario override
|
# The URI must stay a bare path. go-sqlite3 takes it as a filename, so a
|
||||||
# rather than the role's derived value - see the comment in molecule.yml -
|
# `sqlite:///` prefix makes the bridge die at startup - which is what this
|
||||||
# so what this checks is only that both reach the configuration. The real
|
# role's default used to do.
|
||||||
# proof that the bridge is using the role's data path is the database file
|
- name: Assert the configuration points the bridge at the sqlite database the role derived
|
||||||
# asserted further down.
|
|
||||||
- name: Assert the configuration points the bridge at the sqlite database the scenario chose
|
|
||||||
ansible.builtin.assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- mautrix_meta_messenger_config.database.type == matrix_bridge_mautrix_meta_messenger_database_engine
|
- mautrix_meta_messenger_config.database.type == matrix_bridge_mautrix_meta_messenger_database_engine
|
||||||
- mautrix_meta_messenger_config.database.uri == matrix_bridge_mautrix_meta_messenger_appservice_database_uri
|
- mautrix_meta_messenger_config.database.uri == mautrix_meta_messenger_role_defaults.matrix_bridge_mautrix_meta_messenger_sqlite_database_path_in_container
|
||||||
fail_msg: "The rendered configuration does not point the bridge at the scenario's sqlite database"
|
fail_msg: >-
|
||||||
success_msg: "The rendered configuration points the bridge at the scenario's sqlite database"
|
database.uri is {{ mautrix_meta_messenger_config.database.uri | default('unset') }},
|
||||||
|
which is not the bare in-container path the role defines
|
||||||
|
success_msg: "The rendered configuration points the bridge at the sqlite database the role derived"
|
||||||
|
|
||||||
# The public address is what the role builds out of the three exposure
|
# The public address is what the role builds out of the three exposure
|
||||||
# variables; it is the same endpoint the Traefik labels below route to.
|
# variables; it is the same endpoint the Traefik labels below route to.
|
||||||
|
|||||||
Reference in New Issue
Block a user