From 6b730730121c870099b7933a0d7ec1aee9543dff Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Sat, 13 Jan 2024 17:10:02 +0200 Subject: [PATCH] Fix NeDB to Postgres importing task for matrix-bridge-appservice-irc Postgres is not in `matrix_docker_network` anymore, so what we had before could not possibly work anymore. --- group_vars/matrix_servers | 1 + roles/custom/matrix-bridge-appservice-irc/defaults/main.yml | 4 ++++ .../tasks/migrate_nedb_to_postgres.yml | 4 +++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/group_vars/matrix_servers b/group_vars/matrix_servers index f7f9d6bd5..fe727616d 100755 --- a/group_vars/matrix_servers +++ b/group_vars/matrix_servers @@ -703,6 +703,7 @@ matrix_appservice_irc_homeserver_token: "{{ '%s' | format(matrix_homeserver_gene matrix_appservice_irc_database_engine: "{{ 'postgres' if devture_postgres_enabled else 'nedb' }}" matrix_appservice_irc_database_hostname: "{{ devture_postgres_connection_hostname if devture_postgres_enabled else '' }}" matrix_appservice_irc_database_password: "{{ '%s' | format(matrix_homeserver_generic_secret_key) | password_hash('sha512', 'as.irc.db', rounds=655555) | to_uuid }}" +matrix_appservice_irc_database_container_network: "{{ devture_postgres_container_network if devture_postgres_enabled else '' }}" ###################################################################### # diff --git a/roles/custom/matrix-bridge-appservice-irc/defaults/main.yml b/roles/custom/matrix-bridge-appservice-irc/defaults/main.yml index f021252c9..3155ebd76 100644 --- a/roles/custom/matrix-bridge-appservice-irc/defaults/main.yml +++ b/roles/custom/matrix-bridge-appservice-irc/defaults/main.yml @@ -36,6 +36,10 @@ matrix_appservice_irc_database_port: 5432 matrix_appservice_irc_database_name: matrix_appservice_irc matrix_appservice_irc_database_sslmode: disable +# The name of the container network to use when importing a NeDB database into Postgres. +# For Postgres not working in a container, this can be left empty. +matrix_appservice_irc_database_container_network: '' + # This is just the Postgres connection string, if Postgres is used. # Naming clashes with `matrix_appservice_irc_database_connectionString` somewhat. matrix_appservice_irc_database_connection_string: 'postgresql://{{ matrix_appservice_irc_database_username }}:{{ matrix_appservice_irc_database_password }}@{{ matrix_appservice_irc_database_hostname }}:{{ matrix_appservice_irc_database_port }}/{{ matrix_appservice_irc_database_name }}?sslmode={{ matrix_appservice_irc_database_sslmode }}' diff --git a/roles/custom/matrix-bridge-appservice-irc/tasks/migrate_nedb_to_postgres.yml b/roles/custom/matrix-bridge-appservice-irc/tasks/migrate_nedb_to_postgres.yml index 79978ecd3..6a3edb895 100644 --- a/roles/custom/matrix-bridge-appservice-irc/tasks/migrate_nedb_to_postgres.yml +++ b/roles/custom/matrix-bridge-appservice-irc/tasks/migrate_nedb_to_postgres.yml @@ -46,7 +46,9 @@ --rm --user={{ matrix_user_uid }}:{{ matrix_user_gid }} --cap-drop=ALL - --network={{ matrix_docker_network }} + {% if matrix_appservice_irc_database_container_network %} + --network={{ matrix_appservice_irc_database_container_network }} + {% endif %} --mount type=bind,src={{ matrix_appservice_irc_data_path }},dst=/data --entrypoint=/bin/sh {{ matrix_appservice_irc_docker_image }}