From efcdef78564b3a3777efa5c1ed99ebc77fab0131 Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Fri, 4 Jun 2021 19:48:50 +0200 Subject: [PATCH] Matrix 1.35.1 + S3 backend --- app/docker-compose.yml | 6 ++++-- app/im/build/matrix-synapse/Dockerfile | 5 ++++- app/im/config/synapse/homeserver.yaml | 23 +++++++++++++++++++++++ app/im/deploy/im.hcl | 2 +- app/im/secrets/chat/synapse/s3_access_key | 1 + app/im/secrets/chat/synapse/s3_secret_key | 1 + 6 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 app/im/secrets/chat/synapse/s3_access_key create mode 100644 app/im/secrets/chat/synapse/s3_secret_key diff --git a/app/docker-compose.yml b/app/docker-compose.yml index b72bac9..9905a57 100644 --- a/app/docker-compose.yml +++ b/app/docker-compose.yml @@ -22,8 +22,10 @@ services: context: ./im/build/matrix-synapse args: # https://github.com/matrix-org/synapse/releases - VERSION: 1.34.0 - image: superboum/amd64_synapse:v44 + VERSION: 1.35.1 + # https://github.com/matrix-org/synapse-s3-storage-provider/commits/main + S3_VERSION: 3c3fafd6a2624f05fd396d9e003501bf8bef7b2e + image: superboum/amd64_synapse:v45 # Email sogo: diff --git a/app/im/build/matrix-synapse/Dockerfile b/app/im/build/matrix-synapse/Dockerfile index b8480d5..20650d0 100644 --- a/app/im/build/matrix-synapse/Dockerfile +++ b/app/im/build/matrix-synapse/Dockerfile @@ -1,6 +1,7 @@ FROM amd64/debian:buster as builder ARG VERSION +ARG S3_VERSION RUN apt-get update && \ apt-get -qq -y full-upgrade && \ apt-get install -y \ @@ -22,7 +23,9 @@ RUN apt-get update && \ virtualenv /root/matrix-env -p /usr/bin/python3 && \ . /root/matrix-env/bin/activate && \ pip3 install \ - https://github.com/matrix-org/synapse/archive/v${VERSION}.tar.gz#egg=matrix-synapse[matrix-synapse-ldap3,postgres,resources.consent,saml2,url_preview] + https://github.com/matrix-org/synapse/archive/v${VERSION}.tar.gz#egg=matrix-synapse[matrix-synapse-ldap3,postgres,resources.consent,saml2,url_preview] && \ + pip3 install \ + git+https://github.com/matrix-org/synapse-s3-storage-provider.git@${S3_VERSION} FROM amd64/debian:buster diff --git a/app/im/config/synapse/homeserver.yaml b/app/im/config/synapse/homeserver.yaml index eacf509..c68bc49 100644 --- a/app/im/config/synapse/homeserver.yaml +++ b/app/im/config/synapse/homeserver.yaml @@ -137,6 +137,29 @@ federation_rc_concurrent: 3 media_store_path: "/var/lib/matrix-synapse/media" uploads_path: "/var/lib/matrix-synapse/uploads" +media_storage_providers: +- module: s3_storage_provider.S3StorageProviderBackend + store_local: True + store_remote: True + store_synchronous: True + config: + bucket: matrix + # All of the below options are optional, for use with non-AWS S3-like + # services, or to specify access tokens here instead of some external method. + region_name: garage + endpoint_url: https://garagehq.deuxfleurs.fr + access_key_id: {{ key "secrets/chat/synapse/s3_access_key" | trimSpace }} + secret_access_key: {{ key "secrets/chat/synapse/s3_secret_key" | trimSpace }} + + # The object storage class used when uploading files to the bucket. + # Default is STANDARD. + #storage_class: "STANDARD_IA" + + # The maximum number of concurrent threads which will be used to connect + # to S3. Each thread manages a single connection. Default is 40. + # + #threadpool_size: 20 + # The largest allowed upload size in bytes max_upload_size: "100M" diff --git a/app/im/deploy/im.hcl b/app/im/deploy/im.hcl index d3cad7c..b53645c 100644 --- a/app/im/deploy/im.hcl +++ b/app/im/deploy/im.hcl @@ -15,7 +15,7 @@ job "im" { driver = "docker" config { - image = "superboum/amd64_synapse:v44" + image = "superboum/amd64_synapse:v45" network_mode = "host" readonly_rootfs = true ports = [ "client_port", "federation_port" ] diff --git a/app/im/secrets/chat/synapse/s3_access_key b/app/im/secrets/chat/synapse/s3_access_key new file mode 100644 index 0000000..ab09a8e --- /dev/null +++ b/app/im/secrets/chat/synapse/s3_access_key @@ -0,0 +1 @@ +USER matrix diff --git a/app/im/secrets/chat/synapse/s3_secret_key b/app/im/secrets/chat/synapse/s3_secret_key new file mode 100644 index 0000000..ab09a8e --- /dev/null +++ b/app/im/secrets/chat/synapse/s3_secret_key @@ -0,0 +1 @@ +USER matrix