aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/docker-compose.yml2
-rw-r--r--app/im/build/matrix-synapse/Dockerfile1
-rwxr-xr-xapp/im/build/matrix-synapse/matrix-s3-async16
-rw-r--r--app/im/deploy/im.hcl45
4 files changed, 59 insertions, 5 deletions
diff --git a/app/docker-compose.yml b/app/docker-compose.yml
index 65ce98a..cebe914 100644
--- a/app/docker-compose.yml
+++ b/app/docker-compose.yml
@@ -18,7 +18,7 @@ services:
VERSION: 1.42.0
# https://github.com/matrix-org/synapse-s3-storage-provider/commits/main
S3_VERSION: 3c3fafd6a2624f05fd396d9e003501bf8bef7b2e
- image: superboum/amd64_synapse:v46
+ image: superboum/amd64_synapse:v47
# Email
sogo:
diff --git a/app/im/build/matrix-synapse/Dockerfile b/app/im/build/matrix-synapse/Dockerfile
index 48cf2c7..d410779 100644
--- a/app/im/build/matrix-synapse/Dockerfile
+++ b/app/im/build/matrix-synapse/Dockerfile
@@ -46,6 +46,7 @@ RUN apt-get update && \
ENV LD_PRELOAD /usr/lib/x86_64-linux-gnu/libjemalloc.so.2
COPY --from=builder /root/matrix-env /root/matrix-env
+COPY matrix-s3-async /usr/local/bin/matrix-s3-async
COPY entrypoint.sh /usr/local/bin/entrypoint
ENTRYPOINT ["/usr/local/bin/entrypoint"]
diff --git a/app/im/build/matrix-synapse/matrix-s3-async b/app/im/build/matrix-synapse/matrix-s3-async
new file mode 100755
index 0000000..e435144
--- /dev/null
+++ b/app/im/build/matrix-synapse/matrix-s3-async
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+cat > database.yaml <<EOF
+user: $PG_USER
+password: $PG_PASS
+database: $PG_DB
+host: $PG_HOST
+port: $PG_PORT
+EOF
+
+while true; do
+ /root/matrix-env/bin/s3_media_upload update-db 0d
+ /root/matrix-env/bin/s3_media_upload --no-progress check-deleted /var/lib/matrix-synapse/media
+ /root/matrix-env/bin/s3_media_upload --no-progress upload /var/lib/matrix-synapse/media matrix --delete --endpoint-url https://garage.deuxfleurs.fr
+ sleep 600
+done
diff --git a/app/im/deploy/im.hcl b/app/im/deploy/im.hcl
index 98ea9b7..645d966 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:v46"
+ image = "superboum/amd64_synapse:v47"
network_mode = "host"
readonly_rootfs = true
ports = [ "client_port", "federation_port" ]
@@ -27,13 +27,13 @@ job "im" {
]
volumes = [
"secrets/conf:/etc/matrix-synapse",
- "/mnt/glusterfs/chat/matrix/synapse/media:/var/lib/matrix-synapse/media",
- "/mnt/glusterfs/chat/matrix/synapse/uploads:/var/lib/matrix-synapse/uploads",
+ "/tmp/synapse-media:/var/lib/matrix-synapse/media",
+ "/tmp/synapse-uploads:/var/lib/matrix-synapse/uploads",
"/tmp/synapse-logs:/var/log/matrix-synapse",
"/tmp/synapse:/tmp"
]
}
-
+
template {
data = file("../config/synapse/homeserver.yaml")
destination = "secrets/conf/homeserver.yaml"
@@ -130,6 +130,43 @@ job "im" {
}
+ task "media-async-upload" {
+ driver = "docker"
+
+ config {
+ image = "superboum/amd64_synapse:v47"
+ readonly_rootfs = true
+ command = "/usr/local/bin/matrix-s3-async"
+ work_dir = "/tmp"
+ volumes = [
+ "/tmp/synapse-media:/var/lib/matrix-synapse/media",
+ "/tmp/synapse-uploads:/var/lib/matrix-synapse/uploads",
+ "/tmp/synapse:/tmp"
+ ]
+ }
+
+ resources {
+ cpu = 100
+ memory = 200
+ }
+
+ template {
+ data = <<EOH
+AWS_ACCESS_KEY_ID={{ key "secrets/chat/synapse/s3_access_key" | trimSpace }}
+AWS_SECRET_ACCESS_KEY={{ key "secrets/chat/synapse/s3_secret_key" | trimSpace }}
+AWS_DEFAULT_REGION=garage
+PG_USER={{ key "secrets/chat/synapse/postgres_user" | trimSpace }}
+PG_PASS={{ key "secrets/chat/synapse/postgres_pwd" | trimSpace }}
+PG_DB={{ key "secrets/chat/synapse/postgres_db" | trimSpace }}
+PG_HOST=psql-proxy.service.2.cluster.deuxfleurs.fr
+PG_PORT=5432
+EOH
+ destination = "secrets/env"
+ env = true
+ }
+ }
+
+
group "riotweb" {
count = 1