From c86cff27086e6c627aa3fcc32e40fa33ca4fba33 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Sat, 13 Jan 2024 17:11:57 +0200 Subject: [PATCH] Fix NeDB to Postgres importing task for matrix-bridge-appservice-slack Same as 250b91a40968e, but for Slack --- group_vars/matrix_servers | 1 + roles/custom/matrix-bridge-appservice-slack/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 fe727616d..fd9b2f754 100755 --- a/group_vars/matrix_servers +++ b/group_vars/matrix_servers @@ -650,6 +650,7 @@ matrix_appservice_slack_id_token: "{{ '%s' | format(matrix_homeserver_generic_se matrix_appservice_slack_database_engine: "{{ 'postgres' if devture_postgres_enabled else 'nedb' }}" matrix_appservice_slack_database_hostname: "{{ devture_postgres_connection_hostname if devture_postgres_enabled else '' }}" matrix_appservice_slack_database_password: "{{ '%s' | format(matrix_homeserver_generic_secret_key) | password_hash('sha512', 'as.slack.db', rounds=655555) | to_uuid }}" +matrix_appservice_slack_database_container_network: "{{ devture_postgres_container_network if devture_postgres_enabled else '' }}" ###################################################################### # diff --git a/roles/custom/matrix-bridge-appservice-slack/defaults/main.yml b/roles/custom/matrix-bridge-appservice-slack/defaults/main.yml index 20b12b721..eb4863530 100644 --- a/roles/custom/matrix-bridge-appservice-slack/defaults/main.yml +++ b/roles/custom/matrix-bridge-appservice-slack/defaults/main.yml @@ -105,6 +105,10 @@ matrix_appservice_slack_database_port: 5432 matrix_appservice_slack_database_name: matrix_appservice_slack matrix_appservice_slack_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_slack_database_container_network: '' + # This is just the Postgres connection string, if Postgres is used. # Naming clashes with `matrix_appservice_slack_database_connectionString` somewhat. matrix_appservice_slack_database_connection_string: 'postgresql://{{ matrix_appservice_slack_database_username }}:{{ matrix_appservice_slack_database_password }}@{{ matrix_appservice_slack_database_hostname }}:{{ matrix_appservice_slack_database_port }}/{{ matrix_appservice_slack_database_name }}?sslmode={{ matrix_appservice_slack_database_sslmode }}' diff --git a/roles/custom/matrix-bridge-appservice-slack/tasks/migrate_nedb_to_postgres.yml b/roles/custom/matrix-bridge-appservice-slack/tasks/migrate_nedb_to_postgres.yml index 58c125ab9..63f746228 100644 --- a/roles/custom/matrix-bridge-appservice-slack/tasks/migrate_nedb_to_postgres.yml +++ b/roles/custom/matrix-bridge-appservice-slack/tasks/migrate_nedb_to_postgres.yml @@ -40,7 +40,9 @@ --rm --user={{ matrix_user_uid }}:{{ matrix_user_gid }} --cap-drop=ALL - --network={{ matrix_docker_network }} + {% if matrix_appservice_slack_database_container_network %} + --network={{ matrix_appservice_irc_database_container_network }} + {% endif %} --mount type=bind,src={{ matrix_appservice_slack_data_path }},dst=/data --entrypoint=/bin/sh {{ matrix_appservice_slack_docker_image }}