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
|
# Update with the latest commit on main each time you update the synapse version
|
||||||
# otherwise synapse may fail to launch due to incompatibility issues
|
# 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
|
# see this issue for an example: https://github.com/matrix-org/synapse-s3-storage-provider/issues/64
|
||||||
S3_VERSION: 772481b6500ba9dc87d0d3045d7bbe6de28e463f
|
S3_VERSION: 8926b4e4178edcda1a32fdb39bd36cef1a1a9d40
|
||||||
image: lxpz/amd64_synapse:1.49.2-3
|
image: lxpz/amd64_synapse:1.49.2-4
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ RUN . /root/matrix-env/bin/activate && \
|
||||||
pip3 install \
|
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 \
|
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
|
FROM amd64/debian:buster
|
||||||
|
|
||||||
|
|
|
@ -2,12 +2,12 @@
|
||||||
|
|
||||||
cat > database.yaml <<EOF
|
cat > database.yaml <<EOF
|
||||||
sqlite:
|
sqlite:
|
||||||
database: /ephemeral/homeserver.db
|
database: $SYNAPSE_SQLITE_DB
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
/root/matrix-env/bin/s3_media_upload update-db 0d
|
/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 check-deleted $SYNAPSE_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 upload $SYNAPSE_MEDIA_STORE $SYNAPSE_MEDIA_S3_BUCKET --delete --endpoint-url $S3_ENDPOINT
|
||||||
sleep 600
|
sleep 600
|
||||||
done
|
done
|
||||||
|
|
|
@ -956,7 +956,7 @@ media_storage_providers:
|
||||||
# All of the below options are optional, for use with non-AWS S3-like
|
# 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.
|
# services, or to specify access tokens here instead of some external method.
|
||||||
region_name: garage-staging
|
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 }}
|
access_key_id: {{ key "secrets/synapse/s3_access_key" | trimSpace }}
|
||||||
secret_access_key: {{ key "secrets/synapse/s3_secret_key" | trimSpace }}
|
secret_access_key: {{ key "secrets/synapse/s3_secret_key" | trimSpace }}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ dbs:
|
||||||
replicas:
|
replicas:
|
||||||
- url: s3://synapse-db/homeserver.db
|
- url: s3://synapse-db/homeserver.db
|
||||||
region: garage-staging
|
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 }}
|
access-key-id: {{ key "secrets/synapse/s3_access_key" | trimSpace }}
|
||||||
secret-access-key: {{ key "secrets/synapse/s3_secret_key" | trimSpace }}
|
secret-access-key: {{ key "secrets/synapse/s3_secret_key" | trimSpace }}
|
||||||
force-path-style: true
|
force-path-style: true
|
||||||
|
|
|
@ -108,7 +108,7 @@ job "im" {
|
||||||
driver = "docker"
|
driver = "docker"
|
||||||
|
|
||||||
config {
|
config {
|
||||||
image = "lxpz/amd64_synapse:1.49.2-3"
|
image = "lxpz/amd64_synapse:1.49.2-4"
|
||||||
readonly_rootfs = true
|
readonly_rootfs = true
|
||||||
command = "/usr/local/bin/matrix-s3-async-sqlite"
|
command = "/usr/local/bin/matrix-s3-async-sqlite"
|
||||||
work_dir = "/ephemeral"
|
work_dir = "/ephemeral"
|
||||||
|
@ -124,9 +124,14 @@ job "im" {
|
||||||
|
|
||||||
template {
|
template {
|
||||||
data = <<EOH
|
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_ACCESS_KEY_ID={{ key "secrets/synapse/s3_access_key" | trimSpace }}
|
||||||
AWS_SECRET_ACCESS_KEY={{ key "secrets/synapse/s3_secret_key" | trimSpace }}
|
AWS_SECRET_ACCESS_KEY={{ key "secrets/synapse/s3_secret_key" | trimSpace }}
|
||||||
AWS_DEFAULT_REGION=garage-staging
|
AWS_DEFAULT_REGION=garage-staging
|
||||||
|
S3_ENDPOINT=http://{{ env "attr.unique.network.ip-address" }}:3990
|
||||||
|
|
||||||
EOH
|
EOH
|
||||||
destination = "secrets/env"
|
destination = "secrets/env"
|
||||||
env = true
|
env = true
|
||||||
|
|
Loading…
Reference in a new issue