From 8874e9d06d0bdfc89510e171141f1a8a49777b0b Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Sat, 27 Jan 2024 18:03:03 +0200 Subject: [PATCH] Connect to s3-storage-provider shell to multiple networks in multiple steps The previous commit actually fixed the `migrate` script. This one fixes `shell`. --- .../synapse/ext/s3-storage-provider/bin/shell.j2 | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/roles/custom/matrix-synapse/templates/synapse/ext/s3-storage-provider/bin/shell.j2 b/roles/custom/matrix-synapse/templates/synapse/ext/s3-storage-provider/bin/shell.j2 index 7ca439755..239554a1c 100644 --- a/roles/custom/matrix-synapse/templates/synapse/ext/s3-storage-provider/bin/shell.j2 +++ b/roles/custom/matrix-synapse/templates/synapse/ext/s3-storage-provider/bin/shell.j2 @@ -1,14 +1,24 @@ #jinja2: lstrip_blocks: "True" #!/bin/bash +set -euo pipefail -{{ devture_systemd_docker_base_host_command_docker }} run \ +container_id=$(\ + {{ devture_systemd_docker_base_host_command_docker }} create \ -it \ --rm \ + --name=matrix-synapse-s3-storage-provider-shell \ --env-file={{ matrix_synapse_ext_s3_storage_provider_base_path }}/env \ --mount type=bind,src={{ matrix_synapse_storage_path }},dst=/matrix-media-store-parent,bind-propagation=slave \ --mount type=bind,src={{ matrix_synapse_ext_s3_storage_provider_data_path }},dst=/data \ --workdir=/data \ --network={{ matrix_synapse_container_network }} \ - --network={{ devture_postgres_container_network }} \ --entrypoint=/bin/bash \ - {{ matrix_synapse_docker_image_final }} + {{ matrix_synapse_docker_image_final }} \ +) + +{# We need to connect to the Postgres network, which should be in this list. #} +{% for network in matrix_synapse_container_additional_networks %} +{{ devture_systemd_docker_base_host_command_docker }} network connect {{ network }} $container_id +{% endfor %} + +{{ devture_systemd_docker_base_host_command_docker }} start --attach -i $container_id