Skip to content
This repository was archived by the owner on Mar 26, 2024. It is now read-only.

Commit 84eef5b

Browse files
committed
Merge tag 'v1.65.0' into beeper
Synapse 1.65.0 (2022-08-16) =========================== No significant changes since 1.65.0rc2. Synapse 1.65.0rc2 (2022-08-11) ============================== Internal Changes ---------------- - Revert 'Remove the unspecced `room_id` field in the `/hierarchy` response. ([\matrix-org#13365](matrix-org#13365))' to give more time for clients to update. ([\matrix-org#13501](matrix-org#13501)) Synapse 1.65.0rc1 (2022-08-09) ============================== Features -------- - Add support for stable prefixes for [MSC2285 (private read receipts)](matrix-org/matrix-spec-proposals#2285). ([\matrix-org#13273](matrix-org#13273)) - Add new unstable error codes `ORG.MATRIX.MSC3848.ALREADY_JOINED`, `ORG.MATRIX.MSC3848.NOT_JOINED`, and `ORG.MATRIX.MSC3848.INSUFFICIENT_POWER` described in [MSC3848](matrix-org/matrix-spec-proposals#3848). ([\matrix-org#13343](matrix-org#13343)) - Use stable prefixes for [MSC3827](matrix-org/matrix-spec-proposals#3827). ([\matrix-org#13370](matrix-org#13370)) - Add a new module API method to translate a room alias into a room ID. ([\matrix-org#13428](matrix-org#13428)) - Add a new module API method to create a room. ([\matrix-org#13429](matrix-org#13429)) - Add remote join capability to the module API's `update_room_membership` method (in a backwards compatible manner). ([\matrix-org#13441](matrix-org#13441)) Bugfixes -------- - Update the version of the LDAP3 auth provider module included in the `matrixdotorg/synapse` DockerHub images and the Debian packages hosted on packages.matrix.org to 0.2.2. This version fixes a regression in the module. ([\matrix-org#13470](matrix-org#13470)) - Fix a bug introduced in Synapse v1.41.0 where the `/hierarchy` API returned non-standard information (a `room_id` field under each entry in `children_state`). ([\matrix-org#13365](matrix-org#13365)) - Fix a bug introduced in Synapse 0.24.0 that would respond with the wrong error status code to `/joined_members` requests when the requester is not a current member of the room. Contributed by @andrewdoh. ([\matrix-org#13374](matrix-org#13374)) - Fix bug in handling of typing events for appservices. Contributed by Nick @ Beeper (@Fizzadar). ([\matrix-org#13392](matrix-org#13392)) - Fix a bug introduced in Synapse 1.57.0 where rooms listed in `exclude_rooms_from_sync` in the configuration file would not be properly excluded from incremental syncs. ([\matrix-org#13408](matrix-org#13408)) - Fix a bug in the experimental faster-room-joins support which could cause it to get stuck in an infinite loop. ([\matrix-org#13353](matrix-org#13353)) - Faster room joins: fix a bug which caused rejected events to become un-rejected during state syncing. ([\matrix-org#13413](matrix-org#13413)) - Faster room joins: fix error when running out of servers to sync partial state with, so that Synapse raises the intended error instead. ([\matrix-org#13432](matrix-org#13432)) Updates to the Docker image --------------------------- - Make Docker images build on armv7 by installing cryptography dependencies in the 'requirements' stage. Contributed by Jasper Spaans. ([\matrix-org#13372](matrix-org#13372)) Improved Documentation ---------------------- - Update the 'registration tokens' page to acknowledge that the relevant MSC was merged into version 1.2 of the Matrix specification. Contributed by @moan0s. ([\matrix-org#11897](matrix-org#11897)) - Document which HTTP resources support gzip compression. ([\matrix-org#13221](matrix-org#13221)) - Add steps describing how to elevate an existing user to administrator by manipulating the database. ([\matrix-org#13230](matrix-org#13230)) - Fix wrong headline for `url_preview_accept_language` in documentation. ([\matrix-org#13437](matrix-org#13437)) - Remove redundant 'Contents' section from the Configuration Manual. Contributed by @dklimpel. ([\matrix-org#13438](matrix-org#13438)) - Update documentation for config setting `macaroon_secret_key`. ([\matrix-org#13443](matrix-org#13443)) - Update outdated information on `sso_mapping_providers` documentation. ([\matrix-org#13449](matrix-org#13449)) - Fix example code in module documentation of `password_auth_provider_callbacks`. ([\matrix-org#13450](matrix-org#13450)) - Make the configuration for the cache clearer. ([\matrix-org#13481](matrix-org#13481)) Internal Changes ---------------- - Extend the release script to automatically push a new SyTest branch, rather than having that be a manual process. ([\matrix-org#12978](matrix-org#12978)) - Make minor clarifications to the error messages given when we fail to join a room via any server. ([\matrix-org#13160](matrix-org#13160)) - Enable Complement CI tests in the 'latest deps' test run. ([\matrix-org#13213](matrix-org#13213)) - Fix long-standing bugged logic which was never hit in `get_pdu` asking every remote destination even after it finds an event. ([\matrix-org#13346](matrix-org#13346)) - Faster room joins: avoid blocking when pulling events with partially missing prev events. ([\matrix-org#13355](matrix-org#13355)) - Instrument `/messages` for understandable traces in Jaeger. ([\matrix-org#13368](matrix-org#13368)) - Remove an unused argument to `get_relations_for_event`. ([\matrix-org#13383](matrix-org#13383)) - Add a `merge-back` command to the release script, which automates merging the correct branches after a release. ([\matrix-org#13393](matrix-org#13393)) - Adding missing type hints to tests. ([\matrix-org#13397](matrix-org#13397)) - Faster Room Joins: don't leave a stuck room partial state flag if the join fails. ([\matrix-org#13403](matrix-org#13403)) - Refactor `_resolve_state_at_missing_prevs` to compute an `EventContext` instead. ([\matrix-org#13404](matrix-org#13404), [\matrix-org#13431](matrix-org#13431)) - Faster Room Joins: prevent Synapse from answering federated join requests for a room which it has not fully joined yet. ([\matrix-org#13416](matrix-org#13416)) - Re-enable running Complement tests against Synapse with workers. ([\matrix-org#13420](matrix-org#13420)) - Prevent unnecessary lookups to any external `get_event` cache. Contributed by Nick @ Beeper (@Fizzadar). ([\matrix-org#13435](matrix-org#13435)) - Add some tracing to give more insight into local room joins. ([\matrix-org#13439](matrix-org#13439)) - Rename class `RateLimitConfig` to `RatelimitSettings` and `FederationRateLimitConfig` to `FederationRatelimitSettings`. ([\matrix-org#13442](matrix-org#13442)) - Add some comments about how event push actions are stored. ([\matrix-org#13445](matrix-org#13445), [\matrix-org#13455](matrix-org#13455)) - Improve rebuild speed for the "synapse-workers" docker image. ([\matrix-org#13447](matrix-org#13447)) - Fix `@tag_args` being off-by-one with the arguments when tagging a span (tracing). ([\matrix-org#13452](matrix-org#13452)) - Update type of `EventContext.rejected`. ([\matrix-org#13460](matrix-org#13460)) - Use literals in place of `HTTPStatus` constants in tests. ([\matrix-org#13463](matrix-org#13463), [\matrix-org#13469](matrix-org#13469)) - Correct a misnamed argument in state res v2 internals. ([\matrix-org#13467](matrix-org#13467))
2 parents 27cadc7 + 738c117 commit 84eef5b

File tree

101 files changed

+2297
-1194
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+2297
-1194
lines changed

.github/workflows/latest_deps.yml

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,42 @@ jobs:
135135
/logs/**/*.log*
136136
137137
138-
# TODO: run complement (as with twisted trunk, see #12473).
138+
complement:
139+
if: "${{ !failure() && !cancelled() }}"
140+
runs-on: ubuntu-latest
141+
142+
strategy:
143+
fail-fast: false
144+
matrix:
145+
include:
146+
- arrangement: monolith
147+
database: SQLite
148+
149+
- arrangement: monolith
150+
database: Postgres
151+
152+
- arrangement: workers
153+
database: Postgres
154+
155+
steps:
156+
- name: Run actions/checkout@v2 for synapse
157+
uses: actions/checkout@v2
158+
with:
159+
path: synapse
160+
161+
- name: Prepare Complement's Prerequisites
162+
run: synapse/.ci/scripts/setup_complement_prerequisites.sh
163+
164+
- run: |
165+
set -o pipefail
166+
TEST_ONLY_IGNORE_POETRY_LOCKFILE=1 POSTGRES=${{ (matrix.database == 'Postgres') && 1 || '' }} WORKERS=${{ (matrix.arrangement == 'workers') && 1 || '' }} COMPLEMENT_DIR=`pwd`/complement synapse/scripts-dev/complement.sh -json 2>&1 | gotestfmt
167+
shell: bash
168+
name: Run Complement Tests
139169
140-
# open an issue if the build fails, so we know about it.
170+
# Open an issue if the build fails, so we know about it.
171+
# Only do this if we're not experimenting with this action in a PR.
141172
open-issue:
142-
if: failure()
173+
if: "failure() && github.event_name != 'push' && github.event_name != 'pull_request'"
143174
needs:
144175
# TODO: should mypy be included here? It feels more brittle than the other two.
145176
- mypy

.github/workflows/tests.yml

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -328,29 +328,8 @@ jobs:
328328
- arrangement: monolith
329329
database: Postgres
330330

331-
steps:
332-
- name: Run actions/checkout@v2 for synapse
333-
uses: actions/checkout@v2
334-
with:
335-
path: synapse
336-
337-
- name: Prepare Complement's Prerequisites
338-
run: synapse/.ci/scripts/setup_complement_prerequisites.sh
339-
340-
- run: |
341-
set -o pipefail
342-
POSTGRES=${{ (matrix.database == 'Postgres') && 1 || '' }} WORKERS=${{ (matrix.arrangement == 'workers') && 1 || '' }} COMPLEMENT_DIR=`pwd`/complement synapse/scripts-dev/complement.sh -json 2>&1 | gotestfmt
343-
shell: bash
344-
name: Run Complement Tests
345-
346-
# XXX When complement with workers is stable, move this back into the standard
347-
# "complement" matrix above.
348-
#
349-
# See https://github.com/matrix-org/synapse/issues/13161
350-
complement-workers:
351-
if: "${{ !failure() && !cancelled() }}"
352-
needs: linting-done
353-
runs-on: ubuntu-latest
331+
- arrangement: workers
332+
database: Postgres
354333

355334
steps:
356335
- name: Run actions/checkout@v2 for synapse
@@ -363,7 +342,7 @@ jobs:
363342

364343
- run: |
365344
set -o pipefail
366-
POSTGRES=1 WORKERS=1 COMPLEMENT_DIR=`pwd`/complement synapse/scripts-dev/complement.sh -json 2>&1 | gotestfmt
345+
POSTGRES=${{ (matrix.database == 'Postgres') && 1 || '' }} WORKERS=${{ (matrix.arrangement == 'workers') && 1 || '' }} COMPLEMENT_DIR=`pwd`/complement synapse/scripts-dev/complement.sh -json 2>&1 | gotestfmt
367346
shell: bash
368347
name: Run Complement Tests
369348

CHANGES.md

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,92 @@
1+
Synapse 1.65.0 (2022-08-16)
2+
===========================
3+
4+
No significant changes since 1.65.0rc2.
5+
6+
7+
Synapse 1.65.0rc2 (2022-08-11)
8+
==============================
9+
10+
Internal Changes
11+
----------------
12+
13+
- Revert 'Remove the unspecced `room_id` field in the `/hierarchy` response. ([\#13365](https://github.com/matrix-org/synapse/issues/13365))' to give more time for clients to update. ([\#13501](https://github.com/matrix-org/synapse/issues/13501))
14+
15+
16+
Synapse 1.65.0rc1 (2022-08-09)
17+
==============================
18+
19+
Features
20+
--------
21+
22+
- Add support for stable prefixes for [MSC2285 (private read receipts)](https://github.com/matrix-org/matrix-spec-proposals/pull/2285). ([\#13273](https://github.com/matrix-org/synapse/issues/13273))
23+
- Add new unstable error codes `ORG.MATRIX.MSC3848.ALREADY_JOINED`, `ORG.MATRIX.MSC3848.NOT_JOINED`, and `ORG.MATRIX.MSC3848.INSUFFICIENT_POWER` described in [MSC3848](https://github.com/matrix-org/matrix-spec-proposals/pull/3848). ([\#13343](https://github.com/matrix-org/synapse/issues/13343))
24+
- Use stable prefixes for [MSC3827](https://github.com/matrix-org/matrix-spec-proposals/pull/3827). ([\#13370](https://github.com/matrix-org/synapse/issues/13370))
25+
- Add a new module API method to translate a room alias into a room ID. ([\#13428](https://github.com/matrix-org/synapse/issues/13428))
26+
- Add a new module API method to create a room. ([\#13429](https://github.com/matrix-org/synapse/issues/13429))
27+
- Add remote join capability to the module API's `update_room_membership` method (in a backwards compatible manner). ([\#13441](https://github.com/matrix-org/synapse/issues/13441))
28+
29+
30+
Bugfixes
31+
--------
32+
33+
- Update the version of the LDAP3 auth provider module included in the `matrixdotorg/synapse` DockerHub images and the Debian packages hosted on packages.matrix.org to 0.2.2. This version fixes a regression in the module. ([\#13470](https://github.com/matrix-org/synapse/issues/13470))
34+
- Fix a bug introduced in Synapse v1.41.0 where the `/hierarchy` API returned non-standard information (a `room_id` field under each entry in `children_state`). ([\#13365](https://github.com/matrix-org/synapse/issues/13365))
35+
- Fix a bug introduced in Synapse 0.24.0 that would respond with the wrong error status code to `/joined_members` requests when the requester is not a current member of the room. Contributed by @andrewdoh. ([\#13374](https://github.com/matrix-org/synapse/issues/13374))
36+
- Fix bug in handling of typing events for appservices. Contributed by Nick @ Beeper (@fizzadar). ([\#13392](https://github.com/matrix-org/synapse/issues/13392))
37+
- Fix a bug introduced in Synapse 1.57.0 where rooms listed in `exclude_rooms_from_sync` in the configuration file would not be properly excluded from incremental syncs. ([\#13408](https://github.com/matrix-org/synapse/issues/13408))
38+
- Fix a bug in the experimental faster-room-joins support which could cause it to get stuck in an infinite loop. ([\#13353](https://github.com/matrix-org/synapse/issues/13353))
39+
- Faster room joins: fix a bug which caused rejected events to become un-rejected during state syncing. ([\#13413](https://github.com/matrix-org/synapse/issues/13413))
40+
- Faster room joins: fix error when running out of servers to sync partial state with, so that Synapse raises the intended error instead. ([\#13432](https://github.com/matrix-org/synapse/issues/13432))
41+
42+
43+
Updates to the Docker image
44+
---------------------------
45+
46+
- Make Docker images build on armv7 by installing cryptography dependencies in the 'requirements' stage. Contributed by Jasper Spaans. ([\#13372](https://github.com/matrix-org/synapse/issues/13372))
47+
48+
49+
Improved Documentation
50+
----------------------
51+
52+
- Update the 'registration tokens' page to acknowledge that the relevant MSC was merged into version 1.2 of the Matrix specification. Contributed by @moan0s. ([\#11897](https://github.com/matrix-org/synapse/issues/11897))
53+
- Document which HTTP resources support gzip compression. ([\#13221](https://github.com/matrix-org/synapse/issues/13221))
54+
- Add steps describing how to elevate an existing user to administrator by manipulating the database. ([\#13230](https://github.com/matrix-org/synapse/issues/13230))
55+
- Fix wrong headline for `url_preview_accept_language` in documentation. ([\#13437](https://github.com/matrix-org/synapse/issues/13437))
56+
- Remove redundant 'Contents' section from the Configuration Manual. Contributed by @dklimpel. ([\#13438](https://github.com/matrix-org/synapse/issues/13438))
57+
- Update documentation for config setting `macaroon_secret_key`. ([\#13443](https://github.com/matrix-org/synapse/issues/13443))
58+
- Update outdated information on `sso_mapping_providers` documentation. ([\#13449](https://github.com/matrix-org/synapse/issues/13449))
59+
- Fix example code in module documentation of `password_auth_provider_callbacks`. ([\#13450](https://github.com/matrix-org/synapse/issues/13450))
60+
- Make the configuration for the cache clearer. ([\#13481](https://github.com/matrix-org/synapse/issues/13481))
61+
62+
63+
Internal Changes
64+
----------------
65+
66+
- Extend the release script to automatically push a new SyTest branch, rather than having that be a manual process. ([\#12978](https://github.com/matrix-org/synapse/issues/12978))
67+
- Make minor clarifications to the error messages given when we fail to join a room via any server. ([\#13160](https://github.com/matrix-org/synapse/issues/13160))
68+
- Enable Complement CI tests in the 'latest deps' test run. ([\#13213](https://github.com/matrix-org/synapse/issues/13213))
69+
- Fix long-standing bugged logic which was never hit in `get_pdu` asking every remote destination even after it finds an event. ([\#13346](https://github.com/matrix-org/synapse/issues/13346))
70+
- Faster room joins: avoid blocking when pulling events with partially missing prev events. ([\#13355](https://github.com/matrix-org/synapse/issues/13355))
71+
- Instrument `/messages` for understandable traces in Jaeger. ([\#13368](https://github.com/matrix-org/synapse/issues/13368))
72+
- Remove an unused argument to `get_relations_for_event`. ([\#13383](https://github.com/matrix-org/synapse/issues/13383))
73+
- Add a `merge-back` command to the release script, which automates merging the correct branches after a release. ([\#13393](https://github.com/matrix-org/synapse/issues/13393))
74+
- Adding missing type hints to tests. ([\#13397](https://github.com/matrix-org/synapse/issues/13397))
75+
- Faster Room Joins: don't leave a stuck room partial state flag if the join fails. ([\#13403](https://github.com/matrix-org/synapse/issues/13403))
76+
- Refactor `_resolve_state_at_missing_prevs` to compute an `EventContext` instead. ([\#13404](https://github.com/matrix-org/synapse/issues/13404), [\#13431](https://github.com/matrix-org/synapse/issues/13431))
77+
- Faster Room Joins: prevent Synapse from answering federated join requests for a room which it has not fully joined yet. ([\#13416](https://github.com/matrix-org/synapse/issues/13416))
78+
- Re-enable running Complement tests against Synapse with workers. ([\#13420](https://github.com/matrix-org/synapse/issues/13420))
79+
- Prevent unnecessary lookups to any external `get_event` cache. Contributed by Nick @ Beeper (@fizzadar). ([\#13435](https://github.com/matrix-org/synapse/issues/13435))
80+
- Add some tracing to give more insight into local room joins. ([\#13439](https://github.com/matrix-org/synapse/issues/13439))
81+
- Rename class `RateLimitConfig` to `RatelimitSettings` and `FederationRateLimitConfig` to `FederationRatelimitSettings`. ([\#13442](https://github.com/matrix-org/synapse/issues/13442))
82+
- Add some comments about how event push actions are stored. ([\#13445](https://github.com/matrix-org/synapse/issues/13445), [\#13455](https://github.com/matrix-org/synapse/issues/13455))
83+
- Improve rebuild speed for the "synapse-workers" docker image. ([\#13447](https://github.com/matrix-org/synapse/issues/13447))
84+
- Fix `@tag_args` being off-by-one with the arguments when tagging a span (tracing). ([\#13452](https://github.com/matrix-org/synapse/issues/13452))
85+
- Update type of `EventContext.rejected`. ([\#13460](https://github.com/matrix-org/synapse/issues/13460))
86+
- Use literals in place of `HTTPStatus` constants in tests. ([\#13463](https://github.com/matrix-org/synapse/issues/13463), [\#13469](https://github.com/matrix-org/synapse/issues/13469))
87+
- Correct a misnamed argument in state res v2 internals. ([\#13467](https://github.com/matrix-org/synapse/issues/13467))
88+
89+
190
Synapse 1.64.0 (2022-08-02)
291
===========================
392

debian/changelog

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
matrix-synapse-py3 (1.65.0) stable; urgency=medium
2+
3+
* New Synapse release 1.65.0.
4+
5+
-- Synapse Packaging team <[email protected]> Tue, 16 Aug 2022 16:51:26 +0100
6+
7+
matrix-synapse-py3 (1.65.0~rc2) stable; urgency=medium
8+
9+
* New Synapse release 1.65.0rc2.
10+
11+
-- Synapse Packaging team <[email protected]> Thu, 11 Aug 2022 11:38:18 +0100
12+
13+
matrix-synapse-py3 (1.65.0~rc1) stable; urgency=medium
14+
15+
* New Synapse release 1.65.0rc1.
16+
17+
-- Synapse Packaging team <[email protected]> Tue, 09 Aug 2022 11:39:29 +0100
18+
119
matrix-synapse-py3 (1.64.0) stable; urgency=medium
220

321
* New Synapse release 1.64.0.

docker/Dockerfile

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ FROM docker.io/python:${PYTHON_VERSION}-slim as requirements
4040
RUN \
4141
--mount=type=cache,target=/var/cache/apt,sharing=locked \
4242
--mount=type=cache,target=/var/lib/apt,sharing=locked \
43-
apt-get update -qq && apt-get install -yqq git \
43+
apt-get update -qq && apt-get install -yqq \
44+
build-essential cargo git libffi-dev libssl-dev \
4445
&& rm -rf /var/lib/apt/lists/*
4546

4647
# We install poetry in its own build stage to avoid its dependencies conflicting with
@@ -68,7 +69,18 @@ COPY pyproject.toml poetry.lock /synapse/
6869
# reason, such as when a git repository is used directly as a dependency.
6970
ARG TEST_ONLY_SKIP_DEP_HASH_VERIFICATION
7071

71-
RUN /root/.local/bin/poetry export --extras all -o /synapse/requirements.txt ${TEST_ONLY_SKIP_DEP_HASH_VERIFICATION:+--without-hashes}
72+
# If specified, we won't use the Poetry lockfile.
73+
# Instead, we'll just install what a regular `pip install` would from PyPI.
74+
ARG TEST_ONLY_IGNORE_POETRY_LOCKFILE
75+
76+
# Export the dependencies, but only if we're actually going to use the Poetry lockfile.
77+
# Otherwise, just create an empty requirements file so that the Dockerfile can
78+
# proceed.
79+
RUN if [ -z "$TEST_ONLY_IGNORE_POETRY_LOCKFILE" ]; then \
80+
/root/.local/bin/poetry export --extras all -o /synapse/requirements.txt ${TEST_ONLY_SKIP_DEP_HASH_VERIFICATION:+--without-hashes}; \
81+
else \
82+
touch /synapse/requirements.txt; \
83+
fi
7284

7385
###
7486
### Stage 1: builder
@@ -113,8 +125,17 @@ COPY synapse /synapse/synapse/
113125
# ... and what we need to `pip install`.
114126
COPY pyproject.toml README.rst /synapse/
115127

128+
# Repeat of earlier build argument declaration, as this is a new build stage.
129+
ARG TEST_ONLY_IGNORE_POETRY_LOCKFILE
130+
116131
# Install the synapse package itself.
117-
RUN pip install --prefix="/install" --no-deps --no-warn-script-location /synapse
132+
# If we have populated requirements.txt, we don't install any dependencies
133+
# as we should already have those from the previous `pip install` step.
134+
RUN if [ -z "$TEST_ONLY_IGNORE_POETRY_LOCKFILE" ]; then \
135+
pip install --prefix="/install" --no-deps --no-warn-script-location /synapse[all]; \
136+
else \
137+
pip install --prefix="/install" --no-warn-script-location /synapse[all]; \
138+
fi
118139

119140
###
120141
### Stage 2: runtime

docker/Dockerfile-workers

Lines changed: 58 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,62 @@
11
# syntax=docker/dockerfile:1
2-
# Inherit from the official Synapse docker image
3-
ARG SYNAPSE_VERSION=latest
4-
FROM matrixdotorg/synapse:$SYNAPSE_VERSION
5-
6-
# Install deps
7-
RUN \
8-
--mount=type=cache,target=/var/cache/apt,sharing=locked \
9-
--mount=type=cache,target=/var/lib/apt,sharing=locked \
10-
apt-get update -qq && \
11-
DEBIAN_FRONTEND=noninteractive apt-get install -yqq --no-install-recommends \
12-
redis-server nginx-light
13-
14-
# Install supervisord with pip instead of apt, to avoid installing a second
15-
# copy of python.
16-
RUN --mount=type=cache,target=/root/.cache/pip \
17-
pip install supervisor~=4.2
18-
19-
# Disable the default nginx sites
20-
RUN rm /etc/nginx/sites-enabled/default
212

22-
# Copy Synapse worker, nginx and supervisord configuration template files
23-
COPY ./docker/conf-workers/* /conf/
24-
25-
# Copy a script to prefix log lines with the supervisor program name
26-
COPY ./docker/prefix-log /usr/local/bin/
27-
28-
# Expose nginx listener port
29-
EXPOSE 8080/tcp
3+
ARG SYNAPSE_VERSION=latest
304

31-
# A script to read environment variables and create the necessary
32-
# files to run the desired worker configuration. Will start supervisord.
33-
COPY ./docker/configure_workers_and_start.py /configure_workers_and_start.py
34-
ENTRYPOINT ["/configure_workers_and_start.py"]
5+
# first of all, we create a base image with an nginx which we can copy into the
6+
# target image. For repeated rebuilds, this is much faster than apt installing
7+
# each time.
8+
9+
FROM debian:bullseye-slim AS deps_base
10+
RUN \
11+
--mount=type=cache,target=/var/cache/apt,sharing=locked \
12+
--mount=type=cache,target=/var/lib/apt,sharing=locked \
13+
apt-get update -qq && \
14+
DEBIAN_FRONTEND=noninteractive apt-get install -yqq --no-install-recommends \
15+
redis-server nginx-light
16+
17+
# Similarly, a base to copy the redis server from.
18+
#
19+
# The redis docker image has fewer dynamic libraries than the debian package,
20+
# which makes it much easier to copy (but we need to make sure we use an image
21+
# based on the same debian version as the synapse image, to make sure we get
22+
# the expected version of libc.
23+
FROM redis:6-bullseye AS redis_base
24+
25+
# now build the final image, based on the the regular Synapse docker image
26+
FROM matrixdotorg/synapse:$SYNAPSE_VERSION
3527

36-
# Replace the healthcheck with one which checks *all* the workers. The script
37-
# is generated by configure_workers_and_start.py.
38-
HEALTHCHECK --start-period=5s --interval=15s --timeout=5s \
39-
CMD /bin/sh /healthcheck.sh
28+
# Install supervisord with pip instead of apt, to avoid installing a second
29+
# copy of python.
30+
RUN --mount=type=cache,target=/root/.cache/pip \
31+
pip install supervisor~=4.2
32+
RUN mkdir -p /etc/supervisor/conf.d
33+
34+
# Copy over redis and nginx
35+
COPY --from=redis_base /usr/local/bin/redis-server /usr/local/bin
36+
37+
COPY --from=deps_base /usr/sbin/nginx /usr/sbin
38+
COPY --from=deps_base /usr/share/nginx /usr/share/nginx
39+
COPY --from=deps_base /usr/lib/nginx /usr/lib/nginx
40+
COPY --from=deps_base /etc/nginx /etc/nginx
41+
RUN rm /etc/nginx/sites-enabled/default
42+
RUN mkdir /var/log/nginx /var/lib/nginx
43+
RUN chown www-data /var/log/nginx /var/lib/nginx
44+
45+
# Copy Synapse worker, nginx and supervisord configuration template files
46+
COPY ./docker/conf-workers/* /conf/
47+
48+
# Copy a script to prefix log lines with the supervisor program name
49+
COPY ./docker/prefix-log /usr/local/bin/
50+
51+
# Expose nginx listener port
52+
EXPOSE 8080/tcp
53+
54+
# A script to read environment variables and create the necessary
55+
# files to run the desired worker configuration. Will start supervisord.
56+
COPY ./docker/configure_workers_and_start.py /configure_workers_and_start.py
57+
ENTRYPOINT ["/configure_workers_and_start.py"]
58+
59+
# Replace the healthcheck with one which checks *all* the workers. The script
60+
# is generated by configure_workers_and_start.py.
61+
HEALTHCHECK --start-period=5s --interval=15s --timeout=5s \
62+
CMD /bin/sh /healthcheck.sh

docker/conf-workers/supervisord.conf.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ username=www-data
1919
autorestart=true
2020

2121
[program:redis]
22-
command=/usr/local/bin/prefix-log /usr/bin/redis-server /etc/redis/redis.conf --daemonize no
22+
command=/usr/local/bin/prefix-log /usr/local/bin/redis-server
2323
priority=1
2424
stdout_logfile=/dev/stdout
2525
stdout_logfile_maxbytes=0

docs/modules/password_auth_provider_callbacks.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ class MyAuthProvider:
263263
return None
264264

265265
if self.credentials.get(username) == login_dict.get("my_field"):
266-
return self.api.get_qualified_user_id(username)
266+
return (self.api.get_qualified_user_id(username), None)
267267

268268
async def check_pass(
269269
self,
@@ -280,5 +280,5 @@ class MyAuthProvider:
280280
return None
281281

282282
if self.credentials.get(username) == login_dict.get("password"):
283-
return self.api.get_qualified_user_id(username)
283+
return (self.api.get_qualified_user_id(username), None)
284284
```

0 commit comments

Comments
 (0)