diff options
Diffstat (limited to 'docker')
-rw-r--r-- | docker/Dockerfile | 4 | ||||
-rw-r--r-- | docker/README-testing.md | 2 | ||||
-rw-r--r-- | docker/README.md | 10 | ||||
-rw-r--r-- | docker/complement/Dockerfile | 94 | ||||
-rwxr-xr-x | docker/configure_workers_and_start.py | 26 |
5 files changed, 71 insertions, 65 deletions
diff --git a/docker/Dockerfile b/docker/Dockerfile index b58e518ec1..d4cb9414ff 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -161,8 +161,8 @@ RUN --mount=type=cache,target=/synapse/target,sharing=locked \ FROM docker.io/library/python:${PYTHON_VERSION}-slim-bookworm LABEL org.opencontainers.image.url='https://matrix.org/docs/projects/server/synapse' -LABEL org.opencontainers.image.documentation='https://github.com/matrix-org/synapse/blob/master/docker/README.md' -LABEL org.opencontainers.image.source='https://github.com/matrix-org/synapse.git' +LABEL org.opencontainers.image.documentation='https://github.com/element-hq/synapse/blob/master/docker/README.md' +LABEL org.opencontainers.image.source='https://github.com/element-hq/synapse.git' LABEL org.opencontainers.image.licenses='Apache-2.0' RUN \ diff --git a/docker/README-testing.md b/docker/README-testing.md index 21b99963d8..db88598b8c 100644 --- a/docker/README-testing.md +++ b/docker/README-testing.md @@ -15,7 +15,7 @@ and run Synapse against Complement. Consult the [contributing guide][guideComplementSh] for instructions on how to use it. -[guideComplementSh]: https://matrix-org.github.io/synapse/latest/development/contributing_guide.html#run-the-integration-tests-complement +[guideComplementSh]: https://element-hq.github.io/synapse/latest/development/contributing_guide.html#run-the-integration-tests-complement ## Building and running the images manually diff --git a/docker/README.md b/docker/README.md index 08372e95c6..8dba6fdb05 100644 --- a/docker/README.md +++ b/docker/README.md @@ -45,7 +45,7 @@ docker run -it --rm \ ``` For information on picking a suitable server name, see -https://matrix-org.github.io/synapse/latest/setup/installation.html. +https://element-hq.github.io/synapse/latest/setup/installation.html. The above command will generate a `homeserver.yaml` in (typically) `/var/lib/docker/volumes/synapse-data/_data`. You should check this file, and @@ -78,7 +78,7 @@ The following environment variables are supported in `generate` mode: ## Postgres -By default the config will use SQLite. See the [docs on using Postgres](https://github.com/matrix-org/synapse/blob/develop/docs/postgres.md) for more info on how to use Postgres. Until this section is improved [this issue](https://github.com/matrix-org/synapse/issues/8304) may provide useful information. +By default the config will use SQLite. See the [docs on using Postgres](https://github.com/element-hq/synapse/blob/develop/docs/postgres.md) for more info on how to use Postgres. Until this section is improved [this issue](https://github.com/element-hq/synapse/issues/8304) may provide useful information. ## Running synapse @@ -151,10 +151,10 @@ is suitable for local testing, but for any practical use, you will either need to use a reverse proxy, or configure Synapse to expose an HTTPS port. For documentation on using a reverse proxy, see -https://github.com/matrix-org/synapse/blob/master/docs/reverse_proxy.md. +https://github.com/element-hq/synapse/blob/master/docs/reverse_proxy.md. For more information on enabling TLS support in synapse itself, see -https://matrix-org.github.io/synapse/latest/setup/installation.html#tls-certificates. Of +https://element-hq.github.io/synapse/latest/setup/installation.html#tls-certificates. Of course, you will need to expose the TLS port from the container with a `-p` argument to `docker run`. @@ -242,4 +242,4 @@ healthcheck: Jemalloc is embedded in the image and will be used instead of the default allocator. You can read about jemalloc by reading the Synapse -[Admin FAQ](https://matrix-org.github.io/synapse/latest/usage/administration/admin_faq.html#help-synapse-is-slow-and-eats-all-my-ramcpu). +[Admin FAQ](https://element-hq.github.io/synapse/latest/usage/administration/admin_faq.html#help-synapse-is-slow-and-eats-all-my-ramcpu). diff --git a/docker/complement/Dockerfile b/docker/complement/Dockerfile index b511e2ab23..ce82c400eb 100644 --- a/docker/complement/Dockerfile +++ b/docker/complement/Dockerfile @@ -1,58 +1,58 @@ # syntax=docker/dockerfile:1 -# This dockerfile builds on top of 'docker/Dockerfile-workers' in matrix-org/synapse +# This dockerfile builds on top of 'docker/Dockerfile-workers' in element-hq/synapse # by including a built-in postgres instance, as well as setting up the homeserver so # that it is ready for testing via Complement. # # Instructions for building this image from those it depends on is detailed in this guide: -# https://github.com/matrix-org/synapse/blob/develop/docker/README-testing.md#testing-with-postgresql-and-single-or-multi-process-synapse +# https://github.com/element-hq/synapse/blob/develop/docker/README-testing.md#testing-with-postgresql-and-single-or-multi-process-synapse ARG SYNAPSE_VERSION=latest # This is an intermediate image, to be built locally (not pulled from a registry). ARG FROM=matrixdotorg/synapse-workers:$SYNAPSE_VERSION FROM $FROM - # First of all, we copy postgres server from the official postgres image, - # since for repeated rebuilds, this is much faster than apt installing - # postgres each time. - - # This trick only works because (a) the Synapse image happens to have all the - # shared libraries that postgres wants, (b) we use a postgres image based on - # the same debian version as Synapse's docker image (so the versions of the - # shared libraries match). - RUN adduser --system --uid 999 postgres --home /var/lib/postgresql - COPY --from=docker.io/library/postgres:13-bookworm /usr/lib/postgresql /usr/lib/postgresql - COPY --from=docker.io/library/postgres:13-bookworm /usr/share/postgresql /usr/share/postgresql - RUN mkdir /var/run/postgresql && chown postgres /var/run/postgresql - ENV PATH="${PATH}:/usr/lib/postgresql/13/bin" - ENV PGDATA=/var/lib/postgresql/data - - # We also initialize the database at build time, rather than runtime, so that it's faster to spin up the image. - RUN gosu postgres initdb --locale=C --encoding=UTF-8 --auth-host password - - # Configure a password and create a database for Synapse - RUN echo "ALTER USER postgres PASSWORD 'somesecret'" | gosu postgres postgres --single - RUN echo "CREATE DATABASE synapse" | gosu postgres postgres --single - - # Extend the shared homeserver config to disable rate-limiting, - # set Complement's static shared secret, enable registration, amongst other - # tweaks to get Synapse ready for testing. - # To do this, we copy the old template out of the way and then include it - # with Jinja2. - RUN mv /conf/shared.yaml.j2 /conf/shared-orig.yaml.j2 - COPY conf/workers-shared-extra.yaml.j2 /conf/shared.yaml.j2 - - WORKDIR /data - - COPY conf/postgres.supervisord.conf /etc/supervisor/conf.d/postgres.conf - - # Copy the entrypoint - COPY conf/start_for_complement.sh / - - # Expose nginx's listener ports - EXPOSE 8008 8448 - - ENTRYPOINT ["/start_for_complement.sh"] - - # Update the healthcheck to have a shorter check interval - HEALTHCHECK --start-period=5s --interval=1s --timeout=1s \ - CMD /bin/sh /healthcheck.sh +# First of all, we copy postgres server from the official postgres image, +# since for repeated rebuilds, this is much faster than apt installing +# postgres each time. + +# This trick only works because (a) the Synapse image happens to have all the +# shared libraries that postgres wants, (b) we use a postgres image based on +# the same debian version as Synapse's docker image (so the versions of the +# shared libraries match). +RUN adduser --system --uid 999 postgres --home /var/lib/postgresql +COPY --from=docker.io/library/postgres:13-bookworm /usr/lib/postgresql /usr/lib/postgresql +COPY --from=docker.io/library/postgres:13-bookworm /usr/share/postgresql /usr/share/postgresql +RUN mkdir /var/run/postgresql && chown postgres /var/run/postgresql +ENV PATH="${PATH}:/usr/lib/postgresql/13/bin" +ENV PGDATA=/var/lib/postgresql/data + +# We also initialize the database at build time, rather than runtime, so that it's faster to spin up the image. +RUN gosu postgres initdb --locale=C --encoding=UTF-8 --auth-host password + +# Configure a password and create a database for Synapse +RUN echo "ALTER USER postgres PASSWORD 'somesecret'" | gosu postgres postgres --single +RUN echo "CREATE DATABASE synapse" | gosu postgres postgres --single + +# Extend the shared homeserver config to disable rate-limiting, +# set Complement's static shared secret, enable registration, amongst other +# tweaks to get Synapse ready for testing. +# To do this, we copy the old template out of the way and then include it +# with Jinja2. +RUN mv /conf/shared.yaml.j2 /conf/shared-orig.yaml.j2 +COPY conf/workers-shared-extra.yaml.j2 /conf/shared.yaml.j2 + +WORKDIR /data + +COPY conf/postgres.supervisord.conf /etc/supervisor/conf.d/postgres.conf + +# Copy the entrypoint +COPY conf/start_for_complement.sh / + +# Expose nginx's listener ports +EXPOSE 8008 8448 + +ENTRYPOINT ["/start_for_complement.sh"] + +# Update the healthcheck to have a shorter check interval +HEALTHCHECK --start-period=5s --interval=1s --timeout=1s \ + CMD /bin/sh /healthcheck.sh diff --git a/docker/configure_workers_and_start.py b/docker/configure_workers_and_start.py index 62952e6b26..dff8f1733a 100755 --- a/docker/configure_workers_and_start.py +++ b/docker/configure_workers_and_start.py @@ -1,17 +1,23 @@ #!/usr/bin/env python -# Copyright 2021 The Matrix.org Foundation C.I.C. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# This file is licensed under the Affero General Public License (AGPL) version 3. +# +# Copyright (C) 2023 New Vector, Ltd +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# See the GNU Affero General Public License for more details: +# <https://www.gnu.org/licenses/agpl-3.0.html>. +# +# Originally licensed under the Apache License, Version 2.0: +# <http://www.apache.org/licenses/LICENSE-2.0>. +# +# [This file includes modifications made by New Vector Limited] # -# http://www.apache.org/licenses/LICENSE-2.0 # -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. # This script reads environment variables and generates a shared Synapse worker, # nginx and supervisord configs depending on the workers requested. |