aboutsummaryrefslogtreecommitdiff
path: root/app/im
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-01-19 14:24:44 +0100
committerAlex Auvolat <alex@adnab.me>2022-01-19 14:24:44 +0100
commit3c12cf646373cb66c3eb0a9b0dbb3f12534dd69a (patch)
tree2e6e931faef312bf6e6cdbef33f2944a8a5cde2d /app/im
parentb5ec581bc8404ff993910e4ba28df564b0e15c02 (diff)
downloadnixcfg-3c12cf646373cb66c3eb0a9b0dbb3f12534dd69a.tar.gz
nixcfg-3c12cf646373cb66c3eb0a9b0dbb3f12534dd69a.zip
im: directly call Garage on local node when possible
Diffstat (limited to 'app/im')
-rw-r--r--app/im/build/matrix-synapse/Dockerfile2
-rwxr-xr-xapp/im/build/matrix-synapse/matrix-s3-async-sqlite6
-rw-r--r--app/im/config/homeserver.yaml2
-rw-r--r--app/im/config/litestream.yml2
-rw-r--r--app/im/deploy/im.hcl7
5 files changed, 12 insertions, 7 deletions
diff --git a/app/im/build/matrix-synapse/Dockerfile b/app/im/build/matrix-synapse/Dockerfile
index 4388d88..0496b19 100644
--- a/app/im/build/matrix-synapse/Dockerfile
+++ b/app/im/build/matrix-synapse/Dockerfile
@@ -27,7 +27,7 @@ RUN . /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] && \
pip3 install \
- git+https://github.com/Alexis211/synapse-s3-storage-provider.git@${S3_VERSION}
+ git+https://github.com/matrix-org/synapse-s3-storage-provider.git@${S3_VERSION}
FROM amd64/debian:buster
diff --git a/app/im/build/matrix-synapse/matrix-s3-async-sqlite b/app/im/build/matrix-synapse/matrix-s3-async-sqlite
index 8ab205e..4bba072 100755
--- a/app/im/build/matrix-synapse/matrix-s3-async-sqlite
+++ b/app/im/build/matrix-synapse/matrix-s3-async-sqlite
@@ -2,12 +2,12 @@
cat > database.yaml <<EOF
sqlite:
- database: /ephemeral/homeserver.db
+ database: $SYNAPSE_SQLITE_DB
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 /ephemeral/media_store
- /root/matrix-env/bin/s3_media_upload --no-progress upload /ephemeral/media_store synapse-data --delete --endpoint-url https://garage-staging.home.adnab.me
+ /root/matrix-env/bin/s3_media_upload --no-progress check-deleted $SYNAPSE_MEDIA_STORE
+ /root/matrix-env/bin/s3_media_upload --no-progress upload $SYNAPSE_MEDIA_STORE $SYNAPSE_MEDIA_S3_BUCKET --delete --endpoint-url $S3_ENDPOINT
sleep 600
done
diff --git a/app/im/config/homeserver.yaml b/app/im/config/homeserver.yaml
index 4a7e862..38db527 100644
--- a/app/im/config/homeserver.yaml
+++ b/app/im/config/homeserver.yaml
@@ -956,7 +956,7 @@ media_storage_providers:
# 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-staging
- endpoint_url: https://garage-staging.home.adnab.me
+ endpoint_url: http://{{ env "attr.unique.network.ip-address" }}:3990
access_key_id: {{ key "secrets/synapse/s3_access_key" | trimSpace }}
secret_access_key: {{ key "secrets/synapse/s3_secret_key" | trimSpace }}
diff --git a/app/im/config/litestream.yml b/app/im/config/litestream.yml
index 0f5dbd5..e444e38 100644
--- a/app/im/config/litestream.yml
+++ b/app/im/config/litestream.yml
@@ -3,7 +3,7 @@ dbs:
replicas:
- url: s3://synapse-db/homeserver.db
region: garage-staging
- endpoint: https://garage-staging.home.adnab.me
+ endpoint: http://{{ env "attr.unique.network.ip-address" }}:3990
access-key-id: {{ key "secrets/synapse/s3_access_key" | trimSpace }}
secret-access-key: {{ key "secrets/synapse/s3_secret_key" | trimSpace }}
force-path-style: true
diff --git a/app/im/deploy/im.hcl b/app/im/deploy/im.hcl
index 0732943..af5304f 100644
--- a/app/im/deploy/im.hcl
+++ b/app/im/deploy/im.hcl
@@ -108,7 +108,7 @@ job "im" {
driver = "docker"
config {
- image = "lxpz/amd64_synapse:1.49.2-3"
+ image = "lxpz/amd64_synapse:1.49.2-4"
readonly_rootfs = true
command = "/usr/local/bin/matrix-s3-async-sqlite"
work_dir = "/ephemeral"
@@ -124,9 +124,14 @@ job "im" {
template {
data = <<EOH
+SYNAPSE_SQLITE_DB=/ephemeral/homeserver.db
+SYNAPSE_MEDIA_STORE=/ephemeral/media_store
+SYNAPSE_MEDIA_S3_BUCKET=synapse-data
AWS_ACCESS_KEY_ID={{ key "secrets/synapse/s3_access_key" | trimSpace }}
AWS_SECRET_ACCESS_KEY={{ key "secrets/synapse/s3_secret_key" | trimSpace }}
AWS_DEFAULT_REGION=garage-staging
+S3_ENDPOINT=http://{{ env "attr.unique.network.ip-address" }}:3990
+
EOH
destination = "secrets/env"
env = true