From b5fbec8d836b13288b01b8a126bf33a4b3686a68 Mon Sep 17 00:00:00 2001 From: Alexander Acevedo Date: Fri, 5 Apr 2019 05:33:38 -0400 Subject: [PATCH 1/5] add goofys custom Creates the configuration variable to toggle custom endpoint and the default custom endpoint. --- roles/matrix-synapse/defaults/main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/roles/matrix-synapse/defaults/main.yml b/roles/matrix-synapse/defaults/main.yml index 49525a754..7438f0328 100644 --- a/roles/matrix-synapse/defaults/main.yml +++ b/roles/matrix-synapse/defaults/main.yml @@ -218,7 +218,9 @@ matrix_synapse_ext_password_provider_ldap_filter: "" matrix_s3_media_store_enabled: false +matrix_s3_media_store_custom_endpoint_enabled: false matrix_s3_goofys_docker_image: "ewoutp/goofys:latest" +matrix_s3_media_store_custom_endpoint: "your-custom-endpoint" matrix_s3_media_store_bucket_name: "your-bucket-name" matrix_s3_media_store_aws_access_key: "your-aws-access-key" matrix_s3_media_store_aws_secret_key: "your-aws-secret-key" From c55e49d7332d8eae10290ea79e1fb2b756d47213 Mon Sep 17 00:00:00 2001 From: Alexander Acevedo Date: Fri, 5 Apr 2019 05:48:31 -0400 Subject: [PATCH 2/5] add custom endpoint to matrix-goofys.service.j2 This (should) check if custom endpoint is enabled. --- .../templates/goofys/systemd/matrix-goofys.service.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/matrix-synapse/templates/goofys/systemd/matrix-goofys.service.j2 b/roles/matrix-synapse/templates/goofys/systemd/matrix-goofys.service.j2 index c123b2c47..0c7d1acf8 100644 --- a/roles/matrix-synapse/templates/goofys/systemd/matrix-goofys.service.j2 +++ b/roles/matrix-synapse/templates/goofys/systemd/matrix-goofys.service.j2 @@ -20,7 +20,7 @@ ExecStart=/usr/bin/docker run --rm --name %n \ --env-file={{ matrix_synapse_config_dir_path }}/env-goofys \ --entrypoint /bin/sh \ {{ matrix_s3_goofys_docker_image }} \ - -c 'goofys -f --storage-class=STANDARD_IA --region {{ matrix_s3_media_store_region }} --stat-cache-ttl 60m0s --type-cache-ttl 60m0s --dir-mode 0700 --file-mode 0700 {{ matrix_s3_media_store_bucket_name }} /s3' + -c 'goofys -f{% if matrix_s3_media_store_custom_endpoint_enabled is false %} --storage-class=STANDARD_IA{% endif %}{% matrix_s3_media_store_custom_endpoint_enabled %} --endpoint={{matrix_s3_media_store_custom_endpoint}}{% endif %} --region {{ matrix_s3_media_store_region }} --stat-cache-ttl 60m0s --type-cache-ttl 60m0s --dir-mode 0700 --file-mode 0700 {{ matrix_s3_media_store_bucket_name }} /s3' TimeoutStartSec=5min ExecStop=-/usr/bin/docker stop %n ExecStop=-/usr/bin/docker kill %n From 3ffb03f20e3469667b87370b4328d09a3ee55a17 Mon Sep 17 00:00:00 2001 From: Alexander Acevedo Date: Fri, 5 Apr 2019 05:54:58 -0400 Subject: [PATCH 3/5] missing whitespace --- .../templates/goofys/systemd/matrix-goofys.service.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/matrix-synapse/templates/goofys/systemd/matrix-goofys.service.j2 b/roles/matrix-synapse/templates/goofys/systemd/matrix-goofys.service.j2 index 0c7d1acf8..20b0b4305 100644 --- a/roles/matrix-synapse/templates/goofys/systemd/matrix-goofys.service.j2 +++ b/roles/matrix-synapse/templates/goofys/systemd/matrix-goofys.service.j2 @@ -20,7 +20,7 @@ ExecStart=/usr/bin/docker run --rm --name %n \ --env-file={{ matrix_synapse_config_dir_path }}/env-goofys \ --entrypoint /bin/sh \ {{ matrix_s3_goofys_docker_image }} \ - -c 'goofys -f{% if matrix_s3_media_store_custom_endpoint_enabled is false %} --storage-class=STANDARD_IA{% endif %}{% matrix_s3_media_store_custom_endpoint_enabled %} --endpoint={{matrix_s3_media_store_custom_endpoint}}{% endif %} --region {{ matrix_s3_media_store_region }} --stat-cache-ttl 60m0s --type-cache-ttl 60m0s --dir-mode 0700 --file-mode 0700 {{ matrix_s3_media_store_bucket_name }} /s3' + -c 'goofys -f{% if matrix_s3_media_store_custom_endpoint_enabled is false %} --storage-class=STANDARD_IA{% endif %}{% matrix_s3_media_store_custom_endpoint_enabled %} --endpoint={{ matrix_s3_media_store_custom_endpoint }}{% endif %} --region {{ matrix_s3_media_store_region }} --stat-cache-ttl 60m0s --type-cache-ttl 60m0s --dir-mode 0700 --file-mode 0700 {{ matrix_s3_media_store_bucket_name }} /s3' TimeoutStartSec=5min ExecStop=-/usr/bin/docker stop %n ExecStop=-/usr/bin/docker kill %n From 3953705682e380465be5c1b6e7c856b0e94bbcaa Mon Sep 17 00:00:00 2001 From: Alexander Acevedo Date: Fri, 5 Apr 2019 05:56:36 -0400 Subject: [PATCH 4/5] add custom endpoint environment variable --- roles/matrix-synapse/templates/goofys/env-goofys.j2 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/roles/matrix-synapse/templates/goofys/env-goofys.j2 b/roles/matrix-synapse/templates/goofys/env-goofys.j2 index a9e4b6926..bb5812fc2 100644 --- a/roles/matrix-synapse/templates/goofys/env-goofys.j2 +++ b/roles/matrix-synapse/templates/goofys/env-goofys.j2 @@ -1,2 +1,3 @@ AWS_ACCESS_KEY={{ matrix_s3_media_store_aws_access_key }} -AWS_SECRET_KEY={{ matrix_s3_media_store_aws_secret_key }} \ No newline at end of file +AWS_SECRET_KEY={{ matrix_s3_media_store_aws_secret_key }} +{% matrix_s3_media_store_custom_endpoint_enabled %}ENDPOINT={{ matrix_s3_media_store_custom_endpoint }}{% endif %} From 6cc6638098e36bb458ad2f7bc7f20fad5eb3b66a Mon Sep 17 00:00:00 2001 From: Alexander Acevedo Date: Fri, 5 Apr 2019 06:01:58 -0400 Subject: [PATCH 5/5] revert 3953705682e380465be5c1b6e7c856b0e94bbcaa that's not how it works --- roles/matrix-synapse/templates/goofys/env-goofys.j2 | 1 - 1 file changed, 1 deletion(-) diff --git a/roles/matrix-synapse/templates/goofys/env-goofys.j2 b/roles/matrix-synapse/templates/goofys/env-goofys.j2 index bb5812fc2..dd47a548a 100644 --- a/roles/matrix-synapse/templates/goofys/env-goofys.j2 +++ b/roles/matrix-synapse/templates/goofys/env-goofys.j2 @@ -1,3 +1,2 @@ AWS_ACCESS_KEY={{ matrix_s3_media_store_aws_access_key }} AWS_SECRET_KEY={{ matrix_s3_media_store_aws_secret_key }} -{% matrix_s3_media_store_custom_endpoint_enabled %}ENDPOINT={{ matrix_s3_media_store_custom_endpoint }}{% endif %}