Fix s3-storage migrate and shell (#3136)
* Fix s3-storage migrate and shell: container needs attachment to postgres network also * Connect to s3-storage-provider migrate to multiple networks in multiple steps Multiple `--network` calls lead to: > docker: Error response from daemon: Container cannot be connected to network endpoints: NETWORK_1 NETWORK_2. * Connect to s3-storage-provider shell to multiple networks in multiple steps --------- Co-authored-by: Slavi Pantaleev <slavi@devture.com>
This commit is contained in:
parent
f08fbbe103
commit
5ca527066d
@ -1,7 +1,9 @@
|
|||||||
#jinja2: lstrip_blocks: "True"
|
#jinja2: lstrip_blocks: "True"
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
{{ devture_systemd_docker_base_host_command_docker }} run \
|
container_id=$(\
|
||||||
|
{{ devture_systemd_docker_base_host_command_docker }} create \
|
||||||
--rm \
|
--rm \
|
||||||
--env-file={{ matrix_synapse_ext_s3_storage_provider_base_path }}/env \
|
--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_storage_path }},dst=/matrix-media-store-parent,bind-propagation=slave \
|
||||||
@ -10,4 +12,12 @@
|
|||||||
--network={{ matrix_synapse_container_network }} \
|
--network={{ matrix_synapse_container_network }} \
|
||||||
--entrypoint=/bin/bash \
|
--entrypoint=/bin/bash \
|
||||||
{{ matrix_synapse_docker_image_final }} \
|
{{ matrix_synapse_docker_image_final }} \
|
||||||
-c 's3_media_upload update-db $UPDATE_DB_DURATION && s3_media_upload --no-progress check-deleted $MEDIA_PATH && s3_media_upload --no-progress upload $MEDIA_PATH $BUCKET --delete --storage-class $STORAGE_CLASS --endpoint-url $ENDPOINT {% if matrix_synapse_ext_synapse_s3_storage_provider_config_sse_customer_enabled %}--sse-customer-algo $SSE_CUSTOMER_ALGO --sse-customer-key $SSE_CUSTOMER_KEY{% endif %}'
|
-c 's3_media_upload update-db $UPDATE_DB_DURATION && s3_media_upload --no-progress check-deleted $MEDIA_PATH && s3_media_upload --no-progress upload $MEDIA_PATH $BUCKET --delete --storage-class $STORAGE_CLASS --endpoint-url $ENDPOINT {% if matrix_synapse_ext_synapse_s3_storage_provider_config_sse_customer_enabled %}--sse-customer-algo $SSE_CUSTOMER_ALGO --sse-customer-key $SSE_CUSTOMER_KEY{% endif %}' \
|
||||||
|
)
|
||||||
|
|
||||||
|
{# 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 $container_id
|
||||||
|
@ -1,13 +1,24 @@
|
|||||||
#jinja2: lstrip_blocks: "True"
|
#jinja2: lstrip_blocks: "True"
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
{{ devture_systemd_docker_base_host_command_docker }} run \
|
container_id=$(\
|
||||||
|
{{ devture_systemd_docker_base_host_command_docker }} create \
|
||||||
-it \
|
-it \
|
||||||
--rm \
|
--rm \
|
||||||
|
--name=matrix-synapse-s3-storage-provider-shell \
|
||||||
--env-file={{ matrix_synapse_ext_s3_storage_provider_base_path }}/env \
|
--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_storage_path }},dst=/matrix-media-store-parent,bind-propagation=slave \
|
||||||
--mount type=bind,src={{ matrix_synapse_ext_s3_storage_provider_data_path }},dst=/data \
|
--mount type=bind,src={{ matrix_synapse_ext_s3_storage_provider_data_path }},dst=/data \
|
||||||
--workdir=/data \
|
--workdir=/data \
|
||||||
--network={{ matrix_synapse_container_network }} \
|
--network={{ matrix_synapse_container_network }} \
|
||||||
--entrypoint=/bin/bash \
|
--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
|
||||||
|
Loading…
Reference in New Issue
Block a user