From f978b23d19f6d4b2ac87c862d30b0f1bfe3f4382 Mon Sep 17 00:00:00 2001 From: Sebastian Hugentobler Date: Wed, 23 May 2018 18:04:35 +0200 Subject: [PATCH] update paths and user to reflect the debian package scheme --- Dockerfile | 10 +++++----- README.md | 8 ++++---- rootfs/etc/confd/conf.d/server.yaml.toml | 2 +- rootfs/etc/confd/templates/server.yaml.tmpl | 18 +++++++++--------- rootfs/etc/cont-init.d/synapse-keys | 9 ++++----- rootfs/etc/fix-attrs.d/01-synapse | 6 +++--- rootfs/etc/services.d/synapse/run | 4 ++-- 7 files changed, 28 insertions(+), 29 deletions(-) diff --git a/Dockerfile b/Dockerfile index a2c96de..956ebe8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,8 +2,8 @@ FROM registry.gitlab.com/thallian/docker-confd-env:master ENV VERSION v0.30.0-rc1 -RUN addgroup -g 2222 synapse -RUN adduser -h /var/lib/synapse -u 2222 -D -G synapse synapse +RUN addgroup -g 2222 matrix-synapse +RUN adduser -h /var/lib/matrix-synapse -u 2222 -D -G matrix-synapse matrix-synapse RUN apk add --no-cache \ libressl \ @@ -47,9 +47,9 @@ RUN pip install https://github.com/matrix-org/synapse/tarball/$VERSION ADD /rootfs / -RUN chown -R synapse:synapse /var/lib/synapse -ENV HOME /var/lib/synapse +RUN chown -R matrix-synapse:matrix-synapse /var/lib/matrix-synapse +ENV HOME /var/lib/matrix-synapse EXPOSE 8448 -VOLUME /var/lib/synapse/media_store/ /var/lib/synapse/uploads /var/lib/synapse/signing/ /etc/ssl/synapse/ +VOLUME /var/lib/matrix-synapse/media_store/ /var/lib/matrix-synapse/uploads /var/lib/matrix-synapse/signing/ /etc/ssl/matrix-synapse/ diff --git a/README.md b/README.md index e6a98cc..fc7a7c4 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ [Synapse](https://github.com/matrix-org/synapse) homeserver for the [matrix](http://matrix.org/) network. # Volumes -- `/var/lib/synapse/media_store/` -- `/var/lib/synapse/signing/` -- `/var/lib/synapse/uploads/` -- `/etc/ssl/synapse/:ro`: certificates have to be here +- `/var/lib/matrix-synapse/media_store/` +- `/var/lib/matrix-synapse/signing/` +- `/var/lib/matrix-synapse/uploads/` +- `/etc/ssl/matrix-synapse/:ro`: certificates have to be here # Environment Variables ## SERVER_NAME diff --git a/rootfs/etc/confd/conf.d/server.yaml.toml b/rootfs/etc/confd/conf.d/server.yaml.toml index ae80ed8..c88c905 100644 --- a/rootfs/etc/confd/conf.d/server.yaml.toml +++ b/rootfs/etc/confd/conf.d/server.yaml.toml @@ -1,6 +1,6 @@ [template] src = "server.yaml.tmpl" -dest = "/var/lib/synapse/server.yaml" +dest = "/var/lib/matrix-synapse/server.yaml" uid = 2222 gid = 2222 mode = "0644" diff --git a/rootfs/etc/confd/templates/server.yaml.tmpl b/rootfs/etc/confd/templates/server.yaml.tmpl index 96c9eec..1f2ab5c 100644 --- a/rootfs/etc/confd/templates/server.yaml.tmpl +++ b/rootfs/etc/confd/templates/server.yaml.tmpl @@ -1,11 +1,11 @@ -tls_certificate_path: "/etc/ssl/synapse/{{getenv "CERT_NAME" "fullchain.pem"}}" -tls_private_key_path: "/etc/ssl/synapse/{{getenv "KEY_NAME" "privkey.pem"}}" -tls_dh_params_path: "/var/lib/synapse/signing/dhparams.pem" +tls_certificate_path: "/etc/ssl/matrix-synapse/{{getenv "CERT_NAME" "fullchain.pem"}}" +tls_private_key_path: "/etc/ssl/matrix-synapse/{{getenv "KEY_NAME" "privkey.pem"}}" +tls_dh_params_path: "/var/lib/matrix-synapse/signing/dhparams.pem" no_tls: False server_name: "{{getenv "SERVER_NAME"}}" -pid_file: /var/lib/synapse/homeserver.pid +pid_file: /var/lib/matrix-synapse/homeserver.pid web_client: True public_baseurl: {{getenv "PUBLIC_BASE_URL"}} @@ -54,8 +54,8 @@ database: event_cache_size: "10K" verbose: 0 -log_file: "/var/lib/synapse/homeserver.log" -log_config: "/var/lib/synapse/log.config" +log_file: "/var/lib/matrix-synapse/homeserver.log" +log_config: "/var/lib/matrix-synapse/log.config" rc_messages_per_second: 0.2 rc_message_burst_count: 10.0 @@ -65,8 +65,8 @@ federation_rc_sleep_delay: 500 federation_rc_reject_limit: 50 federation_rc_concurrent: 3 -media_store_path: "/var/lib/synapse/media_store" -uploads_path: "/var/lib/synapse/uploads" +media_store_path: "/var/lib/matrix-synapse/media_store" +uploads_path: "/var/lib/matrix-synapse/uploads" max_upload_size: "{{getenv "MAX_UPLOAD_SIZE" "10M"}}" max_image_pixels: "{{getenv "MAX_THUMBNAIL_PIXELS" "32M"}}" dynamic_thumbnails: {{getenv "DYNAMIC_THUMBNAILS" "True"}} @@ -118,7 +118,7 @@ app_service_config_files: [] macaroon_secret_key: "{{getenv "MACAROON_SECRET_KEY"}}" expire_access_token: False -signing_key_path: "/var/lib/synapse/signing/signing.key" +signing_key_path: "/var/lib/matrix-synapse/signing/signing.key" old_signing_keys: {} key_refresh_interval: "1d" # 1 Day. diff --git a/rootfs/etc/cont-init.d/synapse-keys b/rootfs/etc/cont-init.d/synapse-keys index 77dcf1f..2afa89d 100644 --- a/rootfs/etc/cont-init.d/synapse-keys +++ b/rootfs/etc/cont-init.d/synapse-keys @@ -1,10 +1,9 @@ #!/usr/bin/with-contenv sh -if [ ! -f /var/lib/synapse/signing/signing.key ]; then - source /var/lib/synapse/bin/activate - s6-setuidgid synapse python -B -m synapse.app.homeserver -c /var/lib/synapse/server.yaml --generate-config -H $SERVER_NAME --report-stats=no +if [ ! -f /var/lib/matrix-synapse/signing/signing.key ]; then + s6-setuidgid matrix-synapse python -B -m synapse.app.homeserver -c /var/lib/matrix-synapse/server.yaml --generate-config -H $SERVER_NAME --report-stats=no fi -if [ ! -f /var/lib/synapse/signing/dhparams.pem ]; then - openssl dhparam -out /var/lib/synapse/signing/dhparams.pem $DHPARAM_LENGTH +if [ ! -f /var/lib/matrix-synapse/signing/dhparams.pem ]; then + openssl dhparam -out /var/lib/matrix-synapse/signing/dhparams.pem $DHPARAM_LENGTH fi diff --git a/rootfs/etc/fix-attrs.d/01-synapse b/rootfs/etc/fix-attrs.d/01-synapse index 66bcba4..ef822b8 100644 --- a/rootfs/etc/fix-attrs.d/01-synapse +++ b/rootfs/etc/fix-attrs.d/01-synapse @@ -1,3 +1,3 @@ -/var/lib/synapse/signing/ true synapse 0640 0750 -/var/lib/synapse/media_store/ true synapse 0640 0750 -/var/lib/synapse/uploads true synapse 0640 0750 \ No newline at end of file +/var/lib/matrix-synapse/signing/ true matrix-synapse 0640 0750 +/var/lib/matrix-synapse/media_store/ true matrix-synapse 0640 0750 +/var/lib/matrix-synapse/uploads true matrix-synapse 0640 0750 diff --git a/rootfs/etc/services.d/synapse/run b/rootfs/etc/services.d/synapse/run index 85cb803..f63079a 100644 --- a/rootfs/etc/services.d/synapse/run +++ b/rootfs/etc/services.d/synapse/run @@ -1,4 +1,4 @@ #!/usr/bin/with-contenv sh -cd /var/lib/synapse -s6-setuidgid synapse python -B -m synapse.app.homeserver -c server.yaml +cd /var/lib/matrix-synapse +s6-setuidgid matrix-synapse python -B -m synapse.app.homeserver -c server.yaml