forked from Deuxfleurs/nixcfg
im: directly call Garage on local node when possible
This commit is contained in:
parent
b5ec581bc8
commit
3c12cf6463
6 changed files with 14 additions and 9 deletions
|
@ -11,6 +11,6 @@ services:
|
|||
# Update with the latest commit on main each time you update the synapse version
|
||||
# otherwise synapse may fail to launch due to incompatibility issues
|
||||
# see this issue for an example: https://github.com/matrix-org/synapse-s3-storage-provider/issues/64
|
||||
S3_VERSION: 772481b6500ba9dc87d0d3045d7bbe6de28e463f
|
||||
image: lxpz/amd64_synapse:1.49.2-3
|
||||
S3_VERSION: 8926b4e4178edcda1a32fdb39bd36cef1a1a9d40
|
||||
image: lxpz/amd64_synapse:1.49.2-4
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 }}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue