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

Commit 1d4f5c3

Browse files
committed
Merge tag 'v1.33.0' into babolivier/dinsic_1.41.0
Synapse 1.33.0 (2021-05-05) =========================== Features -------- - Build Debian packages for Ubuntu 21.04 (Hirsute Hippo). ([\#9909](matrix-org/synapse#9909)) Synapse 1.33.0rc2 (2021-04-29) ============================== Bugfixes -------- - Fix tight loop when handling presence replication when using workers. Introduced in v1.33.0rc1. ([\#9900](matrix-org/synapse#9900)) Synapse 1.33.0rc1 (2021-04-28) ============================== Features -------- - Update experimental support for [MSC3083](matrix-org/matrix-spec-proposals#3083): restricting room access via group membership. ([\#9800](matrix-org/synapse#9800), [\#9814](matrix-org/synapse#9814)) - Add experimental support for handling presence on a worker. ([\#9819](matrix-org/synapse#9819), [\#9820](matrix-org/synapse#9820), [\#9828](matrix-org/synapse#9828), [\#9850](matrix-org/synapse#9850)) - Return a new template when an user attempts to renew their account multiple times with the same token, stating that their account is set to expire. This replaces the invalid token template that would previously be shown in this case. This change concerns the optional account validity feature. ([\#9832](matrix-org/synapse#9832)) Bugfixes -------- - Fixes the OIDC SSO flow when using a `public_baseurl` value including a non-root URL path. ([\#9726](matrix-org/synapse#9726)) - Fix thumbnail generation for some sites with non-standard content types. Contributed by @rkfg. ([\#9788](matrix-org/synapse#9788)) - Add some sanity checks to identity server passed to 3PID bind/unbind endpoints. ([\#9802](matrix-org/synapse#9802)) - Limit the size of HTTP responses read over federation. ([\#9833](matrix-org/synapse#9833)) - Fix a bug which could cause Synapse to get stuck in a loop of resyncing device lists. ([\#9867](matrix-org/synapse#9867)) - Fix a long-standing bug where errors from federation did not propagate to the client. ([\#9868](matrix-org/synapse#9868)) Improved Documentation ---------------------- - Add a note to the docker docs mentioning that we mirror upstream's supported Docker platforms. ([\#9801](matrix-org/synapse#9801)) Internal Changes ---------------- - Add a dockerfile for running Synapse in worker-mode under Complement. ([\#9162](matrix-org/synapse#9162)) - Apply `pyupgrade` across the codebase. ([\#9786](matrix-org/synapse#9786)) - Move some replication processing out of `generic_worker`. ([\#9796](matrix-org/synapse#9796)) - Replace `HomeServer.get_config()` with inline references. ([\#9815](matrix-org/synapse#9815)) - Rename some handlers and config modules to not duplicate the top-level module. ([\#9816](matrix-org/synapse#9816)) - Fix a long-standing bug which caused `max_upload_size` to not be correctly enforced. ([\#9817](matrix-org/synapse#9817)) - Reduce CPU usage of the user directory by reusing existing calculated room membership. ([\#9821](matrix-org/synapse#9821)) - Small speed up for joining large remote rooms. ([\#9825](matrix-org/synapse#9825)) - Introduce flake8-bugbear to the test suite and fix some of its lint violations. ([\#9838](matrix-org/synapse#9838)) - Only store the raw data in the in-memory caches, rather than objects that include references to e.g. the data stores. ([\#9845](matrix-org/synapse#9845)) - Limit length of accepted email addresses. ([\#9855](matrix-org/synapse#9855)) - Remove redundant `synapse.types.Collection` type definition. ([\#9856](matrix-org/synapse#9856)) - Handle recently added rate limits correctly when using `--no-rate-limit` with the demo scripts. ([\#9858](matrix-org/synapse#9858)) - Disable invite rate-limiting by default when running the unit tests. ([\#9871](matrix-org/synapse#9871)) - Pass a reactor into `SynapseSite` to make testing easier. ([\#9874](matrix-org/synapse#9874)) - Make `DomainSpecificString` an `attrs` class. ([\#9875](matrix-org/synapse#9875)) - Add type hints to `synapse.api.auth` and `synapse.api.auth_blocking` modules. ([\#9876](matrix-org/synapse#9876)) - Remove redundant `_PushHTTPChannel` test class. ([\#9878](matrix-org/synapse#9878)) - Remove backwards-compatibility code for Python versions < 3.6. ([\#9879](matrix-org/synapse#9879)) - Small performance improvement around handling new local presence updates. ([\#9887](matrix-org/synapse#9887))
2 parents 06690b1 + 0644ac0 commit 1d4f5c3

File tree

685 files changed

+3793
-2498
lines changed

Some content is hidden

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

685 files changed

+3793
-2498
lines changed

.buildkite/scripts/create_postgres_db.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env python
2-
# -*- coding: utf-8 -*-
32
# Copyright 2019 The Matrix.org Foundation C.I.C.
43
#
54
# Licensed under the Apache License, Version 2.0 (the "License");

CHANGES.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,74 @@
1+
Synapse 1.33.0 (2021-05-05)
2+
===========================
3+
4+
Features
5+
--------
6+
7+
- Build Debian packages for Ubuntu 21.04 (Hirsute Hippo). ([\#9909](https://github.com/matrix-org/synapse/issues/9909))
8+
9+
10+
Synapse 1.33.0rc2 (2021-04-29)
11+
==============================
12+
13+
Bugfixes
14+
--------
15+
16+
- Fix tight loop when handling presence replication when using workers. Introduced in v1.33.0rc1. ([\#9900](https://github.com/matrix-org/synapse/issues/9900))
17+
18+
19+
Synapse 1.33.0rc1 (2021-04-28)
20+
==============================
21+
22+
Features
23+
--------
24+
25+
- Update experimental support for [MSC3083](https://github.com/matrix-org/matrix-doc/pull/3083): restricting room access via group membership. ([\#9800](https://github.com/matrix-org/synapse/issues/9800), [\#9814](https://github.com/matrix-org/synapse/issues/9814))
26+
- Add experimental support for handling presence on a worker. ([\#9819](https://github.com/matrix-org/synapse/issues/9819), [\#9820](https://github.com/matrix-org/synapse/issues/9820), [\#9828](https://github.com/matrix-org/synapse/issues/9828), [\#9850](https://github.com/matrix-org/synapse/issues/9850))
27+
- Return a new template when an user attempts to renew their account multiple times with the same token, stating that their account is set to expire. This replaces the invalid token template that would previously be shown in this case. This change concerns the optional account validity feature. ([\#9832](https://github.com/matrix-org/synapse/issues/9832))
28+
29+
30+
Bugfixes
31+
--------
32+
33+
- Fixes the OIDC SSO flow when using a `public_baseurl` value including a non-root URL path. ([\#9726](https://github.com/matrix-org/synapse/issues/9726))
34+
- Fix thumbnail generation for some sites with non-standard content types. Contributed by @rkfg. ([\#9788](https://github.com/matrix-org/synapse/issues/9788))
35+
- Add some sanity checks to identity server passed to 3PID bind/unbind endpoints. ([\#9802](https://github.com/matrix-org/synapse/issues/9802))
36+
- Limit the size of HTTP responses read over federation. ([\#9833](https://github.com/matrix-org/synapse/issues/9833))
37+
- Fix a bug which could cause Synapse to get stuck in a loop of resyncing device lists. ([\#9867](https://github.com/matrix-org/synapse/issues/9867))
38+
- Fix a long-standing bug where errors from federation did not propagate to the client. ([\#9868](https://github.com/matrix-org/synapse/issues/9868))
39+
40+
41+
Improved Documentation
42+
----------------------
43+
44+
- Add a note to the docker docs mentioning that we mirror upstream's supported Docker platforms. ([\#9801](https://github.com/matrix-org/synapse/issues/9801))
45+
46+
47+
Internal Changes
48+
----------------
49+
50+
- Add a dockerfile for running Synapse in worker-mode under Complement. ([\#9162](https://github.com/matrix-org/synapse/issues/9162))
51+
- Apply `pyupgrade` across the codebase. ([\#9786](https://github.com/matrix-org/synapse/issues/9786))
52+
- Move some replication processing out of `generic_worker`. ([\#9796](https://github.com/matrix-org/synapse/issues/9796))
53+
- Replace `HomeServer.get_config()` with inline references. ([\#9815](https://github.com/matrix-org/synapse/issues/9815))
54+
- Rename some handlers and config modules to not duplicate the top-level module. ([\#9816](https://github.com/matrix-org/synapse/issues/9816))
55+
- Fix a long-standing bug which caused `max_upload_size` to not be correctly enforced. ([\#9817](https://github.com/matrix-org/synapse/issues/9817))
56+
- Reduce CPU usage of the user directory by reusing existing calculated room membership. ([\#9821](https://github.com/matrix-org/synapse/issues/9821))
57+
- Small speed up for joining large remote rooms. ([\#9825](https://github.com/matrix-org/synapse/issues/9825))
58+
- Introduce flake8-bugbear to the test suite and fix some of its lint violations. ([\#9838](https://github.com/matrix-org/synapse/issues/9838))
59+
- Only store the raw data in the in-memory caches, rather than objects that include references to e.g. the data stores. ([\#9845](https://github.com/matrix-org/synapse/issues/9845))
60+
- Limit length of accepted email addresses. ([\#9855](https://github.com/matrix-org/synapse/issues/9855))
61+
- Remove redundant `synapse.types.Collection` type definition. ([\#9856](https://github.com/matrix-org/synapse/issues/9856))
62+
- Handle recently added rate limits correctly when using `--no-rate-limit` with the demo scripts. ([\#9858](https://github.com/matrix-org/synapse/issues/9858))
63+
- Disable invite rate-limiting by default when running the unit tests. ([\#9871](https://github.com/matrix-org/synapse/issues/9871))
64+
- Pass a reactor into `SynapseSite` to make testing easier. ([\#9874](https://github.com/matrix-org/synapse/issues/9874))
65+
- Make `DomainSpecificString` an `attrs` class. ([\#9875](https://github.com/matrix-org/synapse/issues/9875))
66+
- Add type hints to `synapse.api.auth` and `synapse.api.auth_blocking` modules. ([\#9876](https://github.com/matrix-org/synapse/issues/9876))
67+
- Remove redundant `_PushHTTPChannel` test class. ([\#9878](https://github.com/matrix-org/synapse/issues/9878))
68+
- Remove backwards-compatibility code for Python versions < 3.6. ([\#9879](https://github.com/matrix-org/synapse/issues/9879))
69+
- Small performance improvement around handling new local presence updates. ([\#9887](https://github.com/matrix-org/synapse/issues/9887))
70+
71+
172
Synapse 1.32.2 (2021-04-22)
273
===========================
374

UPGRADE.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,29 @@ for example:
8585
wget https://packages.matrix.org/debian/pool/main/m/matrix-synapse-py3/matrix-synapse-py3_1.3.0+stretch1_amd64.deb
8686
dpkg -i matrix-synapse-py3_1.3.0+stretch1_amd64.deb
8787
88+
Upgrading to v1.33.0
89+
====================
90+
91+
Account Validity HTML templates can now display a user's expiration date
92+
------------------------------------------------------------------------
93+
94+
This may affect you if you have enabled the account validity feature, and have made use of a
95+
custom HTML template specified by the ``account_validity.template_dir`` or ``account_validity.account_renewed_html_path``
96+
Synapse config options.
97+
98+
The template can now accept an ``expiration_ts`` variable, which represents the unix timestamp in milliseconds for the
99+
future date of which their account has been renewed until. See the
100+
`default template <https://github.com/matrix-org/synapse/blob/release-v1.33.0/synapse/res/templates/account_renewed.html>`_
101+
for an example of usage.
102+
103+
ALso note that a new HTML template, ``account_previously_renewed.html``, has been added. This is is shown to users
104+
when they attempt to renew their account with a valid renewal token that has already been used before. The default
105+
template contents can been found
106+
`here <https://github.com/matrix-org/synapse/blob/release-v1.33.0/synapse/res/templates/account_previously_renewed.html>`_,
107+
and can also accept an ``expiration_ts`` variable. This template replaces the error message users would previously see
108+
upon attempting to use a valid renewal token more than once.
109+
110+
88111
Upgrading to v1.32.0
89112
====================
90113

contrib/cmdclient/http.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
# Copyright 2014-2016 OpenMarket Ltd
32
#
43
# Licensed under the Apache License, Version 2.0 (the "License");

contrib/experiments/test_messaging.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
# Copyright 2014-2016 OpenMarket Ltd
32
#
43
# Licensed under the Apache License, Version 2.0 (the "License");

debian/changelog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
matrix-synapse-py3 (1.33.0) stable; urgency=medium
2+
3+
* New synapse release 1.33.0.
4+
5+
-- Synapse Packaging team <[email protected]> Wed, 05 May 2021 14:15:27 +0100
6+
17
matrix-synapse-py3 (1.32.2) stable; urgency=medium
28

39
* New synapse release 1.32.2.

demo/start.sh

Lines changed: 42 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -96,18 +96,48 @@ for port in 8080 8081 8082; do
9696
# Check script parameters
9797
if [ $# -eq 1 ]; then
9898
if [ $1 = "--no-rate-limit" ]; then
99-
# messages rate limit
100-
echo 'rc_messages_per_second: 1000' >> $DIR/etc/$port.config
101-
echo 'rc_message_burst_count: 1000' >> $DIR/etc/$port.config
102-
103-
# registration rate limit
104-
printf 'rc_registration:\n per_second: 1000\n burst_count: 1000\n' >> $DIR/etc/$port.config
105-
106-
# login rate limit
107-
echo 'rc_login:' >> $DIR/etc/$port.config
108-
printf ' address:\n per_second: 1000\n burst_count: 1000\n' >> $DIR/etc/$port.config
109-
printf ' account:\n per_second: 1000\n burst_count: 1000\n' >> $DIR/etc/$port.config
110-
printf ' failed_attempts:\n per_second: 1000\n burst_count: 1000\n' >> $DIR/etc/$port.config
99+
100+
# Disable any rate limiting
101+
ratelimiting=$(cat <<-RC
102+
rc_message:
103+
per_second: 1000
104+
burst_count: 1000
105+
rc_registration:
106+
per_second: 1000
107+
burst_count: 1000
108+
rc_login:
109+
address:
110+
per_second: 1000
111+
burst_count: 1000
112+
account:
113+
per_second: 1000
114+
burst_count: 1000
115+
failed_attempts:
116+
per_second: 1000
117+
burst_count: 1000
118+
rc_admin_redaction:
119+
per_second: 1000
120+
burst_count: 1000
121+
rc_joins:
122+
local:
123+
per_second: 1000
124+
burst_count: 1000
125+
remote:
126+
per_second: 1000
127+
burst_count: 1000
128+
rc_3pid_validation:
129+
per_second: 1000
130+
burst_count: 1000
131+
rc_invites:
132+
per_room:
133+
per_second: 1000
134+
burst_count: 1000
135+
per_user:
136+
per_second: 1000
137+
burst_count: 1000
138+
RC
139+
)
140+
echo "${ratelimiting}" >> $DIR/etc/$port.config
111141
fi
112142
fi
113143

docker/Dockerfile-workers

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Inherit from the official Synapse docker image
2+
FROM matrixdotorg/synapse
3+
4+
# Install deps
5+
RUN apt-get update
6+
RUN apt-get install -y supervisor redis nginx
7+
8+
# Remove the default nginx sites
9+
RUN rm /etc/nginx/sites-enabled/default
10+
11+
# Copy Synapse worker, nginx and supervisord configuration template files
12+
COPY ./docker/conf-workers/* /conf/
13+
14+
# Expose nginx listener port
15+
EXPOSE 8080/tcp
16+
17+
# Volume for user-editable config files, logs etc.
18+
VOLUME ["/data"]
19+
20+
# A script to read environment variables and create the necessary
21+
# files to run the desired worker configuration. Will start supervisord.
22+
COPY ./docker/configure_workers_and_start.py /configure_workers_and_start.py
23+
ENTRYPOINT ["/configure_workers_and_start.py"]

docker/README-testing.md

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
# Running tests against a dockerised Synapse
2+
3+
It's possible to run integration tests against Synapse
4+
using [Complement](https://github.com/matrix-org/complement). Complement is a Matrix Spec
5+
compliance test suite for homeservers, and supports any homeserver docker image configured
6+
to listen on ports 8008/8448. This document contains instructions for building Synapse
7+
docker images that can be run inside Complement for testing purposes.
8+
9+
Note that running Synapse's unit tests from within the docker image is not supported.
10+
11+
## Testing with SQLite and single-process Synapse
12+
13+
> Note that `scripts-dev/complement.sh` is a script that will automatically build
14+
> and run an SQLite-based, single-process of Synapse against Complement.
15+
16+
The instructions below will set up Complement testing for a single-process,
17+
SQLite-based Synapse deployment.
18+
19+
Start by building the base Synapse docker image. If you wish to run tests with the latest
20+
release of Synapse, instead of your current checkout, you can skip this step. From the
21+
root of the repository:
22+
23+
```sh
24+
docker build -t matrixdotorg/synapse -f docker/Dockerfile .
25+
```
26+
27+
This will build an image with the tag `matrixdotorg/synapse`.
28+
29+
Next, build the Synapse image for Complement. You will need a local checkout
30+
of Complement. Change to the root of your Complement checkout and run:
31+
32+
```sh
33+
docker build -t complement-synapse -f "dockerfiles/Synapse.Dockerfile" dockerfiles
34+
```
35+
36+
This will build an image with the tag `complement-synapse`, which can be handed to
37+
Complement for testing via the `COMPLEMENT_BASE_IMAGE` environment variable. Refer to
38+
[Complement's documentation](https://github.com/matrix-org/complement/#running) for
39+
how to run the tests, as well as the various available command line flags.
40+
41+
## Testing with PostgreSQL and single or multi-process Synapse
42+
43+
The above docker image only supports running Synapse with SQLite and in a
44+
single-process topology. The following instructions are used to build a Synapse image for
45+
Complement that supports either single or multi-process topology with a PostgreSQL
46+
database backend.
47+
48+
As with the single-process image, build the base Synapse docker image. If you wish to run
49+
tests with the latest release of Synapse, instead of your current checkout, you can skip
50+
this step. From the root of the repository:
51+
52+
```sh
53+
docker build -t matrixdotorg/synapse -f docker/Dockerfile .
54+
```
55+
56+
This will build an image with the tag `matrixdotorg/synapse`.
57+
58+
Next, we build a new image with worker support based on `matrixdotorg/synapse:latest`.
59+
Again, from the root of the repository:
60+
61+
```sh
62+
docker build -t matrixdotorg/synapse-workers -f docker/Dockerfile-workers .
63+
```
64+
65+
This will build an image with the tag` matrixdotorg/synapse-workers`.
66+
67+
It's worth noting at this point that this image is fully functional, and
68+
can be used for testing against locally. See instructions for using the container
69+
under
70+
[Running the Dockerfile-worker image standalone](#running-the-dockerfile-worker-image-standalone)
71+
below.
72+
73+
Finally, build the Synapse image for Complement, which is based on
74+
`matrixdotorg/synapse-workers`. You will need a local checkout of Complement. Change to
75+
the root of your Complement checkout and run:
76+
77+
```sh
78+
docker build -t matrixdotorg/complement-synapse-workers -f dockerfiles/SynapseWorkers.Dockerfile dockerfiles
79+
```
80+
81+
This will build an image with the tag `complement-synapse`, which can be handed to
82+
Complement for testing via the `COMPLEMENT_BASE_IMAGE` environment variable. Refer to
83+
[Complement's documentation](https://github.com/matrix-org/complement/#running) for
84+
how to run the tests, as well as the various available command line flags.
85+
86+
## Running the Dockerfile-worker image standalone
87+
88+
For manual testing of a multi-process Synapse instance in Docker,
89+
[Dockerfile-workers](Dockerfile-workers) is a Dockerfile that will produce an image
90+
bundling all necessary components together for a workerised homeserver instance.
91+
92+
This includes any desired Synapse worker processes, a nginx to route traffic accordingly,
93+
a redis for worker communication and a supervisord instance to start up and monitor all
94+
processes. You will need to provide your own postgres container to connect to, and TLS
95+
is not handled by the container.
96+
97+
Once you've built the image using the above instructions, you can run it. Be sure
98+
you've set up a volume according to the [usual Synapse docker instructions](README.md).
99+
Then run something along the lines of:
100+
101+
```
102+
docker run -d --name synapse \
103+
--mount type=volume,src=synapse-data,dst=/data \
104+
-p 8008:8008 \
105+
-e SYNAPSE_SERVER_NAME=my.matrix.host \
106+
-e SYNAPSE_REPORT_STATS=no \
107+
-e POSTGRES_HOST=postgres \
108+
-e POSTGRES_USER=postgres \
109+
-e POSTGRES_PASSWORD=somesecret \
110+
-e SYNAPSE_WORKER_TYPES=synchrotron,media_repository,user_dir \
111+
-e SYNAPSE_WORKERS_WRITE_LOGS_TO_DISK=1 \
112+
matrixdotorg/synapse-workers
113+
```
114+
115+
...substituting `POSTGRES*` variables for those that match a postgres host you have
116+
available (usually a running postgres docker container).
117+
118+
The `SYNAPSE_WORKER_TYPES` environment variable is a comma-separated list of workers to
119+
use when running the container. All possible worker names are defined by the keys of the
120+
`WORKERS_CONFIG` variable in [this script](configure_workers_and_start.py), which the
121+
Dockerfile makes use of to generate appropriate worker, nginx and supervisord config
122+
files.
123+
124+
Sharding is supported for a subset of workers, in line with the
125+
[worker documentation](../docs/workers.md). To run multiple instances of a given worker
126+
type, simply specify the type multiple times in `SYNAPSE_WORKER_TYPES`
127+
(e.g `SYNAPSE_WORKER_TYPES=event_creator,event_creator...`).
128+
129+
Otherwise, `SYNAPSE_WORKER_TYPES` can either be left empty or unset to spawn no workers
130+
(leaving only the main process). The container is configured to use redis-based worker
131+
mode.
132+
133+
Logs for workers and the main process are logged to stdout and can be viewed with
134+
standard `docker logs` tooling. Worker logs contain their worker name
135+
after the timestamp.
136+
137+
Setting `SYNAPSE_WORKERS_WRITE_LOGS_TO_DISK=1` will cause worker logs to be written to
138+
`<data_dir>/logs/<worker_name>.log`. Logs are kept for 1 week and rotate every day at 00:
139+
00, according to the container's clock. Logging for the main process must still be
140+
configured by modifying the homeserver's log config in your Synapse data volume.

0 commit comments

Comments
 (0)