mirror of
https://github.com/element-hq/synapse.git
synced 2025-12-15 02:00:21 +00:00
Compare commits
428 Commits
erikj/arm_
...
v1.35.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5666773341 | ||
|
|
57c01dca29 | ||
|
|
36a7ff0c86 | ||
|
|
3fdaf4df55 | ||
|
|
08e54345b1 | ||
|
|
a8372ad591 | ||
|
|
408ecf8ece | ||
|
|
4f41b711d8 | ||
|
|
258a9a9e8b | ||
|
|
6b6c6a02db | ||
|
|
9408b86f5c | ||
|
|
1641c5c707 | ||
|
|
84cf3e47a0 | ||
|
|
b1bc26a909 | ||
|
|
8e15c92c2f | ||
|
|
557635f69a | ||
|
|
7d90d6ce9b | ||
|
|
7adcb20fc0 | ||
|
|
22a8838f62 | ||
|
|
057ce7b754 | ||
|
|
82eacb0e07 | ||
|
|
daca7b2794 | ||
|
|
c0df6bae06 | ||
|
|
316f89e87f | ||
|
|
387c297489 | ||
|
|
5f1198a67e | ||
|
|
3e831f24ff | ||
|
|
e8ac9ac8ca | ||
|
|
21bd230831 | ||
|
|
c5413d0e9e | ||
|
|
6a8643ff3d | ||
|
|
7958eadcd1 | ||
|
|
1c6a19002c | ||
|
|
64887f06fc | ||
|
|
551d2c3f4b | ||
|
|
d983ced596 | ||
|
|
141b073c7b | ||
|
|
9c76d0561b | ||
|
|
5bba1b4905 | ||
|
|
ac6bfcd52f | ||
|
|
4d6e5a5e99 | ||
|
|
206a7b5f12 | ||
|
|
9752849e2b | ||
|
|
653fe2f3cd | ||
|
|
13b0673b5a | ||
|
|
8dde0bf8b3 | ||
|
|
afb6dcf806 | ||
|
|
41ac128fd3 | ||
|
|
6660912226 | ||
|
|
6482075c95 | ||
|
|
5090f26b63 | ||
|
|
52ed9655ed | ||
|
|
ebdef256b3 | ||
|
|
bd918d874f | ||
|
|
498084228b | ||
|
|
c14f99be46 | ||
|
|
976216959b | ||
|
|
d19bccdbec | ||
|
|
451f25172a | ||
|
|
91143bb24e | ||
|
|
47806b0869 | ||
|
|
a683028d81 | ||
|
|
7562d887e1 | ||
|
|
affaffb0ab | ||
|
|
63fb220e5f | ||
|
|
27c375f812 | ||
|
|
f4833e0c06 | ||
|
|
28c6841102 | ||
|
|
652a6b094d | ||
|
|
d1473f7362 | ||
|
|
dc6366a9bd | ||
|
|
86fb71431c | ||
|
|
b378d98c8f | ||
|
|
7967b36efe | ||
|
|
03318a766c | ||
|
|
2b2985b5cf | ||
|
|
51065c44bb | ||
|
|
6c84778549 | ||
|
|
765473567c | ||
|
|
b65ecaff9b | ||
|
|
4df26abf28 | ||
|
|
25f43faa70 | ||
|
|
8771b1337d | ||
|
|
eba431c539 | ||
|
|
a8803e2b6e | ||
|
|
ac88aca7f7 | ||
|
|
24f07a83e6 | ||
|
|
70f0ffd2fc | ||
|
|
d783880083 | ||
|
|
37623e3382 | ||
|
|
e2a443550e | ||
|
|
ef889c98a6 | ||
|
|
1fb9a2d0bf | ||
|
|
de8f0a03a3 | ||
|
|
d0aee697ac | ||
|
|
d5305000f1 | ||
|
|
e9eb3549d3 | ||
|
|
a61b13c0a1 | ||
|
|
0644ac0989 | ||
|
|
e3bc4617fc | ||
|
|
b85821aca2 | ||
|
|
56c4b47df3 | ||
|
|
4d624f467a | ||
|
|
d11f2dfee5 | ||
|
|
bb4b11846f | ||
|
|
e9444cc74d | ||
|
|
0085dc5abc | ||
|
|
802560211a | ||
|
|
e4ab8676b4 | ||
|
|
10a08ab88a | ||
|
|
fa6679e794 | ||
|
|
8ba086980d | ||
|
|
391bfe9a7b | ||
|
|
787de3190f | ||
|
|
4e0fd35bc9 | ||
|
|
dd2d32dcdb | ||
|
|
fe604a022a | ||
|
|
1350b053da | ||
|
|
0ffa5fb935 | ||
|
|
3ff2251754 | ||
|
|
84936e2264 | ||
|
|
695b73c861 | ||
|
|
59d24c5bef | ||
|
|
e83627926f | ||
|
|
a15c003e5b | ||
|
|
ceaa76970f | ||
|
|
9d25a0ae65 | ||
|
|
d924827da1 | ||
|
|
3853a7edfc | ||
|
|
51a20914a8 | ||
|
|
c1ddbbde4f | ||
|
|
177dae2704 | ||
|
|
69018acbd2 | ||
|
|
294c675033 | ||
|
|
3186324260 | ||
|
|
0f2629ebc6 | ||
|
|
dac4445934 | ||
|
|
79e6d9e4b1 | ||
|
|
ca380881b1 | ||
|
|
55159c48e3 | ||
|
|
ca6ecb8d67 | ||
|
|
8798f2291c | ||
|
|
046175daba | ||
|
|
0c23aa393c | ||
|
|
d9bd62f9d1 | ||
|
|
4b2217ace2 | ||
|
|
a0972085ed | ||
|
|
bdb4c20dc1 | ||
|
|
acb8c81041 | ||
|
|
98a1b84631 | ||
|
|
026a66f2b3 | ||
|
|
a745531c10 | ||
|
|
30c94862b4 | ||
|
|
5d281c10dd | ||
|
|
683d6f75af | ||
|
|
eccacd72cb | ||
|
|
b8c5f6fddb | ||
|
|
272402c4d7 | ||
|
|
05fa06834d | ||
|
|
913f790bb2 | ||
|
|
6982db9651 | ||
|
|
438a8594cb | ||
|
|
e031c7e0cc | ||
|
|
0a88ec0a87 | ||
|
|
b076bc276e | ||
|
|
de0d088adc | ||
|
|
db70435de7 | ||
|
|
495b214f4f | ||
|
|
71f0623de9 | ||
|
|
e694a598f8 | ||
|
|
2b7dd21655 | ||
|
|
c571736c6c | ||
|
|
601b893352 | ||
|
|
5a153772c1 | ||
|
|
936e69825a | ||
|
|
e8816c6ace | ||
|
|
cc51aaaa7a | ||
|
|
05e8c70c05 | ||
|
|
00a6db9676 | ||
|
|
c9a2b5d402 | ||
|
|
4b965c862d | ||
|
|
7e460ec2a5 | ||
|
|
f16c6cf59a | ||
|
|
d9bd181a3f | ||
|
|
3efd98aa1c | ||
|
|
c1dbe84c3d | ||
|
|
1d5f0e3529 | ||
|
|
1fc97ee876 | ||
|
|
a7044e5c0f | ||
|
|
3efde8b69a | ||
|
|
e300ef64b1 | ||
|
|
0b3112123d | ||
|
|
f946450184 | ||
|
|
abc814dcbf | ||
|
|
0277b8f3e6 | ||
|
|
48a1f4db31 | ||
|
|
2ca4e349e9 | ||
|
|
64f4f506c5 | ||
|
|
9e167d9c53 | ||
|
|
24c58ebfc9 | ||
|
|
88b9414e32 | ||
|
|
be0e722fe1 | ||
|
|
3a569fb200 | ||
|
|
77e56deffc | ||
|
|
04ff88139a | ||
|
|
9278eb701e | ||
|
|
3ada9b4264 | ||
|
|
abade34633 | ||
|
|
906065c75b | ||
|
|
5edd91caec | ||
|
|
cb657eb2f8 | ||
|
|
452991527a | ||
|
|
48d44ab142 | ||
|
|
0d87c6bd12 | ||
|
|
04819239ba | ||
|
|
44bb881096 | ||
|
|
024f121b74 | ||
|
|
0ef321ff3b | ||
|
|
5688a74cf3 | ||
|
|
1d8863c67d | ||
|
|
a888cbdd31 | ||
|
|
fc8695d621 | ||
|
|
d959d28730 | ||
|
|
e7b769aea1 | ||
|
|
e2b8a90897 | ||
|
|
4609e58970 | ||
|
|
33548f37aa | ||
|
|
bb0fe02a52 | ||
|
|
35c5ef2d24 | ||
|
|
e32294f54b | ||
|
|
5fe38e07e7 | ||
|
|
5ff8eb97c6 | ||
|
|
670564446c | ||
|
|
ac99774dac | ||
|
|
4dabcf026e | ||
|
|
f02663c4dd | ||
|
|
963f4309fe | ||
|
|
3a446c21f8 | ||
|
|
78e48f61bf | ||
|
|
f380bb77d1 | ||
|
|
01dd90b0f0 | ||
|
|
7dcf3fd221 | ||
|
|
da75d2ea1f | ||
|
|
4bbd535450 | ||
|
|
5fdff97719 | ||
|
|
fc53a606e4 | ||
|
|
ad8690a26c | ||
|
|
0a778c135f | ||
|
|
7c8402ddb8 | ||
|
|
b5efcb577e | ||
|
|
019010964d | ||
|
|
262ed05f5b | ||
|
|
548c4a6587 | ||
|
|
c6f8e8086c | ||
|
|
12d6184713 | ||
|
|
d7d4232a2d | ||
|
|
d4c4798a25 | ||
|
|
e5801db830 | ||
|
|
fae81f2f68 | ||
|
|
c602ba8336 | ||
|
|
c2d4bd62a2 | ||
|
|
4c3827f2c1 | ||
|
|
c73cc2c2ad | ||
|
|
4655d2221e | ||
|
|
83de0be4b0 | ||
|
|
af387cf52a | ||
|
|
7e8dc9934e | ||
|
|
e550ab17ad | ||
|
|
0caf2a338e | ||
|
|
4ecba9bd5c | ||
|
|
b7748d3c00 | ||
|
|
5b268997bd | ||
|
|
4612302399 | ||
|
|
d66f9070cd | ||
|
|
d600d4506b | ||
|
|
e09838c78f | ||
|
|
e2904f720d | ||
|
|
b6ed4f55ac | ||
|
|
592d6305fd | ||
|
|
0b56481caa | ||
|
|
066068f034 | ||
|
|
0e35584734 | ||
|
|
201178db1a | ||
|
|
9b0e3009fa | ||
|
|
004234f03a | ||
|
|
066c703729 | ||
|
|
8dd2ea65a9 | ||
|
|
dd71eb0f8a | ||
|
|
405aeb0b2c | ||
|
|
7b06f85c0e | ||
|
|
cc324d53fe | ||
|
|
73dbce5523 | ||
|
|
ad721fc559 | ||
|
|
567f88f835 | ||
|
|
b449af0379 | ||
|
|
27d2820c33 | ||
|
|
dd5e5dc1d6 | ||
|
|
8000cf1315 | ||
|
|
45ef73fd4f | ||
|
|
e3bc0e6f7c | ||
|
|
ad5d2e7ec0 | ||
|
|
d315e96443 | ||
|
|
847ecdd8fa | ||
|
|
ccf1dc51d7 | ||
|
|
1383508f29 | ||
|
|
dd69110d95 | ||
|
|
5b5bc188cf | ||
|
|
1b0eaed21f | ||
|
|
1c8a2541da | ||
|
|
f87dfb9403 | ||
|
|
d29b71aa50 | ||
|
|
026503fa3b | ||
|
|
af2248f8bf | ||
|
|
55da8df078 | ||
|
|
1e67bff833 | ||
|
|
2b328d7e02 | ||
|
|
464e5da7b2 | ||
|
|
e55bd0e110 | ||
|
|
70d1b6abff | ||
|
|
a7a3790066 | ||
|
|
1107214a1d | ||
|
|
17cd48fe51 | ||
|
|
2a99cc6524 | ||
|
|
918f6ed827 | ||
|
|
67b979bfa1 | ||
|
|
dc51d8ffaf | ||
|
|
e9df3f496b | ||
|
|
eaada74075 | ||
|
|
9cd18cc588 | ||
|
|
7fdc6cefb3 | ||
|
|
075c16b410 | ||
|
|
3ce650057d | ||
|
|
576c91c7c1 | ||
|
|
22db45bd4d | ||
|
|
9898470e7d | ||
|
|
0764d0c6e5 | ||
|
|
d6196efafc | ||
|
|
b2c4d3d721 | ||
|
|
7076eee4b9 | ||
|
|
cb7fc7523e | ||
|
|
b988b07bb0 | ||
|
|
4de1c35728 | ||
|
|
15c788e22d | ||
|
|
58114f8a17 | ||
|
|
0fc4eb103a | ||
|
|
e5da770cce | ||
|
|
8a4b3738f3 | ||
|
|
df425c2c63 | ||
|
|
7eb6e39a8f | ||
|
|
a6333b8d42 | ||
|
|
ea0a3aaf0a | ||
|
|
3f49d80dcf | ||
|
|
33a02f0f52 | ||
|
|
4db07f9aef | ||
|
|
a4fa044c00 | ||
|
|
922788c604 | ||
|
|
d790d0d314 | ||
|
|
0c330423bc | ||
|
|
16f9f93eb7 | ||
|
|
a5daae2a5f | ||
|
|
0279e0e086 | ||
|
|
aee10768d8 | ||
|
|
7f5d753d06 | ||
|
|
16108c579d | ||
|
|
f00c4e7af0 | ||
|
|
ad8589d392 | ||
|
|
16ec8c3272 | ||
|
|
a0bc9d387e | ||
|
|
e12077a78a | ||
|
|
ddb240293a | ||
|
|
15090de850 | ||
|
|
e53f11bd62 | ||
|
|
2566dc57ce | ||
|
|
1e62d9ee8c | ||
|
|
1efdcc3e87 | ||
|
|
2756517f7a | ||
|
|
0f9f30b32b | ||
|
|
b5c4fe1971 | ||
|
|
d8e95e5452 | ||
|
|
00bf80cb8e | ||
|
|
7cc571510b | ||
|
|
f5c93fc993 | ||
|
|
2927921942 | ||
|
|
0b5c967813 | ||
|
|
7292b7c0eb | ||
|
|
713145d3de | ||
|
|
65a9eb8994 | ||
|
|
66f4949e7f | ||
|
|
1b2d6d55c5 | ||
|
|
71c9f8de6d | ||
|
|
70ea9593ff | ||
|
|
0a363f9ca4 | ||
|
|
e22b71810e | ||
|
|
fc8b3d8809 | ||
|
|
179c0953ff | ||
|
|
3a2fe5054f | ||
|
|
a1901abd6b | ||
|
|
c4a55ac4a4 | ||
|
|
d9f1dccba9 | ||
|
|
d0365bc8b0 | ||
|
|
b114a45f5f | ||
|
|
8bcfc2eaad | ||
|
|
13e9029f44 | ||
|
|
3d2acc930f | ||
|
|
9bc74743d5 | ||
|
|
1c5e715e5e | ||
|
|
1381cd05b0 | ||
|
|
2d577283ab | ||
|
|
b106080fb4 | ||
|
|
84a7191410 | ||
|
|
d804285139 | ||
|
|
9ee3b9775f | ||
|
|
90550f598e | ||
|
|
8ad4676f35 | ||
|
|
9d64e4dbd6 | ||
|
|
e17553e185 | ||
|
|
e8e7012265 | ||
|
|
8ec2217103 | ||
|
|
bb2577f6b7 | ||
|
|
43f1c82457 | ||
|
|
626afd7e89 | ||
|
|
c8d9383cfb | ||
|
|
a25661b2eb | ||
|
|
3e5749b99f | ||
|
|
53f1c4da81 | ||
|
|
a8878960c0 | ||
|
|
9e19c6aab4 | ||
|
|
d2f0ec12d5 |
@@ -3,7 +3,7 @@
|
|||||||
# CI's Docker setup at the point where this file is considered.
|
# CI's Docker setup at the point where this file is considered.
|
||||||
server_name: "localhost:8800"
|
server_name: "localhost:8800"
|
||||||
|
|
||||||
signing_key_path: "/src/.buildkite/test.signing.key"
|
signing_key_path: ".buildkite/test.signing.key"
|
||||||
|
|
||||||
report_stats: false
|
report_stats: false
|
||||||
|
|
||||||
@@ -16,6 +16,4 @@ database:
|
|||||||
database: synapse
|
database: synapse
|
||||||
|
|
||||||
# Suppress the key server warning.
|
# Suppress the key server warning.
|
||||||
trusted_key_servers:
|
trusted_key_servers: []
|
||||||
- server_name: "matrix.org"
|
|
||||||
suppress_key_server_warning: true
|
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
# Copyright 2019 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
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
|
|
||||||
import logging
|
|
||||||
|
|
||||||
from synapse.storage.engines import create_engine
|
|
||||||
|
|
||||||
logger = logging.getLogger("create_postgres_db")
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
# Create a PostgresEngine.
|
|
||||||
db_engine = create_engine({"name": "psycopg2", "args": {}})
|
|
||||||
|
|
||||||
# Connect to postgres to create the base database.
|
|
||||||
# We use "postgres" as a database because it's bound to exist and the "synapse" one
|
|
||||||
# doesn't exist yet.
|
|
||||||
db_conn = db_engine.module.connect(
|
|
||||||
user="postgres", host="postgres", password="postgres", dbname="postgres"
|
|
||||||
)
|
|
||||||
db_conn.autocommit = True
|
|
||||||
cur = db_conn.cursor()
|
|
||||||
cur.execute("CREATE DATABASE synapse;")
|
|
||||||
cur.close()
|
|
||||||
db_conn.close()
|
|
||||||
31
.buildkite/scripts/postgres_exec.py
Executable file
31
.buildkite/scripts/postgres_exec.py
Executable file
@@ -0,0 +1,31 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# Copyright 2019 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
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
|
import psycopg2
|
||||||
|
|
||||||
|
# a very simple replacment for `psql`, to make up for the lack of the postgres client
|
||||||
|
# libraries in the synapse docker image.
|
||||||
|
|
||||||
|
# We use "postgres" as a database because it's bound to exist and the "synapse" one
|
||||||
|
# doesn't exist yet.
|
||||||
|
db_conn = psycopg2.connect(
|
||||||
|
user="postgres", host="postgres", password="postgres", dbname="postgres"
|
||||||
|
)
|
||||||
|
db_conn.autocommit = True
|
||||||
|
cur = db_conn.cursor()
|
||||||
|
for c in sys.argv[1:]:
|
||||||
|
cur.execute(c)
|
||||||
@@ -1,16 +1,16 @@
|
|||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# this script is run by buildkite in a plain `xenial` container; it installs the
|
# this script is run by buildkite in a plain `bionic` container; it installs the
|
||||||
# minimal requirements for tox and hands over to the py35-old tox environment.
|
# minimal requirements for tox and hands over to the py3-old tox environment.
|
||||||
|
|
||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
apt-get update
|
apt-get update
|
||||||
apt-get install -y python3.5 python3.5-dev python3-pip libxml2-dev libxslt-dev xmlsec1 zlib1g-dev tox
|
apt-get install -y python3 python3-dev python3-pip libxml2-dev libxslt-dev xmlsec1 zlib1g-dev tox
|
||||||
|
|
||||||
export LANG="C.UTF-8"
|
export LANG="C.UTF-8"
|
||||||
|
|
||||||
# Prevent virtualenv from auto-updating pip to an incompatible version
|
# Prevent virtualenv from auto-updating pip to an incompatible version
|
||||||
export VIRTUALENV_NO_DOWNLOAD=1
|
export VIRTUALENV_NO_DOWNLOAD=1
|
||||||
|
|
||||||
exec tox -e py35-old,combine
|
exec tox -e py3-old,combine
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
#
|
#
|
||||||
# Test script for 'synapse_port_db', which creates a virtualenv, installs Synapse along
|
# Test script for 'synapse_port_db'.
|
||||||
# with additional dependencies needed for the test (such as coverage or the PostgreSQL
|
# - sets up synapse and deps
|
||||||
# driver), update the schema of the test SQLite database and run background updates on it,
|
# - runs the port script on a prepopulated test sqlite db
|
||||||
# create an empty test database in PostgreSQL, then run the 'synapse_port_db' script to
|
# - also runs it against an new sqlite db
|
||||||
# test porting the SQLite database to the PostgreSQL database (with coverage).
|
|
||||||
|
|
||||||
set -xe
|
set -xe
|
||||||
cd `dirname $0`/../..
|
cd `dirname $0`/../..
|
||||||
@@ -22,15 +22,36 @@ echo "--- Generate the signing key"
|
|||||||
# Generate the server's signing key.
|
# Generate the server's signing key.
|
||||||
python -m synapse.app.homeserver --generate-keys -c .buildkite/sqlite-config.yaml
|
python -m synapse.app.homeserver --generate-keys -c .buildkite/sqlite-config.yaml
|
||||||
|
|
||||||
echo "--- Prepare the databases"
|
echo "--- Prepare test database"
|
||||||
|
|
||||||
# Make sure the SQLite3 database is using the latest schema and has no pending background update.
|
# Make sure the SQLite3 database is using the latest schema and has no pending background update.
|
||||||
scripts-dev/update_database --database-config .buildkite/sqlite-config.yaml
|
scripts-dev/update_database --database-config .buildkite/sqlite-config.yaml
|
||||||
|
|
||||||
# Create the PostgreSQL database.
|
# Create the PostgreSQL database.
|
||||||
./.buildkite/scripts/create_postgres_db.py
|
./.buildkite/scripts/postgres_exec.py "CREATE DATABASE synapse"
|
||||||
|
|
||||||
echo "+++ Run synapse_port_db"
|
echo "+++ Run synapse_port_db against test database"
|
||||||
|
coverage run scripts/synapse_port_db --sqlite-database .buildkite/test_db.db --postgres-config .buildkite/postgres-config.yaml
|
||||||
# Run the script
|
|
||||||
|
# We should be able to run twice against the same database.
|
||||||
|
echo "+++ Run synapse_port_db a second time"
|
||||||
|
coverage run scripts/synapse_port_db --sqlite-database .buildkite/test_db.db --postgres-config .buildkite/postgres-config.yaml
|
||||||
|
|
||||||
|
#####
|
||||||
|
|
||||||
|
# Now do the same again, on an empty database.
|
||||||
|
|
||||||
|
echo "--- Prepare empty SQLite database"
|
||||||
|
|
||||||
|
# we do this by deleting the sqlite db, and then doing the same again.
|
||||||
|
rm .buildkite/test_db.db
|
||||||
|
|
||||||
|
scripts-dev/update_database --database-config .buildkite/sqlite-config.yaml
|
||||||
|
|
||||||
|
# re-create the PostgreSQL database.
|
||||||
|
./.buildkite/scripts/postgres_exec.py \
|
||||||
|
"DROP DATABASE synapse" \
|
||||||
|
"CREATE DATABASE synapse"
|
||||||
|
|
||||||
|
echo "+++ Run synapse_port_db against empty database"
|
||||||
coverage run scripts/synapse_port_db --sqlite-database .buildkite/test_db.db --postgres-config .buildkite/postgres-config.yaml
|
coverage run scripts/synapse_port_db --sqlite-database .buildkite/test_db.db --postgres-config .buildkite/postgres-config.yaml
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
# schema and run background updates on it.
|
# schema and run background updates on it.
|
||||||
server_name: "localhost:8800"
|
server_name: "localhost:8800"
|
||||||
|
|
||||||
signing_key_path: "/src/.buildkite/test.signing.key"
|
signing_key_path: ".buildkite/test.signing.key"
|
||||||
|
|
||||||
report_stats: false
|
report_stats: false
|
||||||
|
|
||||||
@@ -13,6 +13,4 @@ database:
|
|||||||
database: ".buildkite/test_db.db"
|
database: ".buildkite/test_db.db"
|
||||||
|
|
||||||
# Suppress the key server warning.
|
# Suppress the key server warning.
|
||||||
trusted_key_servers:
|
trusted_key_servers: []
|
||||||
- server_name: "matrix.org"
|
|
||||||
suppress_key_server_warning: true
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ jobs:
|
|||||||
platforms: linux/amd64
|
platforms: linux/amd64
|
||||||
- docker_build:
|
- docker_build:
|
||||||
tag: -t matrixdotorg/synapse:${CIRCLE_TAG}
|
tag: -t matrixdotorg/synapse:${CIRCLE_TAG}
|
||||||
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
|
|
||||||
dockerhubuploadlatest:
|
dockerhubuploadlatest:
|
||||||
docker:
|
docker:
|
||||||
@@ -27,7 +27,7 @@ jobs:
|
|||||||
# until all of the platforms are built.
|
# until all of the platforms are built.
|
||||||
- docker_build:
|
- docker_build:
|
||||||
tag: -t matrixdotorg/synapse:latest
|
tag: -t matrixdotorg/synapse:latest
|
||||||
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
|
|
||||||
workflows:
|
workflows:
|
||||||
build:
|
build:
|
||||||
|
|||||||
8
.git-blame-ignore-revs
Normal file
8
.git-blame-ignore-revs
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
# Black reformatting (#5482).
|
||||||
|
32e7c9e7f20b57dd081023ac42d6931a8da9b3a3
|
||||||
|
|
||||||
|
# Target Python 3.5 with black (#8664).
|
||||||
|
aff1eb7c671b0a3813407321d2702ec46c71fa56
|
||||||
|
|
||||||
|
# Update black to 20.8b1 (#9381).
|
||||||
|
0a00b7ff14890987f09112a2ae696c61001e6cf1
|
||||||
322
.github/workflows/tests.yml
vendored
Normal file
322
.github/workflows/tests.yml
vendored
Normal file
@@ -0,0 +1,322 @@
|
|||||||
|
name: Tests
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: ["develop", "release-*"]
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
toxenv:
|
||||||
|
- "check-sampleconfig"
|
||||||
|
- "check_codestyle"
|
||||||
|
- "check_isort"
|
||||||
|
- "mypy"
|
||||||
|
- "packaging"
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions/setup-python@v2
|
||||||
|
- run: pip install tox
|
||||||
|
- run: tox -e ${{ matrix.toxenv }}
|
||||||
|
|
||||||
|
lint-crlf:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Check line endings
|
||||||
|
run: scripts-dev/check_line_terminators.sh
|
||||||
|
|
||||||
|
lint-newsfile:
|
||||||
|
if: ${{ github.base_ref == 'develop' || contains(github.base_ref, 'release-') }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions/setup-python@v2
|
||||||
|
- run: pip install tox
|
||||||
|
- name: Patch Buildkite-specific test script
|
||||||
|
run: |
|
||||||
|
sed -i -e 's/\$BUILDKITE_PULL_REQUEST/${{ github.event.number }}/' \
|
||||||
|
scripts-dev/check-newsfragment
|
||||||
|
- run: scripts-dev/check-newsfragment
|
||||||
|
|
||||||
|
lint-sdist:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: "3.x"
|
||||||
|
- run: pip install wheel
|
||||||
|
- run: python setup.py sdist bdist_wheel
|
||||||
|
- uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: Python Distributions
|
||||||
|
path: dist/*
|
||||||
|
|
||||||
|
# Dummy step to gate other tests on without repeating the whole list
|
||||||
|
linting-done:
|
||||||
|
if: ${{ always() }} # Run this even if prior jobs were skipped
|
||||||
|
needs: [lint, lint-crlf, lint-newsfile, lint-sdist]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- run: "true"
|
||||||
|
|
||||||
|
trial:
|
||||||
|
if: ${{ !failure() }} # Allow previous steps to be skipped, but not fail
|
||||||
|
needs: linting-done
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
python-version: ["3.6", "3.7", "3.8", "3.9"]
|
||||||
|
database: ["sqlite"]
|
||||||
|
include:
|
||||||
|
# Newest Python without optional deps
|
||||||
|
- python-version: "3.9"
|
||||||
|
toxenv: "py-noextras,combine"
|
||||||
|
|
||||||
|
# Oldest Python with PostgreSQL
|
||||||
|
- python-version: "3.6"
|
||||||
|
database: "postgres"
|
||||||
|
postgres-version: "9.6"
|
||||||
|
|
||||||
|
# Newest Python with PostgreSQL
|
||||||
|
- python-version: "3.9"
|
||||||
|
database: "postgres"
|
||||||
|
postgres-version: "13"
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- run: sudo apt-get -qq install xmlsec1
|
||||||
|
- name: Set up PostgreSQL ${{ matrix.postgres-version }}
|
||||||
|
if: ${{ matrix.postgres-version }}
|
||||||
|
run: |
|
||||||
|
docker run -d -p 5432:5432 \
|
||||||
|
-e POSTGRES_PASSWORD=postgres \
|
||||||
|
-e POSTGRES_INITDB_ARGS="--lc-collate C --lc-ctype C --encoding UTF8" \
|
||||||
|
postgres:${{ matrix.postgres-version }}
|
||||||
|
- uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python-version }}
|
||||||
|
- run: pip install tox
|
||||||
|
- name: Await PostgreSQL
|
||||||
|
if: ${{ matrix.postgres-version }}
|
||||||
|
timeout-minutes: 2
|
||||||
|
run: until pg_isready -h localhost; do sleep 1; done
|
||||||
|
- run: tox -e py,combine
|
||||||
|
env:
|
||||||
|
TRIAL_FLAGS: "--jobs=2"
|
||||||
|
SYNAPSE_POSTGRES: ${{ matrix.database == 'postgres' || '' }}
|
||||||
|
SYNAPSE_POSTGRES_HOST: localhost
|
||||||
|
SYNAPSE_POSTGRES_USER: postgres
|
||||||
|
SYNAPSE_POSTGRES_PASSWORD: postgres
|
||||||
|
- name: Dump logs
|
||||||
|
# Note: Dumps to workflow logs instead of using actions/upload-artifact
|
||||||
|
# This keeps logs colocated with failing jobs
|
||||||
|
# It also ignores find's exit code; this is a best effort affair
|
||||||
|
run: >-
|
||||||
|
find _trial_temp -name '*.log'
|
||||||
|
-exec echo "::group::{}" \;
|
||||||
|
-exec cat {} \;
|
||||||
|
-exec echo "::endgroup::" \;
|
||||||
|
|| true
|
||||||
|
|
||||||
|
trial-olddeps:
|
||||||
|
if: ${{ !failure() }} # Allow previous steps to be skipped, but not fail
|
||||||
|
needs: linting-done
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Test with old deps
|
||||||
|
uses: docker://ubuntu:bionic # For old python and sqlite
|
||||||
|
with:
|
||||||
|
workdir: /github/workspace
|
||||||
|
entrypoint: .buildkite/scripts/test_old_deps.sh
|
||||||
|
env:
|
||||||
|
TRIAL_FLAGS: "--jobs=2"
|
||||||
|
- name: Dump logs
|
||||||
|
# Note: Dumps to workflow logs instead of using actions/upload-artifact
|
||||||
|
# This keeps logs colocated with failing jobs
|
||||||
|
# It also ignores find's exit code; this is a best effort affair
|
||||||
|
run: >-
|
||||||
|
find _trial_temp -name '*.log'
|
||||||
|
-exec echo "::group::{}" \;
|
||||||
|
-exec cat {} \;
|
||||||
|
-exec echo "::endgroup::" \;
|
||||||
|
|| true
|
||||||
|
|
||||||
|
trial-pypy:
|
||||||
|
# Very slow; only run if the branch name includes 'pypy'
|
||||||
|
if: ${{ contains(github.ref, 'pypy') && !failure() }}
|
||||||
|
needs: linting-done
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
python-version: ["pypy-3.6"]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- run: sudo apt-get -qq install xmlsec1 libxml2-dev libxslt-dev
|
||||||
|
- uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python-version }}
|
||||||
|
- run: pip install tox
|
||||||
|
- run: tox -e py,combine
|
||||||
|
env:
|
||||||
|
TRIAL_FLAGS: "--jobs=2"
|
||||||
|
- name: Dump logs
|
||||||
|
# Note: Dumps to workflow logs instead of using actions/upload-artifact
|
||||||
|
# This keeps logs colocated with failing jobs
|
||||||
|
# It also ignores find's exit code; this is a best effort affair
|
||||||
|
run: >-
|
||||||
|
find _trial_temp -name '*.log'
|
||||||
|
-exec echo "::group::{}" \;
|
||||||
|
-exec cat {} \;
|
||||||
|
-exec echo "::endgroup::" \;
|
||||||
|
|| true
|
||||||
|
|
||||||
|
sytest:
|
||||||
|
if: ${{ !failure() }}
|
||||||
|
needs: linting-done
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: matrixdotorg/sytest-synapse:${{ matrix.sytest-tag }}
|
||||||
|
volumes:
|
||||||
|
- ${{ github.workspace }}:/src
|
||||||
|
env:
|
||||||
|
BUILDKITE_BRANCH: ${{ github.head_ref }}
|
||||||
|
POSTGRES: ${{ matrix.postgres && 1}}
|
||||||
|
MULTI_POSTGRES: ${{ (matrix.postgres == 'multi-postgres') && 1}}
|
||||||
|
WORKERS: ${{ matrix.workers && 1 }}
|
||||||
|
REDIS: ${{ matrix.redis && 1 }}
|
||||||
|
BLACKLIST: ${{ matrix.workers && 'synapse-blacklist-with-workers' }}
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- sytest-tag: bionic
|
||||||
|
|
||||||
|
- sytest-tag: bionic
|
||||||
|
postgres: postgres
|
||||||
|
|
||||||
|
- sytest-tag: testing
|
||||||
|
postgres: postgres
|
||||||
|
|
||||||
|
- sytest-tag: bionic
|
||||||
|
postgres: multi-postgres
|
||||||
|
workers: workers
|
||||||
|
|
||||||
|
- sytest-tag: buster
|
||||||
|
postgres: multi-postgres
|
||||||
|
workers: workers
|
||||||
|
|
||||||
|
- sytest-tag: buster
|
||||||
|
postgres: postgres
|
||||||
|
workers: workers
|
||||||
|
redis: redis
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Prepare test blacklist
|
||||||
|
run: cat sytest-blacklist .buildkite/worker-blacklist > synapse-blacklist-with-workers
|
||||||
|
- name: Run SyTest
|
||||||
|
run: /bootstrap.sh synapse
|
||||||
|
working-directory: /src
|
||||||
|
- name: Dump results.tap
|
||||||
|
if: ${{ always() }}
|
||||||
|
run: cat /logs/results.tap
|
||||||
|
- name: Upload SyTest logs
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
if: ${{ always() }}
|
||||||
|
with:
|
||||||
|
name: Sytest Logs - ${{ job.status }} - (${{ join(matrix.*, ', ') }})
|
||||||
|
path: |
|
||||||
|
/logs/results.tap
|
||||||
|
/logs/**/*.log*
|
||||||
|
|
||||||
|
portdb:
|
||||||
|
if: ${{ !failure() }} # Allow previous steps to be skipped, but not fail
|
||||||
|
needs: linting-done
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- python-version: "3.6"
|
||||||
|
postgres-version: "9.6"
|
||||||
|
|
||||||
|
- python-version: "3.9"
|
||||||
|
postgres-version: "13"
|
||||||
|
|
||||||
|
services:
|
||||||
|
postgres:
|
||||||
|
image: postgres:${{ matrix.postgres-version }}
|
||||||
|
ports:
|
||||||
|
- 5432:5432
|
||||||
|
env:
|
||||||
|
POSTGRES_PASSWORD: "postgres"
|
||||||
|
POSTGRES_INITDB_ARGS: "--lc-collate C --lc-ctype C --encoding UTF8"
|
||||||
|
options: >-
|
||||||
|
--health-cmd pg_isready
|
||||||
|
--health-interval 10s
|
||||||
|
--health-timeout 5s
|
||||||
|
--health-retries 5
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- run: sudo apt-get -qq install xmlsec1
|
||||||
|
- uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python-version }}
|
||||||
|
- name: Patch Buildkite-specific test scripts
|
||||||
|
run: |
|
||||||
|
sed -i -e 's/host="postgres"/host="localhost"/' .buildkite/scripts/postgres_exec.py
|
||||||
|
sed -i -e 's/host: postgres/host: localhost/' .buildkite/postgres-config.yaml
|
||||||
|
sed -i -e 's|/src/||' .buildkite/{sqlite,postgres}-config.yaml
|
||||||
|
sed -i -e 's/\$TOP/\$GITHUB_WORKSPACE/' .coveragerc
|
||||||
|
- run: .buildkite/scripts/test_synapse_port_db.sh
|
||||||
|
|
||||||
|
complement:
|
||||||
|
if: ${{ !failure() }}
|
||||||
|
needs: linting-done
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
# https://github.com/matrix-org/complement/blob/master/dockerfiles/ComplementCIBuildkite.Dockerfile
|
||||||
|
image: matrixdotorg/complement:latest
|
||||||
|
env:
|
||||||
|
CI: true
|
||||||
|
ports:
|
||||||
|
- 8448:8448
|
||||||
|
volumes:
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Run actions/checkout@v2 for synapse
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
path: synapse
|
||||||
|
|
||||||
|
- name: Run actions/checkout@v2 for complement
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
repository: "matrix-org/complement"
|
||||||
|
path: complement
|
||||||
|
|
||||||
|
# Build initial Synapse image
|
||||||
|
- run: docker build -t matrixdotorg/synapse:latest -f docker/Dockerfile .
|
||||||
|
working-directory: synapse
|
||||||
|
|
||||||
|
# Build a ready-to-run Synapse image based on the initial image above.
|
||||||
|
# This new image includes a config file, keys for signing and TLS, and
|
||||||
|
# other settings to make it suitable for testing under Complement.
|
||||||
|
- run: docker build -t complement-synapse -f Synapse.Dockerfile .
|
||||||
|
working-directory: complement/dockerfiles
|
||||||
|
|
||||||
|
# Run Complement
|
||||||
|
- run: go test -v -tags synapse_blacklist ./tests
|
||||||
|
env:
|
||||||
|
COMPLEMENT_BASE_IMAGE: complement-synapse:latest
|
||||||
|
working-directory: complement
|
||||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -6,13 +6,14 @@
|
|||||||
*.egg
|
*.egg
|
||||||
*.egg-info
|
*.egg-info
|
||||||
*.lock
|
*.lock
|
||||||
*.pyc
|
*.py[cod]
|
||||||
*.snap
|
*.snap
|
||||||
*.tac
|
*.tac
|
||||||
_trial_temp/
|
_trial_temp/
|
||||||
_trial_temp*/
|
_trial_temp*/
|
||||||
/out
|
/out
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
__pycache__/
|
||||||
|
|
||||||
# stuff that is likely to exist when you run a server locally
|
# stuff that is likely to exist when you run a server locally
|
||||||
/*.db
|
/*.db
|
||||||
|
|||||||
763
CHANGES.md
763
CHANGES.md
@@ -1,9 +1,770 @@
|
|||||||
|
Synapse 1.35.1 (2021-06-03)
|
||||||
|
===========================
|
||||||
|
|
||||||
|
Bugfixes
|
||||||
|
--------
|
||||||
|
|
||||||
|
- Fix a bug introduced in v1.35.0 where invite-only rooms would be shown to all users in a space, regardless of if the user had access to it. ([\#10109](https://github.com/matrix-org/synapse/issues/10109))
|
||||||
|
|
||||||
|
|
||||||
|
Synapse 1.35.0 (2021-06-01)
|
||||||
|
===========================
|
||||||
|
|
||||||
|
Note that [the tag](https://github.com/matrix-org/synapse/releases/tag/v1.35.0rc3) and [docker images](https://hub.docker.com/layers/matrixdotorg/synapse/v1.35.0rc3/images/sha256-34ccc87bd99a17e2cbc0902e678b5937d16bdc1991ead097eee6096481ecf2c4?context=explore) for `v1.35.0rc3` were incorrectly built. If you are experiencing issues with either, it is recommended to upgrade to the equivalent tag or docker image for the `v1.35.0` release.
|
||||||
|
|
||||||
|
Deprecations and Removals
|
||||||
|
-------------------------
|
||||||
|
|
||||||
|
- The core Synapse development team plan to drop support for the [unstable API of MSC2858](https://github.com/matrix-org/matrix-doc/blob/master/proposals/2858-Multiple-SSO-Identity-Providers.md#unstable-prefix), including the undocumented `experimental.msc2858_enabled` config option, in August 2021. Client authors should ensure that their clients are updated to use the stable API (which has been supported since Synapse 1.30) well before that time, to give their users time to upgrade. ([\#10101](https://github.com/matrix-org/synapse/issues/10101))
|
||||||
|
|
||||||
|
Bugfixes
|
||||||
|
--------
|
||||||
|
|
||||||
|
- Fixed a bug causing replication requests to fail when receiving a lot of events via federation. Introduced in v1.33.0. ([\#10082](https://github.com/matrix-org/synapse/issues/10082))
|
||||||
|
- Fix HTTP response size limit to allow joining very large rooms over federation. Introduced in v1.33.0. ([\#10093](https://github.com/matrix-org/synapse/issues/10093))
|
||||||
|
|
||||||
|
|
||||||
|
Internal Changes
|
||||||
|
----------------
|
||||||
|
|
||||||
|
- Log method and path when dropping request due to size limit. ([\#10091](https://github.com/matrix-org/synapse/issues/10091))
|
||||||
|
|
||||||
|
|
||||||
|
Synapse 1.35.0rc2 (2021-05-27)
|
||||||
|
==============================
|
||||||
|
|
||||||
|
Bugfixes
|
||||||
|
--------
|
||||||
|
|
||||||
|
- Fix a bug introduced in v1.35.0rc1 when calling the spaces summary API via a GET request. ([\#10079](https://github.com/matrix-org/synapse/issues/10079))
|
||||||
|
|
||||||
|
|
||||||
|
Synapse 1.35.0rc1 (2021-05-25)
|
||||||
|
==============================
|
||||||
|
|
||||||
|
Features
|
||||||
|
--------
|
||||||
|
|
||||||
|
- Add experimental support to allow a user who could join a restricted room to view it in the spaces summary. ([\#9922](https://github.com/matrix-org/synapse/issues/9922), [\#10007](https://github.com/matrix-org/synapse/issues/10007), [\#10038](https://github.com/matrix-org/synapse/issues/10038))
|
||||||
|
- Reduce memory usage when joining very large rooms over federation. ([\#9958](https://github.com/matrix-org/synapse/issues/9958))
|
||||||
|
- Add a configuration option which allows enabling opentracing by user id. ([\#9978](https://github.com/matrix-org/synapse/issues/9978))
|
||||||
|
- Enable experimental support for [MSC2946](https://github.com/matrix-org/matrix-doc/pull/2946) (spaces summary API) and [MSC3083](https://github.com/matrix-org/matrix-doc/pull/3083) (restricted join rules) by default. ([\#10011](https://github.com/matrix-org/synapse/issues/10011))
|
||||||
|
|
||||||
|
|
||||||
|
Bugfixes
|
||||||
|
--------
|
||||||
|
|
||||||
|
- Fix a bug introduced in v1.26.0 which meant that `synapse_port_db` would not correctly initialise some postgres sequences, requiring manual updates afterwards. ([\#9991](https://github.com/matrix-org/synapse/issues/9991))
|
||||||
|
- Fix `synctl`'s `--no-daemonize` parameter to work correctly with worker processes. ([\#9995](https://github.com/matrix-org/synapse/issues/9995))
|
||||||
|
- Fix a validation bug introduced in v1.34.0 in the ordering of spaces in the space summary API. ([\#10002](https://github.com/matrix-org/synapse/issues/10002))
|
||||||
|
- Fixed deletion of new presence stream states from database. ([\#10014](https://github.com/matrix-org/synapse/issues/10014), [\#10033](https://github.com/matrix-org/synapse/issues/10033))
|
||||||
|
- Fixed a bug with very high resolution image uploads throwing internal server errors. ([\#10029](https://github.com/matrix-org/synapse/issues/10029))
|
||||||
|
|
||||||
|
|
||||||
|
Updates to the Docker image
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
- Fix bug introduced in Synapse 1.33.0 which caused a `Permission denied: '/homeserver.log'` error when starting Synapse with the generated log configuration. Contributed by Sergio Miguéns Iglesias. ([\#10045](https://github.com/matrix-org/synapse/issues/10045))
|
||||||
|
|
||||||
|
|
||||||
|
Improved Documentation
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
- Add hardened systemd files as proposed in [#9760](https://github.com/matrix-org/synapse/issues/9760) and added them to `contrib/`. Change the docs to reflect the presence of these files. ([\#9803](https://github.com/matrix-org/synapse/issues/9803))
|
||||||
|
- Clarify documentation around SSO mapping providers generating unique IDs and localparts. ([\#9980](https://github.com/matrix-org/synapse/issues/9980))
|
||||||
|
- Updates to the PostgreSQL documentation (`postgres.md`). ([\#9988](https://github.com/matrix-org/synapse/issues/9988), [\#9989](https://github.com/matrix-org/synapse/issues/9989))
|
||||||
|
- Fix broken link in user directory documentation. Contributed by @junquera. ([\#10016](https://github.com/matrix-org/synapse/issues/10016))
|
||||||
|
- Add missing room state entry to the table of contents of room admin API. ([\#10043](https://github.com/matrix-org/synapse/issues/10043))
|
||||||
|
|
||||||
|
|
||||||
|
Deprecations and Removals
|
||||||
|
-------------------------
|
||||||
|
|
||||||
|
- Removed support for the deprecated `tls_fingerprints` configuration setting. Contributed by Jerin J Titus. ([\#9280](https://github.com/matrix-org/synapse/issues/9280))
|
||||||
|
|
||||||
|
|
||||||
|
Internal Changes
|
||||||
|
----------------
|
||||||
|
|
||||||
|
- Allow sending full presence to users via workers other than the one that called `ModuleApi.send_local_online_presence_to`. ([\#9823](https://github.com/matrix-org/synapse/issues/9823))
|
||||||
|
- Update comments in the space summary handler. ([\#9974](https://github.com/matrix-org/synapse/issues/9974))
|
||||||
|
- Minor enhancements to the `@cachedList` descriptor. ([\#9975](https://github.com/matrix-org/synapse/issues/9975))
|
||||||
|
- Split multipart email sending into a dedicated handler. ([\#9977](https://github.com/matrix-org/synapse/issues/9977))
|
||||||
|
- Run `black` on files in the `scripts` directory. ([\#9981](https://github.com/matrix-org/synapse/issues/9981))
|
||||||
|
- Add missing type hints to `synapse.util` module. ([\#9982](https://github.com/matrix-org/synapse/issues/9982))
|
||||||
|
- Simplify a few helper functions. ([\#9984](https://github.com/matrix-org/synapse/issues/9984), [\#9985](https://github.com/matrix-org/synapse/issues/9985), [\#9986](https://github.com/matrix-org/synapse/issues/9986))
|
||||||
|
- Remove unnecessary property from SQLBaseStore. ([\#9987](https://github.com/matrix-org/synapse/issues/9987))
|
||||||
|
- Remove `keylen` param on `LruCache`. ([\#9993](https://github.com/matrix-org/synapse/issues/9993))
|
||||||
|
- Update the Grafana dashboard in `contrib/`. ([\#10001](https://github.com/matrix-org/synapse/issues/10001))
|
||||||
|
- Add a batching queue implementation. ([\#10017](https://github.com/matrix-org/synapse/issues/10017))
|
||||||
|
- Reduce memory usage when verifying signatures on large numbers of events at once. ([\#10018](https://github.com/matrix-org/synapse/issues/10018))
|
||||||
|
- Properly invalidate caches for destination retry timings every (instead of expiring entries every 5 minutes). ([\#10036](https://github.com/matrix-org/synapse/issues/10036))
|
||||||
|
- Fix running complement tests with Synapse workers. ([\#10039](https://github.com/matrix-org/synapse/issues/10039))
|
||||||
|
- Fix typo in `get_state_ids_for_event` docstring where the return type was incorrect. ([\#10050](https://github.com/matrix-org/synapse/issues/10050))
|
||||||
|
|
||||||
|
|
||||||
|
Synapse 1.34.0 (2021-05-17)
|
||||||
|
===========================
|
||||||
|
|
||||||
|
This release deprecates the `room_invite_state_types` configuration setting. See the [upgrade notes](https://github.com/matrix-org/synapse/blob/release-v1.34.0/UPGRADE.rst#upgrading-to-v1340) for instructions on updating your configuration file to use the new `room_prejoin_state` setting.
|
||||||
|
|
||||||
|
This release also deprecates the `POST /_synapse/admin/v1/rooms/<room_id>/delete` admin API route. Server administrators are encouraged to update their scripts to use the new `DELETE /_synapse/admin/v1/rooms/<room_id>` route instead.
|
||||||
|
|
||||||
|
|
||||||
|
No significant changes since v1.34.0rc1.
|
||||||
|
|
||||||
|
|
||||||
|
Synapse 1.34.0rc1 (2021-05-12)
|
||||||
|
==============================
|
||||||
|
|
||||||
|
Features
|
||||||
|
--------
|
||||||
|
|
||||||
|
- Add experimental option to track memory usage of the caches. ([\#9881](https://github.com/matrix-org/synapse/issues/9881))
|
||||||
|
- Add support for `DELETE /_synapse/admin/v1/rooms/<room_id>`. ([\#9889](https://github.com/matrix-org/synapse/issues/9889))
|
||||||
|
- Add limits to how often Synapse will GC, ensuring that large servers do not end up GC thrashing if `gc_thresholds` has not been correctly set. ([\#9902](https://github.com/matrix-org/synapse/issues/9902))
|
||||||
|
- Improve performance of sending events for worker-based deployments using Redis. ([\#9905](https://github.com/matrix-org/synapse/issues/9905), [\#9950](https://github.com/matrix-org/synapse/issues/9950), [\#9951](https://github.com/matrix-org/synapse/issues/9951))
|
||||||
|
- Improve performance after joining a large room when presence is enabled. ([\#9910](https://github.com/matrix-org/synapse/issues/9910), [\#9916](https://github.com/matrix-org/synapse/issues/9916))
|
||||||
|
- Support stable identifiers for [MSC1772](https://github.com/matrix-org/matrix-doc/pull/1772) Spaces. `m.space.child` events will now be taken into account when populating the experimental spaces summary response. Please see [the upgrade notes](https://github.com/matrix-org/synapse/blob/release-v1.34.0/UPGRADE.rst#upgrading-to-v1340) if you have customised `room_invite_state_types` in your configuration. ([\#9915](https://github.com/matrix-org/synapse/issues/9915), [\#9966](https://github.com/matrix-org/synapse/issues/9966))
|
||||||
|
- Improve performance of backfilling in large rooms. ([\#9935](https://github.com/matrix-org/synapse/issues/9935))
|
||||||
|
- Add a config option to allow you to prevent device display names from being shared over federation. Contributed by @aaronraimist. ([\#9945](https://github.com/matrix-org/synapse/issues/9945))
|
||||||
|
- Update support for [MSC2946](https://github.com/matrix-org/matrix-doc/pull/2946): Spaces Summary. ([\#9947](https://github.com/matrix-org/synapse/issues/9947), [\#9954](https://github.com/matrix-org/synapse/issues/9954))
|
||||||
|
|
||||||
|
|
||||||
|
Bugfixes
|
||||||
|
--------
|
||||||
|
|
||||||
|
- Fix a bug introduced in v1.32.0 where the associated connection was improperly logged for SQL logging statements. ([\#9895](https://github.com/matrix-org/synapse/issues/9895))
|
||||||
|
- Correct the type hint for the `user_may_create_room_alias` method of spam checkers. It is provided a `RoomAlias`, not a `str`. ([\#9896](https://github.com/matrix-org/synapse/issues/9896))
|
||||||
|
- Fix bug where user directory could get out of sync if room visibility and membership changed in quick succession. ([\#9910](https://github.com/matrix-org/synapse/issues/9910))
|
||||||
|
- Include the `origin_server_ts` property in the experimental [MSC2946](https://github.com/matrix-org/matrix-doc/pull/2946) support to allow clients to properly sort rooms. ([\#9928](https://github.com/matrix-org/synapse/issues/9928))
|
||||||
|
- Fix bugs introduced in v1.23.0 which made the PostgreSQL port script fail when run with a newly-created SQLite database. ([\#9930](https://github.com/matrix-org/synapse/issues/9930))
|
||||||
|
- Fix a bug introduced in Synapse 1.29.0 which caused `m.room_key_request` to-device messages sent from one user to another to be dropped. ([\#9961](https://github.com/matrix-org/synapse/issues/9961), [\#9965](https://github.com/matrix-org/synapse/issues/9965))
|
||||||
|
- Fix a bug introduced in v1.27.0 preventing users and appservices exempt from ratelimiting from creating rooms with many invitees. ([\#9968](https://github.com/matrix-org/synapse/issues/9968))
|
||||||
|
|
||||||
|
|
||||||
|
Updates to the Docker image
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
- Add `startup_delay` to docker healthcheck to reduce waiting time for coming online and update the documentation with extra options. Contributed by @Maquis196. ([\#9913](https://github.com/matrix-org/synapse/issues/9913))
|
||||||
|
|
||||||
|
|
||||||
|
Improved Documentation
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
- Add `port` argument to the Postgres database sample config section. ([\#9911](https://github.com/matrix-org/synapse/issues/9911))
|
||||||
|
|
||||||
|
|
||||||
|
Deprecations and Removals
|
||||||
|
-------------------------
|
||||||
|
|
||||||
|
- Mark as deprecated `POST /_synapse/admin/v1/rooms/<room_id>/delete`. ([\#9889](https://github.com/matrix-org/synapse/issues/9889))
|
||||||
|
|
||||||
|
|
||||||
|
Internal Changes
|
||||||
|
----------------
|
||||||
|
|
||||||
|
- Reduce the length of Synapse's access tokens. ([\#5588](https://github.com/matrix-org/synapse/issues/5588))
|
||||||
|
- Export jemalloc stats to Prometheus if it is being used. ([\#9882](https://github.com/matrix-org/synapse/issues/9882))
|
||||||
|
- Add type hints to presence handler. ([\#9885](https://github.com/matrix-org/synapse/issues/9885))
|
||||||
|
- Reduce memory usage of the LRU caches. ([\#9886](https://github.com/matrix-org/synapse/issues/9886))
|
||||||
|
- Add type hints to the `synapse.handlers` module. ([\#9896](https://github.com/matrix-org/synapse/issues/9896))
|
||||||
|
- Time response time for external cache requests. ([\#9904](https://github.com/matrix-org/synapse/issues/9904))
|
||||||
|
- Minor fixes to the `make_full_schema.sh` script. ([\#9931](https://github.com/matrix-org/synapse/issues/9931))
|
||||||
|
- Move database schema files into a common directory. ([\#9932](https://github.com/matrix-org/synapse/issues/9932))
|
||||||
|
- Add debug logging for lost/delayed to-device messages. ([\#9959](https://github.com/matrix-org/synapse/issues/9959))
|
||||||
|
|
||||||
|
|
||||||
|
Synapse 1.33.2 (2021-05-11)
|
||||||
|
===========================
|
||||||
|
|
||||||
|
Due to the security issue highlighted below, server administrators are encouraged to update Synapse. We are not aware of these vulnerabilities being exploited in the wild.
|
||||||
|
|
||||||
|
Security advisory
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
This release fixes a denial of service attack ([CVE-2021-29471](https://github.com/matrix-org/synapse/security/advisories/GHSA-x345-32rc-8h85)) against Synapse's push rules implementation. Server admins are encouraged to upgrade.
|
||||||
|
|
||||||
|
Internal Changes
|
||||||
|
----------------
|
||||||
|
|
||||||
|
- Unpin attrs dependency. ([\#9946](https://github.com/matrix-org/synapse/issues/9946))
|
||||||
|
|
||||||
|
|
||||||
|
Synapse 1.33.1 (2021-05-06)
|
||||||
|
===========================
|
||||||
|
|
||||||
|
Bugfixes
|
||||||
|
--------
|
||||||
|
|
||||||
|
- Fix bug where `/sync` would break if using the latest version of `attrs` dependency, by pinning to a previous version. ([\#9937](https://github.com/matrix-org/synapse/issues/9937))
|
||||||
|
|
||||||
|
|
||||||
|
Synapse 1.33.0 (2021-05-05)
|
||||||
|
===========================
|
||||||
|
|
||||||
|
Features
|
||||||
|
--------
|
||||||
|
|
||||||
|
- Build Debian packages for Ubuntu 21.04 (Hirsute Hippo). ([\#9909](https://github.com/matrix-org/synapse/issues/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](https://github.com/matrix-org/synapse/issues/9900))
|
||||||
|
|
||||||
|
|
||||||
|
Synapse 1.33.0rc1 (2021-04-28)
|
||||||
|
==============================
|
||||||
|
|
||||||
|
Features
|
||||||
|
--------
|
||||||
|
|
||||||
|
- 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))
|
||||||
|
- 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))
|
||||||
|
- 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))
|
||||||
|
|
||||||
|
|
||||||
|
Bugfixes
|
||||||
|
--------
|
||||||
|
|
||||||
|
- 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))
|
||||||
|
- Fix thumbnail generation for some sites with non-standard content types. Contributed by @rkfg. ([\#9788](https://github.com/matrix-org/synapse/issues/9788))
|
||||||
|
- Add some sanity checks to identity server passed to 3PID bind/unbind endpoints. ([\#9802](https://github.com/matrix-org/synapse/issues/9802))
|
||||||
|
- Limit the size of HTTP responses read over federation. ([\#9833](https://github.com/matrix-org/synapse/issues/9833))
|
||||||
|
- 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))
|
||||||
|
- Fix a long-standing bug where errors from federation did not propagate to the client. ([\#9868](https://github.com/matrix-org/synapse/issues/9868))
|
||||||
|
|
||||||
|
|
||||||
|
Improved Documentation
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
- 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))
|
||||||
|
|
||||||
|
|
||||||
|
Internal Changes
|
||||||
|
----------------
|
||||||
|
|
||||||
|
- Add a dockerfile for running Synapse in worker-mode under Complement. ([\#9162](https://github.com/matrix-org/synapse/issues/9162))
|
||||||
|
- Apply `pyupgrade` across the codebase. ([\#9786](https://github.com/matrix-org/synapse/issues/9786))
|
||||||
|
- Move some replication processing out of `generic_worker`. ([\#9796](https://github.com/matrix-org/synapse/issues/9796))
|
||||||
|
- Replace `HomeServer.get_config()` with inline references. ([\#9815](https://github.com/matrix-org/synapse/issues/9815))
|
||||||
|
- Rename some handlers and config modules to not duplicate the top-level module. ([\#9816](https://github.com/matrix-org/synapse/issues/9816))
|
||||||
|
- Fix a long-standing bug which caused `max_upload_size` to not be correctly enforced. ([\#9817](https://github.com/matrix-org/synapse/issues/9817))
|
||||||
|
- Reduce CPU usage of the user directory by reusing existing calculated room membership. ([\#9821](https://github.com/matrix-org/synapse/issues/9821))
|
||||||
|
- Small speed up for joining large remote rooms. ([\#9825](https://github.com/matrix-org/synapse/issues/9825))
|
||||||
|
- Introduce flake8-bugbear to the test suite and fix some of its lint violations. ([\#9838](https://github.com/matrix-org/synapse/issues/9838))
|
||||||
|
- 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))
|
||||||
|
- Limit length of accepted email addresses. ([\#9855](https://github.com/matrix-org/synapse/issues/9855))
|
||||||
|
- Remove redundant `synapse.types.Collection` type definition. ([\#9856](https://github.com/matrix-org/synapse/issues/9856))
|
||||||
|
- Handle recently added rate limits correctly when using `--no-rate-limit` with the demo scripts. ([\#9858](https://github.com/matrix-org/synapse/issues/9858))
|
||||||
|
- Disable invite rate-limiting by default when running the unit tests. ([\#9871](https://github.com/matrix-org/synapse/issues/9871))
|
||||||
|
- Pass a reactor into `SynapseSite` to make testing easier. ([\#9874](https://github.com/matrix-org/synapse/issues/9874))
|
||||||
|
- Make `DomainSpecificString` an `attrs` class. ([\#9875](https://github.com/matrix-org/synapse/issues/9875))
|
||||||
|
- Add type hints to `synapse.api.auth` and `synapse.api.auth_blocking` modules. ([\#9876](https://github.com/matrix-org/synapse/issues/9876))
|
||||||
|
- Remove redundant `_PushHTTPChannel` test class. ([\#9878](https://github.com/matrix-org/synapse/issues/9878))
|
||||||
|
- Remove backwards-compatibility code for Python versions < 3.6. ([\#9879](https://github.com/matrix-org/synapse/issues/9879))
|
||||||
|
- Small performance improvement around handling new local presence updates. ([\#9887](https://github.com/matrix-org/synapse/issues/9887))
|
||||||
|
|
||||||
|
|
||||||
|
Synapse 1.32.2 (2021-04-22)
|
||||||
|
===========================
|
||||||
|
|
||||||
|
This release includes a fix for a regression introduced in 1.32.0.
|
||||||
|
|
||||||
|
Bugfixes
|
||||||
|
--------
|
||||||
|
|
||||||
|
- Fix a regression in Synapse 1.32.0 and 1.32.1 which caused `LoggingContext` errors in plugins. ([\#9857](https://github.com/matrix-org/synapse/issues/9857))
|
||||||
|
|
||||||
|
|
||||||
|
Synapse 1.32.1 (2021-04-21)
|
||||||
|
===========================
|
||||||
|
|
||||||
|
This release fixes [a regression](https://github.com/matrix-org/synapse/issues/9853)
|
||||||
|
in Synapse 1.32.0 that caused connected Prometheus instances to become unstable.
|
||||||
|
|
||||||
|
However, as this release is still subject to the `LoggingContext` change in 1.32.0,
|
||||||
|
it is recommended to remain on or downgrade to 1.31.0.
|
||||||
|
|
||||||
|
Bugfixes
|
||||||
|
--------
|
||||||
|
|
||||||
|
- Fix a regression in Synapse 1.32.0 which caused Synapse to report large numbers of Prometheus time series, potentially overwhelming Prometheus instances. ([\#9854](https://github.com/matrix-org/synapse/issues/9854))
|
||||||
|
|
||||||
|
|
||||||
|
Synapse 1.32.0 (2021-04-20)
|
||||||
|
===========================
|
||||||
|
|
||||||
|
**Note:** This release introduces [a regression](https://github.com/matrix-org/synapse/issues/9853)
|
||||||
|
that can overwhelm connected Prometheus instances. This issue was not present in
|
||||||
|
1.32.0rc1. If affected, it is recommended to downgrade to 1.31.0 in the meantime, and
|
||||||
|
follow [these instructions](https://github.com/matrix-org/synapse/pull/9854#issuecomment-823472183)
|
||||||
|
to clean up any excess writeahead logs.
|
||||||
|
|
||||||
|
**Note:** This release also mistakenly included a change that may affected Synapse
|
||||||
|
modules that import `synapse.logging.context.LoggingContext`, such as
|
||||||
|
[synapse-s3-storage-provider](https://github.com/matrix-org/synapse-s3-storage-provider).
|
||||||
|
This will be fixed in a later Synapse version.
|
||||||
|
|
||||||
|
**Note:** This release requires Python 3.6+ and Postgres 9.6+ or SQLite 3.22+.
|
||||||
|
|
||||||
|
This release removes the deprecated `GET /_synapse/admin/v1/users/<user_id>` admin API. Please use the [v2 API](https://github.com/matrix-org/synapse/blob/develop/docs/admin_api/user_admin_api.rst#query-user-account) instead, which has improved capabilities.
|
||||||
|
|
||||||
|
This release requires Application Services to use type `m.login.application_service` when registering users via the `/_matrix/client/r0/register` endpoint to comply with the spec. Please ensure your Application Services are up to date.
|
||||||
|
|
||||||
|
If you are using the `packages.matrix.org` Debian repository for Synapse packages,
|
||||||
|
note that we have recently updated the expiry date on the gpg signing key. If you see an
|
||||||
|
error similar to `The following signatures were invalid: EXPKEYSIG F473DD4473365DE1`, you
|
||||||
|
will need to get a fresh copy of the keys. You can do so with:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
sudo wget -O /usr/share/keyrings/matrix-org-archive-keyring.gpg https://packages.matrix.org/debian/matrix-org-archive-keyring.gpg
|
||||||
|
```
|
||||||
|
|
||||||
|
Bugfixes
|
||||||
|
--------
|
||||||
|
|
||||||
|
- Fix the log lines of nested logging contexts. Broke in 1.32.0rc1. ([\#9829](https://github.com/matrix-org/synapse/issues/9829))
|
||||||
|
|
||||||
|
|
||||||
|
Synapse 1.32.0rc1 (2021-04-13)
|
||||||
|
==============================
|
||||||
|
|
||||||
|
Features
|
||||||
|
--------
|
||||||
|
|
||||||
|
- Add a Synapse module for routing presence updates between users. ([\#9491](https://github.com/matrix-org/synapse/issues/9491))
|
||||||
|
- Add an admin API to manage ratelimit for a specific user. ([\#9648](https://github.com/matrix-org/synapse/issues/9648))
|
||||||
|
- Include request information in structured logging output. ([\#9654](https://github.com/matrix-org/synapse/issues/9654))
|
||||||
|
- Add `order_by` to the admin API `GET /_synapse/admin/v2/users`. Contributed by @dklimpel. ([\#9691](https://github.com/matrix-org/synapse/issues/9691))
|
||||||
|
- Replace the `room_invite_state_types` configuration setting with `room_prejoin_state`. ([\#9700](https://github.com/matrix-org/synapse/issues/9700))
|
||||||
|
- Add experimental support for [MSC3083](https://github.com/matrix-org/matrix-doc/pull/3083): restricting room access via group membership. ([\#9717](https://github.com/matrix-org/synapse/issues/9717), [\#9735](https://github.com/matrix-org/synapse/issues/9735))
|
||||||
|
- Update experimental support for Spaces: include `m.room.create` in the room state sent with room-invites. ([\#9710](https://github.com/matrix-org/synapse/issues/9710))
|
||||||
|
- Synapse now requires Python 3.6 or later. It also requires Postgres 9.6 or later or SQLite 3.22 or later. ([\#9766](https://github.com/matrix-org/synapse/issues/9766))
|
||||||
|
|
||||||
|
|
||||||
|
Bugfixes
|
||||||
|
--------
|
||||||
|
|
||||||
|
- Prevent `synapse_forward_extremities` and `synapse_excess_extremity_events` Prometheus metrics from initially reporting zero-values after startup. ([\#8926](https://github.com/matrix-org/synapse/issues/8926))
|
||||||
|
- Fix recently added ratelimits to correctly honour the application service `rate_limited` flag. ([\#9711](https://github.com/matrix-org/synapse/issues/9711))
|
||||||
|
- Fix longstanding bug which caused `duplicate key value violates unique constraint "remote_media_cache_thumbnails_media_origin_media_id_thumbna_key"` errors. ([\#9725](https://github.com/matrix-org/synapse/issues/9725))
|
||||||
|
- Fix bug where sharded federation senders could get stuck repeatedly querying the DB in a loop, using lots of CPU. ([\#9770](https://github.com/matrix-org/synapse/issues/9770))
|
||||||
|
- Fix duplicate logging of exceptions thrown during federation transaction processing. ([\#9780](https://github.com/matrix-org/synapse/issues/9780))
|
||||||
|
|
||||||
|
|
||||||
|
Updates to the Docker image
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
- Move opencontainers labels to the final Docker image such that users can inspect them. ([\#9765](https://github.com/matrix-org/synapse/issues/9765))
|
||||||
|
|
||||||
|
|
||||||
|
Improved Documentation
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
- Make the `allowed_local_3pids` regex example in the sample config stricter. ([\#9719](https://github.com/matrix-org/synapse/issues/9719))
|
||||||
|
|
||||||
|
|
||||||
|
Deprecations and Removals
|
||||||
|
-------------------------
|
||||||
|
|
||||||
|
- Remove old admin API `GET /_synapse/admin/v1/users/<user_id>`. ([\#9401](https://github.com/matrix-org/synapse/issues/9401))
|
||||||
|
- Make `/_matrix/client/r0/register` expect a type of `m.login.application_service` when an Application Service registers a user, to align with [the relevant spec](https://spec.matrix.org/unstable/application-service-api/#server-admin-style-permissions). ([\#9548](https://github.com/matrix-org/synapse/issues/9548))
|
||||||
|
|
||||||
|
|
||||||
|
Internal Changes
|
||||||
|
----------------
|
||||||
|
|
||||||
|
- Replace deprecated `imp` module with successor `importlib`. Contributed by Cristina Muñoz. ([\#9718](https://github.com/matrix-org/synapse/issues/9718))
|
||||||
|
- Experiment with GitHub Actions for CI. ([\#9661](https://github.com/matrix-org/synapse/issues/9661))
|
||||||
|
- Introduce flake8-bugbear to the test suite and fix some of its lint violations. ([\#9682](https://github.com/matrix-org/synapse/issues/9682))
|
||||||
|
- Update `scripts-dev/complement.sh` to use a local checkout of Complement, allow running a subset of tests and have it use Synapse's Complement test blacklist. ([\#9685](https://github.com/matrix-org/synapse/issues/9685))
|
||||||
|
- Improve Jaeger tracing for `to_device` messages. ([\#9686](https://github.com/matrix-org/synapse/issues/9686))
|
||||||
|
- Add release helper script for automating part of the Synapse release process. ([\#9713](https://github.com/matrix-org/synapse/issues/9713))
|
||||||
|
- Add type hints to expiring cache. ([\#9730](https://github.com/matrix-org/synapse/issues/9730))
|
||||||
|
- Convert various testcases to `HomeserverTestCase`. ([\#9736](https://github.com/matrix-org/synapse/issues/9736))
|
||||||
|
- Start linting mypy with `no_implicit_optional`. ([\#9742](https://github.com/matrix-org/synapse/issues/9742))
|
||||||
|
- Add missing type hints to federation handler and server. ([\#9743](https://github.com/matrix-org/synapse/issues/9743))
|
||||||
|
- Check that a `ConfigError` is raised, rather than simply `Exception`, when appropriate in homeserver config file generation tests. ([\#9753](https://github.com/matrix-org/synapse/issues/9753))
|
||||||
|
- Fix incompatibility with `tox` 2.5. ([\#9769](https://github.com/matrix-org/synapse/issues/9769))
|
||||||
|
- Enable Complement tests for [MSC2946](https://github.com/matrix-org/matrix-doc/pull/2946): Spaces Summary API. ([\#9771](https://github.com/matrix-org/synapse/issues/9771))
|
||||||
|
- Use mock from the standard library instead of a separate package. ([\#9772](https://github.com/matrix-org/synapse/issues/9772))
|
||||||
|
- Update Black configuration to target Python 3.6. ([\#9781](https://github.com/matrix-org/synapse/issues/9781))
|
||||||
|
- Add option to skip unit tests when building Debian packages. ([\#9793](https://github.com/matrix-org/synapse/issues/9793))
|
||||||
|
|
||||||
|
|
||||||
|
Synapse 1.31.0 (2021-04-06)
|
||||||
|
===========================
|
||||||
|
|
||||||
|
**Note:** As announced in v1.25.0, and in line with the deprecation policy for platform dependencies, this is the last release to support Python 3.5 and PostgreSQL 9.5. Future versions of Synapse will require Python 3.6+ and PostgreSQL 9.6+, as per our [deprecation policy](docs/deprecation_policy.md).
|
||||||
|
|
||||||
|
This is also the last release that the Synapse team will be publishing packages for Debian Stretch and Ubuntu Xenial.
|
||||||
|
|
||||||
|
|
||||||
|
Improved Documentation
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
- Add a document describing the deprecation policy for platform dependencies. ([\#9723](https://github.com/matrix-org/synapse/issues/9723))
|
||||||
|
|
||||||
|
|
||||||
|
Internal Changes
|
||||||
|
----------------
|
||||||
|
|
||||||
|
- Revert using `dmypy run` in lint script. ([\#9720](https://github.com/matrix-org/synapse/issues/9720))
|
||||||
|
- Pin flake8-bugbear's version. ([\#9734](https://github.com/matrix-org/synapse/issues/9734))
|
||||||
|
|
||||||
|
|
||||||
|
Synapse 1.31.0rc1 (2021-03-30)
|
||||||
|
==============================
|
||||||
|
|
||||||
|
Features
|
||||||
|
--------
|
||||||
|
|
||||||
|
- Add support to OpenID Connect login for requiring attributes on the `userinfo` response. Contributed by Hubbe King. ([\#9609](https://github.com/matrix-org/synapse/issues/9609))
|
||||||
|
- Add initial experimental support for a "space summary" API. ([\#9643](https://github.com/matrix-org/synapse/issues/9643), [\#9652](https://github.com/matrix-org/synapse/issues/9652), [\#9653](https://github.com/matrix-org/synapse/issues/9653))
|
||||||
|
- Add support for the busy presence state as described in [MSC3026](https://github.com/matrix-org/matrix-doc/pull/3026). ([\#9644](https://github.com/matrix-org/synapse/issues/9644))
|
||||||
|
- Add support for credentials for proxy authentication in the `HTTPS_PROXY` environment variable. ([\#9657](https://github.com/matrix-org/synapse/issues/9657))
|
||||||
|
|
||||||
|
|
||||||
|
Bugfixes
|
||||||
|
--------
|
||||||
|
|
||||||
|
- Fix a longstanding bug that could cause issues when editing a reply to a message. ([\#9585](https://github.com/matrix-org/synapse/issues/9585))
|
||||||
|
- Fix the `/capabilities` endpoint to return `m.change_password` as disabled if the local password database is not used for authentication. Contributed by @dklimpel. ([\#9588](https://github.com/matrix-org/synapse/issues/9588))
|
||||||
|
- Check if local passwords are enabled before setting them for the user. ([\#9636](https://github.com/matrix-org/synapse/issues/9636))
|
||||||
|
- Fix a bug where federation sending can stall due to `concurrent access` database exceptions when it falls behind. ([\#9639](https://github.com/matrix-org/synapse/issues/9639))
|
||||||
|
- Fix a bug introduced in Synapse 1.30.1 which meant the suggested `pip` incantation to install an updated `cryptography` was incorrect. ([\#9699](https://github.com/matrix-org/synapse/issues/9699))
|
||||||
|
|
||||||
|
|
||||||
|
Updates to the Docker image
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
- Speed up Docker builds and make it nicer to test against Complement while developing (install all dependencies before copying the project). ([\#9610](https://github.com/matrix-org/synapse/issues/9610))
|
||||||
|
- Include [opencontainers labels](https://github.com/opencontainers/image-spec/blob/master/annotations.md#pre-defined-annotation-keys) in the Docker image. ([\#9612](https://github.com/matrix-org/synapse/issues/9612))
|
||||||
|
|
||||||
|
|
||||||
|
Improved Documentation
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
- Clarify that `register_new_matrix_user` is present also when installed via non-pip package. ([\#9074](https://github.com/matrix-org/synapse/issues/9074))
|
||||||
|
- Update source install documentation to mention platform prerequisites before the source install steps. ([\#9667](https://github.com/matrix-org/synapse/issues/9667))
|
||||||
|
- Improve worker documentation for fallback/web auth endpoints. ([\#9679](https://github.com/matrix-org/synapse/issues/9679))
|
||||||
|
- Update the sample configuration for OIDC authentication. ([\#9695](https://github.com/matrix-org/synapse/issues/9695))
|
||||||
|
|
||||||
|
|
||||||
|
Internal Changes
|
||||||
|
----------------
|
||||||
|
|
||||||
|
- Preparatory steps for removing redundant `outlier` data from `event_json.internal_metadata` column. ([\#9411](https://github.com/matrix-org/synapse/issues/9411))
|
||||||
|
- Add type hints to the caching module. ([\#9442](https://github.com/matrix-org/synapse/issues/9442))
|
||||||
|
- Introduce flake8-bugbear to the test suite and fix some of its lint violations. ([\#9499](https://github.com/matrix-org/synapse/issues/9499), [\#9659](https://github.com/matrix-org/synapse/issues/9659))
|
||||||
|
- Add additional type hints to the Homeserver object. ([\#9631](https://github.com/matrix-org/synapse/issues/9631), [\#9638](https://github.com/matrix-org/synapse/issues/9638), [\#9675](https://github.com/matrix-org/synapse/issues/9675), [\#9681](https://github.com/matrix-org/synapse/issues/9681))
|
||||||
|
- Only save remote cross-signing and device keys if they're different from the current ones. ([\#9634](https://github.com/matrix-org/synapse/issues/9634))
|
||||||
|
- Rename storage function to fix spelling and not conflict with another function's name. ([\#9637](https://github.com/matrix-org/synapse/issues/9637))
|
||||||
|
- Improve performance of federation catch up by sending the latest events in the room to the remote, rather than just the last event sent by the local server. ([\#9640](https://github.com/matrix-org/synapse/issues/9640), [\#9664](https://github.com/matrix-org/synapse/issues/9664))
|
||||||
|
- In the `federation_client` commandline client, stop automatically adding the URL prefix, so that servlets on other prefixes can be tested. ([\#9645](https://github.com/matrix-org/synapse/issues/9645))
|
||||||
|
- In the `federation_client` commandline client, handle inline `signing_key`s in `homeserver.yaml`. ([\#9647](https://github.com/matrix-org/synapse/issues/9647))
|
||||||
|
- Fixed some antipattern issues to improve code quality. ([\#9649](https://github.com/matrix-org/synapse/issues/9649))
|
||||||
|
- Add a storage method for pulling all current user presence state from the database. ([\#9650](https://github.com/matrix-org/synapse/issues/9650))
|
||||||
|
- Import `HomeServer` from the proper module. ([\#9665](https://github.com/matrix-org/synapse/issues/9665))
|
||||||
|
- Increase default join ratelimiting burst rate. ([\#9674](https://github.com/matrix-org/synapse/issues/9674))
|
||||||
|
- Add type hints to third party event rules and visibility modules. ([\#9676](https://github.com/matrix-org/synapse/issues/9676))
|
||||||
|
- Bump mypy-zope to 0.2.13 to fix "Cannot determine consistent method resolution order (MRO)" errors when running mypy a second time. ([\#9678](https://github.com/matrix-org/synapse/issues/9678))
|
||||||
|
- Use interpreter from `$PATH` via `/usr/bin/env` instead of absolute paths in various scripts. ([\#9689](https://github.com/matrix-org/synapse/issues/9689))
|
||||||
|
- Make it possible to use `dmypy`. ([\#9692](https://github.com/matrix-org/synapse/issues/9692))
|
||||||
|
- Suppress "CryptographyDeprecationWarning: int_from_bytes is deprecated". ([\#9698](https://github.com/matrix-org/synapse/issues/9698))
|
||||||
|
- Use `dmypy run` in lint script for improved performance in type-checking while developing. ([\#9701](https://github.com/matrix-org/synapse/issues/9701))
|
||||||
|
- Fix undetected mypy error when using Python 3.6. ([\#9703](https://github.com/matrix-org/synapse/issues/9703))
|
||||||
|
- Fix type-checking CI on develop. ([\#9709](https://github.com/matrix-org/synapse/issues/9709))
|
||||||
|
|
||||||
|
|
||||||
|
Synapse 1.30.1 (2021-03-26)
|
||||||
|
===========================
|
||||||
|
|
||||||
|
This release is identical to Synapse 1.30.0, with the exception of explicitly
|
||||||
|
setting a minimum version of Python's Cryptography library to ensure that users
|
||||||
|
of Synapse are protected from the recent [OpenSSL security advisories](https://mta.openssl.org/pipermail/openssl-announce/2021-March/000198.html),
|
||||||
|
especially CVE-2021-3449.
|
||||||
|
|
||||||
|
Note that Cryptography defaults to bundling its own statically linked copy of
|
||||||
|
OpenSSL, which means that you may not be protected by your operating system's
|
||||||
|
security updates.
|
||||||
|
|
||||||
|
It's also worth noting that Cryptography no longer supports Python 3.5, so
|
||||||
|
admins deploying to older environments may not be protected against this or
|
||||||
|
future vulnerabilities. Synapse will be dropping support for Python 3.5 at the
|
||||||
|
end of March.
|
||||||
|
|
||||||
|
|
||||||
|
Updates to the Docker image
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
- Ensure that the docker container has up to date versions of openssl. ([\#9697](https://github.com/matrix-org/synapse/issues/9697))
|
||||||
|
|
||||||
|
|
||||||
|
Internal Changes
|
||||||
|
----------------
|
||||||
|
|
||||||
|
- Enforce that `cryptography` dependency is up to date to ensure it has the most recent openssl patches. ([\#9697](https://github.com/matrix-org/synapse/issues/9697))
|
||||||
|
|
||||||
|
|
||||||
|
Synapse 1.30.0 (2021-03-22)
|
||||||
|
===========================
|
||||||
|
|
||||||
|
Note that this release deprecates the ability for appservices to
|
||||||
|
call `POST /_matrix/client/r0/register` without the body parameter `type`. Appservice
|
||||||
|
developers should use a `type` value of `m.login.application_service` as
|
||||||
|
per [the spec](https://matrix.org/docs/spec/application_service/r0.1.2#server-admin-style-permissions).
|
||||||
|
In future releases, calling this endpoint with an access token - but without a `m.login.application_service`
|
||||||
|
type - will fail.
|
||||||
|
|
||||||
|
|
||||||
|
No significant changes.
|
||||||
|
|
||||||
|
|
||||||
|
Synapse 1.30.0rc1 (2021-03-16)
|
||||||
|
==============================
|
||||||
|
|
||||||
|
Features
|
||||||
|
--------
|
||||||
|
|
||||||
|
- Add prometheus metrics for number of users successfully registering and logging in. ([\#9510](https://github.com/matrix-org/synapse/issues/9510), [\#9511](https://github.com/matrix-org/synapse/issues/9511), [\#9573](https://github.com/matrix-org/synapse/issues/9573))
|
||||||
|
- Add `synapse_federation_last_sent_pdu_time` and `synapse_federation_last_received_pdu_time` prometheus metrics, which monitor federation delays by reporting the timestamps of messages sent and received to a set of remote servers. ([\#9540](https://github.com/matrix-org/synapse/issues/9540))
|
||||||
|
- Add support for generating JSON Web Tokens dynamically for use as OIDC client secrets. ([\#9549](https://github.com/matrix-org/synapse/issues/9549))
|
||||||
|
- Optimise handling of incomplete room history for incoming federation. ([\#9601](https://github.com/matrix-org/synapse/issues/9601))
|
||||||
|
- Finalise support for allowing clients to pick an SSO Identity Provider ([MSC2858](https://github.com/matrix-org/matrix-doc/pull/2858)). ([\#9617](https://github.com/matrix-org/synapse/issues/9617))
|
||||||
|
- Tell spam checker modules about the SSO IdP a user registered through if one was used. ([\#9626](https://github.com/matrix-org/synapse/issues/9626))
|
||||||
|
|
||||||
|
|
||||||
|
Bugfixes
|
||||||
|
--------
|
||||||
|
|
||||||
|
- Fix long-standing bug when generating thumbnails for some images with transparency: `TypeError: cannot unpack non-iterable int object`. ([\#9473](https://github.com/matrix-org/synapse/issues/9473))
|
||||||
|
- Purge chain cover indexes for events that were purged prior to Synapse v1.29.0. ([\#9542](https://github.com/matrix-org/synapse/issues/9542), [\#9583](https://github.com/matrix-org/synapse/issues/9583))
|
||||||
|
- Fix bug where federation requests were not correctly retried on 5xx responses. ([\#9567](https://github.com/matrix-org/synapse/issues/9567))
|
||||||
|
- Fix re-activating an account via the admin API when local passwords are disabled. ([\#9587](https://github.com/matrix-org/synapse/issues/9587))
|
||||||
|
- Fix a bug introduced in Synapse 1.20 which caused incoming federation transactions to stack up, causing slow recovery from outages. ([\#9597](https://github.com/matrix-org/synapse/issues/9597))
|
||||||
|
- Fix a bug introduced in v1.28.0 where the OpenID Connect callback endpoint could error with a `MacaroonInitException`. ([\#9620](https://github.com/matrix-org/synapse/issues/9620))
|
||||||
|
- Fix Internal Server Error on `GET /_synapse/client/saml2/authn_response` request. ([\#9623](https://github.com/matrix-org/synapse/issues/9623))
|
||||||
|
|
||||||
|
|
||||||
|
Updates to the Docker image
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
- Make use of an improved malloc implementation (`jemalloc`) in the docker image. ([\#8553](https://github.com/matrix-org/synapse/issues/8553))
|
||||||
|
|
||||||
|
|
||||||
|
Improved Documentation
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
- Add relayd entry to reverse proxy example configurations. ([\#9508](https://github.com/matrix-org/synapse/issues/9508))
|
||||||
|
- Improve the SAML2 upgrade notes for 1.27.0. ([\#9550](https://github.com/matrix-org/synapse/issues/9550))
|
||||||
|
- Link to the "List user's media" admin API from the media admin API docs. ([\#9571](https://github.com/matrix-org/synapse/issues/9571))
|
||||||
|
- Clarify the spam checker modules documentation example to mention that `parse_config` is a required method. ([\#9580](https://github.com/matrix-org/synapse/issues/9580))
|
||||||
|
- Clarify the sample configuration for `stats` settings. ([\#9604](https://github.com/matrix-org/synapse/issues/9604))
|
||||||
|
|
||||||
|
|
||||||
|
Deprecations and Removals
|
||||||
|
-------------------------
|
||||||
|
|
||||||
|
- The `synapse_federation_last_sent_pdu_age` and `synapse_federation_last_received_pdu_age` prometheus metrics have been removed. They are replaced by `synapse_federation_last_sent_pdu_time` and `synapse_federation_last_received_pdu_time`. ([\#9540](https://github.com/matrix-org/synapse/issues/9540))
|
||||||
|
- Registering an Application Service user without using the `m.login.application_service` login type will be unsupported in an upcoming Synapse release. ([\#9559](https://github.com/matrix-org/synapse/issues/9559))
|
||||||
|
|
||||||
|
|
||||||
|
Internal Changes
|
||||||
|
----------------
|
||||||
|
|
||||||
|
- Add tests to ResponseCache. ([\#9458](https://github.com/matrix-org/synapse/issues/9458))
|
||||||
|
- Add type hints to purge room and server notice admin API. ([\#9520](https://github.com/matrix-org/synapse/issues/9520))
|
||||||
|
- Add extra logging to ObservableDeferred when callbacks throw exceptions. ([\#9523](https://github.com/matrix-org/synapse/issues/9523))
|
||||||
|
- Fix incorrect type hints. ([\#9528](https://github.com/matrix-org/synapse/issues/9528), [\#9543](https://github.com/matrix-org/synapse/issues/9543), [\#9591](https://github.com/matrix-org/synapse/issues/9591), [\#9608](https://github.com/matrix-org/synapse/issues/9608), [\#9618](https://github.com/matrix-org/synapse/issues/9618))
|
||||||
|
- Add an additional test for purging a room. ([\#9541](https://github.com/matrix-org/synapse/issues/9541))
|
||||||
|
- Add a `.git-blame-ignore-revs` file with the hashes of auto-formatting. ([\#9560](https://github.com/matrix-org/synapse/issues/9560))
|
||||||
|
- Increase the threshold before which outbound federation to a server goes into "catch up" mode, which is expensive for the remote server to handle. ([\#9561](https://github.com/matrix-org/synapse/issues/9561))
|
||||||
|
- Fix spurious errors reported by the `config-lint.sh` script. ([\#9562](https://github.com/matrix-org/synapse/issues/9562))
|
||||||
|
- Fix type hints and tests for BlacklistingAgentWrapper and BlacklistingReactorWrapper. ([\#9563](https://github.com/matrix-org/synapse/issues/9563))
|
||||||
|
- Do not have mypy ignore type hints from unpaddedbase64. ([\#9568](https://github.com/matrix-org/synapse/issues/9568))
|
||||||
|
- Improve efficiency of calculating the auth chain in large rooms. ([\#9576](https://github.com/matrix-org/synapse/issues/9576))
|
||||||
|
- Convert `synapse.types.Requester` to an `attrs` class. ([\#9586](https://github.com/matrix-org/synapse/issues/9586))
|
||||||
|
- Add logging for redis connection setup. ([\#9590](https://github.com/matrix-org/synapse/issues/9590))
|
||||||
|
- Improve logging when processing incoming transactions. ([\#9596](https://github.com/matrix-org/synapse/issues/9596))
|
||||||
|
- Remove unused `stats.retention` setting, and emit a warning if stats are disabled. ([\#9604](https://github.com/matrix-org/synapse/issues/9604))
|
||||||
|
- Prevent attempting to bundle aggregations for state events in /context APIs. ([\#9619](https://github.com/matrix-org/synapse/issues/9619))
|
||||||
|
|
||||||
|
|
||||||
|
Synapse 1.29.0 (2021-03-08)
|
||||||
|
===========================
|
||||||
|
|
||||||
|
Note that synapse now expects an `X-Forwarded-Proto` header when used with a reverse proxy. Please see [UPGRADE.rst](UPGRADE.rst#upgrading-to-v1290) for more details on this change.
|
||||||
|
|
||||||
|
|
||||||
|
No significant changes.
|
||||||
|
|
||||||
|
|
||||||
|
Synapse 1.29.0rc1 (2021-03-04)
|
||||||
|
==============================
|
||||||
|
|
||||||
|
Features
|
||||||
|
--------
|
||||||
|
|
||||||
|
- Add rate limiters to cross-user key sharing requests. ([\#8957](https://github.com/matrix-org/synapse/issues/8957))
|
||||||
|
- Add `order_by` to the admin API `GET /_synapse/admin/v1/users/<user_id>/media`. Contributed by @dklimpel. ([\#8978](https://github.com/matrix-org/synapse/issues/8978))
|
||||||
|
- Add some configuration settings to make users' profile data more private. ([\#9203](https://github.com/matrix-org/synapse/issues/9203))
|
||||||
|
- The `no_proxy` and `NO_PROXY` environment variables are now respected in proxied HTTP clients with the lowercase form taking precedence if both are present. Additionally, the lowercase `https_proxy` environment variable is now respected in proxied HTTP clients on top of existing support for the uppercase `HTTPS_PROXY` form and takes precedence if both are present. Contributed by Timothy Leung. ([\#9372](https://github.com/matrix-org/synapse/issues/9372))
|
||||||
|
- Add a configuration option, `user_directory.prefer_local_users`, which when enabled will make it more likely for users on the same server as you to appear above other users. ([\#9383](https://github.com/matrix-org/synapse/issues/9383), [\#9385](https://github.com/matrix-org/synapse/issues/9385))
|
||||||
|
- Add support for regenerating thumbnails if they have been deleted but the original image is still stored. ([\#9438](https://github.com/matrix-org/synapse/issues/9438))
|
||||||
|
- Add support for `X-Forwarded-Proto` header when using a reverse proxy. ([\#9472](https://github.com/matrix-org/synapse/issues/9472), [\#9501](https://github.com/matrix-org/synapse/issues/9501), [\#9512](https://github.com/matrix-org/synapse/issues/9512), [\#9539](https://github.com/matrix-org/synapse/issues/9539))
|
||||||
|
|
||||||
|
|
||||||
|
Bugfixes
|
||||||
|
--------
|
||||||
|
|
||||||
|
- Fix a bug where users' pushers were not all deleted when they deactivated their account. ([\#9285](https://github.com/matrix-org/synapse/issues/9285), [\#9516](https://github.com/matrix-org/synapse/issues/9516))
|
||||||
|
- Fix a bug where a lot of unnecessary presence updates were sent when joining a room. ([\#9402](https://github.com/matrix-org/synapse/issues/9402))
|
||||||
|
- Fix a bug that caused multiple calls to the experimental `shared_rooms` endpoint to return stale results. ([\#9416](https://github.com/matrix-org/synapse/issues/9416))
|
||||||
|
- Fix a bug in single sign-on which could cause a "No session cookie found" error. ([\#9436](https://github.com/matrix-org/synapse/issues/9436))
|
||||||
|
- Fix bug introduced in v1.27.0 where allowing a user to choose their own username when logging in via single sign-on did not work unless an `idp_icon` was defined. ([\#9440](https://github.com/matrix-org/synapse/issues/9440))
|
||||||
|
- Fix a bug introduced in v1.26.0 where some sequences were not properly configured when running `synapse_port_db`. ([\#9449](https://github.com/matrix-org/synapse/issues/9449))
|
||||||
|
- Fix deleting pushers when using sharded pushers. ([\#9465](https://github.com/matrix-org/synapse/issues/9465), [\#9466](https://github.com/matrix-org/synapse/issues/9466), [\#9479](https://github.com/matrix-org/synapse/issues/9479), [\#9536](https://github.com/matrix-org/synapse/issues/9536))
|
||||||
|
- Fix missing startup checks for the consistency of certain PostgreSQL sequences. ([\#9470](https://github.com/matrix-org/synapse/issues/9470))
|
||||||
|
- Fix a long-standing bug where the media repository could leak file descriptors while previewing media. ([\#9497](https://github.com/matrix-org/synapse/issues/9497))
|
||||||
|
- Properly purge the event chain cover index when purging history. ([\#9498](https://github.com/matrix-org/synapse/issues/9498))
|
||||||
|
- Fix missing chain cover index due to a schema delta not being applied correctly. Only affected servers that ran development versions. ([\#9503](https://github.com/matrix-org/synapse/issues/9503))
|
||||||
|
- Fix a bug introduced in v1.25.0 where `/_synapse/admin/join/` would fail when given a room alias. ([\#9506](https://github.com/matrix-org/synapse/issues/9506))
|
||||||
|
- Prevent presence background jobs from running when presence is disabled. ([\#9530](https://github.com/matrix-org/synapse/issues/9530))
|
||||||
|
- Fix rare edge case that caused a background update to fail if the server had rejected an event that had duplicate auth events. ([\#9537](https://github.com/matrix-org/synapse/issues/9537))
|
||||||
|
|
||||||
|
|
||||||
|
Improved Documentation
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
- Update the example systemd config to propagate reloads to individual units. ([\#9463](https://github.com/matrix-org/synapse/issues/9463))
|
||||||
|
|
||||||
|
|
||||||
|
Internal Changes
|
||||||
|
----------------
|
||||||
|
|
||||||
|
- Add documentation and type hints to `parse_duration`. ([\#9432](https://github.com/matrix-org/synapse/issues/9432))
|
||||||
|
- Remove vestiges of `uploads_path` configuration setting. ([\#9462](https://github.com/matrix-org/synapse/issues/9462))
|
||||||
|
- Add a comment about systemd-python. ([\#9464](https://github.com/matrix-org/synapse/issues/9464))
|
||||||
|
- Test that we require validated email for email pushers. ([\#9496](https://github.com/matrix-org/synapse/issues/9496))
|
||||||
|
- Allow python to generate bytecode for synapse. ([\#9502](https://github.com/matrix-org/synapse/issues/9502))
|
||||||
|
- Fix incorrect type hints. ([\#9515](https://github.com/matrix-org/synapse/issues/9515), [\#9518](https://github.com/matrix-org/synapse/issues/9518))
|
||||||
|
- Add type hints to device and event report admin API. ([\#9519](https://github.com/matrix-org/synapse/issues/9519))
|
||||||
|
- Add type hints to user admin API. ([\#9521](https://github.com/matrix-org/synapse/issues/9521))
|
||||||
|
- Bump the versions of mypy and mypy-zope used for static type checking. ([\#9529](https://github.com/matrix-org/synapse/issues/9529))
|
||||||
|
|
||||||
|
|
||||||
|
Synapse 1.28.0 (2021-02-25)
|
||||||
|
===========================
|
||||||
|
|
||||||
|
Note that this release drops support for ARMv7 in the official Docker images, due to repeated problems building for ARMv7 (and the associated maintenance burden this entails).
|
||||||
|
|
||||||
|
This release also fixes the documentation included in v1.27.0 around the callback URI for SAML2 identity providers. If your server is configured to use single sign-on via a SAML2 IdP, you may need to make configuration changes. Please review [UPGRADE.rst](UPGRADE.rst) for more details on these changes.
|
||||||
|
|
||||||
|
|
||||||
|
Internal Changes
|
||||||
|
----------------
|
||||||
|
|
||||||
|
- Revert change in v1.28.0rc1 to remove the deprecated SAML endpoint. ([\#9474](https://github.com/matrix-org/synapse/issues/9474))
|
||||||
|
|
||||||
|
|
||||||
|
Synapse 1.28.0rc1 (2021-02-19)
|
||||||
|
==============================
|
||||||
|
|
||||||
|
Removal warning
|
||||||
|
---------------
|
||||||
|
|
||||||
|
The v1 list accounts API is deprecated and will be removed in a future release.
|
||||||
|
This API was undocumented and misleading. It can be replaced by the
|
||||||
|
[v2 list accounts API](https://github.com/matrix-org/synapse/blob/release-v1.28.0/docs/admin_api/user_admin_api.rst#list-accounts),
|
||||||
|
which has been available since Synapse 1.7.0 (2019-12-13).
|
||||||
|
|
||||||
|
Please check if you're using any scripts which use the admin API and replace
|
||||||
|
`GET /_synapse/admin/v1/users/<user_id>` with `GET /_synapse/admin/v2/users`.
|
||||||
|
|
||||||
|
|
||||||
|
Features
|
||||||
|
--------
|
||||||
|
|
||||||
|
- New admin API to get the context of an event: `/_synapse/admin/rooms/{roomId}/context/{eventId}`. ([\#9150](https://github.com/matrix-org/synapse/issues/9150))
|
||||||
|
- Further improvements to the user experience of registration via single sign-on. ([\#9300](https://github.com/matrix-org/synapse/issues/9300), [\#9301](https://github.com/matrix-org/synapse/issues/9301))
|
||||||
|
- Add hook to spam checker modules that allow checking file uploads and remote downloads. ([\#9311](https://github.com/matrix-org/synapse/issues/9311))
|
||||||
|
- Add support for receiving OpenID Connect authentication responses via form `POST`s rather than `GET`s. ([\#9376](https://github.com/matrix-org/synapse/issues/9376))
|
||||||
|
- Add the shadow-banning status to the admin API for user info. ([\#9400](https://github.com/matrix-org/synapse/issues/9400))
|
||||||
|
|
||||||
|
|
||||||
|
Bugfixes
|
||||||
|
--------
|
||||||
|
|
||||||
|
- Fix long-standing bug where sending email notifications would fail for rooms that the server had since left. ([\#9257](https://github.com/matrix-org/synapse/issues/9257))
|
||||||
|
- Fix bug introduced in Synapse 1.27.0rc1 which meant the "session expired" error page during SSO registration was badly formatted. ([\#9296](https://github.com/matrix-org/synapse/issues/9296))
|
||||||
|
- Assert a maximum length for some parameters for spec compliance. ([\#9321](https://github.com/matrix-org/synapse/issues/9321), [\#9393](https://github.com/matrix-org/synapse/issues/9393))
|
||||||
|
- Fix additional errors when previewing URLs: "AttributeError 'NoneType' object has no attribute 'xpath'" and "ValueError: Unicode strings with encoding declaration are not supported. Please use bytes input or XML fragments without declaration.". ([\#9333](https://github.com/matrix-org/synapse/issues/9333))
|
||||||
|
- Fix a bug causing Synapse to impose the wrong type constraints on fields when processing responses from appservices to `/_matrix/app/v1/thirdparty/user/{protocol}`. ([\#9361](https://github.com/matrix-org/synapse/issues/9361))
|
||||||
|
- Fix bug where Synapse would occasionally stop reconnecting to Redis after the connection was lost. ([\#9391](https://github.com/matrix-org/synapse/issues/9391))
|
||||||
|
- Fix a long-standing bug when upgrading a room: "TypeError: '>' not supported between instances of 'NoneType' and 'int'". ([\#9395](https://github.com/matrix-org/synapse/issues/9395))
|
||||||
|
- Reduce the amount of memory used when generating the URL preview of a file that is larger than the `max_spider_size`. ([\#9421](https://github.com/matrix-org/synapse/issues/9421))
|
||||||
|
- Fix a long-standing bug in the deduplication of old presence, resulting in no deduplication. ([\#9425](https://github.com/matrix-org/synapse/issues/9425))
|
||||||
|
- The `ui_auth.session_timeout` config option can now be specified in terms of number of seconds/minutes/etc/. Contributed by Rishabh Arya. ([\#9426](https://github.com/matrix-org/synapse/issues/9426))
|
||||||
|
- Fix a bug introduced in v1.27.0: "TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType." related to the user directory. ([\#9428](https://github.com/matrix-org/synapse/issues/9428))
|
||||||
|
|
||||||
|
|
||||||
|
Updates to the Docker image
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
- Drop support for ARMv7 in Docker images. ([\#9433](https://github.com/matrix-org/synapse/issues/9433))
|
||||||
|
|
||||||
|
|
||||||
|
Improved Documentation
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
- Reorganize CHANGELOG.md. ([\#9281](https://github.com/matrix-org/synapse/issues/9281))
|
||||||
|
- Add note to `auto_join_rooms` config option explaining existing rooms must be publicly joinable. ([\#9291](https://github.com/matrix-org/synapse/issues/9291))
|
||||||
|
- Correct name of Synapse's service file in TURN howto. ([\#9308](https://github.com/matrix-org/synapse/issues/9308))
|
||||||
|
- Fix the braces in the `oidc_providers` section of the sample config. ([\#9317](https://github.com/matrix-org/synapse/issues/9317))
|
||||||
|
- Update installation instructions on Fedora. ([\#9322](https://github.com/matrix-org/synapse/issues/9322))
|
||||||
|
- Add HTTP/2 support to the nginx example configuration. Contributed by David Vo. ([\#9390](https://github.com/matrix-org/synapse/issues/9390))
|
||||||
|
- Update docs for using Gitea as OpenID provider. ([\#9404](https://github.com/matrix-org/synapse/issues/9404))
|
||||||
|
- Document that pusher instances are shardable. ([\#9407](https://github.com/matrix-org/synapse/issues/9407))
|
||||||
|
- Fix erroneous documentation from v1.27.0 about updating the SAML2 callback URL. ([\#9434](https://github.com/matrix-org/synapse/issues/9434))
|
||||||
|
|
||||||
|
|
||||||
|
Deprecations and Removals
|
||||||
|
-------------------------
|
||||||
|
|
||||||
|
- Deprecate old admin API `GET /_synapse/admin/v1/users/<user_id>`. ([\#9429](https://github.com/matrix-org/synapse/issues/9429))
|
||||||
|
|
||||||
|
|
||||||
|
Internal Changes
|
||||||
|
----------------
|
||||||
|
|
||||||
|
- Fix 'object name reserved for internal use' errors with recent versions of SQLite. ([\#9003](https://github.com/matrix-org/synapse/issues/9003))
|
||||||
|
- Add experimental support for running Synapse with PyPy. ([\#9123](https://github.com/matrix-org/synapse/issues/9123))
|
||||||
|
- Deny access to additional IP addresses by default. ([\#9240](https://github.com/matrix-org/synapse/issues/9240))
|
||||||
|
- Update the `Cursor` type hints to better match PEP 249. ([\#9299](https://github.com/matrix-org/synapse/issues/9299))
|
||||||
|
- Add debug logging for SRV lookups. Contributed by @Bubu. ([\#9305](https://github.com/matrix-org/synapse/issues/9305))
|
||||||
|
- Improve logging for OIDC login flow. ([\#9307](https://github.com/matrix-org/synapse/issues/9307))
|
||||||
|
- Share the code for handling required attributes between the CAS and SAML handlers. ([\#9326](https://github.com/matrix-org/synapse/issues/9326))
|
||||||
|
- Clean up the code to load the metadata for OpenID Connect identity providers. ([\#9362](https://github.com/matrix-org/synapse/issues/9362))
|
||||||
|
- Convert tests to use `HomeserverTestCase`. ([\#9377](https://github.com/matrix-org/synapse/issues/9377), [\#9396](https://github.com/matrix-org/synapse/issues/9396))
|
||||||
|
- Update the version of black used to 20.8b1. ([\#9381](https://github.com/matrix-org/synapse/issues/9381))
|
||||||
|
- Allow OIDC config to override discovered values. ([\#9384](https://github.com/matrix-org/synapse/issues/9384))
|
||||||
|
- Remove some dead code from the acceptance of room invites path. ([\#9394](https://github.com/matrix-org/synapse/issues/9394))
|
||||||
|
- Clean up an unused method in the presence handler code. ([\#9408](https://github.com/matrix-org/synapse/issues/9408))
|
||||||
|
|
||||||
|
|
||||||
Synapse 1.27.0 (2021-02-16)
|
Synapse 1.27.0 (2021-02-16)
|
||||||
===========================
|
===========================
|
||||||
|
|
||||||
Note that this release includes a change in Synapse to use Redis as a cache ─ as well as a pub/sub mechanism ─ if Redis support is enabled for workers. No action is needed by server administrators, and we do not expect resource usage of the Redis instance to change dramatically.
|
Note that this release includes a change in Synapse to use Redis as a cache ─ as well as a pub/sub mechanism ─ if Redis support is enabled for workers. No action is needed by server administrators, and we do not expect resource usage of the Redis instance to change dramatically.
|
||||||
|
|
||||||
This release also changes the callback URI for OpenID Connect (OIDC) identity providers. If your server is configured to use single sign-on via an OIDC/OAuth2 IdP, you may need to make configuration changes. Please review [UPGRADE.rst](UPGRADE.rst) for more details on these changes.
|
This release also changes the callback URI for OpenID Connect (OIDC) and SAML2 identity providers. If your server is configured to use single sign-on via an OIDC/OAuth2 or SAML2 IdP, you may need to make configuration changes. Please review [UPGRADE.rst](UPGRADE.rst) for more details on these changes.
|
||||||
|
|
||||||
This release also changes escaping of variables in the HTML templates for SSO or email notifications. If you have customised these templates, please review [UPGRADE.rst](UPGRADE.rst) for more details on these changes.
|
This release also changes escaping of variables in the HTML templates for SSO or email notifications. If you have customised these templates, please review [UPGRADE.rst](UPGRADE.rst) for more details on these changes.
|
||||||
|
|
||||||
|
|||||||
271
CONTRIBUTING.md
271
CONTRIBUTING.md
@@ -1,4 +1,31 @@
|
|||||||
# Contributing code to Synapse
|
Welcome to Synapse
|
||||||
|
|
||||||
|
This document aims to get you started with contributing to this repo!
|
||||||
|
|
||||||
|
- [1. Who can contribute to Synapse?](#1-who-can-contribute-to-synapse)
|
||||||
|
- [2. What do I need?](#2-what-do-i-need)
|
||||||
|
- [3. Get the source.](#3-get-the-source)
|
||||||
|
- [4. Install the dependencies](#4-install-the-dependencies)
|
||||||
|
* [Under Unix (macOS, Linux, BSD, ...)](#under-unix-macos-linux-bsd-)
|
||||||
|
* [Under Windows](#under-windows)
|
||||||
|
- [5. Get in touch.](#5-get-in-touch)
|
||||||
|
- [6. Pick an issue.](#6-pick-an-issue)
|
||||||
|
- [7. Turn coffee and documentation into code and documentation!](#7-turn-coffee-and-documentation-into-code-and-documentation)
|
||||||
|
- [8. Test, test, test!](#8-test-test-test)
|
||||||
|
* [Run the linters.](#run-the-linters)
|
||||||
|
* [Run the unit tests.](#run-the-unit-tests)
|
||||||
|
* [Run the integration tests.](#run-the-integration-tests)
|
||||||
|
- [9. Submit your patch.](#9-submit-your-patch)
|
||||||
|
* [Changelog](#changelog)
|
||||||
|
+ [How do I know what to call the changelog file before I create the PR?](#how-do-i-know-what-to-call-the-changelog-file-before-i-create-the-pr)
|
||||||
|
+ [Debian changelog](#debian-changelog)
|
||||||
|
* [Sign off](#sign-off)
|
||||||
|
- [10. Turn feedback into better code.](#10-turn-feedback-into-better-code)
|
||||||
|
- [11. Find a new issue.](#11-find-a-new-issue)
|
||||||
|
- [Notes for maintainers on merging PRs etc](#notes-for-maintainers-on-merging-prs-etc)
|
||||||
|
- [Conclusion](#conclusion)
|
||||||
|
|
||||||
|
# 1. Who can contribute to Synapse?
|
||||||
|
|
||||||
Everyone is welcome to contribute code to [matrix.org
|
Everyone is welcome to contribute code to [matrix.org
|
||||||
projects](https://github.com/matrix-org), provided that they are willing to
|
projects](https://github.com/matrix-org), provided that they are willing to
|
||||||
@@ -9,70 +36,179 @@ license the code under the same terms as the project's overall 'outbound'
|
|||||||
license - in our case, this is almost always Apache Software License v2 (see
|
license - in our case, this is almost always Apache Software License v2 (see
|
||||||
[LICENSE](LICENSE)).
|
[LICENSE](LICENSE)).
|
||||||
|
|
||||||
## How to contribute
|
# 2. What do I need?
|
||||||
|
|
||||||
|
The code of Synapse is written in Python 3. To do pretty much anything, you'll need [a recent version of Python 3](https://wiki.python.org/moin/BeginnersGuide/Download).
|
||||||
|
|
||||||
|
The source code of Synapse is hosted on GitHub. You will also need [a recent version of git](https://github.com/git-guides/install-git).
|
||||||
|
|
||||||
|
For some tests, you will need [a recent version of Docker](https://docs.docker.com/get-docker/).
|
||||||
|
|
||||||
|
|
||||||
|
# 3. Get the source.
|
||||||
|
|
||||||
The preferred and easiest way to contribute changes is to fork the relevant
|
The preferred and easiest way to contribute changes is to fork the relevant
|
||||||
project on github, and then [create a pull request](
|
project on GitHub, and then [create a pull request](
|
||||||
https://help.github.com/articles/using-pull-requests/) to ask us to pull your
|
https://help.github.com/articles/using-pull-requests/) to ask us to pull your
|
||||||
changes into our repo.
|
changes into our repo.
|
||||||
|
|
||||||
Some other points to follow:
|
Please base your changes on the `develop` branch.
|
||||||
|
|
||||||
* Please base your changes on the `develop` branch.
|
```sh
|
||||||
|
git clone git@github.com:YOUR_GITHUB_USER_NAME/synapse.git
|
||||||
|
git checkout develop
|
||||||
|
```
|
||||||
|
|
||||||
* Please follow the [code style requirements](#code-style).
|
If you need help getting started with git, this is beyond the scope of the document, but you
|
||||||
|
can find many good git tutorials on the web.
|
||||||
|
|
||||||
* Please include a [changelog entry](#changelog) with each PR.
|
# 4. Install the dependencies
|
||||||
|
|
||||||
* Please [sign off](#sign-off) your contribution.
|
## Under Unix (macOS, Linux, BSD, ...)
|
||||||
|
|
||||||
* Please keep an eye on the pull request for feedback from the [continuous
|
Once you have installed Python 3 and added the source, please open a terminal and
|
||||||
integration system](#continuous-integration-and-testing) and try to fix any
|
setup a *virtualenv*, as follows:
|
||||||
errors that come up.
|
|
||||||
|
|
||||||
* If you need to [update your PR](#updating-your-pull-request), just add new
|
```sh
|
||||||
commits to your branch rather than rebasing.
|
cd path/where/you/have/cloned/the/repository
|
||||||
|
python3 -m venv ./env
|
||||||
|
source ./env/bin/activate
|
||||||
|
pip install -e ".[all,lint,mypy,test]"
|
||||||
|
pip install tox
|
||||||
|
```
|
||||||
|
|
||||||
## Code style
|
This will install the developer dependencies for the project.
|
||||||
|
|
||||||
|
## Under Windows
|
||||||
|
|
||||||
|
TBD
|
||||||
|
|
||||||
|
|
||||||
|
# 5. Get in touch.
|
||||||
|
|
||||||
|
Join our developer community on Matrix: #synapse-dev:matrix.org !
|
||||||
|
|
||||||
|
|
||||||
|
# 6. Pick an issue.
|
||||||
|
|
||||||
|
Fix your favorite problem or perhaps find a [Good First Issue](https://github.com/matrix-org/synapse/issues?q=is%3Aopen+is%3Aissue+label%3A%22Good+First+Issue%22)
|
||||||
|
to work on.
|
||||||
|
|
||||||
|
|
||||||
|
# 7. Turn coffee and documentation into code and documentation!
|
||||||
|
|
||||||
Synapse's code style is documented [here](docs/code_style.md). Please follow
|
Synapse's code style is documented [here](docs/code_style.md). Please follow
|
||||||
it, including the conventions for the [sample configuration
|
it, including the conventions for the [sample configuration
|
||||||
file](docs/code_style.md#configuration-file-format).
|
file](docs/code_style.md#configuration-file-format).
|
||||||
|
|
||||||
Many of the conventions are enforced by scripts which are run as part of the
|
There is a growing amount of documentation located in the [docs](docs)
|
||||||
[continuous integration system](#continuous-integration-and-testing). To help
|
directory. This documentation is intended primarily for sysadmins running their
|
||||||
check if you have followed the code style, you can run `scripts-dev/lint.sh`
|
own Synapse instance, as well as developers interacting externally with
|
||||||
locally. You'll need python 3.6 or later, and to install a number of tools:
|
Synapse. [docs/dev](docs/dev) exists primarily to house documentation for
|
||||||
|
Synapse developers. [docs/admin_api](docs/admin_api) houses documentation
|
||||||
|
regarding Synapse's Admin API, which is used mostly by sysadmins and external
|
||||||
|
service developers.
|
||||||
|
|
||||||
```
|
If you add new files added to either of these folders, please use [GitHub-Flavoured
|
||||||
# Install the dependencies
|
Markdown](https://guides.github.com/features/mastering-markdown/).
|
||||||
pip install -e ".[lint,mypy]"
|
|
||||||
|
|
||||||
# Run the linter script
|
Some documentation also exists in [Synapse's GitHub
|
||||||
|
Wiki](https://github.com/matrix-org/synapse/wiki), although this is primarily
|
||||||
|
contributed to by community authors.
|
||||||
|
|
||||||
|
|
||||||
|
# 8. Test, test, test!
|
||||||
|
<a name="test-test-test"></a>
|
||||||
|
|
||||||
|
While you're developing and before submitting a patch, you'll
|
||||||
|
want to test your code.
|
||||||
|
|
||||||
|
## Run the linters.
|
||||||
|
|
||||||
|
The linters look at your code and do two things:
|
||||||
|
|
||||||
|
- ensure that your code follows the coding style adopted by the project;
|
||||||
|
- catch a number of errors in your code.
|
||||||
|
|
||||||
|
They're pretty fast, don't hesitate!
|
||||||
|
|
||||||
|
```sh
|
||||||
|
source ./env/bin/activate
|
||||||
./scripts-dev/lint.sh
|
./scripts-dev/lint.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
**Note that the script does not just test/check, but also reformats code, so you
|
Note that this script *will modify your files* to fix styling errors.
|
||||||
may wish to ensure any new code is committed first**.
|
Make sure that you have saved all your files.
|
||||||
|
|
||||||
By default, this script checks all files and can take some time; if you alter
|
If you wish to restrict the linters to only the files changed since the last commit
|
||||||
only certain files, you might wish to specify paths as arguments to reduce the
|
(much faster!), you can instead run:
|
||||||
run-time:
|
|
||||||
|
|
||||||
|
```sh
|
||||||
|
source ./env/bin/activate
|
||||||
|
./scripts-dev/lint.sh -d
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Or if you know exactly which files you wish to lint, you can instead run:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
source ./env/bin/activate
|
||||||
./scripts-dev/lint.sh path/to/file1.py path/to/file2.py path/to/folder
|
./scripts-dev/lint.sh path/to/file1.py path/to/file2.py path/to/folder
|
||||||
```
|
```
|
||||||
|
|
||||||
You can also provide the `-d` option, which will lint the files that have been
|
## Run the unit tests.
|
||||||
changed since the last git commit. This will often be significantly faster than
|
|
||||||
linting the whole codebase.
|
|
||||||
|
|
||||||
Before pushing new changes, ensure they don't produce linting errors. Commit any
|
The unit tests run parts of Synapse, including your changes, to see if anything
|
||||||
files that were corrected.
|
was broken. They are slower than the linters but will typically catch more errors.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
source ./env/bin/activate
|
||||||
|
trial tests
|
||||||
|
```
|
||||||
|
|
||||||
|
If you wish to only run *some* unit tests, you may specify
|
||||||
|
another module instead of `tests` - or a test class or a method:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
source ./env/bin/activate
|
||||||
|
trial tests.rest.admin.test_room tests.handlers.test_admin.ExfiltrateData.test_invite
|
||||||
|
```
|
||||||
|
|
||||||
|
If your tests fail, you may wish to look at the logs:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
less _trial_temp/test.log
|
||||||
|
```
|
||||||
|
|
||||||
|
## Run the integration tests.
|
||||||
|
|
||||||
|
The integration tests are a more comprehensive suite of tests. They
|
||||||
|
run a full version of Synapse, including your changes, to check if
|
||||||
|
anything was broken. They are slower than the unit tests but will
|
||||||
|
typically catch more errors.
|
||||||
|
|
||||||
|
The following command will let you run the integration test with the most common
|
||||||
|
configuration:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ docker run --rm -it -v /path/where/you/have/cloned/the/repository\:/src:ro -v /path/to/where/you/want/logs\:/logs matrixdotorg/sytest-synapse:py37
|
||||||
|
```
|
||||||
|
|
||||||
|
This configuration should generally cover your needs. For more details about other configurations, see [documentation in the SyTest repo](https://github.com/matrix-org/sytest/blob/develop/docker/README.md).
|
||||||
|
|
||||||
|
|
||||||
|
# 9. Submit your patch.
|
||||||
|
|
||||||
|
Once you're happy with your patch, it's time to prepare a Pull Request.
|
||||||
|
|
||||||
|
To prepare a Pull Request, please:
|
||||||
|
|
||||||
|
1. verify that [all the tests pass](#test-test-test), including the coding style;
|
||||||
|
2. [sign off](#sign-off) your contribution;
|
||||||
|
3. `git push` your commit to your fork of Synapse;
|
||||||
|
4. on GitHub, [create the Pull Request](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request);
|
||||||
|
5. add a [changelog entry](#changelog) and push it to your Pull Request;
|
||||||
|
6. for most contributors, that's all - however, if you are a member of the organization `matrix-org`, on GitHub, please request a review from `matrix.org / Synapse Core`.
|
||||||
|
|
||||||
Please ensure your changes match the cosmetic style of the existing project,
|
|
||||||
and **never** mix cosmetic and functional changes in the same commit, as it
|
|
||||||
makes it horribly hard to review otherwise.
|
|
||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
@@ -156,24 +292,6 @@ directory, you will need both a regular newsfragment *and* an entry in the
|
|||||||
debian changelog. (Though typically such changes should be submitted as two
|
debian changelog. (Though typically such changes should be submitted as two
|
||||||
separate pull requests.)
|
separate pull requests.)
|
||||||
|
|
||||||
## Documentation
|
|
||||||
|
|
||||||
There is a growing amount of documentation located in the [docs](docs)
|
|
||||||
directory. This documentation is intended primarily for sysadmins running their
|
|
||||||
own Synapse instance, as well as developers interacting externally with
|
|
||||||
Synapse. [docs/dev](docs/dev) exists primarily to house documentation for
|
|
||||||
Synapse developers. [docs/admin_api](docs/admin_api) houses documentation
|
|
||||||
regarding Synapse's Admin API, which is used mostly by sysadmins and external
|
|
||||||
service developers.
|
|
||||||
|
|
||||||
New files added to both folders should be written in [Github-Flavoured
|
|
||||||
Markdown](https://guides.github.com/features/mastering-markdown/), and attempts
|
|
||||||
should be made to migrate existing documents to markdown where possible.
|
|
||||||
|
|
||||||
Some documentation also exists in [Synapse's Github
|
|
||||||
Wiki](https://github.com/matrix-org/synapse/wiki), although this is primarily
|
|
||||||
contributed to by community authors.
|
|
||||||
|
|
||||||
## Sign off
|
## Sign off
|
||||||
|
|
||||||
In order to have a concrete record that your contribution is intentional
|
In order to have a concrete record that your contribution is intentional
|
||||||
@@ -240,47 +358,36 @@ Git allows you to add this signoff automatically when using the `-s`
|
|||||||
flag to `git commit`, which uses the name and email set in your
|
flag to `git commit`, which uses the name and email set in your
|
||||||
`user.name` and `user.email` git configs.
|
`user.name` and `user.email` git configs.
|
||||||
|
|
||||||
## Continuous integration and testing
|
|
||||||
|
|
||||||
[Buildkite](https://buildkite.com/matrix-dot-org/synapse) will automatically
|
# 10. Turn feedback into better code.
|
||||||
run a series of checks and tests against any PR which is opened against the
|
|
||||||
project; if your change breaks the build, this will be shown in GitHub, with
|
|
||||||
links to the build results. If your build fails, please try to fix the errors
|
|
||||||
and update your branch.
|
|
||||||
|
|
||||||
To run unit tests in a local development environment, you can use:
|
Once the Pull Request is opened, you will see a few things:
|
||||||
|
|
||||||
- ``tox -e py35`` (requires tox to be installed by ``pip install tox``)
|
1. our automated CI (Continuous Integration) pipeline will run (again) the linters, the unit tests, the integration tests and more;
|
||||||
for SQLite-backed Synapse on Python 3.5.
|
2. one or more of the developers will take a look at your Pull Request and offer feedback.
|
||||||
- ``tox -e py36`` for SQLite-backed Synapse on Python 3.6.
|
|
||||||
- ``tox -e py36-postgres`` for PostgreSQL-backed Synapse on Python 3.6
|
|
||||||
(requires a running local PostgreSQL with access to create databases).
|
|
||||||
- ``./test_postgresql.sh`` for PostgreSQL-backed Synapse on Python 3.5
|
|
||||||
(requires Docker). Entirely self-contained, recommended if you don't want to
|
|
||||||
set up PostgreSQL yourself.
|
|
||||||
|
|
||||||
Docker images are available for running the integration tests (SyTest) locally,
|
From this point, you should:
|
||||||
see the [documentation in the SyTest repo](
|
|
||||||
https://github.com/matrix-org/sytest/blob/develop/docker/README.md) for more
|
|
||||||
information.
|
|
||||||
|
|
||||||
## Updating your pull request
|
1. Look at the results of the CI pipeline.
|
||||||
|
- If there is any error, fix the error.
|
||||||
|
2. If a developer has requested changes, make these changes and let us know if it is ready for a developer to review again.
|
||||||
|
3. Create a new commit with the changes.
|
||||||
|
- Please do NOT overwrite the history. New commits make the reviewer's life easier.
|
||||||
|
- Push this commits to your Pull Request.
|
||||||
|
4. Back to 1.
|
||||||
|
|
||||||
If you decide to make changes to your pull request - perhaps to address issues
|
Once both the CI and the developers are happy, the patch will be merged into Synapse and released shortly!
|
||||||
raised in a review, or to fix problems highlighted by [continuous
|
|
||||||
integration](#continuous-integration-and-testing) - just add new commits to your
|
|
||||||
branch, and push to GitHub. The pull request will automatically be updated.
|
|
||||||
|
|
||||||
Please **avoid** rebasing your branch, especially once the PR has been
|
# 11. Find a new issue.
|
||||||
reviewed: doing so makes it very difficult for a reviewer to see what has
|
|
||||||
changed since a previous review.
|
|
||||||
|
|
||||||
## Notes for maintainers on merging PRs etc
|
By now, you know the drill!
|
||||||
|
|
||||||
|
# Notes for maintainers on merging PRs etc
|
||||||
|
|
||||||
There are some notes for those with commit access to the project on how we
|
There are some notes for those with commit access to the project on how we
|
||||||
manage git [here](docs/dev/git.md).
|
manage git [here](docs/dev/git.md).
|
||||||
|
|
||||||
## Conclusion
|
# Conclusion
|
||||||
|
|
||||||
That's it! Matrix is a very open and collaborative project as you might expect
|
That's it! Matrix is a very open and collaborative project as you might expect
|
||||||
given our obsession with open communication. If we're going to successfully
|
given our obsession with open communication. If we're going to successfully
|
||||||
|
|||||||
38
INSTALL.md
38
INSTALL.md
@@ -6,7 +6,7 @@ There are 3 steps to follow under **Installation Instructions**.
|
|||||||
- [Choosing your server name](#choosing-your-server-name)
|
- [Choosing your server name](#choosing-your-server-name)
|
||||||
- [Installing Synapse](#installing-synapse)
|
- [Installing Synapse](#installing-synapse)
|
||||||
- [Installing from source](#installing-from-source)
|
- [Installing from source](#installing-from-source)
|
||||||
- [Platform-Specific Instructions](#platform-specific-instructions)
|
- [Platform-specific prerequisites](#platform-specific-prerequisites)
|
||||||
- [Debian/Ubuntu/Raspbian](#debianubunturaspbian)
|
- [Debian/Ubuntu/Raspbian](#debianubunturaspbian)
|
||||||
- [ArchLinux](#archlinux)
|
- [ArchLinux](#archlinux)
|
||||||
- [CentOS/Fedora](#centosfedora)
|
- [CentOS/Fedora](#centosfedora)
|
||||||
@@ -38,6 +38,7 @@ There are 3 steps to follow under **Installation Instructions**.
|
|||||||
- [URL previews](#url-previews)
|
- [URL previews](#url-previews)
|
||||||
- [Troubleshooting Installation](#troubleshooting-installation)
|
- [Troubleshooting Installation](#troubleshooting-installation)
|
||||||
|
|
||||||
|
|
||||||
## Choosing your server name
|
## Choosing your server name
|
||||||
|
|
||||||
It is important to choose the name for your server before you install Synapse,
|
It is important to choose the name for your server before you install Synapse,
|
||||||
@@ -60,17 +61,14 @@ that your email address is probably `user@example.com` rather than
|
|||||||
|
|
||||||
(Prebuilt packages are available for some platforms - see [Prebuilt packages](#prebuilt-packages).)
|
(Prebuilt packages are available for some platforms - see [Prebuilt packages](#prebuilt-packages).)
|
||||||
|
|
||||||
|
When installing from source please make sure that the [Platform-specific prerequisites](#platform-specific-prerequisites) are already installed.
|
||||||
|
|
||||||
System requirements:
|
System requirements:
|
||||||
|
|
||||||
- POSIX-compliant system (tested on Linux & OS X)
|
- POSIX-compliant system (tested on Linux & OS X)
|
||||||
- Python 3.5.2 or later, up to Python 3.9.
|
- Python 3.5.2 or later, up to Python 3.9.
|
||||||
- At least 1GB of free RAM if you want to join large public rooms like #matrix:matrix.org
|
- At least 1GB of free RAM if you want to join large public rooms like #matrix:matrix.org
|
||||||
|
|
||||||
Synapse is written in Python but some of the libraries it uses are written in
|
|
||||||
C. So before we can install Synapse itself we need a working C compiler and the
|
|
||||||
header files for Python C extensions. See [Platform-Specific
|
|
||||||
Instructions](#platform-specific-instructions) for information on installing
|
|
||||||
these on various platforms.
|
|
||||||
|
|
||||||
To install the Synapse homeserver run:
|
To install the Synapse homeserver run:
|
||||||
|
|
||||||
@@ -128,7 +126,11 @@ source env/bin/activate
|
|||||||
synctl start
|
synctl start
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Platform-Specific Instructions
|
#### Platform-specific prerequisites
|
||||||
|
|
||||||
|
Synapse is written in Python but some of the libraries it uses are written in
|
||||||
|
C. So before we can install Synapse itself we need a working C compiler and the
|
||||||
|
header files for Python C extensions.
|
||||||
|
|
||||||
##### Debian/Ubuntu/Raspbian
|
##### Debian/Ubuntu/Raspbian
|
||||||
|
|
||||||
@@ -526,14 +528,24 @@ email will be disabled.
|
|||||||
|
|
||||||
The easiest way to create a new user is to do so from a client like [Element](https://element.io/).
|
The easiest way to create a new user is to do so from a client like [Element](https://element.io/).
|
||||||
|
|
||||||
Alternatively you can do so from the command line if you have installed via pip.
|
Alternatively, you can do so from the command line. This can be done as follows:
|
||||||
|
|
||||||
This can be done as follows:
|
1. If synapse was installed via pip, activate the virtualenv as follows (if Synapse was
|
||||||
|
installed via a prebuilt package, `register_new_matrix_user` should already be
|
||||||
|
on the search path):
|
||||||
|
```sh
|
||||||
|
cd ~/synapse
|
||||||
|
source env/bin/activate
|
||||||
|
synctl start # if not already running
|
||||||
|
```
|
||||||
|
2. Run the following command:
|
||||||
|
```sh
|
||||||
|
register_new_matrix_user -c homeserver.yaml http://localhost:8008
|
||||||
|
```
|
||||||
|
|
||||||
```sh
|
This will prompt you to add details for the new user, and will then connect to
|
||||||
$ source ~/synapse/env/bin/activate
|
the running Synapse to create the new user. For example:
|
||||||
$ synctl start # if not already running
|
```
|
||||||
$ register_new_matrix_user -c homeserver.yaml http://localhost:8008
|
|
||||||
New user localpart: erikj
|
New user localpart: erikj
|
||||||
Password:
|
Password:
|
||||||
Confirm password:
|
Confirm password:
|
||||||
|
|||||||
@@ -20,9 +20,10 @@ recursive-include scripts *
|
|||||||
recursive-include scripts-dev *
|
recursive-include scripts-dev *
|
||||||
recursive-include synapse *.pyi
|
recursive-include synapse *.pyi
|
||||||
recursive-include tests *.py
|
recursive-include tests *.py
|
||||||
include tests/http/ca.crt
|
recursive-include tests *.pem
|
||||||
include tests/http/ca.key
|
recursive-include tests *.p8
|
||||||
include tests/http/server.key
|
recursive-include tests *.crt
|
||||||
|
recursive-include tests *.key
|
||||||
|
|
||||||
recursive-include synapse/res *
|
recursive-include synapse/res *
|
||||||
recursive-include synapse/static *.css
|
recursive-include synapse/static *.css
|
||||||
|
|||||||
23
README.rst
23
README.rst
@@ -183,8 +183,9 @@ Using a reverse proxy with Synapse
|
|||||||
It is recommended to put a reverse proxy such as
|
It is recommended to put a reverse proxy such as
|
||||||
`nginx <https://nginx.org/en/docs/http/ngx_http_proxy_module.html>`_,
|
`nginx <https://nginx.org/en/docs/http/ngx_http_proxy_module.html>`_,
|
||||||
`Apache <https://httpd.apache.org/docs/current/mod/mod_proxy_http.html>`_,
|
`Apache <https://httpd.apache.org/docs/current/mod/mod_proxy_http.html>`_,
|
||||||
`Caddy <https://caddyserver.com/docs/quick-starts/reverse-proxy>`_ or
|
`Caddy <https://caddyserver.com/docs/quick-starts/reverse-proxy>`_,
|
||||||
`HAProxy <https://www.haproxy.org/>`_ in front of Synapse. One advantage of
|
`HAProxy <https://www.haproxy.org/>`_ or
|
||||||
|
`relayd <https://man.openbsd.org/relayd.8>`_ in front of Synapse. One advantage of
|
||||||
doing so is that it means that you can expose the default https port (443) to
|
doing so is that it means that you can expose the default https port (443) to
|
||||||
Matrix clients without needing to run Synapse with root privileges.
|
Matrix clients without needing to run Synapse with root privileges.
|
||||||
|
|
||||||
@@ -313,6 +314,15 @@ Testing with SyTest is recommended for verifying that changes related to the
|
|||||||
Client-Server API are functioning correctly. See the `installation instructions
|
Client-Server API are functioning correctly. See the `installation instructions
|
||||||
<https://github.com/matrix-org/sytest#installing>`_ for details.
|
<https://github.com/matrix-org/sytest#installing>`_ for details.
|
||||||
|
|
||||||
|
|
||||||
|
Platform dependencies
|
||||||
|
=====================
|
||||||
|
|
||||||
|
Synapse uses a number of platform dependencies such as Python and PostgreSQL,
|
||||||
|
and aims to follow supported upstream versions. See the
|
||||||
|
`<docs/deprecation_policy.md>`_ document for more details.
|
||||||
|
|
||||||
|
|
||||||
Troubleshooting
|
Troubleshooting
|
||||||
===============
|
===============
|
||||||
|
|
||||||
@@ -383,12 +393,17 @@ massive excess of outgoing federation requests (see `discussion
|
|||||||
indicate that your server is also issuing far more outgoing federation
|
indicate that your server is also issuing far more outgoing federation
|
||||||
requests than can be accounted for by your users' activity, this is a
|
requests than can be accounted for by your users' activity, this is a
|
||||||
likely cause. The misbehavior can be worked around by setting
|
likely cause. The misbehavior can be worked around by setting
|
||||||
``use_presence: false`` in the Synapse config file.
|
the following in the Synapse config file:
|
||||||
|
|
||||||
|
.. code-block:: yaml
|
||||||
|
|
||||||
|
presence:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
People can't accept room invitations from me
|
People can't accept room invitations from me
|
||||||
--------------------------------------------
|
--------------------------------------------
|
||||||
|
|
||||||
The typical failure mode here is that you send an invitation to someone
|
The typical failure mode here is that you send an invitation to someone
|
||||||
to join a room or direct chat, but when they go to accept it, they get an
|
to join a room or direct chat, but when they go to accept it, they get an
|
||||||
error (typically along the lines of "Invalid signature"). They might see
|
error (typically along the lines of "Invalid signature"). They might see
|
||||||
something like the following in their logs::
|
something like the following in their logs::
|
||||||
|
|||||||
145
UPGRADE.rst
145
UPGRADE.rst
@@ -85,23 +85,146 @@ for example:
|
|||||||
wget https://packages.matrix.org/debian/pool/main/m/matrix-synapse-py3/matrix-synapse-py3_1.3.0+stretch1_amd64.deb
|
wget https://packages.matrix.org/debian/pool/main/m/matrix-synapse-py3/matrix-synapse-py3_1.3.0+stretch1_amd64.deb
|
||||||
dpkg -i matrix-synapse-py3_1.3.0+stretch1_amd64.deb
|
dpkg -i matrix-synapse-py3_1.3.0+stretch1_amd64.deb
|
||||||
|
|
||||||
|
Upgrading to v1.34.0
|
||||||
|
====================
|
||||||
|
|
||||||
|
``room_invite_state_types`` configuration setting
|
||||||
|
-----------------------------------------------
|
||||||
|
|
||||||
|
The ``room_invite_state_types`` configuration setting has been deprecated and
|
||||||
|
replaced with ``room_prejoin_state``. See the `sample configuration file <https://github.com/matrix-org/synapse/blob/v1.34.0/docs/sample_config.yaml#L1515>`_.
|
||||||
|
|
||||||
|
If you have set ``room_invite_state_types`` to the default value you should simply
|
||||||
|
remove it from your configuration file. The default value used to be:
|
||||||
|
|
||||||
|
.. code:: yaml
|
||||||
|
|
||||||
|
room_invite_state_types:
|
||||||
|
- "m.room.join_rules"
|
||||||
|
- "m.room.canonical_alias"
|
||||||
|
- "m.room.avatar"
|
||||||
|
- "m.room.encryption"
|
||||||
|
- "m.room.name"
|
||||||
|
|
||||||
|
If you have customised this value, you should remove ``room_invite_state_types`` and
|
||||||
|
configure ``room_prejoin_state`` instead.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Upgrading to v1.33.0
|
||||||
|
====================
|
||||||
|
|
||||||
|
Account Validity HTML templates can now display a user's expiration date
|
||||||
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
|
This may affect you if you have enabled the account validity feature, and have made use of a
|
||||||
|
custom HTML template specified by the ``account_validity.template_dir`` or ``account_validity.account_renewed_html_path``
|
||||||
|
Synapse config options.
|
||||||
|
|
||||||
|
The template can now accept an ``expiration_ts`` variable, which represents the unix timestamp in milliseconds for the
|
||||||
|
future date of which their account has been renewed until. See the
|
||||||
|
`default template <https://github.com/matrix-org/synapse/blob/release-v1.33.0/synapse/res/templates/account_renewed.html>`_
|
||||||
|
for an example of usage.
|
||||||
|
|
||||||
|
ALso note that a new HTML template, ``account_previously_renewed.html``, has been added. This is is shown to users
|
||||||
|
when they attempt to renew their account with a valid renewal token that has already been used before. The default
|
||||||
|
template contents can been found
|
||||||
|
`here <https://github.com/matrix-org/synapse/blob/release-v1.33.0/synapse/res/templates/account_previously_renewed.html>`_,
|
||||||
|
and can also accept an ``expiration_ts`` variable. This template replaces the error message users would previously see
|
||||||
|
upon attempting to use a valid renewal token more than once.
|
||||||
|
|
||||||
|
|
||||||
|
Upgrading to v1.32.0
|
||||||
|
====================
|
||||||
|
|
||||||
|
Regression causing connected Prometheus instances to become overwhelmed
|
||||||
|
-----------------------------------------------------------------------
|
||||||
|
|
||||||
|
This release introduces `a regression <https://github.com/matrix-org/synapse/issues/9853>`_
|
||||||
|
that can overwhelm connected Prometheus instances. This issue is not present in
|
||||||
|
Synapse v1.32.0rc1.
|
||||||
|
|
||||||
|
If you have been affected, please downgrade to 1.31.0. You then may need to
|
||||||
|
remove excess writeahead logs in order for Prometheus to recover. Instructions
|
||||||
|
for doing so are provided
|
||||||
|
`here <https://github.com/matrix-org/synapse/pull/9854#issuecomment-823472183>`_.
|
||||||
|
|
||||||
|
Dropping support for old Python, Postgres and SQLite versions
|
||||||
|
-------------------------------------------------------------
|
||||||
|
|
||||||
|
In line with our `deprecation policy <https://github.com/matrix-org/synapse/blob/release-v1.32.0/docs/deprecation_policy.md>`_,
|
||||||
|
we've dropped support for Python 3.5 and PostgreSQL 9.5, as they are no longer supported upstream.
|
||||||
|
|
||||||
|
This release of Synapse requires Python 3.6+ and PostgresSQL 9.6+ or SQLite 3.22+.
|
||||||
|
|
||||||
|
Removal of old List Accounts Admin API
|
||||||
|
--------------------------------------
|
||||||
|
|
||||||
|
The deprecated v1 "list accounts" admin API (``GET /_synapse/admin/v1/users/<user_id>``) has been removed in this version.
|
||||||
|
|
||||||
|
The `v2 list accounts API <https://github.com/matrix-org/synapse/blob/master/docs/admin_api/user_admin_api.rst#list-accounts>`_
|
||||||
|
has been available since Synapse 1.7.0 (2019-12-13), and is accessible under ``GET /_synapse/admin/v2/users``.
|
||||||
|
|
||||||
|
The deprecation of the old endpoint was announced with Synapse 1.28.0 (released on 2021-02-25).
|
||||||
|
|
||||||
|
Application Services must use type ``m.login.application_service`` when registering users
|
||||||
|
-----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
In compliance with the
|
||||||
|
`Application Service spec <https://matrix.org/docs/spec/application_service/r0.1.2#server-admin-style-permissions>`_,
|
||||||
|
Application Services are now required to use the ``m.login.application_service`` type when registering users via the
|
||||||
|
``/_matrix/client/r0/register`` endpoint. This behaviour was deprecated in Synapse v1.30.0.
|
||||||
|
|
||||||
|
Please ensure your Application Services are up to date.
|
||||||
|
|
||||||
|
Upgrading to v1.29.0
|
||||||
|
====================
|
||||||
|
|
||||||
|
Requirement for X-Forwarded-Proto header
|
||||||
|
----------------------------------------
|
||||||
|
|
||||||
|
When using Synapse with a reverse proxy (in particular, when using the
|
||||||
|
`x_forwarded` option on an HTTP listener), Synapse now expects to receive an
|
||||||
|
`X-Forwarded-Proto` header on incoming HTTP requests. If it is not set, Synapse
|
||||||
|
will log a warning on each received request.
|
||||||
|
|
||||||
|
To avoid the warning, administrators using a reverse proxy should ensure that
|
||||||
|
the reverse proxy sets `X-Forwarded-Proto` header to `https` or `http` to
|
||||||
|
indicate the protocol used by the client.
|
||||||
|
|
||||||
|
Synapse also requires the `Host` header to be preserved.
|
||||||
|
|
||||||
|
See the `reverse proxy documentation <docs/reverse_proxy.md>`_, where the
|
||||||
|
example configurations have been updated to show how to set these headers.
|
||||||
|
|
||||||
|
(Users of `Caddy <https://caddyserver.com/>`_ are unaffected, since we believe it
|
||||||
|
sets `X-Forwarded-Proto` by default.)
|
||||||
|
|
||||||
Upgrading to v1.27.0
|
Upgrading to v1.27.0
|
||||||
====================
|
====================
|
||||||
|
|
||||||
Changes to callback URI for OAuth2 / OpenID Connect
|
Changes to callback URI for OAuth2 / OpenID Connect and SAML2
|
||||||
---------------------------------------------------
|
-------------------------------------------------------------
|
||||||
|
|
||||||
This version changes the URI used for callbacks from OAuth2 identity providers. If
|
This version changes the URI used for callbacks from OAuth2 and SAML2 identity providers:
|
||||||
your server is configured for single sign-on via an OpenID Connect or OAuth2 identity
|
|
||||||
provider, you will need to add ``[synapse public baseurl]/_synapse/client/oidc/callback``
|
|
||||||
to the list of permitted "redirect URIs" at the identity provider.
|
|
||||||
|
|
||||||
See `docs/openid.md <docs/openid.md>`_ for more information on setting up OpenID
|
* If your server is configured for single sign-on via an OpenID Connect or OAuth2 identity
|
||||||
Connect.
|
provider, you will need to add ``[synapse public baseurl]/_synapse/client/oidc/callback``
|
||||||
|
to the list of permitted "redirect URIs" at the identity provider.
|
||||||
|
|
||||||
(Note: a similar change is being made for SAML2; in this case the old URI
|
See `docs/openid.md <docs/openid.md>`_ for more information on setting up OpenID
|
||||||
``[synapse public baseurl]/_matrix/saml2`` is being deprecated, but will continue to
|
Connect.
|
||||||
work, so no immediate changes are required for existing installations.)
|
|
||||||
|
* If your server is configured for single sign-on via a SAML2 identity provider, you will
|
||||||
|
need to add ``[synapse public baseurl]/_synapse/client/saml2/authn_response`` as a permitted
|
||||||
|
"ACS location" (also known as "allowed callback URLs") at the identity provider.
|
||||||
|
|
||||||
|
The "Issuer" in the "AuthnRequest" to the SAML2 identity provider is also updated to
|
||||||
|
``[synapse public baseurl]/_synapse/client/saml2/metadata.xml``. If your SAML2 identity
|
||||||
|
provider uses this property to validate or otherwise identify Synapse, its configuration
|
||||||
|
will need to be updated to use the new URL. Alternatively you could create a new, separate
|
||||||
|
"EntityDescriptor" in your SAML2 identity provider with the new URLs and leave the URLs in
|
||||||
|
the existing "EntityDescriptor" as they were.
|
||||||
|
|
||||||
Changes to HTML templates
|
Changes to HTML templates
|
||||||
-------------------------
|
-------------------------
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
Fix 'object name reserved for internal use' errors with recent versions of SQLite.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Add experimental support for running Synapse with PyPy.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
New API /_synapse/admin/rooms/{roomId}/context/{eventId}.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Deny access to additional IP addresses by default.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Fix long-standing bug where sending email push would fail for rooms that the server had since left.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Add note to `auto_join_rooms` config option explaining existing rooms must be publicly joinable.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Fix bug in Synapse 1.27.0rc1 which meant the "session expired" error page during SSO registration was badly formatted.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Update the `Cursor` type hints to better match PEP 249.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Further improvements to the user experience of registration via single sign-on.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Further improvements to the user experience of registration via single sign-on.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Add debug logging for SRV lookups. Contributed by @Bubu.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Improve logging for OIDC login flow.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Correct name of Synapse's service file in TURN howto.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Add hook to spam checker modules that allow checking file uploads and remote downloads.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Fix the braces in the `oidc_providers` section of the sample config.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Assert a maximum length for the `client_secret` parameter for spec compliance.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Update installation instructions on Fedora.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Share the code for handling required attributes between the CAS and SAML handlers.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Fix additional errors when previewing URLs: "AttributeError 'NoneType' object has no attribute 'xpath'" and "ValueError: Unicode strings with encoding declaration are not supported. Please use bytes input or XML fragments without declaration.".
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Fix a bug causing Synapse to impose the wrong type constraints on fields when processing responses from appservices to `/_matrix/app/v1/thirdparty/user/{protocol}`.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Clean up the code to load the metadata for OpenID Connect identity providers.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Add support for receiving OpenID Connect authentication responses via form `POST`s rather than `GET`s.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Convert tests to use `HomeserverTestCase`.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Update the version of black used to 20.8b1.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Allow OIDC config to override discovered values.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Fix bug where Synapse would occaisonally stop reconnecting after the connection was lost.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Remove some dead code from the acceptance of room invites path.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Fix a long-standing bug when upgrading a room: "TypeError: '>' not supported between instances of 'NoneType' and 'int'".
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Convert tests to use `HomeserverTestCase`.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Update docs for using Gitea as OpenID provider.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Document that pusher instances are shardable.
|
|
||||||
@@ -24,6 +24,7 @@ import sys
|
|||||||
import time
|
import time
|
||||||
import urllib
|
import urllib
|
||||||
from http import TwistedHttpClient
|
from http import TwistedHttpClient
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
import nacl.encoding
|
import nacl.encoding
|
||||||
import nacl.signing
|
import nacl.signing
|
||||||
@@ -718,7 +719,7 @@ class SynapseCmd(cmd.Cmd):
|
|||||||
method,
|
method,
|
||||||
path,
|
path,
|
||||||
data=None,
|
data=None,
|
||||||
query_params={"access_token": None},
|
query_params: Optional[dict] = None,
|
||||||
alt_text=None,
|
alt_text=None,
|
||||||
):
|
):
|
||||||
"""Runs an HTTP request and pretty prints the output.
|
"""Runs an HTTP request and pretty prints the output.
|
||||||
@@ -729,6 +730,8 @@ class SynapseCmd(cmd.Cmd):
|
|||||||
data: Raw JSON data if any
|
data: Raw JSON data if any
|
||||||
query_params: dict of query parameters to add to the url
|
query_params: dict of query parameters to add to the url
|
||||||
"""
|
"""
|
||||||
|
query_params = query_params or {"access_token": None}
|
||||||
|
|
||||||
url = self._url() + path
|
url = self._url() + path
|
||||||
if "access_token" in query_params:
|
if "access_token" in query_params:
|
||||||
query_params["access_token"] = self._tok()
|
query_params["access_token"] = self._tok()
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
# Copyright 2014-2016 OpenMarket Ltd
|
# Copyright 2014-2016 OpenMarket Ltd
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@@ -16,6 +15,7 @@
|
|||||||
import json
|
import json
|
||||||
import urllib
|
import urllib
|
||||||
from pprint import pformat
|
from pprint import pformat
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
from twisted.internet import defer, reactor
|
from twisted.internet import defer, reactor
|
||||||
from twisted.web.client import Agent, readBody
|
from twisted.web.client import Agent, readBody
|
||||||
@@ -85,8 +85,9 @@ class TwistedHttpClient(HttpClient):
|
|||||||
body = yield readBody(response)
|
body = yield readBody(response)
|
||||||
defer.returnValue(json.loads(body))
|
defer.returnValue(json.loads(body))
|
||||||
|
|
||||||
def _create_put_request(self, url, json_data, headers_dict={}):
|
def _create_put_request(self, url, json_data, headers_dict: Optional[dict] = None):
|
||||||
"""Wrapper of _create_request to issue a PUT request"""
|
"""Wrapper of _create_request to issue a PUT request"""
|
||||||
|
headers_dict = headers_dict or {}
|
||||||
|
|
||||||
if "Content-Type" not in headers_dict:
|
if "Content-Type" not in headers_dict:
|
||||||
raise defer.error(RuntimeError("Must include Content-Type header for PUTs"))
|
raise defer.error(RuntimeError("Must include Content-Type header for PUTs"))
|
||||||
@@ -95,14 +96,22 @@ class TwistedHttpClient(HttpClient):
|
|||||||
"PUT", url, producer=_JsonProducer(json_data), headers_dict=headers_dict
|
"PUT", url, producer=_JsonProducer(json_data), headers_dict=headers_dict
|
||||||
)
|
)
|
||||||
|
|
||||||
def _create_get_request(self, url, headers_dict={}):
|
def _create_get_request(self, url, headers_dict: Optional[dict] = None):
|
||||||
"""Wrapper of _create_request to issue a GET request"""
|
"""Wrapper of _create_request to issue a GET request"""
|
||||||
return self._create_request("GET", url, headers_dict=headers_dict)
|
return self._create_request("GET", url, headers_dict=headers_dict or {})
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def do_request(
|
def do_request(
|
||||||
self, method, url, data=None, qparams=None, jsonreq=True, headers={}
|
self,
|
||||||
|
method,
|
||||||
|
url,
|
||||||
|
data=None,
|
||||||
|
qparams=None,
|
||||||
|
jsonreq=True,
|
||||||
|
headers: Optional[dict] = None,
|
||||||
):
|
):
|
||||||
|
headers = headers or {}
|
||||||
|
|
||||||
if qparams:
|
if qparams:
|
||||||
url = "%s?%s" % (url, urllib.urlencode(qparams, True))
|
url = "%s?%s" % (url, urllib.urlencode(qparams, True))
|
||||||
|
|
||||||
@@ -123,8 +132,12 @@ class TwistedHttpClient(HttpClient):
|
|||||||
defer.returnValue(json.loads(body))
|
defer.returnValue(json.loads(body))
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def _create_request(self, method, url, producer=None, headers_dict={}):
|
def _create_request(
|
||||||
|
self, method, url, producer=None, headers_dict: Optional[dict] = None
|
||||||
|
):
|
||||||
"""Creates and sends a request to the given url"""
|
"""Creates and sends a request to the given url"""
|
||||||
|
headers_dict = headers_dict or {}
|
||||||
|
|
||||||
headers_dict["User-Agent"] = ["Synapse Cmd Client"]
|
headers_dict["User-Agent"] = ["Synapse Cmd Client"]
|
||||||
|
|
||||||
retries_left = 5
|
retries_left = 5
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
# Copyright 2014-2016 OpenMarket Ltd
|
# Copyright 2014-2016 OpenMarket Ltd
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# this script will use the api:
|
# this script will use the api:
|
||||||
# https://github.com/matrix-org/synapse/blob/master/docs/admin_api/purge_history_api.rst
|
# https://github.com/matrix-org/synapse/blob/master/docs/admin_api/purge_history_api.rst
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
DOMAIN=yourserver.tld
|
DOMAIN=yourserver.tld
|
||||||
# add this user as admin in your home server:
|
# add this user as admin in your home server:
|
||||||
|
|||||||
71
contrib/systemd/override-hardened.conf
Normal file
71
contrib/systemd/override-hardened.conf
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
[Service]
|
||||||
|
# The following directives give the synapse service R/W access to:
|
||||||
|
# - /run/matrix-synapse
|
||||||
|
# - /var/lib/matrix-synapse
|
||||||
|
# - /var/log/matrix-synapse
|
||||||
|
|
||||||
|
RuntimeDirectory=matrix-synapse
|
||||||
|
StateDirectory=matrix-synapse
|
||||||
|
LogsDirectory=matrix-synapse
|
||||||
|
|
||||||
|
######################
|
||||||
|
## Security Sandbox ##
|
||||||
|
######################
|
||||||
|
|
||||||
|
# Make sure that the service has its own unshared tmpfs at /tmp and that it
|
||||||
|
# cannot see or change any real devices
|
||||||
|
PrivateTmp=true
|
||||||
|
PrivateDevices=true
|
||||||
|
|
||||||
|
# We give no capabilities to a service by default
|
||||||
|
CapabilityBoundingSet=
|
||||||
|
AmbientCapabilities=
|
||||||
|
|
||||||
|
# Protect the following from modification:
|
||||||
|
# - The entire filesystem
|
||||||
|
# - sysctl settings and loaded kernel modules
|
||||||
|
# - No modifications allowed to Control Groups
|
||||||
|
# - Hostname
|
||||||
|
# - System Clock
|
||||||
|
ProtectSystem=strict
|
||||||
|
ProtectKernelTunables=true
|
||||||
|
ProtectKernelModules=true
|
||||||
|
ProtectControlGroups=true
|
||||||
|
ProtectClock=true
|
||||||
|
ProtectHostname=true
|
||||||
|
|
||||||
|
# Prevent access to the following:
|
||||||
|
# - /home directory
|
||||||
|
# - Kernel logs
|
||||||
|
ProtectHome=tmpfs
|
||||||
|
ProtectKernelLogs=true
|
||||||
|
|
||||||
|
# Make sure that the process can only see PIDs and process details of itself,
|
||||||
|
# and the second option disables seeing details of things like system load and
|
||||||
|
# I/O etc
|
||||||
|
ProtectProc=invisible
|
||||||
|
ProcSubset=pid
|
||||||
|
|
||||||
|
# While not needed, we set these options explicitly
|
||||||
|
# - This process has been given access to the host network
|
||||||
|
# - It can also communicate with any IP Address
|
||||||
|
PrivateNetwork=false
|
||||||
|
RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
|
||||||
|
IPAddressAllow=any
|
||||||
|
|
||||||
|
# Restrict system calls to a sane bunch
|
||||||
|
SystemCallArchitectures=native
|
||||||
|
SystemCallFilter=@system-service
|
||||||
|
SystemCallFilter=~@privileged @resources @obsolete
|
||||||
|
|
||||||
|
# Misc restrictions
|
||||||
|
# - Since the process is a python process it needs to be able to write and
|
||||||
|
# execute memory regions, so we set MemoryDenyWriteExecute to false
|
||||||
|
RestrictSUIDSGID=true
|
||||||
|
RemoveIPC=true
|
||||||
|
NoNewPrivileges=true
|
||||||
|
RestrictRealtime=true
|
||||||
|
RestrictNamespaces=true
|
||||||
|
LockPersonality=true
|
||||||
|
PrivateUsers=true
|
||||||
|
MemoryDenyWriteExecute=false
|
||||||
27
debian/build_virtualenv
vendored
27
debian/build_virtualenv
vendored
@@ -50,18 +50,27 @@ PACKAGE_BUILD_DIR="debian/matrix-synapse-py3"
|
|||||||
VIRTUALENV_DIR="${PACKAGE_BUILD_DIR}${DH_VIRTUALENV_INSTALL_ROOT}/matrix-synapse"
|
VIRTUALENV_DIR="${PACKAGE_BUILD_DIR}${DH_VIRTUALENV_INSTALL_ROOT}/matrix-synapse"
|
||||||
TARGET_PYTHON="${VIRTUALENV_DIR}/bin/python"
|
TARGET_PYTHON="${VIRTUALENV_DIR}/bin/python"
|
||||||
|
|
||||||
# we copy the tests to a temporary directory so that we can put them on the
|
case "$DEB_BUILD_OPTIONS" in
|
||||||
# PYTHONPATH without putting the uninstalled synapse on the pythonpath.
|
*nocheck*)
|
||||||
tmpdir=`mktemp -d`
|
# Skip running tests if "nocheck" present in $DEB_BUILD_OPTIONS
|
||||||
trap "rm -r $tmpdir" EXIT
|
;;
|
||||||
|
|
||||||
cp -r tests "$tmpdir"
|
*)
|
||||||
|
# Copy tests to a temporary directory so that we can put them on the
|
||||||
|
# PYTHONPATH without putting the uninstalled synapse on the pythonpath.
|
||||||
|
tmpdir=`mktemp -d`
|
||||||
|
trap "rm -r $tmpdir" EXIT
|
||||||
|
|
||||||
PYTHONPATH="$tmpdir" \
|
cp -r tests "$tmpdir"
|
||||||
"${TARGET_PYTHON}" -B -m twisted.trial --reporter=text -j2 tests
|
|
||||||
|
PYTHONPATH="$tmpdir" \
|
||||||
|
"${TARGET_PYTHON}" -m twisted.trial --reporter=text -j2 tests
|
||||||
|
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
# build the config file
|
# build the config file
|
||||||
"${TARGET_PYTHON}" -B "${VIRTUALENV_DIR}/bin/generate_config" \
|
"${TARGET_PYTHON}" "${VIRTUALENV_DIR}/bin/generate_config" \
|
||||||
--config-dir="/etc/matrix-synapse" \
|
--config-dir="/etc/matrix-synapse" \
|
||||||
--data-dir="/var/lib/matrix-synapse" |
|
--data-dir="/var/lib/matrix-synapse" |
|
||||||
perl -pe '
|
perl -pe '
|
||||||
@@ -87,7 +96,7 @@ PYTHONPATH="$tmpdir" \
|
|||||||
' > "${PACKAGE_BUILD_DIR}/etc/matrix-synapse/homeserver.yaml"
|
' > "${PACKAGE_BUILD_DIR}/etc/matrix-synapse/homeserver.yaml"
|
||||||
|
|
||||||
# build the log config file
|
# build the log config file
|
||||||
"${TARGET_PYTHON}" -B "${VIRTUALENV_DIR}/bin/generate_log_config" \
|
"${TARGET_PYTHON}" "${VIRTUALENV_DIR}/bin/generate_log_config" \
|
||||||
--output-file="${PACKAGE_BUILD_DIR}/etc/matrix-synapse/log.yaml"
|
--output-file="${PACKAGE_BUILD_DIR}/etc/matrix-synapse/log.yaml"
|
||||||
|
|
||||||
# add a dependency on the right version of python to substvars.
|
# add a dependency on the right version of python to substvars.
|
||||||
|
|||||||
92
debian/changelog
vendored
92
debian/changelog
vendored
@@ -1,3 +1,95 @@
|
|||||||
|
matrix-synapse-py3 (1.35.1) stable; urgency=medium
|
||||||
|
|
||||||
|
* New synapse release 1.35.1.
|
||||||
|
|
||||||
|
-- Synapse Packaging team <packages@matrix.org> Thu, 03 Jun 2021 08:11:29 -0400
|
||||||
|
|
||||||
|
matrix-synapse-py3 (1.35.0) stable; urgency=medium
|
||||||
|
|
||||||
|
* New synapse release 1.35.0.
|
||||||
|
|
||||||
|
-- Synapse Packaging team <packages@matrix.org> Tue, 01 Jun 2021 13:23:35 +0100
|
||||||
|
|
||||||
|
matrix-synapse-py3 (1.34.0) stable; urgency=medium
|
||||||
|
|
||||||
|
* New synapse release 1.34.0.
|
||||||
|
|
||||||
|
-- Synapse Packaging team <packages@matrix.org> Mon, 17 May 2021 11:34:18 +0100
|
||||||
|
|
||||||
|
matrix-synapse-py3 (1.33.2) stable; urgency=medium
|
||||||
|
|
||||||
|
* New synapse release 1.33.2.
|
||||||
|
|
||||||
|
-- Synapse Packaging team <packages@matrix.org> Tue, 11 May 2021 11:17:59 +0100
|
||||||
|
|
||||||
|
matrix-synapse-py3 (1.33.1) stable; urgency=medium
|
||||||
|
|
||||||
|
* New synapse release 1.33.1.
|
||||||
|
|
||||||
|
-- Synapse Packaging team <packages@matrix.org> Thu, 06 May 2021 14:06:33 +0100
|
||||||
|
|
||||||
|
matrix-synapse-py3 (1.33.0) stable; urgency=medium
|
||||||
|
|
||||||
|
* New synapse release 1.33.0.
|
||||||
|
|
||||||
|
-- Synapse Packaging team <packages@matrix.org> Wed, 05 May 2021 14:15:27 +0100
|
||||||
|
|
||||||
|
matrix-synapse-py3 (1.32.2) stable; urgency=medium
|
||||||
|
|
||||||
|
* New synapse release 1.32.2.
|
||||||
|
|
||||||
|
-- Synapse Packaging team <packages@matrix.org> Wed, 22 Apr 2021 12:43:52 +0100
|
||||||
|
|
||||||
|
matrix-synapse-py3 (1.32.1) stable; urgency=medium
|
||||||
|
|
||||||
|
* New synapse release 1.32.1.
|
||||||
|
|
||||||
|
-- Synapse Packaging team <packages@matrix.org> Wed, 21 Apr 2021 14:00:55 +0100
|
||||||
|
|
||||||
|
matrix-synapse-py3 (1.32.0) stable; urgency=medium
|
||||||
|
|
||||||
|
[ Dan Callahan ]
|
||||||
|
* Skip tests when DEB_BUILD_OPTIONS contains "nocheck".
|
||||||
|
|
||||||
|
[ Synapse Packaging team ]
|
||||||
|
* New synapse release 1.32.0.
|
||||||
|
|
||||||
|
-- Synapse Packaging team <packages@matrix.org> Tue, 20 Apr 2021 14:28:39 +0100
|
||||||
|
|
||||||
|
matrix-synapse-py3 (1.31.0) stable; urgency=medium
|
||||||
|
|
||||||
|
* New synapse release 1.31.0.
|
||||||
|
|
||||||
|
-- Synapse Packaging team <packages@matrix.org> Tue, 06 Apr 2021 13:08:29 +0100
|
||||||
|
|
||||||
|
matrix-synapse-py3 (1.30.1) stable; urgency=medium
|
||||||
|
|
||||||
|
* New synapse release 1.30.1.
|
||||||
|
|
||||||
|
-- Synapse Packaging team <packages@matrix.org> Fri, 26 Mar 2021 12:01:28 +0000
|
||||||
|
|
||||||
|
matrix-synapse-py3 (1.30.0) stable; urgency=medium
|
||||||
|
|
||||||
|
* New synapse release 1.30.0.
|
||||||
|
|
||||||
|
-- Synapse Packaging team <packages@matrix.org> Mon, 22 Mar 2021 13:15:34 +0000
|
||||||
|
|
||||||
|
matrix-synapse-py3 (1.29.0) stable; urgency=medium
|
||||||
|
|
||||||
|
[ Jonathan de Jong ]
|
||||||
|
* Remove the python -B flag (don't generate bytecode) in scripts and documentation.
|
||||||
|
|
||||||
|
[ Synapse Packaging team ]
|
||||||
|
* New synapse release 1.29.0.
|
||||||
|
|
||||||
|
-- Synapse Packaging team <packages@matrix.org> Mon, 08 Mar 2021 13:51:50 +0000
|
||||||
|
|
||||||
|
matrix-synapse-py3 (1.28.0) stable; urgency=medium
|
||||||
|
|
||||||
|
* New synapse release 1.28.0.
|
||||||
|
|
||||||
|
-- Synapse Packaging team <packages@matrix.org> Thu, 25 Feb 2021 10:21:57 +0000
|
||||||
|
|
||||||
matrix-synapse-py3 (1.27.0) stable; urgency=medium
|
matrix-synapse-py3 (1.27.0) stable; urgency=medium
|
||||||
|
|
||||||
[ Dan Callahan ]
|
[ Dan Callahan ]
|
||||||
|
|||||||
2
debian/synctl.1
vendored
2
debian/synctl.1
vendored
@@ -44,7 +44,7 @@ Configuration file may be generated as follows:
|
|||||||
.
|
.
|
||||||
.nf
|
.nf
|
||||||
|
|
||||||
$ python \-B \-m synapse\.app\.homeserver \-c config\.yaml \-\-generate\-config \-\-server\-name=<server name>
|
$ python \-m synapse\.app\.homeserver \-c config\.yaml \-\-generate\-config \-\-server\-name=<server name>
|
||||||
.
|
.
|
||||||
.fi
|
.fi
|
||||||
.
|
.
|
||||||
|
|||||||
2
debian/synctl.ronn
vendored
2
debian/synctl.ronn
vendored
@@ -41,7 +41,7 @@ process.
|
|||||||
|
|
||||||
Configuration file may be generated as follows:
|
Configuration file may be generated as follows:
|
||||||
|
|
||||||
$ python -B -m synapse.app.homeserver -c config.yaml --generate-config --server-name=<server name>
|
$ python -m synapse.app.homeserver -c config.yaml --generate-config --server-name=<server name>
|
||||||
|
|
||||||
## ENVIRONMENT
|
## ENVIRONMENT
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
DIR="$( cd "$( dirname "$0" )" && pwd )"
|
DIR="$( cd "$( dirname "$0" )" && pwd )"
|
||||||
|
|
||||||
@@ -96,18 +96,48 @@ for port in 8080 8081 8082; do
|
|||||||
# Check script parameters
|
# Check script parameters
|
||||||
if [ $# -eq 1 ]; then
|
if [ $# -eq 1 ]; then
|
||||||
if [ $1 = "--no-rate-limit" ]; then
|
if [ $1 = "--no-rate-limit" ]; then
|
||||||
# messages rate limit
|
|
||||||
echo 'rc_messages_per_second: 1000' >> $DIR/etc/$port.config
|
|
||||||
echo 'rc_message_burst_count: 1000' >> $DIR/etc/$port.config
|
|
||||||
|
|
||||||
# registration rate limit
|
# Disable any rate limiting
|
||||||
printf 'rc_registration:\n per_second: 1000\n burst_count: 1000\n' >> $DIR/etc/$port.config
|
ratelimiting=$(cat <<-RC
|
||||||
|
rc_message:
|
||||||
# login rate limit
|
per_second: 1000
|
||||||
echo 'rc_login:' >> $DIR/etc/$port.config
|
burst_count: 1000
|
||||||
printf ' address:\n per_second: 1000\n burst_count: 1000\n' >> $DIR/etc/$port.config
|
rc_registration:
|
||||||
printf ' account:\n per_second: 1000\n burst_count: 1000\n' >> $DIR/etc/$port.config
|
per_second: 1000
|
||||||
printf ' failed_attempts:\n per_second: 1000\n burst_count: 1000\n' >> $DIR/etc/$port.config
|
burst_count: 1000
|
||||||
|
rc_login:
|
||||||
|
address:
|
||||||
|
per_second: 1000
|
||||||
|
burst_count: 1000
|
||||||
|
account:
|
||||||
|
per_second: 1000
|
||||||
|
burst_count: 1000
|
||||||
|
failed_attempts:
|
||||||
|
per_second: 1000
|
||||||
|
burst_count: 1000
|
||||||
|
rc_admin_redaction:
|
||||||
|
per_second: 1000
|
||||||
|
burst_count: 1000
|
||||||
|
rc_joins:
|
||||||
|
local:
|
||||||
|
per_second: 1000
|
||||||
|
burst_count: 1000
|
||||||
|
remote:
|
||||||
|
per_second: 1000
|
||||||
|
burst_count: 1000
|
||||||
|
rc_3pid_validation:
|
||||||
|
per_second: 1000
|
||||||
|
burst_count: 1000
|
||||||
|
rc_invites:
|
||||||
|
per_room:
|
||||||
|
per_second: 1000
|
||||||
|
burst_count: 1000
|
||||||
|
per_user:
|
||||||
|
per_second: 1000
|
||||||
|
burst_count: 1000
|
||||||
|
RC
|
||||||
|
)
|
||||||
|
echo "${ratelimiting}" >> $DIR/etc/$port.config
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
DIR="$( cd "$( dirname "$0" )" && pwd )"
|
DIR="$( cd "$( dirname "$0" )" && pwd )"
|
||||||
|
|
||||||
|
|||||||
@@ -28,33 +28,32 @@ RUN apt-get update && apt-get install -y \
|
|||||||
libwebp-dev \
|
libwebp-dev \
|
||||||
libxml++2.6-dev \
|
libxml++2.6-dev \
|
||||||
libxslt1-dev \
|
libxslt1-dev \
|
||||||
|
openssl \
|
||||||
rustc \
|
rustc \
|
||||||
zlib1g-dev \
|
zlib1g-dev \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Build dependencies that are not available as wheels, to speed up rebuilds
|
# Copy just what we need to pip install
|
||||||
RUN pip install --prefix="/install" --no-warn-script-location \
|
|
||||||
cryptography \
|
|
||||||
frozendict \
|
|
||||||
jaeger-client \
|
|
||||||
opentracing \
|
|
||||||
# Match the version constraints of Synapse
|
|
||||||
"prometheus_client>=0.4.0" \
|
|
||||||
psycopg2 \
|
|
||||||
pycparser \
|
|
||||||
pyrsistent \
|
|
||||||
pyyaml \
|
|
||||||
simplejson \
|
|
||||||
threadloop \
|
|
||||||
thrift
|
|
||||||
|
|
||||||
# now install synapse and all of the python deps to /install.
|
|
||||||
COPY synapse /synapse/synapse/
|
|
||||||
COPY scripts /synapse/scripts/
|
COPY scripts /synapse/scripts/
|
||||||
COPY MANIFEST.in README.rst setup.py synctl /synapse/
|
COPY MANIFEST.in README.rst setup.py synctl /synapse/
|
||||||
|
COPY synapse/__init__.py /synapse/synapse/__init__.py
|
||||||
|
COPY synapse/python_dependencies.py /synapse/synapse/python_dependencies.py
|
||||||
|
|
||||||
|
# To speed up rebuilds, install all of the dependencies before we copy over
|
||||||
|
# the whole synapse project so that we this layer in the Docker cache can be
|
||||||
|
# used while you develop on the source
|
||||||
|
#
|
||||||
|
# This is aiming at installing the `install_requires` and `extras_require` from `setup.py`
|
||||||
RUN pip install --prefix="/install" --no-warn-script-location \
|
RUN pip install --prefix="/install" --no-warn-script-location \
|
||||||
/synapse[all]
|
/synapse[all]
|
||||||
|
|
||||||
|
# Copy over the rest of the project
|
||||||
|
COPY synapse /synapse/synapse/
|
||||||
|
|
||||||
|
# Install the synapse package itself and all of its children packages.
|
||||||
|
#
|
||||||
|
# This is aiming at installing only the `packages=find_packages(...)` from `setup.py
|
||||||
|
RUN pip install --prefix="/install" --no-deps --no-warn-script-location /synapse
|
||||||
|
|
||||||
###
|
###
|
||||||
### Stage 1: runtime
|
### Stage 1: runtime
|
||||||
@@ -62,6 +61,11 @@ RUN pip install --prefix="/install" --no-warn-script-location \
|
|||||||
|
|
||||||
FROM docker.io/python:${PYTHON_VERSION}-slim
|
FROM docker.io/python:${PYTHON_VERSION}-slim
|
||||||
|
|
||||||
|
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.licenses='Apache-2.0'
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y \
|
RUN apt-get update && apt-get install -y \
|
||||||
curl \
|
curl \
|
||||||
gosu \
|
gosu \
|
||||||
@@ -69,7 +73,10 @@ RUN apt-get update && apt-get install -y \
|
|||||||
libpq5 \
|
libpq5 \
|
||||||
libwebp6 \
|
libwebp6 \
|
||||||
xmlsec1 \
|
xmlsec1 \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
libjemalloc2 \
|
||||||
|
libssl-dev \
|
||||||
|
openssl \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
COPY --from=builder /install /usr/local
|
COPY --from=builder /install /usr/local
|
||||||
COPY ./docker/start.py /start.py
|
COPY ./docker/start.py /start.py
|
||||||
@@ -81,5 +88,5 @@ EXPOSE 8008/tcp 8009/tcp 8448/tcp
|
|||||||
|
|
||||||
ENTRYPOINT ["/start.py"]
|
ENTRYPOINT ["/start.py"]
|
||||||
|
|
||||||
HEALTHCHECK --interval=1m --timeout=5s \
|
HEALTHCHECK --start-period=5s --interval=15s --timeout=5s \
|
||||||
CMD curl -fSs http://localhost:8008/health || exit 1
|
CMD curl -fSs http://localhost:8008/health || exit 1
|
||||||
|
|||||||
23
docker/Dockerfile-workers
Normal file
23
docker/Dockerfile-workers
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
# Inherit from the official Synapse docker image
|
||||||
|
FROM matrixdotorg/synapse
|
||||||
|
|
||||||
|
# Install deps
|
||||||
|
RUN apt-get update
|
||||||
|
RUN apt-get install -y supervisor redis nginx
|
||||||
|
|
||||||
|
# Remove the default nginx sites
|
||||||
|
RUN rm /etc/nginx/sites-enabled/default
|
||||||
|
|
||||||
|
# Copy Synapse worker, nginx and supervisord configuration template files
|
||||||
|
COPY ./docker/conf-workers/* /conf/
|
||||||
|
|
||||||
|
# Expose nginx listener port
|
||||||
|
EXPOSE 8080/tcp
|
||||||
|
|
||||||
|
# Volume for user-editable config files, logs etc.
|
||||||
|
VOLUME ["/data"]
|
||||||
|
|
||||||
|
# A script to read environment variables and create the necessary
|
||||||
|
# files to run the desired worker configuration. Will start supervisord.
|
||||||
|
COPY ./docker/configure_workers_and_start.py /configure_workers_and_start.py
|
||||||
|
ENTRYPOINT ["/configure_workers_and_start.py"]
|
||||||
140
docker/README-testing.md
Normal file
140
docker/README-testing.md
Normal file
@@ -0,0 +1,140 @@
|
|||||||
|
# Running tests against a dockerised Synapse
|
||||||
|
|
||||||
|
It's possible to run integration tests against Synapse
|
||||||
|
using [Complement](https://github.com/matrix-org/complement). Complement is a Matrix Spec
|
||||||
|
compliance test suite for homeservers, and supports any homeserver docker image configured
|
||||||
|
to listen on ports 8008/8448. This document contains instructions for building Synapse
|
||||||
|
docker images that can be run inside Complement for testing purposes.
|
||||||
|
|
||||||
|
Note that running Synapse's unit tests from within the docker image is not supported.
|
||||||
|
|
||||||
|
## Testing with SQLite and single-process Synapse
|
||||||
|
|
||||||
|
> Note that `scripts-dev/complement.sh` is a script that will automatically build
|
||||||
|
> and run an SQLite-based, single-process of Synapse against Complement.
|
||||||
|
|
||||||
|
The instructions below will set up Complement testing for a single-process,
|
||||||
|
SQLite-based Synapse deployment.
|
||||||
|
|
||||||
|
Start by building the base Synapse docker image. If you wish to run tests with the latest
|
||||||
|
release of Synapse, instead of your current checkout, you can skip this step. From the
|
||||||
|
root of the repository:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
docker build -t matrixdotorg/synapse -f docker/Dockerfile .
|
||||||
|
```
|
||||||
|
|
||||||
|
This will build an image with the tag `matrixdotorg/synapse`.
|
||||||
|
|
||||||
|
Next, build the Synapse image for Complement. You will need a local checkout
|
||||||
|
of Complement. Change to the root of your Complement checkout and run:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
docker build -t complement-synapse -f "dockerfiles/Synapse.Dockerfile" dockerfiles
|
||||||
|
```
|
||||||
|
|
||||||
|
This will build an image with the tag `complement-synapse`, which can be handed to
|
||||||
|
Complement for testing via the `COMPLEMENT_BASE_IMAGE` environment variable. Refer to
|
||||||
|
[Complement's documentation](https://github.com/matrix-org/complement/#running) for
|
||||||
|
how to run the tests, as well as the various available command line flags.
|
||||||
|
|
||||||
|
## Testing with PostgreSQL and single or multi-process Synapse
|
||||||
|
|
||||||
|
The above docker image only supports running Synapse with SQLite and in a
|
||||||
|
single-process topology. The following instructions are used to build a Synapse image for
|
||||||
|
Complement that supports either single or multi-process topology with a PostgreSQL
|
||||||
|
database backend.
|
||||||
|
|
||||||
|
As with the single-process image, build the base Synapse docker image. If you wish to run
|
||||||
|
tests with the latest release of Synapse, instead of your current checkout, you can skip
|
||||||
|
this step. From the root of the repository:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
docker build -t matrixdotorg/synapse -f docker/Dockerfile .
|
||||||
|
```
|
||||||
|
|
||||||
|
This will build an image with the tag `matrixdotorg/synapse`.
|
||||||
|
|
||||||
|
Next, we build a new image with worker support based on `matrixdotorg/synapse:latest`.
|
||||||
|
Again, from the root of the repository:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
docker build -t matrixdotorg/synapse-workers -f docker/Dockerfile-workers .
|
||||||
|
```
|
||||||
|
|
||||||
|
This will build an image with the tag` matrixdotorg/synapse-workers`.
|
||||||
|
|
||||||
|
It's worth noting at this point that this image is fully functional, and
|
||||||
|
can be used for testing against locally. See instructions for using the container
|
||||||
|
under
|
||||||
|
[Running the Dockerfile-worker image standalone](#running-the-dockerfile-worker-image-standalone)
|
||||||
|
below.
|
||||||
|
|
||||||
|
Finally, build the Synapse image for Complement, which is based on
|
||||||
|
`matrixdotorg/synapse-workers`. You will need a local checkout of Complement. Change to
|
||||||
|
the root of your Complement checkout and run:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
docker build -t matrixdotorg/complement-synapse-workers -f dockerfiles/SynapseWorkers.Dockerfile dockerfiles
|
||||||
|
```
|
||||||
|
|
||||||
|
This will build an image with the tag `complement-synapse`, which can be handed to
|
||||||
|
Complement for testing via the `COMPLEMENT_BASE_IMAGE` environment variable. Refer to
|
||||||
|
[Complement's documentation](https://github.com/matrix-org/complement/#running) for
|
||||||
|
how to run the tests, as well as the various available command line flags.
|
||||||
|
|
||||||
|
## Running the Dockerfile-worker image standalone
|
||||||
|
|
||||||
|
For manual testing of a multi-process Synapse instance in Docker,
|
||||||
|
[Dockerfile-workers](Dockerfile-workers) is a Dockerfile that will produce an image
|
||||||
|
bundling all necessary components together for a workerised homeserver instance.
|
||||||
|
|
||||||
|
This includes any desired Synapse worker processes, a nginx to route traffic accordingly,
|
||||||
|
a redis for worker communication and a supervisord instance to start up and monitor all
|
||||||
|
processes. You will need to provide your own postgres container to connect to, and TLS
|
||||||
|
is not handled by the container.
|
||||||
|
|
||||||
|
Once you've built the image using the above instructions, you can run it. Be sure
|
||||||
|
you've set up a volume according to the [usual Synapse docker instructions](README.md).
|
||||||
|
Then run something along the lines of:
|
||||||
|
|
||||||
|
```
|
||||||
|
docker run -d --name synapse \
|
||||||
|
--mount type=volume,src=synapse-data,dst=/data \
|
||||||
|
-p 8008:8008 \
|
||||||
|
-e SYNAPSE_SERVER_NAME=my.matrix.host \
|
||||||
|
-e SYNAPSE_REPORT_STATS=no \
|
||||||
|
-e POSTGRES_HOST=postgres \
|
||||||
|
-e POSTGRES_USER=postgres \
|
||||||
|
-e POSTGRES_PASSWORD=somesecret \
|
||||||
|
-e SYNAPSE_WORKER_TYPES=synchrotron,media_repository,user_dir \
|
||||||
|
-e SYNAPSE_WORKERS_WRITE_LOGS_TO_DISK=1 \
|
||||||
|
matrixdotorg/synapse-workers
|
||||||
|
```
|
||||||
|
|
||||||
|
...substituting `POSTGRES*` variables for those that match a postgres host you have
|
||||||
|
available (usually a running postgres docker container).
|
||||||
|
|
||||||
|
The `SYNAPSE_WORKER_TYPES` environment variable is a comma-separated list of workers to
|
||||||
|
use when running the container. All possible worker names are defined by the keys of the
|
||||||
|
`WORKERS_CONFIG` variable in [this script](configure_workers_and_start.py), which the
|
||||||
|
Dockerfile makes use of to generate appropriate worker, nginx and supervisord config
|
||||||
|
files.
|
||||||
|
|
||||||
|
Sharding is supported for a subset of workers, in line with the
|
||||||
|
[worker documentation](../docs/workers.md). To run multiple instances of a given worker
|
||||||
|
type, simply specify the type multiple times in `SYNAPSE_WORKER_TYPES`
|
||||||
|
(e.g `SYNAPSE_WORKER_TYPES=event_creator,event_creator...`).
|
||||||
|
|
||||||
|
Otherwise, `SYNAPSE_WORKER_TYPES` can either be left empty or unset to spawn no workers
|
||||||
|
(leaving only the main process). The container is configured to use redis-based worker
|
||||||
|
mode.
|
||||||
|
|
||||||
|
Logs for workers and the main process are logged to stdout and can be viewed with
|
||||||
|
standard `docker logs` tooling. Worker logs contain their worker name
|
||||||
|
after the timestamp.
|
||||||
|
|
||||||
|
Setting `SYNAPSE_WORKERS_WRITE_LOGS_TO_DISK=1` will cause worker logs to be written to
|
||||||
|
`<data_dir>/logs/<worker_name>.log`. Logs are kept for 1 week and rotate every day at 00:
|
||||||
|
00, according to the container's clock. Logging for the main process must still be
|
||||||
|
configured by modifying the homeserver's log config in your Synapse data volume.
|
||||||
@@ -2,26 +2,28 @@
|
|||||||
|
|
||||||
This Docker image will run Synapse as a single process. By default it uses a
|
This Docker image will run Synapse as a single process. By default it uses a
|
||||||
sqlite database; for production use you should connect it to a separate
|
sqlite database; for production use you should connect it to a separate
|
||||||
postgres database.
|
postgres database. The image also does *not* provide a TURN server.
|
||||||
|
|
||||||
The image also does *not* provide a TURN server.
|
This image should work on all platforms that are supported by Docker upstream.
|
||||||
|
Note that Docker's WS1-backend Linux Containers on Windows
|
||||||
|
platform is [experimental](https://github.com/docker/for-win/issues/6470) and
|
||||||
|
is not supported by this image.
|
||||||
|
|
||||||
## Volumes
|
## Volumes
|
||||||
|
|
||||||
By default, the image expects a single volume, located at ``/data``, that will hold:
|
By default, the image expects a single volume, located at `/data`, that will hold:
|
||||||
|
|
||||||
* configuration files;
|
* configuration files;
|
||||||
* temporary files during uploads;
|
|
||||||
* uploaded media and thumbnails;
|
* uploaded media and thumbnails;
|
||||||
* the SQLite database if you do not configure postgres;
|
* the SQLite database if you do not configure postgres;
|
||||||
* the appservices configuration.
|
* the appservices configuration.
|
||||||
|
|
||||||
You are free to use separate volumes depending on storage endpoints at your
|
You are free to use separate volumes depending on storage endpoints at your
|
||||||
disposal. For instance, ``/data/media`` could be stored on a large but low
|
disposal. For instance, `/data/media` could be stored on a large but low
|
||||||
performance hdd storage while other files could be stored on high performance
|
performance hdd storage while other files could be stored on high performance
|
||||||
endpoints.
|
endpoints.
|
||||||
|
|
||||||
In order to setup an application service, simply create an ``appservices``
|
In order to setup an application service, simply create an `appservices`
|
||||||
directory in the data volume and write the application service Yaml
|
directory in the data volume and write the application service Yaml
|
||||||
configuration file there. Multiple application services are supported.
|
configuration file there. Multiple application services are supported.
|
||||||
|
|
||||||
@@ -54,6 +56,8 @@ The following environment variables are supported in `generate` mode:
|
|||||||
* `SYNAPSE_SERVER_NAME` (mandatory): the server public hostname.
|
* `SYNAPSE_SERVER_NAME` (mandatory): the server public hostname.
|
||||||
* `SYNAPSE_REPORT_STATS` (mandatory, `yes` or `no`): whether to enable
|
* `SYNAPSE_REPORT_STATS` (mandatory, `yes` or `no`): whether to enable
|
||||||
anonymous statistics reporting.
|
anonymous statistics reporting.
|
||||||
|
* `SYNAPSE_HTTP_PORT`: the port Synapse should listen on for http traffic.
|
||||||
|
Defaults to `8008`.
|
||||||
* `SYNAPSE_CONFIG_DIR`: where additional config files (such as the log config
|
* `SYNAPSE_CONFIG_DIR`: where additional config files (such as the log config
|
||||||
and event signing key) will be stored. Defaults to `/data`.
|
and event signing key) will be stored. Defaults to `/data`.
|
||||||
* `SYNAPSE_CONFIG_PATH`: path to the file to be generated. Defaults to
|
* `SYNAPSE_CONFIG_PATH`: path to the file to be generated. Defaults to
|
||||||
@@ -74,6 +78,8 @@ docker run -d --name synapse \
|
|||||||
matrixdotorg/synapse:latest
|
matrixdotorg/synapse:latest
|
||||||
```
|
```
|
||||||
|
|
||||||
|
(assuming 8008 is the port Synapse is configured to listen on for http traffic.)
|
||||||
|
|
||||||
You can then check that it has started correctly with:
|
You can then check that it has started correctly with:
|
||||||
|
|
||||||
```
|
```
|
||||||
@@ -185,6 +191,16 @@ whilst running the above `docker run` commands.
|
|||||||
```
|
```
|
||||||
--no-healthcheck
|
--no-healthcheck
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Disabling the healthcheck in docker-compose file
|
||||||
|
|
||||||
|
If you wish to disable the healthcheck via docker-compose, append the following to your service configuration.
|
||||||
|
|
||||||
|
```
|
||||||
|
healthcheck:
|
||||||
|
disable: true
|
||||||
|
```
|
||||||
|
|
||||||
## Setting custom healthcheck on docker run
|
## Setting custom healthcheck on docker run
|
||||||
|
|
||||||
If you wish to point the healthcheck at a different port with docker command, add the following
|
If you wish to point the healthcheck at a different port with docker command, add the following
|
||||||
@@ -196,12 +212,18 @@ If you wish to point the healthcheck at a different port with docker command, ad
|
|||||||
## Setting the healthcheck in docker-compose file
|
## Setting the healthcheck in docker-compose file
|
||||||
|
|
||||||
You can add the following to set a custom healthcheck in a docker compose file.
|
You can add the following to set a custom healthcheck in a docker compose file.
|
||||||
You will need version >2.1 for this to work.
|
You will need docker-compose version >2.1 for this to work.
|
||||||
|
|
||||||
```
|
```
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "curl", "-fSs", "http://localhost:8008/health"]
|
test: ["CMD", "curl", "-fSs", "http://localhost:8008/health"]
|
||||||
interval: 1m
|
interval: 15s
|
||||||
timeout: 10s
|
timeout: 5s
|
||||||
retries: 3
|
retries: 3
|
||||||
|
start_period: 5s
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Using jemalloc
|
||||||
|
|
||||||
|
Jemalloc is embedded in the image and will be used instead of the default allocator.
|
||||||
|
You can read about jemalloc by reading the Synapse [README](../README.md).
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# The script to build the Debian package, as ran inside the Docker image.
|
# The script to build the Debian package, as ran inside the Docker image.
|
||||||
|
|
||||||
|
|||||||
27
docker/conf-workers/nginx.conf.j2
Normal file
27
docker/conf-workers/nginx.conf.j2
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
# This file contains the base config for the reverse proxy, as part of ../Dockerfile-workers.
|
||||||
|
# configure_workers_and_start.py uses and amends to this file depending on the workers
|
||||||
|
# that have been selected.
|
||||||
|
|
||||||
|
{{ upstream_directives }}
|
||||||
|
|
||||||
|
server {
|
||||||
|
# Listen on an unoccupied port number
|
||||||
|
listen 8008;
|
||||||
|
listen [::]:8008;
|
||||||
|
|
||||||
|
server_name localhost;
|
||||||
|
|
||||||
|
# Nginx by default only allows file uploads up to 1M in size
|
||||||
|
# Increase client_max_body_size to match max_upload_size defined in homeserver.yaml
|
||||||
|
client_max_body_size 100M;
|
||||||
|
|
||||||
|
{{ worker_locations }}
|
||||||
|
|
||||||
|
# Send all other traffic to the main process
|
||||||
|
location ~* ^(\\/_matrix|\\/_synapse) {
|
||||||
|
proxy_pass http://localhost:8080;
|
||||||
|
proxy_set_header X-Forwarded-For $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
}
|
||||||
|
}
|
||||||
9
docker/conf-workers/shared.yaml.j2
Normal file
9
docker/conf-workers/shared.yaml.j2
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
# This file contains the base for the shared homeserver config file between Synapse workers,
|
||||||
|
# as part of ./Dockerfile-workers.
|
||||||
|
# configure_workers_and_start.py uses and amends to this file depending on the workers
|
||||||
|
# that have been selected.
|
||||||
|
|
||||||
|
redis:
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
{{ shared_worker_config }}
|
||||||
41
docker/conf-workers/supervisord.conf.j2
Normal file
41
docker/conf-workers/supervisord.conf.j2
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
# This file contains the base config for supervisord, as part of ../Dockerfile-workers.
|
||||||
|
# configure_workers_and_start.py uses and amends to this file depending on the workers
|
||||||
|
# that have been selected.
|
||||||
|
[supervisord]
|
||||||
|
nodaemon=true
|
||||||
|
user=root
|
||||||
|
|
||||||
|
[program:nginx]
|
||||||
|
command=/usr/sbin/nginx -g "daemon off;"
|
||||||
|
priority=500
|
||||||
|
stdout_logfile=/dev/stdout
|
||||||
|
stdout_logfile_maxbytes=0
|
||||||
|
stderr_logfile=/dev/stderr
|
||||||
|
stderr_logfile_maxbytes=0
|
||||||
|
username=www-data
|
||||||
|
autorestart=true
|
||||||
|
|
||||||
|
[program:redis]
|
||||||
|
command=/usr/bin/redis-server /etc/redis/redis.conf --daemonize no
|
||||||
|
priority=1
|
||||||
|
stdout_logfile=/dev/stdout
|
||||||
|
stdout_logfile_maxbytes=0
|
||||||
|
stderr_logfile=/dev/stderr
|
||||||
|
stderr_logfile_maxbytes=0
|
||||||
|
username=redis
|
||||||
|
autorestart=true
|
||||||
|
|
||||||
|
[program:synapse_main]
|
||||||
|
command=/usr/local/bin/python -m synapse.app.homeserver --config-path="{{ main_config_path }}" --config-path=/conf/workers/shared.yaml
|
||||||
|
priority=10
|
||||||
|
# Log startup failures to supervisord's stdout/err
|
||||||
|
# Regular synapse logs will still go in the configured data directory
|
||||||
|
stdout_logfile=/dev/stdout
|
||||||
|
stdout_logfile_maxbytes=0
|
||||||
|
stderr_logfile=/dev/stderr
|
||||||
|
stderr_logfile_maxbytes=0
|
||||||
|
autorestart=unexpected
|
||||||
|
exitcodes=0
|
||||||
|
|
||||||
|
# Additional process blocks
|
||||||
|
{{ worker_config }}
|
||||||
26
docker/conf-workers/worker.yaml.j2
Normal file
26
docker/conf-workers/worker.yaml.j2
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
# This is a configuration template for a single worker instance, and is
|
||||||
|
# used by Dockerfile-workers.
|
||||||
|
# Values will be change depending on whichever workers are selected when
|
||||||
|
# running that image.
|
||||||
|
|
||||||
|
worker_app: "{{ app }}"
|
||||||
|
worker_name: "{{ name }}"
|
||||||
|
|
||||||
|
# The replication listener on the main synapse process.
|
||||||
|
worker_replication_host: 127.0.0.1
|
||||||
|
worker_replication_http_port: 9093
|
||||||
|
|
||||||
|
worker_listeners:
|
||||||
|
- type: http
|
||||||
|
port: {{ port }}
|
||||||
|
{% if listener_resources %}
|
||||||
|
resources:
|
||||||
|
- names:
|
||||||
|
{%- for resource in listener_resources %}
|
||||||
|
- {{ resource }}
|
||||||
|
{%- endfor %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
worker_log_config: {{ worker_log_config_filepath }}
|
||||||
|
|
||||||
|
{{ worker_extra_conf }}
|
||||||
@@ -40,7 +40,9 @@ listeners:
|
|||||||
compress: false
|
compress: false
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
- port: 8008
|
# Allow configuring in case we want to reverse proxy 8008
|
||||||
|
# using another process in the same container
|
||||||
|
- port: {{ SYNAPSE_HTTP_PORT or 8008 }}
|
||||||
tls: false
|
tls: false
|
||||||
bind_addresses: ['::']
|
bind_addresses: ['::']
|
||||||
type: http
|
type: http
|
||||||
@@ -89,7 +91,6 @@ federation_rc_concurrent: 3
|
|||||||
## Files ##
|
## Files ##
|
||||||
|
|
||||||
media_store_path: "/data/media"
|
media_store_path: "/data/media"
|
||||||
uploads_path: "/data/uploads"
|
|
||||||
max_upload_size: "{{ SYNAPSE_MAX_UPLOAD_SIZE or "50M" }}"
|
max_upload_size: "{{ SYNAPSE_MAX_UPLOAD_SIZE or "50M" }}"
|
||||||
max_image_pixels: "32M"
|
max_image_pixels: "32M"
|
||||||
dynamic_thumbnails: false
|
dynamic_thumbnails: false
|
||||||
@@ -174,18 +175,10 @@ report_stats: False
|
|||||||
|
|
||||||
## API Configuration ##
|
## API Configuration ##
|
||||||
|
|
||||||
room_invite_state_types:
|
|
||||||
- "m.room.join_rules"
|
|
||||||
- "m.room.canonical_alias"
|
|
||||||
- "m.room.avatar"
|
|
||||||
- "m.room.name"
|
|
||||||
|
|
||||||
{% if SYNAPSE_APPSERVICES %}
|
{% if SYNAPSE_APPSERVICES %}
|
||||||
app_service_config_files:
|
app_service_config_files:
|
||||||
{% for appservice in SYNAPSE_APPSERVICES %} - "{{ appservice }}"
|
{% for appservice in SYNAPSE_APPSERVICES %} - "{{ appservice }}"
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% else %}
|
|
||||||
app_service_config_files: []
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
macaroon_secret_key: "{{ SYNAPSE_MACAROON_SECRET_KEY }}"
|
macaroon_secret_key: "{{ SYNAPSE_MACAROON_SECRET_KEY }}"
|
||||||
|
|||||||
@@ -2,9 +2,36 @@ version: 1
|
|||||||
|
|
||||||
formatters:
|
formatters:
|
||||||
precise:
|
precise:
|
||||||
format: '%(asctime)s - %(name)s - %(lineno)d - %(levelname)s - %(request)s - %(message)s'
|
{% if worker_name %}
|
||||||
|
format: '%(asctime)s - worker:{{ worker_name }} - %(name)s - %(lineno)d - %(levelname)s - %(request)s - %(message)s'
|
||||||
|
{% else %}
|
||||||
|
format: '%(asctime)s - %(name)s - %(lineno)d - %(levelname)s - %(request)s - %(message)s'
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
handlers:
|
handlers:
|
||||||
|
{% if LOG_FILE_PATH %}
|
||||||
|
file:
|
||||||
|
class: logging.handlers.TimedRotatingFileHandler
|
||||||
|
formatter: precise
|
||||||
|
filename: {{ LOG_FILE_PATH }}
|
||||||
|
when: "midnight"
|
||||||
|
backupCount: 6 # Does not include the current log file.
|
||||||
|
encoding: utf8
|
||||||
|
|
||||||
|
# Default to buffering writes to log file for efficiency. This means that
|
||||||
|
# there will be a delay for INFO/DEBUG logs to get written, but WARNING/ERROR
|
||||||
|
# logs will still be flushed immediately.
|
||||||
|
buffer:
|
||||||
|
class: logging.handlers.MemoryHandler
|
||||||
|
target: file
|
||||||
|
# The capacity is the number of log lines that are buffered before
|
||||||
|
# being written to disk. Increasing this will lead to better
|
||||||
|
# performance, at the expensive of it taking longer for log lines to
|
||||||
|
# be written to disk.
|
||||||
|
capacity: 10
|
||||||
|
flushLevel: 30 # Flush for WARNING logs as well
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
console:
|
console:
|
||||||
class: logging.StreamHandler
|
class: logging.StreamHandler
|
||||||
formatter: precise
|
formatter: precise
|
||||||
@@ -17,6 +44,11 @@ loggers:
|
|||||||
|
|
||||||
root:
|
root:
|
||||||
level: {{ SYNAPSE_LOG_LEVEL or "INFO" }}
|
level: {{ SYNAPSE_LOG_LEVEL or "INFO" }}
|
||||||
|
|
||||||
|
{% if LOG_FILE_PATH %}
|
||||||
|
handlers: [console, buffer]
|
||||||
|
{% else %}
|
||||||
handlers: [console]
|
handlers: [console]
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
disable_existing_loggers: false
|
disable_existing_loggers: false
|
||||||
|
|||||||
558
docker/configure_workers_and_start.py
Executable file
558
docker/configure_workers_and_start.py
Executable file
@@ -0,0 +1,558 @@
|
|||||||
|
#!/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
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
# The environment variables it reads are:
|
||||||
|
# * SYNAPSE_SERVER_NAME: The desired server_name of the homeserver.
|
||||||
|
# * SYNAPSE_REPORT_STATS: Whether to report stats.
|
||||||
|
# * SYNAPSE_WORKER_TYPES: A comma separated list of worker names as specified in WORKER_CONFIG
|
||||||
|
# below. Leave empty for no workers, or set to '*' for all possible workers.
|
||||||
|
#
|
||||||
|
# NOTE: According to Complement's ENTRYPOINT expectations for a homeserver image (as defined
|
||||||
|
# in the project's README), this script may be run multiple times, and functionality should
|
||||||
|
# continue to work if so.
|
||||||
|
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
|
||||||
|
import jinja2
|
||||||
|
import yaml
|
||||||
|
|
||||||
|
MAIN_PROCESS_HTTP_LISTENER_PORT = 8080
|
||||||
|
|
||||||
|
|
||||||
|
WORKERS_CONFIG = {
|
||||||
|
"pusher": {
|
||||||
|
"app": "synapse.app.pusher",
|
||||||
|
"listener_resources": [],
|
||||||
|
"endpoint_patterns": [],
|
||||||
|
"shared_extra_conf": {"start_pushers": False},
|
||||||
|
"worker_extra_conf": "",
|
||||||
|
},
|
||||||
|
"user_dir": {
|
||||||
|
"app": "synapse.app.user_dir",
|
||||||
|
"listener_resources": ["client"],
|
||||||
|
"endpoint_patterns": [
|
||||||
|
"^/_matrix/client/(api/v1|r0|unstable)/user_directory/search$"
|
||||||
|
],
|
||||||
|
"shared_extra_conf": {"update_user_directory": False},
|
||||||
|
"worker_extra_conf": "",
|
||||||
|
},
|
||||||
|
"media_repository": {
|
||||||
|
"app": "synapse.app.media_repository",
|
||||||
|
"listener_resources": ["media"],
|
||||||
|
"endpoint_patterns": [
|
||||||
|
"^/_matrix/media/",
|
||||||
|
"^/_synapse/admin/v1/purge_media_cache$",
|
||||||
|
"^/_synapse/admin/v1/room/.*/media.*$",
|
||||||
|
"^/_synapse/admin/v1/user/.*/media.*$",
|
||||||
|
"^/_synapse/admin/v1/media/.*$",
|
||||||
|
"^/_synapse/admin/v1/quarantine_media/.*$",
|
||||||
|
],
|
||||||
|
"shared_extra_conf": {"enable_media_repo": False},
|
||||||
|
"worker_extra_conf": "enable_media_repo: true",
|
||||||
|
},
|
||||||
|
"appservice": {
|
||||||
|
"app": "synapse.app.appservice",
|
||||||
|
"listener_resources": [],
|
||||||
|
"endpoint_patterns": [],
|
||||||
|
"shared_extra_conf": {"notify_appservices": False},
|
||||||
|
"worker_extra_conf": "",
|
||||||
|
},
|
||||||
|
"federation_sender": {
|
||||||
|
"app": "synapse.app.federation_sender",
|
||||||
|
"listener_resources": [],
|
||||||
|
"endpoint_patterns": [],
|
||||||
|
"shared_extra_conf": {"send_federation": False},
|
||||||
|
"worker_extra_conf": "",
|
||||||
|
},
|
||||||
|
"synchrotron": {
|
||||||
|
"app": "synapse.app.generic_worker",
|
||||||
|
"listener_resources": ["client"],
|
||||||
|
"endpoint_patterns": [
|
||||||
|
"^/_matrix/client/(v2_alpha|r0)/sync$",
|
||||||
|
"^/_matrix/client/(api/v1|v2_alpha|r0)/events$",
|
||||||
|
"^/_matrix/client/(api/v1|r0)/initialSync$",
|
||||||
|
"^/_matrix/client/(api/v1|r0)/rooms/[^/]+/initialSync$",
|
||||||
|
],
|
||||||
|
"shared_extra_conf": {},
|
||||||
|
"worker_extra_conf": "",
|
||||||
|
},
|
||||||
|
"federation_reader": {
|
||||||
|
"app": "synapse.app.generic_worker",
|
||||||
|
"listener_resources": ["federation"],
|
||||||
|
"endpoint_patterns": [
|
||||||
|
"^/_matrix/federation/(v1|v2)/event/",
|
||||||
|
"^/_matrix/federation/(v1|v2)/state/",
|
||||||
|
"^/_matrix/federation/(v1|v2)/state_ids/",
|
||||||
|
"^/_matrix/federation/(v1|v2)/backfill/",
|
||||||
|
"^/_matrix/federation/(v1|v2)/get_missing_events/",
|
||||||
|
"^/_matrix/federation/(v1|v2)/publicRooms",
|
||||||
|
"^/_matrix/federation/(v1|v2)/query/",
|
||||||
|
"^/_matrix/federation/(v1|v2)/make_join/",
|
||||||
|
"^/_matrix/federation/(v1|v2)/make_leave/",
|
||||||
|
"^/_matrix/federation/(v1|v2)/send_join/",
|
||||||
|
"^/_matrix/federation/(v1|v2)/send_leave/",
|
||||||
|
"^/_matrix/federation/(v1|v2)/invite/",
|
||||||
|
"^/_matrix/federation/(v1|v2)/query_auth/",
|
||||||
|
"^/_matrix/federation/(v1|v2)/event_auth/",
|
||||||
|
"^/_matrix/federation/(v1|v2)/exchange_third_party_invite/",
|
||||||
|
"^/_matrix/federation/(v1|v2)/user/devices/",
|
||||||
|
"^/_matrix/federation/(v1|v2)/get_groups_publicised$",
|
||||||
|
"^/_matrix/key/v2/query",
|
||||||
|
],
|
||||||
|
"shared_extra_conf": {},
|
||||||
|
"worker_extra_conf": "",
|
||||||
|
},
|
||||||
|
"federation_inbound": {
|
||||||
|
"app": "synapse.app.generic_worker",
|
||||||
|
"listener_resources": ["federation"],
|
||||||
|
"endpoint_patterns": ["/_matrix/federation/(v1|v2)/send/"],
|
||||||
|
"shared_extra_conf": {},
|
||||||
|
"worker_extra_conf": "",
|
||||||
|
},
|
||||||
|
"event_persister": {
|
||||||
|
"app": "synapse.app.generic_worker",
|
||||||
|
"listener_resources": ["replication"],
|
||||||
|
"endpoint_patterns": [],
|
||||||
|
"shared_extra_conf": {},
|
||||||
|
"worker_extra_conf": "",
|
||||||
|
},
|
||||||
|
"background_worker": {
|
||||||
|
"app": "synapse.app.generic_worker",
|
||||||
|
"listener_resources": [],
|
||||||
|
"endpoint_patterns": [],
|
||||||
|
# This worker cannot be sharded. Therefore there should only ever be one background
|
||||||
|
# worker, and it should be named background_worker1
|
||||||
|
"shared_extra_conf": {"run_background_tasks_on": "background_worker1"},
|
||||||
|
"worker_extra_conf": "",
|
||||||
|
},
|
||||||
|
"event_creator": {
|
||||||
|
"app": "synapse.app.generic_worker",
|
||||||
|
"listener_resources": ["client"],
|
||||||
|
"endpoint_patterns": [
|
||||||
|
"^/_matrix/client/(api/v1|r0|unstable)/rooms/.*/redact",
|
||||||
|
"^/_matrix/client/(api/v1|r0|unstable)/rooms/.*/send",
|
||||||
|
"^/_matrix/client/(api/v1|r0|unstable)/rooms/.*/(join|invite|leave|ban|unban|kick)$",
|
||||||
|
"^/_matrix/client/(api/v1|r0|unstable)/join/",
|
||||||
|
"^/_matrix/client/(api/v1|r0|unstable)/profile/",
|
||||||
|
],
|
||||||
|
"shared_extra_conf": {},
|
||||||
|
"worker_extra_conf": "",
|
||||||
|
},
|
||||||
|
"frontend_proxy": {
|
||||||
|
"app": "synapse.app.frontend_proxy",
|
||||||
|
"listener_resources": ["client", "replication"],
|
||||||
|
"endpoint_patterns": ["^/_matrix/client/(api/v1|r0|unstable)/keys/upload"],
|
||||||
|
"shared_extra_conf": {},
|
||||||
|
"worker_extra_conf": (
|
||||||
|
"worker_main_http_uri: http://127.0.0.1:%d"
|
||||||
|
% (MAIN_PROCESS_HTTP_LISTENER_PORT,),
|
||||||
|
),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
# Templates for sections that may be inserted multiple times in config files
|
||||||
|
SUPERVISORD_PROCESS_CONFIG_BLOCK = """
|
||||||
|
[program:synapse_{name}]
|
||||||
|
command=/usr/local/bin/python -m {app} \
|
||||||
|
--config-path="{config_path}" \
|
||||||
|
--config-path=/conf/workers/shared.yaml \
|
||||||
|
--config-path=/conf/workers/{name}.yaml
|
||||||
|
autorestart=unexpected
|
||||||
|
priority=500
|
||||||
|
exitcodes=0
|
||||||
|
stdout_logfile=/dev/stdout
|
||||||
|
stdout_logfile_maxbytes=0
|
||||||
|
stderr_logfile=/dev/stderr
|
||||||
|
stderr_logfile_maxbytes=0
|
||||||
|
"""
|
||||||
|
|
||||||
|
NGINX_LOCATION_CONFIG_BLOCK = """
|
||||||
|
location ~* {endpoint} {{
|
||||||
|
proxy_pass {upstream};
|
||||||
|
proxy_set_header X-Forwarded-For $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
}}
|
||||||
|
"""
|
||||||
|
|
||||||
|
NGINX_UPSTREAM_CONFIG_BLOCK = """
|
||||||
|
upstream {upstream_worker_type} {{
|
||||||
|
{body}
|
||||||
|
}}
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
# Utility functions
|
||||||
|
def log(txt: str):
|
||||||
|
"""Log something to the stdout.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
txt: The text to log.
|
||||||
|
"""
|
||||||
|
print(txt)
|
||||||
|
|
||||||
|
|
||||||
|
def error(txt: str):
|
||||||
|
"""Log something and exit with an error code.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
txt: The text to log in error.
|
||||||
|
"""
|
||||||
|
log(txt)
|
||||||
|
sys.exit(2)
|
||||||
|
|
||||||
|
|
||||||
|
def convert(src: str, dst: str, **template_vars):
|
||||||
|
"""Generate a file from a template
|
||||||
|
|
||||||
|
Args:
|
||||||
|
src: Path to the input file.
|
||||||
|
dst: Path to write to.
|
||||||
|
template_vars: The arguments to replace placeholder variables in the template with.
|
||||||
|
"""
|
||||||
|
# Read the template file
|
||||||
|
with open(src) as infile:
|
||||||
|
template = infile.read()
|
||||||
|
|
||||||
|
# Generate a string from the template. We disable autoescape to prevent template
|
||||||
|
# variables from being escaped.
|
||||||
|
rendered = jinja2.Template(template, autoescape=False).render(**template_vars)
|
||||||
|
|
||||||
|
# Write the generated contents to a file
|
||||||
|
#
|
||||||
|
# We use append mode in case the files have already been written to by something else
|
||||||
|
# (for instance, as part of the instructions in a dockerfile).
|
||||||
|
with open(dst, "a") as outfile:
|
||||||
|
# In case the existing file doesn't end with a newline
|
||||||
|
outfile.write("\n")
|
||||||
|
|
||||||
|
outfile.write(rendered)
|
||||||
|
|
||||||
|
|
||||||
|
def add_sharding_to_shared_config(
|
||||||
|
shared_config: dict,
|
||||||
|
worker_type: str,
|
||||||
|
worker_name: str,
|
||||||
|
worker_port: int,
|
||||||
|
) -> None:
|
||||||
|
"""Given a dictionary representing a config file shared across all workers,
|
||||||
|
append sharded worker information to it for the current worker_type instance.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
shared_config: The config dict that all worker instances share (after being converted to YAML)
|
||||||
|
worker_type: The type of worker (one of those defined in WORKERS_CONFIG).
|
||||||
|
worker_name: The name of the worker instance.
|
||||||
|
worker_port: The HTTP replication port that the worker instance is listening on.
|
||||||
|
"""
|
||||||
|
# The instance_map config field marks the workers that write to various replication streams
|
||||||
|
instance_map = shared_config.setdefault("instance_map", {})
|
||||||
|
|
||||||
|
# Worker-type specific sharding config
|
||||||
|
if worker_type == "pusher":
|
||||||
|
shared_config.setdefault("pusher_instances", []).append(worker_name)
|
||||||
|
|
||||||
|
elif worker_type == "federation_sender":
|
||||||
|
shared_config.setdefault("federation_sender_instances", []).append(worker_name)
|
||||||
|
|
||||||
|
elif worker_type == "event_persister":
|
||||||
|
# Event persisters write to the events stream, so we need to update
|
||||||
|
# the list of event stream writers
|
||||||
|
shared_config.setdefault("stream_writers", {}).setdefault("events", []).append(
|
||||||
|
worker_name
|
||||||
|
)
|
||||||
|
|
||||||
|
# Map of stream writer instance names to host/ports combos
|
||||||
|
instance_map[worker_name] = {
|
||||||
|
"host": "localhost",
|
||||||
|
"port": worker_port,
|
||||||
|
}
|
||||||
|
|
||||||
|
elif worker_type == "media_repository":
|
||||||
|
# The first configured media worker will run the media background jobs
|
||||||
|
shared_config.setdefault("media_instance_running_background_jobs", worker_name)
|
||||||
|
|
||||||
|
|
||||||
|
def generate_base_homeserver_config():
|
||||||
|
"""Starts Synapse and generates a basic homeserver config, which will later be
|
||||||
|
modified for worker support.
|
||||||
|
|
||||||
|
Raises: CalledProcessError if calling start.py returned a non-zero exit code.
|
||||||
|
"""
|
||||||
|
# start.py already does this for us, so just call that.
|
||||||
|
# note that this script is copied in in the official, monolith dockerfile
|
||||||
|
os.environ["SYNAPSE_HTTP_PORT"] = str(MAIN_PROCESS_HTTP_LISTENER_PORT)
|
||||||
|
subprocess.check_output(["/usr/local/bin/python", "/start.py", "migrate_config"])
|
||||||
|
|
||||||
|
|
||||||
|
def generate_worker_files(environ, config_path: str, data_dir: str):
|
||||||
|
"""Read the desired list of workers from environment variables and generate
|
||||||
|
shared homeserver, nginx and supervisord configs.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
environ: _Environ[str]
|
||||||
|
config_path: Where to output the generated Synapse main worker config file.
|
||||||
|
data_dir: The location of the synapse data directory. Where log and
|
||||||
|
user-facing config files live.
|
||||||
|
"""
|
||||||
|
# Note that yaml cares about indentation, so care should be taken to insert lines
|
||||||
|
# into files at the correct indentation below.
|
||||||
|
|
||||||
|
# shared_config is the contents of a Synapse config file that will be shared amongst
|
||||||
|
# the main Synapse process as well as all workers.
|
||||||
|
# It is intended mainly for disabling functionality when certain workers are spun up,
|
||||||
|
# and adding a replication listener.
|
||||||
|
|
||||||
|
# First read the original config file and extract the listeners block. Then we'll add
|
||||||
|
# another listener for replication. Later we'll write out the result.
|
||||||
|
listeners = [
|
||||||
|
{
|
||||||
|
"port": 9093,
|
||||||
|
"bind_address": "127.0.0.1",
|
||||||
|
"type": "http",
|
||||||
|
"resources": [{"names": ["replication"]}],
|
||||||
|
}
|
||||||
|
]
|
||||||
|
with open(config_path) as file_stream:
|
||||||
|
original_config = yaml.safe_load(file_stream)
|
||||||
|
original_listeners = original_config.get("listeners")
|
||||||
|
if original_listeners:
|
||||||
|
listeners += original_listeners
|
||||||
|
|
||||||
|
# The shared homeserver config. The contents of which will be inserted into the
|
||||||
|
# base shared worker jinja2 template.
|
||||||
|
#
|
||||||
|
# This config file will be passed to all workers, included Synapse's main process.
|
||||||
|
shared_config = {"listeners": listeners}
|
||||||
|
|
||||||
|
# The supervisord config. The contents of which will be inserted into the
|
||||||
|
# base supervisord jinja2 template.
|
||||||
|
#
|
||||||
|
# Supervisord will be in charge of running everything, from redis to nginx to Synapse
|
||||||
|
# and all of its worker processes. Load the config template, which defines a few
|
||||||
|
# services that are necessary to run.
|
||||||
|
supervisord_config = ""
|
||||||
|
|
||||||
|
# Upstreams for load-balancing purposes. This dict takes the form of a worker type to the
|
||||||
|
# ports of each worker. For example:
|
||||||
|
# {
|
||||||
|
# worker_type: {1234, 1235, ...}}
|
||||||
|
# }
|
||||||
|
# and will be used to construct 'upstream' nginx directives.
|
||||||
|
nginx_upstreams = {}
|
||||||
|
|
||||||
|
# A map of: {"endpoint": "upstream"}, where "upstream" is a str representing what will be
|
||||||
|
# placed after the proxy_pass directive. The main benefit to representing this data as a
|
||||||
|
# dict over a str is that we can easily deduplicate endpoints across multiple instances
|
||||||
|
# of the same worker.
|
||||||
|
#
|
||||||
|
# An nginx site config that will be amended to depending on the workers that are
|
||||||
|
# spun up. To be placed in /etc/nginx/conf.d.
|
||||||
|
nginx_locations = {}
|
||||||
|
|
||||||
|
# Read the desired worker configuration from the environment
|
||||||
|
worker_types = environ.get("SYNAPSE_WORKER_TYPES")
|
||||||
|
if worker_types is None:
|
||||||
|
# No workers, just the main process
|
||||||
|
worker_types = []
|
||||||
|
else:
|
||||||
|
# Split type names by comma
|
||||||
|
worker_types = worker_types.split(",")
|
||||||
|
|
||||||
|
# Create the worker configuration directory if it doesn't already exist
|
||||||
|
os.makedirs("/conf/workers", exist_ok=True)
|
||||||
|
|
||||||
|
# Start worker ports from this arbitrary port
|
||||||
|
worker_port = 18009
|
||||||
|
|
||||||
|
# A counter of worker_type -> int. Used for determining the name for a given
|
||||||
|
# worker type when generating its config file, as each worker's name is just
|
||||||
|
# worker_type + instance #
|
||||||
|
worker_type_counter = {}
|
||||||
|
|
||||||
|
# For each worker type specified by the user, create config values
|
||||||
|
for worker_type in worker_types:
|
||||||
|
worker_type = worker_type.strip()
|
||||||
|
|
||||||
|
worker_config = WORKERS_CONFIG.get(worker_type)
|
||||||
|
if worker_config:
|
||||||
|
worker_config = worker_config.copy()
|
||||||
|
else:
|
||||||
|
log(worker_type + " is an unknown worker type! It will be ignored")
|
||||||
|
continue
|
||||||
|
|
||||||
|
new_worker_count = worker_type_counter.setdefault(worker_type, 0) + 1
|
||||||
|
worker_type_counter[worker_type] = new_worker_count
|
||||||
|
|
||||||
|
# Name workers by their type concatenated with an incrementing number
|
||||||
|
# e.g. federation_reader1
|
||||||
|
worker_name = worker_type + str(new_worker_count)
|
||||||
|
worker_config.update(
|
||||||
|
{"name": worker_name, "port": worker_port, "config_path": config_path}
|
||||||
|
)
|
||||||
|
|
||||||
|
# Update the shared config with any worker-type specific options
|
||||||
|
shared_config.update(worker_config["shared_extra_conf"])
|
||||||
|
|
||||||
|
# Check if more than one instance of this worker type has been specified
|
||||||
|
worker_type_total_count = worker_types.count(worker_type)
|
||||||
|
if worker_type_total_count > 1:
|
||||||
|
# Update the shared config with sharding-related options if necessary
|
||||||
|
add_sharding_to_shared_config(
|
||||||
|
shared_config, worker_type, worker_name, worker_port
|
||||||
|
)
|
||||||
|
|
||||||
|
# Enable the worker in supervisord
|
||||||
|
supervisord_config += SUPERVISORD_PROCESS_CONFIG_BLOCK.format_map(worker_config)
|
||||||
|
|
||||||
|
# Add nginx location blocks for this worker's endpoints (if any are defined)
|
||||||
|
for pattern in worker_config["endpoint_patterns"]:
|
||||||
|
# Determine whether we need to load-balance this worker
|
||||||
|
if worker_type_total_count > 1:
|
||||||
|
# Create or add to a load-balanced upstream for this worker
|
||||||
|
nginx_upstreams.setdefault(worker_type, set()).add(worker_port)
|
||||||
|
|
||||||
|
# Upstreams are named after the worker_type
|
||||||
|
upstream = "http://" + worker_type
|
||||||
|
else:
|
||||||
|
upstream = "http://localhost:%d" % (worker_port,)
|
||||||
|
|
||||||
|
# Note that this endpoint should proxy to this upstream
|
||||||
|
nginx_locations[pattern] = upstream
|
||||||
|
|
||||||
|
# Write out the worker's logging config file
|
||||||
|
|
||||||
|
# Check whether we should write worker logs to disk, in addition to the console
|
||||||
|
extra_log_template_args = {}
|
||||||
|
if environ.get("SYNAPSE_WORKERS_WRITE_LOGS_TO_DISK"):
|
||||||
|
extra_log_template_args["LOG_FILE_PATH"] = "{dir}/logs/{name}.log".format(
|
||||||
|
dir=data_dir, name=worker_name
|
||||||
|
)
|
||||||
|
|
||||||
|
# Render and write the file
|
||||||
|
log_config_filepath = "/conf/workers/{name}.log.config".format(name=worker_name)
|
||||||
|
convert(
|
||||||
|
"/conf/log.config",
|
||||||
|
log_config_filepath,
|
||||||
|
worker_name=worker_name,
|
||||||
|
**extra_log_template_args,
|
||||||
|
)
|
||||||
|
|
||||||
|
# Then a worker config file
|
||||||
|
convert(
|
||||||
|
"/conf/worker.yaml.j2",
|
||||||
|
"/conf/workers/{name}.yaml".format(name=worker_name),
|
||||||
|
**worker_config,
|
||||||
|
worker_log_config_filepath=log_config_filepath,
|
||||||
|
)
|
||||||
|
|
||||||
|
worker_port += 1
|
||||||
|
|
||||||
|
# Build the nginx location config blocks
|
||||||
|
nginx_location_config = ""
|
||||||
|
for endpoint, upstream in nginx_locations.items():
|
||||||
|
nginx_location_config += NGINX_LOCATION_CONFIG_BLOCK.format(
|
||||||
|
endpoint=endpoint,
|
||||||
|
upstream=upstream,
|
||||||
|
)
|
||||||
|
|
||||||
|
# Determine the load-balancing upstreams to configure
|
||||||
|
nginx_upstream_config = ""
|
||||||
|
for upstream_worker_type, upstream_worker_ports in nginx_upstreams.items():
|
||||||
|
body = ""
|
||||||
|
for port in upstream_worker_ports:
|
||||||
|
body += " server localhost:%d;\n" % (port,)
|
||||||
|
|
||||||
|
# Add to the list of configured upstreams
|
||||||
|
nginx_upstream_config += NGINX_UPSTREAM_CONFIG_BLOCK.format(
|
||||||
|
upstream_worker_type=upstream_worker_type,
|
||||||
|
body=body,
|
||||||
|
)
|
||||||
|
|
||||||
|
# Finally, we'll write out the config files.
|
||||||
|
|
||||||
|
# Shared homeserver config
|
||||||
|
convert(
|
||||||
|
"/conf/shared.yaml.j2",
|
||||||
|
"/conf/workers/shared.yaml",
|
||||||
|
shared_worker_config=yaml.dump(shared_config),
|
||||||
|
)
|
||||||
|
|
||||||
|
# Nginx config
|
||||||
|
convert(
|
||||||
|
"/conf/nginx.conf.j2",
|
||||||
|
"/etc/nginx/conf.d/matrix-synapse.conf",
|
||||||
|
worker_locations=nginx_location_config,
|
||||||
|
upstream_directives=nginx_upstream_config,
|
||||||
|
)
|
||||||
|
|
||||||
|
# Supervisord config
|
||||||
|
convert(
|
||||||
|
"/conf/supervisord.conf.j2",
|
||||||
|
"/etc/supervisor/conf.d/supervisord.conf",
|
||||||
|
main_config_path=config_path,
|
||||||
|
worker_config=supervisord_config,
|
||||||
|
)
|
||||||
|
|
||||||
|
# Ensure the logging directory exists
|
||||||
|
log_dir = data_dir + "/logs"
|
||||||
|
if not os.path.exists(log_dir):
|
||||||
|
os.mkdir(log_dir)
|
||||||
|
|
||||||
|
|
||||||
|
def start_supervisord():
|
||||||
|
"""Starts up supervisord which then starts and monitors all other necessary processes
|
||||||
|
|
||||||
|
Raises: CalledProcessError if calling start.py return a non-zero exit code.
|
||||||
|
"""
|
||||||
|
subprocess.run(["/usr/bin/supervisord"], stdin=subprocess.PIPE)
|
||||||
|
|
||||||
|
|
||||||
|
def main(args, environ):
|
||||||
|
config_dir = environ.get("SYNAPSE_CONFIG_DIR", "/data")
|
||||||
|
config_path = environ.get("SYNAPSE_CONFIG_PATH", config_dir + "/homeserver.yaml")
|
||||||
|
data_dir = environ.get("SYNAPSE_DATA_DIR", "/data")
|
||||||
|
|
||||||
|
# override SYNAPSE_NO_TLS, we don't support TLS in worker mode,
|
||||||
|
# this needs to be handled by a frontend proxy
|
||||||
|
environ["SYNAPSE_NO_TLS"] = "yes"
|
||||||
|
|
||||||
|
# Generate the base homeserver config if one does not yet exist
|
||||||
|
if not os.path.exists(config_path):
|
||||||
|
log("Generating base homeserver config")
|
||||||
|
generate_base_homeserver_config()
|
||||||
|
|
||||||
|
# This script may be run multiple times (mostly by Complement, see note at top of file).
|
||||||
|
# Don't re-configure workers in this instance.
|
||||||
|
mark_filepath = "/conf/workers_have_been_configured"
|
||||||
|
if not os.path.exists(mark_filepath):
|
||||||
|
# Always regenerate all other config files
|
||||||
|
generate_worker_files(environ, config_path, data_dir)
|
||||||
|
|
||||||
|
# Mark workers as being configured
|
||||||
|
with open(mark_filepath, "w") as f:
|
||||||
|
f.write("")
|
||||||
|
|
||||||
|
# Start supervisord, which will start Synapse, all of the configured worker
|
||||||
|
# processes, redis, nginx etc. according to the config we created above.
|
||||||
|
start_supervisord()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main(sys.argv, os.environ)
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# This script runs the PostgreSQL tests inside a Docker container. It expects
|
# This script runs the PostgreSQL tests inside a Docker container. It expects
|
||||||
# the relevant source files to be mounted into /src (done automatically by the
|
# the relevant source files to be mounted into /src (done automatically by the
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
import codecs
|
import codecs
|
||||||
import glob
|
import glob
|
||||||
import os
|
import os
|
||||||
|
import platform
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
@@ -213,6 +214,13 @@ def main(args, environ):
|
|||||||
if "-m" not in args:
|
if "-m" not in args:
|
||||||
args = ["-m", synapse_worker] + args
|
args = ["-m", synapse_worker] + args
|
||||||
|
|
||||||
|
jemallocpath = "/usr/lib/%s-linux-gnu/libjemalloc.so.2" % (platform.machine(),)
|
||||||
|
|
||||||
|
if os.path.isfile(jemallocpath):
|
||||||
|
environ["LD_PRELOAD"] = jemallocpath
|
||||||
|
else:
|
||||||
|
log("Could not find %s, will not use" % (jemallocpath,))
|
||||||
|
|
||||||
# if there are no config files passed to synapse, try adding the default file
|
# if there are no config files passed to synapse, try adding the default file
|
||||||
if not any(p.startswith("--config-path") or p.startswith("-c") for p in args):
|
if not any(p.startswith("--config-path") or p.startswith("-c") for p in args):
|
||||||
config_dir = environ.get("SYNAPSE_CONFIG_DIR", "/data")
|
config_dir = environ.get("SYNAPSE_CONFIG_DIR", "/data")
|
||||||
@@ -248,9 +256,9 @@ running with 'migrate_config'. See the README for more details.
|
|||||||
args = ["python"] + args
|
args = ["python"] + args
|
||||||
if ownership is not None:
|
if ownership is not None:
|
||||||
args = ["gosu", ownership] + args
|
args = ["gosu", ownership] + args
|
||||||
os.execv("/usr/sbin/gosu", args)
|
os.execve("/usr/sbin/gosu", args, environ)
|
||||||
else:
|
else:
|
||||||
os.execv("/usr/local/bin/python", args)
|
os.execve("/usr/local/bin/python", args, environ)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
# Contents
|
# Contents
|
||||||
- [List all media in a room](#list-all-media-in-a-room)
|
- [Querying media](#querying-media)
|
||||||
|
* [List all media in a room](#list-all-media-in-a-room)
|
||||||
|
* [List all media uploaded by a user](#list-all-media-uploaded-by-a-user)
|
||||||
- [Quarantine media](#quarantine-media)
|
- [Quarantine media](#quarantine-media)
|
||||||
* [Quarantining media by ID](#quarantining-media-by-id)
|
* [Quarantining media by ID](#quarantining-media-by-id)
|
||||||
* [Quarantining media in a room](#quarantining-media-in-a-room)
|
* [Quarantining media in a room](#quarantining-media-in-a-room)
|
||||||
@@ -10,7 +12,11 @@
|
|||||||
* [Delete local media by date or size](#delete-local-media-by-date-or-size)
|
* [Delete local media by date or size](#delete-local-media-by-date-or-size)
|
||||||
- [Purge Remote Media API](#purge-remote-media-api)
|
- [Purge Remote Media API](#purge-remote-media-api)
|
||||||
|
|
||||||
# List all media in a room
|
# Querying media
|
||||||
|
|
||||||
|
These APIs allow extracting media information from the homeserver.
|
||||||
|
|
||||||
|
## List all media in a room
|
||||||
|
|
||||||
This API gets a list of known media in a room.
|
This API gets a list of known media in a room.
|
||||||
However, it only shows media from unencrypted events or rooms.
|
However, it only shows media from unencrypted events or rooms.
|
||||||
@@ -36,6 +42,12 @@ The API returns a JSON body like the following:
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## List all media uploaded by a user
|
||||||
|
|
||||||
|
Listing all media that has been uploaded by a local user can be achieved through
|
||||||
|
the use of the [List media of a user](user_admin_api.rst#list-media-of-a-user)
|
||||||
|
Admin API.
|
||||||
|
|
||||||
# Quarantine media
|
# Quarantine media
|
||||||
|
|
||||||
Quarantining media means that it is marked as inaccessible by users. It applies
|
Quarantining media means that it is marked as inaccessible by users. It applies
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
* [Usage](#usage)
|
* [Usage](#usage)
|
||||||
- [Room Details API](#room-details-api)
|
- [Room Details API](#room-details-api)
|
||||||
- [Room Members API](#room-members-api)
|
- [Room Members API](#room-members-api)
|
||||||
|
- [Room State API](#room-state-api)
|
||||||
- [Delete Room API](#delete-room-api)
|
- [Delete Room API](#delete-room-api)
|
||||||
* [Parameters](#parameters-1)
|
* [Parameters](#parameters-1)
|
||||||
* [Response](#response)
|
* [Response](#response)
|
||||||
@@ -427,7 +428,7 @@ the new room. Users on other servers will be unaffected.
|
|||||||
The API is:
|
The API is:
|
||||||
|
|
||||||
```
|
```
|
||||||
POST /_synapse/admin/v1/rooms/<room_id>/delete
|
DELETE /_synapse/admin/v1/rooms/<room_id>
|
||||||
```
|
```
|
||||||
|
|
||||||
with a body of:
|
with a body of:
|
||||||
@@ -528,6 +529,15 @@ You will have to manually handle, if you so choose, the following:
|
|||||||
* Users that would have been booted from the room (and will have been force-joined to the Content Violation room).
|
* Users that would have been booted from the room (and will have been force-joined to the Content Violation room).
|
||||||
* Removal of the Content Violation room if desired.
|
* Removal of the Content Violation room if desired.
|
||||||
|
|
||||||
|
## Deprecated endpoint
|
||||||
|
|
||||||
|
The previous deprecated API will be removed in a future release, it was:
|
||||||
|
|
||||||
|
```
|
||||||
|
POST /_synapse/admin/v1/rooms/<room_id>/delete
|
||||||
|
```
|
||||||
|
|
||||||
|
It behaves the same way than the current endpoint except the path and the method.
|
||||||
|
|
||||||
# Make Room Admin API
|
# Make Room Admin API
|
||||||
|
|
||||||
|
|||||||
@@ -29,8 +29,9 @@ It returns a JSON body like the following:
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"avatar_url": "<avatar_url>",
|
"avatar_url": "<avatar_url>",
|
||||||
"admin": false,
|
"admin": 0,
|
||||||
"deactivated": false,
|
"deactivated": 0,
|
||||||
|
"shadow_banned": 0,
|
||||||
"password_hash": "$2b$12$p9B4GkqYdRTPGD",
|
"password_hash": "$2b$12$p9B4GkqYdRTPGD",
|
||||||
"creation_ts": 1560432506,
|
"creation_ts": 1560432506,
|
||||||
"appservice_id": null,
|
"appservice_id": null,
|
||||||
@@ -110,35 +111,16 @@ List Accounts
|
|||||||
=============
|
=============
|
||||||
|
|
||||||
This API returns all local user accounts.
|
This API returns all local user accounts.
|
||||||
|
By default, the response is ordered by ascending user ID.
|
||||||
|
|
||||||
The api is::
|
The API is::
|
||||||
|
|
||||||
GET /_synapse/admin/v2/users?from=0&limit=10&guests=false
|
GET /_synapse/admin/v2/users?from=0&limit=10&guests=false
|
||||||
|
|
||||||
To use it, you will need to authenticate by providing an ``access_token`` for a
|
To use it, you will need to authenticate by providing an ``access_token`` for a
|
||||||
server admin: see `README.rst <README.rst>`_.
|
server admin: see `README.rst <README.rst>`_.
|
||||||
|
|
||||||
The parameter ``from`` is optional but used for pagination, denoting the
|
A response body like the following is returned:
|
||||||
offset in the returned results. This should be treated as an opaque value and
|
|
||||||
not explicitly set to anything other than the return value of ``next_token``
|
|
||||||
from a previous call.
|
|
||||||
|
|
||||||
The parameter ``limit`` is optional but is used for pagination, denoting the
|
|
||||||
maximum number of items to return in this call. Defaults to ``100``.
|
|
||||||
|
|
||||||
The parameter ``user_id`` is optional and filters to only return users with user IDs
|
|
||||||
that contain this value. This parameter is ignored when using the ``name`` parameter.
|
|
||||||
|
|
||||||
The parameter ``name`` is optional and filters to only return users with user ID localparts
|
|
||||||
**or** displaynames that contain this value.
|
|
||||||
|
|
||||||
The parameter ``guests`` is optional and if ``false`` will **exclude** guest users.
|
|
||||||
Defaults to ``true`` to include guest users.
|
|
||||||
|
|
||||||
The parameter ``deactivated`` is optional and if ``true`` will **include** deactivated users.
|
|
||||||
Defaults to ``false`` to exclude deactivated users.
|
|
||||||
|
|
||||||
A JSON body is returned with the following shape:
|
|
||||||
|
|
||||||
.. code:: json
|
.. code:: json
|
||||||
|
|
||||||
@@ -150,6 +132,7 @@ A JSON body is returned with the following shape:
|
|||||||
"admin": 0,
|
"admin": 0,
|
||||||
"user_type": null,
|
"user_type": null,
|
||||||
"deactivated": 0,
|
"deactivated": 0,
|
||||||
|
"shadow_banned": 0,
|
||||||
"displayname": "<User One>",
|
"displayname": "<User One>",
|
||||||
"avatar_url": null
|
"avatar_url": null
|
||||||
}, {
|
}, {
|
||||||
@@ -158,6 +141,7 @@ A JSON body is returned with the following shape:
|
|||||||
"admin": 1,
|
"admin": 1,
|
||||||
"user_type": null,
|
"user_type": null,
|
||||||
"deactivated": 0,
|
"deactivated": 0,
|
||||||
|
"shadow_banned": 0,
|
||||||
"displayname": "<User Two>",
|
"displayname": "<User Two>",
|
||||||
"avatar_url": "<avatar_url>"
|
"avatar_url": "<avatar_url>"
|
||||||
}
|
}
|
||||||
@@ -172,6 +156,66 @@ with ``from`` set to the value of ``next_token``. This will return a new page.
|
|||||||
If the endpoint does not return a ``next_token`` then there are no more users
|
If the endpoint does not return a ``next_token`` then there are no more users
|
||||||
to paginate through.
|
to paginate through.
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
The following parameters should be set in the URL:
|
||||||
|
|
||||||
|
- ``user_id`` - Is optional and filters to only return users with user IDs
|
||||||
|
that contain this value. This parameter is ignored when using the ``name`` parameter.
|
||||||
|
- ``name`` - Is optional and filters to only return users with user ID localparts
|
||||||
|
**or** displaynames that contain this value.
|
||||||
|
- ``guests`` - string representing a bool - Is optional and if ``false`` will **exclude** guest users.
|
||||||
|
Defaults to ``true`` to include guest users.
|
||||||
|
- ``deactivated`` - string representing a bool - Is optional and if ``true`` will **include** deactivated users.
|
||||||
|
Defaults to ``false`` to exclude deactivated users.
|
||||||
|
- ``limit`` - string representing a positive integer - Is optional but is used for pagination,
|
||||||
|
denoting the maximum number of items to return in this call. Defaults to ``100``.
|
||||||
|
- ``from`` - string representing a positive integer - Is optional but used for pagination,
|
||||||
|
denoting the offset in the returned results. This should be treated as an opaque value and
|
||||||
|
not explicitly set to anything other than the return value of ``next_token`` from a previous call.
|
||||||
|
Defaults to ``0``.
|
||||||
|
- ``order_by`` - The method by which to sort the returned list of users.
|
||||||
|
If the ordered field has duplicates, the second order is always by ascending ``name``,
|
||||||
|
which guarantees a stable ordering. Valid values are:
|
||||||
|
|
||||||
|
- ``name`` - Users are ordered alphabetically by ``name``. This is the default.
|
||||||
|
- ``is_guest`` - Users are ordered by ``is_guest`` status.
|
||||||
|
- ``admin`` - Users are ordered by ``admin`` status.
|
||||||
|
- ``user_type`` - Users are ordered alphabetically by ``user_type``.
|
||||||
|
- ``deactivated`` - Users are ordered by ``deactivated`` status.
|
||||||
|
- ``shadow_banned`` - Users are ordered by ``shadow_banned`` status.
|
||||||
|
- ``displayname`` - Users are ordered alphabetically by ``displayname``.
|
||||||
|
- ``avatar_url`` - Users are ordered alphabetically by avatar URL.
|
||||||
|
|
||||||
|
- ``dir`` - Direction of media order. Either ``f`` for forwards or ``b`` for backwards.
|
||||||
|
Setting this value to ``b`` will reverse the above sort order. Defaults to ``f``.
|
||||||
|
|
||||||
|
Caution. The database only has indexes on the columns ``name`` and ``created_ts``.
|
||||||
|
This means that if a different sort order is used (``is_guest``, ``admin``,
|
||||||
|
``user_type``, ``deactivated``, ``shadow_banned``, ``avatar_url`` or ``displayname``),
|
||||||
|
this can cause a large load on the database, especially for large environments.
|
||||||
|
|
||||||
|
**Response**
|
||||||
|
|
||||||
|
The following fields are returned in the JSON response body:
|
||||||
|
|
||||||
|
- ``users`` - An array of objects, each containing information about an user.
|
||||||
|
User objects contain the following fields:
|
||||||
|
|
||||||
|
- ``name`` - string - Fully-qualified user ID (ex. ``@user:server.com``).
|
||||||
|
- ``is_guest`` - bool - Status if that user is a guest account.
|
||||||
|
- ``admin`` - bool - Status if that user is a server administrator.
|
||||||
|
- ``user_type`` - string - Type of the user. Normal users are type ``None``.
|
||||||
|
This allows user type specific behaviour. There are also types ``support`` and ``bot``.
|
||||||
|
- ``deactivated`` - bool - Status if that user has been marked as deactivated.
|
||||||
|
- ``shadow_banned`` - bool - Status if that user has been marked as shadow banned.
|
||||||
|
- ``displayname`` - string - The user's display name if they have set one.
|
||||||
|
- ``avatar_url`` - string - The user's avatar URL if they have set one.
|
||||||
|
|
||||||
|
- ``next_token``: string representing a positive integer - Indication for pagination. See above.
|
||||||
|
- ``total`` - integer - Total number of media.
|
||||||
|
|
||||||
|
|
||||||
Query current sessions for a user
|
Query current sessions for a user
|
||||||
=================================
|
=================================
|
||||||
|
|
||||||
@@ -262,7 +306,7 @@ The following actions are performed when deactivating an user:
|
|||||||
- Reject all pending invites
|
- Reject all pending invites
|
||||||
- Remove all account validity information related to the user
|
- Remove all account validity information related to the user
|
||||||
|
|
||||||
The following additional actions are performed during deactivation if``erase``
|
The following additional actions are performed during deactivation if ``erase``
|
||||||
is set to ``true``:
|
is set to ``true``:
|
||||||
|
|
||||||
- Remove the user's display name
|
- Remove the user's display name
|
||||||
@@ -376,11 +420,12 @@ The following fields are returned in the JSON response body:
|
|||||||
- ``total`` - Number of rooms.
|
- ``total`` - Number of rooms.
|
||||||
|
|
||||||
|
|
||||||
List media of an user
|
List media of a user
|
||||||
================================
|
====================
|
||||||
Gets a list of all local media that a specific ``user_id`` has created.
|
Gets a list of all local media that a specific ``user_id`` has created.
|
||||||
The response is ordered by creation date descending and media ID descending.
|
By default, the response is ordered by descending creation date and ascending media ID.
|
||||||
The newest media is on top.
|
The newest media is on top. You can change the order with parameters
|
||||||
|
``order_by`` and ``dir``.
|
||||||
|
|
||||||
The API is::
|
The API is::
|
||||||
|
|
||||||
@@ -437,6 +482,35 @@ The following parameters should be set in the URL:
|
|||||||
denoting the offset in the returned results. This should be treated as an opaque value and
|
denoting the offset in the returned results. This should be treated as an opaque value and
|
||||||
not explicitly set to anything other than the return value of ``next_token`` from a previous call.
|
not explicitly set to anything other than the return value of ``next_token`` from a previous call.
|
||||||
Defaults to ``0``.
|
Defaults to ``0``.
|
||||||
|
- ``order_by`` - The method by which to sort the returned list of media.
|
||||||
|
If the ordered field has duplicates, the second order is always by ascending ``media_id``,
|
||||||
|
which guarantees a stable ordering. Valid values are:
|
||||||
|
|
||||||
|
- ``media_id`` - Media are ordered alphabetically by ``media_id``.
|
||||||
|
- ``upload_name`` - Media are ordered alphabetically by name the media was uploaded with.
|
||||||
|
- ``created_ts`` - Media are ordered by when the content was uploaded in ms.
|
||||||
|
Smallest to largest. This is the default.
|
||||||
|
- ``last_access_ts`` - Media are ordered by when the content was last accessed in ms.
|
||||||
|
Smallest to largest.
|
||||||
|
- ``media_length`` - Media are ordered by length of the media in bytes.
|
||||||
|
Smallest to largest.
|
||||||
|
- ``media_type`` - Media are ordered alphabetically by MIME-type.
|
||||||
|
- ``quarantined_by`` - Media are ordered alphabetically by the user ID that
|
||||||
|
initiated the quarantine request for this media.
|
||||||
|
- ``safe_from_quarantine`` - Media are ordered by the status if this media is safe
|
||||||
|
from quarantining.
|
||||||
|
|
||||||
|
- ``dir`` - Direction of media order. Either ``f`` for forwards or ``b`` for backwards.
|
||||||
|
Setting this value to ``b`` will reverse the above sort order. Defaults to ``f``.
|
||||||
|
|
||||||
|
If neither ``order_by`` nor ``dir`` is set, the default order is newest media on top
|
||||||
|
(corresponds to ``order_by`` = ``created_ts`` and ``dir`` = ``b``).
|
||||||
|
|
||||||
|
Caution. The database only has indexes on the columns ``media_id``,
|
||||||
|
``user_id`` and ``created_ts``. This means that if a different sort order is used
|
||||||
|
(``upload_name``, ``last_access_ts``, ``media_length``, ``media_type``,
|
||||||
|
``quarantined_by`` or ``safe_from_quarantine``), this can cause a large load on the
|
||||||
|
database, especially for large environments.
|
||||||
|
|
||||||
**Response**
|
**Response**
|
||||||
|
|
||||||
@@ -790,3 +864,118 @@ The following parameters should be set in the URL:
|
|||||||
|
|
||||||
- ``user_id`` - The fully qualified MXID: for example, ``@user:server.com``. The user must
|
- ``user_id`` - The fully qualified MXID: for example, ``@user:server.com``. The user must
|
||||||
be local.
|
be local.
|
||||||
|
|
||||||
|
Override ratelimiting for users
|
||||||
|
===============================
|
||||||
|
|
||||||
|
This API allows to override or disable ratelimiting for a specific user.
|
||||||
|
There are specific APIs to set, get and delete a ratelimit.
|
||||||
|
|
||||||
|
Get status of ratelimit
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
The API is::
|
||||||
|
|
||||||
|
GET /_synapse/admin/v1/users/<user_id>/override_ratelimit
|
||||||
|
|
||||||
|
To use it, you will need to authenticate by providing an ``access_token`` for a
|
||||||
|
server admin: see `README.rst <README.rst>`_.
|
||||||
|
|
||||||
|
A response body like the following is returned:
|
||||||
|
|
||||||
|
.. code:: json
|
||||||
|
|
||||||
|
{
|
||||||
|
"messages_per_second": 0,
|
||||||
|
"burst_count": 0
|
||||||
|
}
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
The following parameters should be set in the URL:
|
||||||
|
|
||||||
|
- ``user_id`` - The fully qualified MXID: for example, ``@user:server.com``. The user must
|
||||||
|
be local.
|
||||||
|
|
||||||
|
**Response**
|
||||||
|
|
||||||
|
The following fields are returned in the JSON response body:
|
||||||
|
|
||||||
|
- ``messages_per_second`` - integer - The number of actions that can
|
||||||
|
be performed in a second. `0` mean that ratelimiting is disabled for this user.
|
||||||
|
- ``burst_count`` - integer - How many actions that can be performed before
|
||||||
|
being limited.
|
||||||
|
|
||||||
|
If **no** custom ratelimit is set, an empty JSON dict is returned.
|
||||||
|
|
||||||
|
.. code:: json
|
||||||
|
|
||||||
|
{}
|
||||||
|
|
||||||
|
Set ratelimit
|
||||||
|
-------------
|
||||||
|
|
||||||
|
The API is::
|
||||||
|
|
||||||
|
POST /_synapse/admin/v1/users/<user_id>/override_ratelimit
|
||||||
|
|
||||||
|
To use it, you will need to authenticate by providing an ``access_token`` for a
|
||||||
|
server admin: see `README.rst <README.rst>`_.
|
||||||
|
|
||||||
|
A response body like the following is returned:
|
||||||
|
|
||||||
|
.. code:: json
|
||||||
|
|
||||||
|
{
|
||||||
|
"messages_per_second": 0,
|
||||||
|
"burst_count": 0
|
||||||
|
}
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
The following parameters should be set in the URL:
|
||||||
|
|
||||||
|
- ``user_id`` - The fully qualified MXID: for example, ``@user:server.com``. The user must
|
||||||
|
be local.
|
||||||
|
|
||||||
|
Body parameters:
|
||||||
|
|
||||||
|
- ``messages_per_second`` - positive integer, optional. The number of actions that can
|
||||||
|
be performed in a second. Defaults to ``0``.
|
||||||
|
- ``burst_count`` - positive integer, optional. How many actions that can be performed
|
||||||
|
before being limited. Defaults to ``0``.
|
||||||
|
|
||||||
|
To disable users' ratelimit set both values to ``0``.
|
||||||
|
|
||||||
|
**Response**
|
||||||
|
|
||||||
|
The following fields are returned in the JSON response body:
|
||||||
|
|
||||||
|
- ``messages_per_second`` - integer - The number of actions that can
|
||||||
|
be performed in a second.
|
||||||
|
- ``burst_count`` - integer - How many actions that can be performed before
|
||||||
|
being limited.
|
||||||
|
|
||||||
|
Delete ratelimit
|
||||||
|
----------------
|
||||||
|
|
||||||
|
The API is::
|
||||||
|
|
||||||
|
DELETE /_synapse/admin/v1/users/<user_id>/override_ratelimit
|
||||||
|
|
||||||
|
To use it, you will need to authenticate by providing an ``access_token`` for a
|
||||||
|
server admin: see `README.rst <README.rst>`_.
|
||||||
|
|
||||||
|
An empty JSON dict is returned.
|
||||||
|
|
||||||
|
.. code:: json
|
||||||
|
|
||||||
|
{}
|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
|
||||||
|
The following parameters should be set in the URL:
|
||||||
|
|
||||||
|
- ``user_id`` - The fully qualified MXID: for example, ``@user:server.com``. The user must
|
||||||
|
be local.
|
||||||
|
|
||||||
|
|||||||
@@ -128,6 +128,9 @@ Some guidelines follow:
|
|||||||
will be if no sub-options are enabled).
|
will be if no sub-options are enabled).
|
||||||
- Lines should be wrapped at 80 characters.
|
- Lines should be wrapped at 80 characters.
|
||||||
- Use two-space indents.
|
- Use two-space indents.
|
||||||
|
- `true` and `false` are spelt thus (as opposed to `True`, etc.)
|
||||||
|
- Use single quotes (`'`) rather than double-quotes (`"`) or backticks
|
||||||
|
(`` ` ``) to refer to configuration options.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
|
|||||||
33
docs/deprecation_policy.md
Normal file
33
docs/deprecation_policy.md
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
Deprecation Policy for Platform Dependencies
|
||||||
|
============================================
|
||||||
|
|
||||||
|
Synapse has a number of platform dependencies, including Python and PostgreSQL.
|
||||||
|
This document outlines the policy towards which versions we support, and when we
|
||||||
|
drop support for versions in the future.
|
||||||
|
|
||||||
|
|
||||||
|
Policy
|
||||||
|
------
|
||||||
|
|
||||||
|
Synapse follows the upstream support life cycles for Python and PostgreSQL,
|
||||||
|
i.e. when a version reaches End of Life Synapse will withdraw support for that
|
||||||
|
version in future releases.
|
||||||
|
|
||||||
|
Details on the upstream support life cycles for Python and PostgreSQL are
|
||||||
|
documented at https://endoflife.date/python and
|
||||||
|
https://endoflife.date/postgresql.
|
||||||
|
|
||||||
|
|
||||||
|
Context
|
||||||
|
-------
|
||||||
|
|
||||||
|
It is important for system admins to have a clear understanding of the platform
|
||||||
|
requirements of Synapse and its deprecation policies so that they can
|
||||||
|
effectively plan upgrading their infrastructure ahead of time. This is
|
||||||
|
especially important in contexts where upgrading the infrastructure requires
|
||||||
|
auditing and approval from a security team, or where otherwise upgrading is a
|
||||||
|
long process.
|
||||||
|
|
||||||
|
By following the upstream support life cycles Synapse can ensure that its
|
||||||
|
dependencies continue to get security patches, while not requiring system admins
|
||||||
|
to constantly update their platform dependencies to the latest versions.
|
||||||
@@ -226,7 +226,7 @@ Synapse config:
|
|||||||
oidc_providers:
|
oidc_providers:
|
||||||
- idp_id: github
|
- idp_id: github
|
||||||
idp_name: Github
|
idp_name: Github
|
||||||
idp_brand: "org.matrix.github" # optional: styling hint for clients
|
idp_brand: "github" # optional: styling hint for clients
|
||||||
discover: false
|
discover: false
|
||||||
issuer: "https://github.com/"
|
issuer: "https://github.com/"
|
||||||
client_id: "your-client-id" # TO BE FILLED
|
client_id: "your-client-id" # TO BE FILLED
|
||||||
@@ -252,7 +252,7 @@ oidc_providers:
|
|||||||
oidc_providers:
|
oidc_providers:
|
||||||
- idp_id: google
|
- idp_id: google
|
||||||
idp_name: Google
|
idp_name: Google
|
||||||
idp_brand: "org.matrix.google" # optional: styling hint for clients
|
idp_brand: "google" # optional: styling hint for clients
|
||||||
issuer: "https://accounts.google.com/"
|
issuer: "https://accounts.google.com/"
|
||||||
client_id: "your-client-id" # TO BE FILLED
|
client_id: "your-client-id" # TO BE FILLED
|
||||||
client_secret: "your-client-secret" # TO BE FILLED
|
client_secret: "your-client-secret" # TO BE FILLED
|
||||||
@@ -299,7 +299,7 @@ Synapse config:
|
|||||||
oidc_providers:
|
oidc_providers:
|
||||||
- idp_id: gitlab
|
- idp_id: gitlab
|
||||||
idp_name: Gitlab
|
idp_name: Gitlab
|
||||||
idp_brand: "org.matrix.gitlab" # optional: styling hint for clients
|
idp_brand: "gitlab" # optional: styling hint for clients
|
||||||
issuer: "https://gitlab.com/"
|
issuer: "https://gitlab.com/"
|
||||||
client_id: "your-client-id" # TO BE FILLED
|
client_id: "your-client-id" # TO BE FILLED
|
||||||
client_secret: "your-client-secret" # TO BE FILLED
|
client_secret: "your-client-secret" # TO BE FILLED
|
||||||
@@ -334,7 +334,7 @@ Synapse config:
|
|||||||
```yaml
|
```yaml
|
||||||
- idp_id: facebook
|
- idp_id: facebook
|
||||||
idp_name: Facebook
|
idp_name: Facebook
|
||||||
idp_brand: "org.matrix.facebook" # optional: styling hint for clients
|
idp_brand: "facebook" # optional: styling hint for clients
|
||||||
discover: false
|
discover: false
|
||||||
issuer: "https://facebook.com"
|
issuer: "https://facebook.com"
|
||||||
client_id: "your-client-id" # TO BE FILLED
|
client_id: "your-client-id" # TO BE FILLED
|
||||||
@@ -386,7 +386,7 @@ oidc_providers:
|
|||||||
config:
|
config:
|
||||||
subject_claim: "id"
|
subject_claim: "id"
|
||||||
localpart_template: "{{ user.login }}"
|
localpart_template: "{{ user.login }}"
|
||||||
display_name_template: "{{ user.full_name }}"
|
display_name_template: "{{ user.full_name }}"
|
||||||
```
|
```
|
||||||
|
|
||||||
### XWiki
|
### XWiki
|
||||||
@@ -401,8 +401,7 @@ oidc_providers:
|
|||||||
idp_name: "XWiki"
|
idp_name: "XWiki"
|
||||||
issuer: "https://myxwikihost/xwiki/oidc/"
|
issuer: "https://myxwikihost/xwiki/oidc/"
|
||||||
client_id: "your-client-id" # TO BE FILLED
|
client_id: "your-client-id" # TO BE FILLED
|
||||||
# Needed until https://github.com/matrix-org/synapse/issues/9212 is fixed
|
client_auth_method: none
|
||||||
client_secret: "dontcare"
|
|
||||||
scopes: ["openid", "profile"]
|
scopes: ["openid", "profile"]
|
||||||
user_profile_method: "userinfo_endpoint"
|
user_profile_method: "userinfo_endpoint"
|
||||||
user_mapping_provider:
|
user_mapping_provider:
|
||||||
@@ -410,3 +409,40 @@ oidc_providers:
|
|||||||
localpart_template: "{{ user.preferred_username }}"
|
localpart_template: "{{ user.preferred_username }}"
|
||||||
display_name_template: "{{ user.name }}"
|
display_name_template: "{{ user.name }}"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Apple
|
||||||
|
|
||||||
|
Configuring "Sign in with Apple" (SiWA) requires an Apple Developer account.
|
||||||
|
|
||||||
|
You will need to create a new "Services ID" for SiWA, and create and download a
|
||||||
|
private key with "SiWA" enabled.
|
||||||
|
|
||||||
|
As well as the private key file, you will need:
|
||||||
|
* Client ID: the "identifier" you gave the "Services ID"
|
||||||
|
* Team ID: a 10-character ID associated with your developer account.
|
||||||
|
* Key ID: the 10-character identifier for the key.
|
||||||
|
|
||||||
|
https://help.apple.com/developer-account/?lang=en#/dev77c875b7e has more
|
||||||
|
documentation on setting up SiWA.
|
||||||
|
|
||||||
|
The synapse config will look like this:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- idp_id: apple
|
||||||
|
idp_name: Apple
|
||||||
|
issuer: "https://appleid.apple.com"
|
||||||
|
client_id: "your-client-id" # Set to the "identifier" for your "ServicesID"
|
||||||
|
client_auth_method: "client_secret_post"
|
||||||
|
client_secret_jwt_key:
|
||||||
|
key_file: "/path/to/AuthKey_KEYIDCODE.p8" # point to your key file
|
||||||
|
jwt_header:
|
||||||
|
alg: ES256
|
||||||
|
kid: "KEYIDCODE" # Set to the 10-char Key ID
|
||||||
|
jwt_payload:
|
||||||
|
iss: TEAMIDCODE # Set to the 10-char Team ID
|
||||||
|
scopes: ["name", "email", "openid"]
|
||||||
|
authorization_endpoint: https://appleid.apple.com/auth/authorize?response_mode=form_post
|
||||||
|
user_mapping_provider:
|
||||||
|
config:
|
||||||
|
email_template: "{{ user.email }}"
|
||||||
|
```
|
||||||
|
|||||||
@@ -42,17 +42,17 @@ To receive OpenTracing spans, start up a Jaeger server. This can be done
|
|||||||
using docker like so:
|
using docker like so:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
docker run -d --name jaeger
|
docker run -d --name jaeger \
|
||||||
-p 6831:6831/udp \
|
-p 6831:6831/udp \
|
||||||
-p 6832:6832/udp \
|
-p 6832:6832/udp \
|
||||||
-p 5778:5778 \
|
-p 5778:5778 \
|
||||||
-p 16686:16686 \
|
-p 16686:16686 \
|
||||||
-p 14268:14268 \
|
-p 14268:14268 \
|
||||||
jaegertracing/all-in-one:1.13
|
jaegertracing/all-in-one:1
|
||||||
```
|
```
|
||||||
|
|
||||||
Latest documentation is probably at
|
Latest documentation is probably at
|
||||||
<https://www.jaegertracing.io/docs/1.13/getting-started/>
|
https://www.jaegertracing.io/docs/latest/getting-started.
|
||||||
|
|
||||||
## Enable OpenTracing in Synapse
|
## Enable OpenTracing in Synapse
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ as shown in the [sample config](./sample_config.yaml). For example:
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
opentracing:
|
opentracing:
|
||||||
tracer_enabled: true
|
enabled: true
|
||||||
homeserver_whitelist:
|
homeserver_whitelist:
|
||||||
- "mytrustedhomeserver.org"
|
- "mytrustedhomeserver.org"
|
||||||
- "*.myotherhomeservers.com"
|
- "*.myotherhomeservers.com"
|
||||||
@@ -90,4 +90,4 @@ to two problems, namely:
|
|||||||
## Configuring Jaeger
|
## Configuring Jaeger
|
||||||
|
|
||||||
Sampling strategies can be set as in this document:
|
Sampling strategies can be set as in this document:
|
||||||
<https://www.jaegertracing.io/docs/1.13/sampling/>
|
<https://www.jaegertracing.io/docs/latest/sampling/>.
|
||||||
|
|||||||
200
docs/postgres.md
200
docs/postgres.md
@@ -1,6 +1,6 @@
|
|||||||
# Using Postgres
|
# Using Postgres
|
||||||
|
|
||||||
Postgres version 9.5 or later is known to work.
|
Synapse supports PostgreSQL versions 9.6 or later.
|
||||||
|
|
||||||
## Install postgres client libraries
|
## Install postgres client libraries
|
||||||
|
|
||||||
@@ -33,28 +33,15 @@ Assuming your PostgreSQL database user is called `postgres`, first authenticate
|
|||||||
# Or, if your system uses sudo to get administrative rights
|
# Or, if your system uses sudo to get administrative rights
|
||||||
sudo -u postgres bash
|
sudo -u postgres bash
|
||||||
|
|
||||||
Then, create a user ``synapse_user`` with:
|
Then, create a postgres user and a database with:
|
||||||
|
|
||||||
|
# this will prompt for a password for the new user
|
||||||
createuser --pwprompt synapse_user
|
createuser --pwprompt synapse_user
|
||||||
|
|
||||||
Before you can authenticate with the `synapse_user`, you must create a
|
createdb --encoding=UTF8 --locale=C --template=template0 --owner=synapse_user synapse
|
||||||
database that it can access. To create a database, first connect to the
|
|
||||||
database with your database user:
|
|
||||||
|
|
||||||
su - postgres # Or: sudo -u postgres bash
|
The above will create a user called `synapse_user`, and a database called
|
||||||
psql
|
`synapse`.
|
||||||
|
|
||||||
and then run:
|
|
||||||
|
|
||||||
CREATE DATABASE synapse
|
|
||||||
ENCODING 'UTF8'
|
|
||||||
LC_COLLATE='C'
|
|
||||||
LC_CTYPE='C'
|
|
||||||
template=template0
|
|
||||||
OWNER synapse_user;
|
|
||||||
|
|
||||||
This would create an appropriate database named `synapse` owned by the
|
|
||||||
`synapse_user` user (which must already have been created as above).
|
|
||||||
|
|
||||||
Note that the PostgreSQL database *must* have the correct encoding set
|
Note that the PostgreSQL database *must* have the correct encoding set
|
||||||
(as shown above), otherwise it will not be able to store UTF8 strings.
|
(as shown above), otherwise it will not be able to store UTF8 strings.
|
||||||
@@ -63,79 +50,6 @@ You may need to enable password authentication so `synapse_user` can
|
|||||||
connect to the database. See
|
connect to the database. See
|
||||||
<https://www.postgresql.org/docs/current/auth-pg-hba-conf.html>.
|
<https://www.postgresql.org/docs/current/auth-pg-hba-conf.html>.
|
||||||
|
|
||||||
If you get an error along the lines of `FATAL: Ident authentication failed for
|
|
||||||
user "synapse_user"`, you may need to use an authentication method other than
|
|
||||||
`ident`:
|
|
||||||
|
|
||||||
* If the `synapse_user` user has a password, add the password to the `database:`
|
|
||||||
section of `homeserver.yaml`. Then add the following to `pg_hba.conf`:
|
|
||||||
|
|
||||||
```
|
|
||||||
host synapse synapse_user ::1/128 md5 # or `scram-sha-256` instead of `md5` if you use that
|
|
||||||
```
|
|
||||||
|
|
||||||
* If the `synapse_user` user does not have a password, then a password doesn't
|
|
||||||
have to be added to `homeserver.yaml`. But the following does need to be added
|
|
||||||
to `pg_hba.conf`:
|
|
||||||
|
|
||||||
```
|
|
||||||
host synapse synapse_user ::1/128 trust
|
|
||||||
```
|
|
||||||
|
|
||||||
Note that line order matters in `pg_hba.conf`, so make sure that if you do add a
|
|
||||||
new line, it is inserted before:
|
|
||||||
|
|
||||||
```
|
|
||||||
host all all ::1/128 ident
|
|
||||||
```
|
|
||||||
|
|
||||||
### Fixing incorrect `COLLATE` or `CTYPE`
|
|
||||||
|
|
||||||
Synapse will refuse to set up a new database if it has the wrong values of
|
|
||||||
`COLLATE` and `CTYPE` set, and will log warnings on existing databases. Using
|
|
||||||
different locales can cause issues if the locale library is updated from
|
|
||||||
underneath the database, or if a different version of the locale is used on any
|
|
||||||
replicas.
|
|
||||||
|
|
||||||
The safest way to fix the issue is to take a dump and recreate the database with
|
|
||||||
the correct `COLLATE` and `CTYPE` parameters (as shown above). It is also possible to change the
|
|
||||||
parameters on a live database and run a `REINDEX` on the entire database,
|
|
||||||
however extreme care must be taken to avoid database corruption.
|
|
||||||
|
|
||||||
Note that the above may fail with an error about duplicate rows if corruption
|
|
||||||
has already occurred, and such duplicate rows will need to be manually removed.
|
|
||||||
|
|
||||||
|
|
||||||
## Fixing inconsistent sequences error
|
|
||||||
|
|
||||||
Synapse uses Postgres sequences to generate IDs for various tables. A sequence
|
|
||||||
and associated table can get out of sync if, for example, Synapse has been
|
|
||||||
downgraded and then upgraded again.
|
|
||||||
|
|
||||||
To fix the issue shut down Synapse (including any and all workers) and run the
|
|
||||||
SQL command included in the error message. Once done Synapse should start
|
|
||||||
successfully.
|
|
||||||
|
|
||||||
|
|
||||||
## Tuning Postgres
|
|
||||||
|
|
||||||
The default settings should be fine for most deployments. For larger
|
|
||||||
scale deployments tuning some of the settings is recommended, details of
|
|
||||||
which can be found at
|
|
||||||
<https://wiki.postgresql.org/wiki/Tuning_Your_PostgreSQL_Server>.
|
|
||||||
|
|
||||||
In particular, we've found tuning the following values helpful for
|
|
||||||
performance:
|
|
||||||
|
|
||||||
- `shared_buffers`
|
|
||||||
- `effective_cache_size`
|
|
||||||
- `work_mem`
|
|
||||||
- `maintenance_work_mem`
|
|
||||||
- `autovacuum_work_mem`
|
|
||||||
|
|
||||||
Note that the appropriate values for those fields depend on the amount
|
|
||||||
of free memory the database host has available.
|
|
||||||
|
|
||||||
## Synapse config
|
## Synapse config
|
||||||
|
|
||||||
When you are ready to start using PostgreSQL, edit the `database`
|
When you are ready to start using PostgreSQL, edit the `database`
|
||||||
@@ -165,18 +79,42 @@ may block for an extended period while it waits for a response from the
|
|||||||
database server. Example values might be:
|
database server. Example values might be:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
# seconds of inactivity after which TCP should send a keepalive message to the server
|
database:
|
||||||
keepalives_idle: 10
|
args:
|
||||||
|
# ... as above
|
||||||
|
|
||||||
# the number of seconds after which a TCP keepalive message that is not
|
# seconds of inactivity after which TCP should send a keepalive message to the server
|
||||||
# acknowledged by the server should be retransmitted
|
keepalives_idle: 10
|
||||||
keepalives_interval: 10
|
|
||||||
|
|
||||||
# the number of TCP keepalives that can be lost before the client's connection
|
# the number of seconds after which a TCP keepalive message that is not
|
||||||
# to the server is considered dead
|
# acknowledged by the server should be retransmitted
|
||||||
keepalives_count: 3
|
keepalives_interval: 10
|
||||||
|
|
||||||
|
# the number of TCP keepalives that can be lost before the client's connection
|
||||||
|
# to the server is considered dead
|
||||||
|
keepalives_count: 3
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Tuning Postgres
|
||||||
|
|
||||||
|
The default settings should be fine for most deployments. For larger
|
||||||
|
scale deployments tuning some of the settings is recommended, details of
|
||||||
|
which can be found at
|
||||||
|
<https://wiki.postgresql.org/wiki/Tuning_Your_PostgreSQL_Server>.
|
||||||
|
|
||||||
|
In particular, we've found tuning the following values helpful for
|
||||||
|
performance:
|
||||||
|
|
||||||
|
- `shared_buffers`
|
||||||
|
- `effective_cache_size`
|
||||||
|
- `work_mem`
|
||||||
|
- `maintenance_work_mem`
|
||||||
|
- `autovacuum_work_mem`
|
||||||
|
|
||||||
|
Note that the appropriate values for those fields depend on the amount
|
||||||
|
of free memory the database host has available.
|
||||||
|
|
||||||
|
|
||||||
## Porting from SQLite
|
## Porting from SQLite
|
||||||
|
|
||||||
### Overview
|
### Overview
|
||||||
@@ -185,9 +123,8 @@ The script `synapse_port_db` allows porting an existing synapse server
|
|||||||
backed by SQLite to using PostgreSQL. This is done in as a two phase
|
backed by SQLite to using PostgreSQL. This is done in as a two phase
|
||||||
process:
|
process:
|
||||||
|
|
||||||
1. Copy the existing SQLite database to a separate location (while the
|
1. Copy the existing SQLite database to a separate location and run
|
||||||
server is down) and running the port script against that offline
|
the port script against that offline database.
|
||||||
database.
|
|
||||||
2. Shut down the server. Rerun the port script to port any data that
|
2. Shut down the server. Rerun the port script to port any data that
|
||||||
has come in since taking the first snapshot. Restart server against
|
has come in since taking the first snapshot. Restart server against
|
||||||
the PostgreSQL database.
|
the PostgreSQL database.
|
||||||
@@ -245,3 +182,60 @@ PostgreSQL database configuration file `homeserver-postgres.yaml`:
|
|||||||
./synctl start
|
./synctl start
|
||||||
|
|
||||||
Synapse should now be running against PostgreSQL.
|
Synapse should now be running against PostgreSQL.
|
||||||
|
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
### Alternative auth methods
|
||||||
|
|
||||||
|
If you get an error along the lines of `FATAL: Ident authentication failed for
|
||||||
|
user "synapse_user"`, you may need to use an authentication method other than
|
||||||
|
`ident`:
|
||||||
|
|
||||||
|
* If the `synapse_user` user has a password, add the password to the `database:`
|
||||||
|
section of `homeserver.yaml`. Then add the following to `pg_hba.conf`:
|
||||||
|
|
||||||
|
```
|
||||||
|
host synapse synapse_user ::1/128 md5 # or `scram-sha-256` instead of `md5` if you use that
|
||||||
|
```
|
||||||
|
|
||||||
|
* If the `synapse_user` user does not have a password, then a password doesn't
|
||||||
|
have to be added to `homeserver.yaml`. But the following does need to be added
|
||||||
|
to `pg_hba.conf`:
|
||||||
|
|
||||||
|
```
|
||||||
|
host synapse synapse_user ::1/128 trust
|
||||||
|
```
|
||||||
|
|
||||||
|
Note that line order matters in `pg_hba.conf`, so make sure that if you do add a
|
||||||
|
new line, it is inserted before:
|
||||||
|
|
||||||
|
```
|
||||||
|
host all all ::1/128 ident
|
||||||
|
```
|
||||||
|
|
||||||
|
### Fixing incorrect `COLLATE` or `CTYPE`
|
||||||
|
|
||||||
|
Synapse will refuse to set up a new database if it has the wrong values of
|
||||||
|
`COLLATE` and `CTYPE` set, and will log warnings on existing databases. Using
|
||||||
|
different locales can cause issues if the locale library is updated from
|
||||||
|
underneath the database, or if a different version of the locale is used on any
|
||||||
|
replicas.
|
||||||
|
|
||||||
|
The safest way to fix the issue is to dump the database and recreate it with
|
||||||
|
the correct locale parameter (as shown above). It is also possible to change the
|
||||||
|
parameters on a live database and run a `REINDEX` on the entire database,
|
||||||
|
however extreme care must be taken to avoid database corruption.
|
||||||
|
|
||||||
|
Note that the above may fail with an error about duplicate rows if corruption
|
||||||
|
has already occurred, and such duplicate rows will need to be manually removed.
|
||||||
|
|
||||||
|
### Fixing inconsistent sequences error
|
||||||
|
|
||||||
|
Synapse uses Postgres sequences to generate IDs for various tables. A sequence
|
||||||
|
and associated table can get out of sync if, for example, Synapse has been
|
||||||
|
downgraded and then upgraded again.
|
||||||
|
|
||||||
|
To fix the issue shut down Synapse (including any and all workers) and run the
|
||||||
|
SQL command included in the error message. Once done Synapse should start
|
||||||
|
successfully.
|
||||||
|
|||||||
239
docs/presence_router_module.md
Normal file
239
docs/presence_router_module.md
Normal file
@@ -0,0 +1,239 @@
|
|||||||
|
# Presence Router Module
|
||||||
|
|
||||||
|
Synapse supports configuring a module that can specify additional users
|
||||||
|
(local or remote) to should receive certain presence updates from local
|
||||||
|
users.
|
||||||
|
|
||||||
|
Note that routing presence via Application Service transactions is not
|
||||||
|
currently supported.
|
||||||
|
|
||||||
|
The presence routing module is implemented as a Python class, which will
|
||||||
|
be imported by the running Synapse.
|
||||||
|
|
||||||
|
## Python Presence Router Class
|
||||||
|
|
||||||
|
The Python class is instantiated with two objects:
|
||||||
|
|
||||||
|
* A configuration object of some type (see below).
|
||||||
|
* An instance of `synapse.module_api.ModuleApi`.
|
||||||
|
|
||||||
|
It then implements methods related to presence routing.
|
||||||
|
|
||||||
|
Note that one method of `ModuleApi` that may be useful is:
|
||||||
|
|
||||||
|
```python
|
||||||
|
async def ModuleApi.send_local_online_presence_to(users: Iterable[str]) -> None
|
||||||
|
```
|
||||||
|
|
||||||
|
which can be given a list of local or remote MXIDs to broadcast known, online user
|
||||||
|
presence to (for those users that the receiving user is considered interested in).
|
||||||
|
It does not include state for users who are currently offline, and it can only be
|
||||||
|
called on workers that support sending federation. Additionally, this method must
|
||||||
|
only be called from the process that has been configured to write to the
|
||||||
|
the [presence stream](https://github.com/matrix-org/synapse/blob/master/docs/workers.md#stream-writers).
|
||||||
|
By default, this is the main process, but another worker can be configured to do
|
||||||
|
so.
|
||||||
|
|
||||||
|
### Module structure
|
||||||
|
|
||||||
|
Below is a list of possible methods that can be implemented, and whether they are
|
||||||
|
required.
|
||||||
|
|
||||||
|
#### `parse_config`
|
||||||
|
|
||||||
|
```python
|
||||||
|
def parse_config(config_dict: dict) -> Any
|
||||||
|
```
|
||||||
|
|
||||||
|
**Required.** A static method that is passed a dictionary of config options, and
|
||||||
|
should return a validated config object. This method is described further in
|
||||||
|
[Configuration](#configuration).
|
||||||
|
|
||||||
|
#### `get_users_for_states`
|
||||||
|
|
||||||
|
```python
|
||||||
|
async def get_users_for_states(
|
||||||
|
self,
|
||||||
|
state_updates: Iterable[UserPresenceState],
|
||||||
|
) -> Dict[str, Set[UserPresenceState]]:
|
||||||
|
```
|
||||||
|
|
||||||
|
**Required.** An asynchronous method that is passed an iterable of user presence
|
||||||
|
state. This method can determine whether a given presence update should be sent to certain
|
||||||
|
users. It does this by returning a dictionary with keys representing local or remote
|
||||||
|
Matrix User IDs, and values being a python set
|
||||||
|
of `synapse.handlers.presence.UserPresenceState` instances.
|
||||||
|
|
||||||
|
Synapse will then attempt to send the specified presence updates to each user when
|
||||||
|
possible.
|
||||||
|
|
||||||
|
#### `get_interested_users`
|
||||||
|
|
||||||
|
```python
|
||||||
|
async def get_interested_users(self, user_id: str) -> Union[Set[str], str]
|
||||||
|
```
|
||||||
|
|
||||||
|
**Required.** An asynchronous method that is passed a single Matrix User ID. This
|
||||||
|
method is expected to return the users that the passed in user may be interested in the
|
||||||
|
presence of. Returned users may be local or remote. The presence routed as a result of
|
||||||
|
what this method returns is sent in addition to the updates already sent between users
|
||||||
|
that share a room together. Presence updates are deduplicated.
|
||||||
|
|
||||||
|
This method should return a python set of Matrix User IDs, or the object
|
||||||
|
`synapse.events.presence_router.PresenceRouter.ALL_USERS` to indicate that the passed
|
||||||
|
user should receive presence information for *all* known users.
|
||||||
|
|
||||||
|
For clarity, if the user `@alice:example.org` is passed to this method, and the Set
|
||||||
|
`{"@bob:example.com", "@charlie:somewhere.org"}` is returned, this signifies that Alice
|
||||||
|
should receive presence updates sent by Bob and Charlie, regardless of whether these
|
||||||
|
users share a room.
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
Below is an example implementation of a presence router class.
|
||||||
|
|
||||||
|
```python
|
||||||
|
from typing import Dict, Iterable, Set, Union
|
||||||
|
from synapse.events.presence_router import PresenceRouter
|
||||||
|
from synapse.handlers.presence import UserPresenceState
|
||||||
|
from synapse.module_api import ModuleApi
|
||||||
|
|
||||||
|
class PresenceRouterConfig:
|
||||||
|
def __init__(self):
|
||||||
|
# Config options with their defaults
|
||||||
|
# A list of users to always send all user presence updates to
|
||||||
|
self.always_send_to_users = [] # type: List[str]
|
||||||
|
|
||||||
|
# A list of users to ignore presence updates for. Does not affect
|
||||||
|
# shared-room presence relationships
|
||||||
|
self.blacklisted_users = [] # type: List[str]
|
||||||
|
|
||||||
|
class ExamplePresenceRouter:
|
||||||
|
"""An example implementation of synapse.presence_router.PresenceRouter.
|
||||||
|
Supports routing all presence to a configured set of users, or a subset
|
||||||
|
of presence from certain users to members of certain rooms.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
config: A configuration object.
|
||||||
|
module_api: An instance of Synapse's ModuleApi.
|
||||||
|
"""
|
||||||
|
def __init__(self, config: PresenceRouterConfig, module_api: ModuleApi):
|
||||||
|
self._config = config
|
||||||
|
self._module_api = module_api
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def parse_config(config_dict: dict) -> PresenceRouterConfig:
|
||||||
|
"""Parse a configuration dictionary from the homeserver config, do
|
||||||
|
some validation and return a typed PresenceRouterConfig.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
config_dict: The configuration dictionary.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
A validated config object.
|
||||||
|
"""
|
||||||
|
# Initialise a typed config object
|
||||||
|
config = PresenceRouterConfig()
|
||||||
|
always_send_to_users = config_dict.get("always_send_to_users")
|
||||||
|
blacklisted_users = config_dict.get("blacklisted_users")
|
||||||
|
|
||||||
|
# Do some validation of config options... otherwise raise a
|
||||||
|
# synapse.config.ConfigError.
|
||||||
|
config.always_send_to_users = always_send_to_users
|
||||||
|
config.blacklisted_users = blacklisted_users
|
||||||
|
|
||||||
|
return config
|
||||||
|
|
||||||
|
async def get_users_for_states(
|
||||||
|
self,
|
||||||
|
state_updates: Iterable[UserPresenceState],
|
||||||
|
) -> Dict[str, Set[UserPresenceState]]:
|
||||||
|
"""Given an iterable of user presence updates, determine where each one
|
||||||
|
needs to go. Returned results will not affect presence updates that are
|
||||||
|
sent between users who share a room.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
state_updates: An iterable of user presence state updates.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
A dictionary of user_id -> set of UserPresenceState that the user should
|
||||||
|
receive.
|
||||||
|
"""
|
||||||
|
destination_users = {} # type: Dict[str, Set[UserPresenceState]
|
||||||
|
|
||||||
|
# Ignore any updates for blacklisted users
|
||||||
|
desired_updates = set()
|
||||||
|
for update in state_updates:
|
||||||
|
if update.state_key not in self._config.blacklisted_users:
|
||||||
|
desired_updates.add(update)
|
||||||
|
|
||||||
|
# Send all presence updates to specific users
|
||||||
|
for user_id in self._config.always_send_to_users:
|
||||||
|
destination_users[user_id] = desired_updates
|
||||||
|
|
||||||
|
return destination_users
|
||||||
|
|
||||||
|
async def get_interested_users(
|
||||||
|
self,
|
||||||
|
user_id: str,
|
||||||
|
) -> Union[Set[str], PresenceRouter.ALL_USERS]:
|
||||||
|
"""
|
||||||
|
Retrieve a list of users that `user_id` is interested in receiving the
|
||||||
|
presence of. This will be in addition to those they share a room with.
|
||||||
|
Optionally, the object PresenceRouter.ALL_USERS can be returned to indicate
|
||||||
|
that this user should receive all incoming local and remote presence updates.
|
||||||
|
|
||||||
|
Note that this method will only be called for local users.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
user_id: A user requesting presence updates.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
A set of user IDs to return additional presence updates for, or
|
||||||
|
PresenceRouter.ALL_USERS to return presence updates for all other users.
|
||||||
|
"""
|
||||||
|
if user_id in self._config.always_send_to_users:
|
||||||
|
return PresenceRouter.ALL_USERS
|
||||||
|
|
||||||
|
return set()
|
||||||
|
```
|
||||||
|
|
||||||
|
#### A note on `get_users_for_states` and `get_interested_users`
|
||||||
|
|
||||||
|
Both of these methods are effectively two different sides of the same coin. The logic
|
||||||
|
regarding which users should receive updates for other users should be the same
|
||||||
|
between them.
|
||||||
|
|
||||||
|
`get_users_for_states` is called when presence updates come in from either federation
|
||||||
|
or local users, and is used to either direct local presence to remote users, or to
|
||||||
|
wake up the sync streams of local users to collect remote presence.
|
||||||
|
|
||||||
|
In contrast, `get_interested_users` is used to determine the users that presence should
|
||||||
|
be fetched for when a local user is syncing. This presence is then retrieved, before
|
||||||
|
being fed through `get_users_for_states` once again, with only the syncing user's
|
||||||
|
routing information pulled from the resulting dictionary.
|
||||||
|
|
||||||
|
Their routing logic should thus line up, else you may run into unintended behaviour.
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
Once you've crafted your module and installed it into the same Python environment as
|
||||||
|
Synapse, amend your homeserver config file with the following.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
presence:
|
||||||
|
routing_module:
|
||||||
|
module: my_module.ExamplePresenceRouter
|
||||||
|
config:
|
||||||
|
# Any configuration options for your module. The below is an example.
|
||||||
|
# of setting options for ExamplePresenceRouter.
|
||||||
|
always_send_to_users: ["@presence_gobbler:example.org"]
|
||||||
|
blacklisted_users:
|
||||||
|
- "@alice:example.com"
|
||||||
|
- "@bob:example.com"
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
|
The contents of `config` will be passed as a Python dictionary to the static
|
||||||
|
`parse_config` method of your class. The object returned by this method will
|
||||||
|
then be passed to the `__init__` method of your module as `config`.
|
||||||
@@ -3,30 +3,31 @@
|
|||||||
It is recommended to put a reverse proxy such as
|
It is recommended to put a reverse proxy such as
|
||||||
[nginx](https://nginx.org/en/docs/http/ngx_http_proxy_module.html),
|
[nginx](https://nginx.org/en/docs/http/ngx_http_proxy_module.html),
|
||||||
[Apache](https://httpd.apache.org/docs/current/mod/mod_proxy_http.html),
|
[Apache](https://httpd.apache.org/docs/current/mod/mod_proxy_http.html),
|
||||||
[Caddy](https://caddyserver.com/docs/quick-starts/reverse-proxy) or
|
[Caddy](https://caddyserver.com/docs/quick-starts/reverse-proxy),
|
||||||
[HAProxy](https://www.haproxy.org/) in front of Synapse. One advantage
|
[HAProxy](https://www.haproxy.org/) or
|
||||||
|
[relayd](https://man.openbsd.org/relayd.8) in front of Synapse. One advantage
|
||||||
of doing so is that it means that you can expose the default https port
|
of doing so is that it means that you can expose the default https port
|
||||||
(443) to Matrix clients without needing to run Synapse with root
|
(443) to Matrix clients without needing to run Synapse with root
|
||||||
privileges.
|
privileges.
|
||||||
|
|
||||||
|
You should configure your reverse proxy to forward requests to `/_matrix` or
|
||||||
|
`/_synapse/client` to Synapse, and have it set the `X-Forwarded-For` and
|
||||||
|
`X-Forwarded-Proto` request headers.
|
||||||
|
|
||||||
|
You should remember that Matrix clients and other Matrix servers do not
|
||||||
|
necessarily need to connect to your server via the same server name or
|
||||||
|
port. Indeed, clients will use port 443 by default, whereas servers default to
|
||||||
|
port 8448. Where these are different, we refer to the 'client port' and the
|
||||||
|
'federation port'. See [the Matrix
|
||||||
|
specification](https://matrix.org/docs/spec/server_server/latest#resolving-server-names)
|
||||||
|
for more details of the algorithm used for federation connections, and
|
||||||
|
[delegate.md](<delegate.md>) for instructions on setting up delegation.
|
||||||
|
|
||||||
**NOTE**: Your reverse proxy must not `canonicalise` or `normalise`
|
**NOTE**: Your reverse proxy must not `canonicalise` or `normalise`
|
||||||
the requested URI in any way (for example, by decoding `%xx` escapes).
|
the requested URI in any way (for example, by decoding `%xx` escapes).
|
||||||
Beware that Apache *will* canonicalise URIs unless you specify
|
Beware that Apache *will* canonicalise URIs unless you specify
|
||||||
`nocanon`.
|
`nocanon`.
|
||||||
|
|
||||||
When setting up a reverse proxy, remember that Matrix clients and other
|
|
||||||
Matrix servers do not necessarily need to connect to your server via the
|
|
||||||
same server name or port. Indeed, clients will use port 443 by default,
|
|
||||||
whereas servers default to port 8448. Where these are different, we
|
|
||||||
refer to the 'client port' and the 'federation port'. See [the Matrix
|
|
||||||
specification](https://matrix.org/docs/spec/server_server/latest#resolving-server-names)
|
|
||||||
for more details of the algorithm used for federation connections, and
|
|
||||||
[delegate.md](<delegate.md>) for instructions on setting up delegation.
|
|
||||||
|
|
||||||
Endpoints that are part of the standardised Matrix specification are
|
|
||||||
located under `/_matrix`, whereas endpoints specific to Synapse are
|
|
||||||
located under `/_synapse/client`.
|
|
||||||
|
|
||||||
Let's assume that we expect clients to connect to our server at
|
Let's assume that we expect clients to connect to our server at
|
||||||
`https://matrix.example.com`, and other servers to connect at
|
`https://matrix.example.com`, and other servers to connect at
|
||||||
`https://example.com:8448`. The following sections detail the configuration of
|
`https://example.com:8448`. The following sections detail the configuration of
|
||||||
@@ -40,18 +41,21 @@ the reverse proxy and the homeserver.
|
|||||||
|
|
||||||
```
|
```
|
||||||
server {
|
server {
|
||||||
listen 443 ssl;
|
listen 443 ssl http2;
|
||||||
listen [::]:443 ssl;
|
listen [::]:443 ssl http2;
|
||||||
|
|
||||||
# For the federation port
|
# For the federation port
|
||||||
listen 8448 ssl default_server;
|
listen 8448 ssl http2 default_server;
|
||||||
listen [::]:8448 ssl default_server;
|
listen [::]:8448 ssl http2 default_server;
|
||||||
|
|
||||||
server_name matrix.example.com;
|
server_name matrix.example.com;
|
||||||
|
|
||||||
location ~* ^(\/_matrix|\/_synapse\/client) {
|
location ~* ^(\/_matrix|\/_synapse\/client) {
|
||||||
proxy_pass http://localhost:8008;
|
proxy_pass http://localhost:8008;
|
||||||
proxy_set_header X-Forwarded-For $remote_addr;
|
proxy_set_header X-Forwarded-For $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
|
||||||
# Nginx by default only allows file uploads up to 1M in size
|
# Nginx by default only allows file uploads up to 1M in size
|
||||||
# Increase client_max_body_size to match max_upload_size defined in homeserver.yaml
|
# Increase client_max_body_size to match max_upload_size defined in homeserver.yaml
|
||||||
client_max_body_size 50M;
|
client_max_body_size 50M;
|
||||||
@@ -100,9 +104,11 @@ example.com:8448 {
|
|||||||
```
|
```
|
||||||
<VirtualHost *:443>
|
<VirtualHost *:443>
|
||||||
SSLEngine on
|
SSLEngine on
|
||||||
ServerName matrix.example.com;
|
ServerName matrix.example.com
|
||||||
|
|
||||||
|
RequestHeader set "X-Forwarded-Proto" expr=%{REQUEST_SCHEME}
|
||||||
AllowEncodedSlashes NoDecode
|
AllowEncodedSlashes NoDecode
|
||||||
|
ProxyPreserveHost on
|
||||||
ProxyPass /_matrix http://127.0.0.1:8008/_matrix nocanon
|
ProxyPass /_matrix http://127.0.0.1:8008/_matrix nocanon
|
||||||
ProxyPassReverse /_matrix http://127.0.0.1:8008/_matrix
|
ProxyPassReverse /_matrix http://127.0.0.1:8008/_matrix
|
||||||
ProxyPass /_synapse/client http://127.0.0.1:8008/_synapse/client nocanon
|
ProxyPass /_synapse/client http://127.0.0.1:8008/_synapse/client nocanon
|
||||||
@@ -111,8 +117,9 @@ example.com:8448 {
|
|||||||
|
|
||||||
<VirtualHost *:8448>
|
<VirtualHost *:8448>
|
||||||
SSLEngine on
|
SSLEngine on
|
||||||
ServerName example.com;
|
ServerName example.com
|
||||||
|
|
||||||
|
RequestHeader set "X-Forwarded-Proto" expr=%{REQUEST_SCHEME}
|
||||||
AllowEncodedSlashes NoDecode
|
AllowEncodedSlashes NoDecode
|
||||||
ProxyPass /_matrix http://127.0.0.1:8008/_matrix nocanon
|
ProxyPass /_matrix http://127.0.0.1:8008/_matrix nocanon
|
||||||
ProxyPassReverse /_matrix http://127.0.0.1:8008/_matrix
|
ProxyPassReverse /_matrix http://127.0.0.1:8008/_matrix
|
||||||
@@ -129,11 +136,16 @@ example.com:8448 {
|
|||||||
</IfModule>
|
</IfModule>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**NOTE 3**: Missing `ProxyPreserveHost on` can lead to a redirect loop.
|
||||||
|
|
||||||
### HAProxy
|
### HAProxy
|
||||||
|
|
||||||
```
|
```
|
||||||
frontend https
|
frontend https
|
||||||
bind :::443 v4v6 ssl crt /etc/ssl/haproxy/ strict-sni alpn h2,http/1.1
|
bind :::443 v4v6 ssl crt /etc/ssl/haproxy/ strict-sni alpn h2,http/1.1
|
||||||
|
http-request set-header X-Forwarded-Proto https if { ssl_fc }
|
||||||
|
http-request set-header X-Forwarded-Proto http if !{ ssl_fc }
|
||||||
|
http-request set-header X-Forwarded-For %[src]
|
||||||
|
|
||||||
# Matrix client traffic
|
# Matrix client traffic
|
||||||
acl matrix-host hdr(host) -i matrix.example.com
|
acl matrix-host hdr(host) -i matrix.example.com
|
||||||
@@ -144,12 +156,62 @@ frontend https
|
|||||||
|
|
||||||
frontend matrix-federation
|
frontend matrix-federation
|
||||||
bind :::8448 v4v6 ssl crt /etc/ssl/haproxy/synapse.pem alpn h2,http/1.1
|
bind :::8448 v4v6 ssl crt /etc/ssl/haproxy/synapse.pem alpn h2,http/1.1
|
||||||
|
http-request set-header X-Forwarded-Proto https if { ssl_fc }
|
||||||
|
http-request set-header X-Forwarded-Proto http if !{ ssl_fc }
|
||||||
|
http-request set-header X-Forwarded-For %[src]
|
||||||
|
|
||||||
default_backend matrix
|
default_backend matrix
|
||||||
|
|
||||||
backend matrix
|
backend matrix
|
||||||
server matrix 127.0.0.1:8008
|
server matrix 127.0.0.1:8008
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Relayd
|
||||||
|
|
||||||
|
```
|
||||||
|
table <webserver> { 127.0.0.1 }
|
||||||
|
table <matrixserver> { 127.0.0.1 }
|
||||||
|
|
||||||
|
http protocol "https" {
|
||||||
|
tls { no tlsv1.0, ciphers "HIGH" }
|
||||||
|
tls keypair "example.com"
|
||||||
|
match header set "X-Forwarded-For" value "$REMOTE_ADDR"
|
||||||
|
match header set "X-Forwarded-Proto" value "https"
|
||||||
|
|
||||||
|
# set CORS header for .well-known/matrix/server, .well-known/matrix/client
|
||||||
|
# httpd does not support setting headers, so do it here
|
||||||
|
match request path "/.well-known/matrix/*" tag "matrix-cors"
|
||||||
|
match response tagged "matrix-cors" header set "Access-Control-Allow-Origin" value "*"
|
||||||
|
|
||||||
|
pass quick path "/_matrix/*" forward to <matrixserver>
|
||||||
|
pass quick path "/_synapse/client/*" forward to <matrixserver>
|
||||||
|
|
||||||
|
# pass on non-matrix traffic to webserver
|
||||||
|
pass forward to <webserver>
|
||||||
|
}
|
||||||
|
|
||||||
|
relay "https_traffic" {
|
||||||
|
listen on egress port 443 tls
|
||||||
|
protocol "https"
|
||||||
|
forward to <matrixserver> port 8008 check tcp
|
||||||
|
forward to <webserver> port 8080 check tcp
|
||||||
|
}
|
||||||
|
|
||||||
|
http protocol "matrix" {
|
||||||
|
tls { no tlsv1.0, ciphers "HIGH" }
|
||||||
|
tls keypair "example.com"
|
||||||
|
block
|
||||||
|
pass quick path "/_matrix/*" forward to <matrixserver>
|
||||||
|
pass quick path "/_synapse/client/*" forward to <matrixserver>
|
||||||
|
}
|
||||||
|
|
||||||
|
relay "matrix_federation" {
|
||||||
|
listen on egress port 8448 tls
|
||||||
|
protocol "matrix"
|
||||||
|
forward to <matrixserver> port 8008 check tcp
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## Homeserver Configuration
|
## Homeserver Configuration
|
||||||
|
|
||||||
You will also want to set `bind_addresses: ['127.0.0.1']` and
|
You will also want to set `bind_addresses: ['127.0.0.1']` and
|
||||||
|
|||||||
@@ -82,15 +82,33 @@ pid_file: DATADIR/homeserver.pid
|
|||||||
#
|
#
|
||||||
#soft_file_limit: 0
|
#soft_file_limit: 0
|
||||||
|
|
||||||
# Set to false to disable presence tracking on this homeserver.
|
# Presence tracking allows users to see the state (e.g online/offline)
|
||||||
|
# of other local and remote users.
|
||||||
#
|
#
|
||||||
#use_presence: false
|
presence:
|
||||||
|
# Uncomment to disable presence tracking on this homeserver. This option
|
||||||
|
# replaces the previous top-level 'use_presence' option.
|
||||||
|
#
|
||||||
|
#enabled: false
|
||||||
|
|
||||||
|
# Presence routers are third-party modules that can specify additional logic
|
||||||
|
# to where presence updates from users are routed.
|
||||||
|
#
|
||||||
|
presence_router:
|
||||||
|
# The custom module's class. Uncomment to use a custom presence router module.
|
||||||
|
#
|
||||||
|
#module: "my_custom_router.PresenceRouter"
|
||||||
|
|
||||||
|
# Configuration options of the custom module. Refer to your module's
|
||||||
|
# documentation for available options.
|
||||||
|
#
|
||||||
|
#config:
|
||||||
|
# example_option: 'something'
|
||||||
|
|
||||||
# Whether to require authentication to retrieve profile data (avatars,
|
# Whether to require authentication to retrieve profile data (avatars,
|
||||||
# display names) of other users through the client API. Defaults to
|
# display names) of other users through the client API. Defaults to
|
||||||
# 'false'. Note that profile data is also available via the federation
|
# 'false'. Note that profile data is also available via the federation
|
||||||
# API, so this setting is of limited value if federation is enabled on
|
# API, unless allow_profile_lookup_over_federation is set to false.
|
||||||
# the server.
|
|
||||||
#
|
#
|
||||||
#require_auth_for_profile_requests: true
|
#require_auth_for_profile_requests: true
|
||||||
|
|
||||||
@@ -101,6 +119,14 @@ pid_file: DATADIR/homeserver.pid
|
|||||||
#
|
#
|
||||||
#limit_profile_requests_to_users_who_share_rooms: true
|
#limit_profile_requests_to_users_who_share_rooms: true
|
||||||
|
|
||||||
|
# Uncomment to prevent a user's profile data from being retrieved and
|
||||||
|
# displayed in a room until they have joined it. By default, a user's
|
||||||
|
# profile data is included in an invite event, regardless of the values
|
||||||
|
# of the above two settings, and whether or not the users share a server.
|
||||||
|
# Defaults to 'true'.
|
||||||
|
#
|
||||||
|
#include_profile_data_on_invite: false
|
||||||
|
|
||||||
# If set to 'true', removes the need for authentication to access the server's
|
# If set to 'true', removes the need for authentication to access the server's
|
||||||
# public rooms directory through the client API, meaning that anyone can
|
# public rooms directory through the client API, meaning that anyone can
|
||||||
# query the room directory. Defaults to 'false'.
|
# query the room directory. Defaults to 'false'.
|
||||||
@@ -126,6 +152,16 @@ pid_file: DATADIR/homeserver.pid
|
|||||||
#
|
#
|
||||||
#gc_thresholds: [700, 10, 10]
|
#gc_thresholds: [700, 10, 10]
|
||||||
|
|
||||||
|
# The minimum time in seconds between each GC for a generation, regardless of
|
||||||
|
# the GC thresholds. This ensures that we don't do GC too frequently.
|
||||||
|
#
|
||||||
|
# A value of `[1s, 10s, 30s]` indicates that a second must pass between consecutive
|
||||||
|
# generation 0 GCs, etc.
|
||||||
|
#
|
||||||
|
# Defaults to `[1s, 10s, 30s]`.
|
||||||
|
#
|
||||||
|
#gc_min_interval: [0.5s, 30s, 1m]
|
||||||
|
|
||||||
# Set the limit on the returned events in the timeline in the get
|
# Set the limit on the returned events in the timeline in the get
|
||||||
# and sync operations. The default value is 100. -1 means no upper limit.
|
# and sync operations. The default value is 100. -1 means no upper limit.
|
||||||
#
|
#
|
||||||
@@ -647,33 +683,6 @@ acme:
|
|||||||
#
|
#
|
||||||
account_key_file: DATADIR/acme_account.key
|
account_key_file: DATADIR/acme_account.key
|
||||||
|
|
||||||
# List of allowed TLS fingerprints for this server to publish along
|
|
||||||
# with the signing keys for this server. Other matrix servers that
|
|
||||||
# make HTTPS requests to this server will check that the TLS
|
|
||||||
# certificates returned by this server match one of the fingerprints.
|
|
||||||
#
|
|
||||||
# Synapse automatically adds the fingerprint of its own certificate
|
|
||||||
# to the list. So if federation traffic is handled directly by synapse
|
|
||||||
# then no modification to the list is required.
|
|
||||||
#
|
|
||||||
# If synapse is run behind a load balancer that handles the TLS then it
|
|
||||||
# will be necessary to add the fingerprints of the certificates used by
|
|
||||||
# the loadbalancers to this list if they are different to the one
|
|
||||||
# synapse is using.
|
|
||||||
#
|
|
||||||
# Homeservers are permitted to cache the list of TLS fingerprints
|
|
||||||
# returned in the key responses up to the "valid_until_ts" returned in
|
|
||||||
# key. It may be necessary to publish the fingerprints of a new
|
|
||||||
# certificate and wait until the "valid_until_ts" of the previous key
|
|
||||||
# responses have passed before deploying it.
|
|
||||||
#
|
|
||||||
# You can calculate a fingerprint from a given TLS listener via:
|
|
||||||
# openssl s_client -connect $host:$port < /dev/null 2> /dev/null |
|
|
||||||
# openssl x509 -outform DER | openssl sha256 -binary | base64 | tr -d '='
|
|
||||||
# or by checking matrix.org/federationtester/api/report?server_name=$host
|
|
||||||
#
|
|
||||||
#tls_fingerprints: [{"sha256": "<base64_encoded_sha256_fingerprint>"}]
|
|
||||||
|
|
||||||
|
|
||||||
## Federation ##
|
## Federation ##
|
||||||
|
|
||||||
@@ -699,6 +708,18 @@ acme:
|
|||||||
# - matrix.org
|
# - matrix.org
|
||||||
# - example.com
|
# - example.com
|
||||||
|
|
||||||
|
# Uncomment to disable profile lookup over federation. By default, the
|
||||||
|
# Federation API allows other homeservers to obtain profile data of any user
|
||||||
|
# on this homeserver. Defaults to 'true'.
|
||||||
|
#
|
||||||
|
#allow_profile_lookup_over_federation: false
|
||||||
|
|
||||||
|
# Uncomment to disable device display name lookup over federation. By default, the
|
||||||
|
# Federation API allows other homeservers to obtain device display names of any user
|
||||||
|
# on this homeserver. Defaults to 'true'.
|
||||||
|
#
|
||||||
|
#allow_device_name_lookup_over_federation: false
|
||||||
|
|
||||||
|
|
||||||
## Caching ##
|
## Caching ##
|
||||||
|
|
||||||
@@ -778,6 +799,7 @@ caches:
|
|||||||
# password: secretpassword
|
# password: secretpassword
|
||||||
# database: synapse
|
# database: synapse
|
||||||
# host: localhost
|
# host: localhost
|
||||||
|
# port: 5432
|
||||||
# cp_min: 5
|
# cp_min: 5
|
||||||
# cp_max: 10
|
# cp_max: 10
|
||||||
#
|
#
|
||||||
@@ -856,10 +878,10 @@ log_config: "CONFDIR/SERVERNAME.log.config"
|
|||||||
#rc_joins:
|
#rc_joins:
|
||||||
# local:
|
# local:
|
||||||
# per_second: 0.1
|
# per_second: 0.1
|
||||||
# burst_count: 3
|
# burst_count: 10
|
||||||
# remote:
|
# remote:
|
||||||
# per_second: 0.01
|
# per_second: 0.01
|
||||||
# burst_count: 3
|
# burst_count: 10
|
||||||
#
|
#
|
||||||
#rc_3pid_validation:
|
#rc_3pid_validation:
|
||||||
# per_second: 0.003
|
# per_second: 0.003
|
||||||
@@ -1143,69 +1165,6 @@ url_preview_accept_language:
|
|||||||
#
|
#
|
||||||
#enable_registration: false
|
#enable_registration: false
|
||||||
|
|
||||||
# Optional account validity configuration. This allows for accounts to be denied
|
|
||||||
# any request after a given period.
|
|
||||||
#
|
|
||||||
# Once this feature is enabled, Synapse will look for registered users without an
|
|
||||||
# expiration date at startup and will add one to every account it found using the
|
|
||||||
# current settings at that time.
|
|
||||||
# This means that, if a validity period is set, and Synapse is restarted (it will
|
|
||||||
# then derive an expiration date from the current validity period), and some time
|
|
||||||
# after that the validity period changes and Synapse is restarted, the users'
|
|
||||||
# expiration dates won't be updated unless their account is manually renewed. This
|
|
||||||
# date will be randomly selected within a range [now + period - d ; now + period],
|
|
||||||
# where d is equal to 10% of the validity period.
|
|
||||||
#
|
|
||||||
account_validity:
|
|
||||||
# The account validity feature is disabled by default. Uncomment the
|
|
||||||
# following line to enable it.
|
|
||||||
#
|
|
||||||
#enabled: true
|
|
||||||
|
|
||||||
# The period after which an account is valid after its registration. When
|
|
||||||
# renewing the account, its validity period will be extended by this amount
|
|
||||||
# of time. This parameter is required when using the account validity
|
|
||||||
# feature.
|
|
||||||
#
|
|
||||||
#period: 6w
|
|
||||||
|
|
||||||
# The amount of time before an account's expiry date at which Synapse will
|
|
||||||
# send an email to the account's email address with a renewal link. By
|
|
||||||
# default, no such emails are sent.
|
|
||||||
#
|
|
||||||
# If you enable this setting, you will also need to fill out the 'email' and
|
|
||||||
# 'public_baseurl' configuration sections.
|
|
||||||
#
|
|
||||||
#renew_at: 1w
|
|
||||||
|
|
||||||
# The subject of the email sent out with the renewal link. '%(app)s' can be
|
|
||||||
# used as a placeholder for the 'app_name' parameter from the 'email'
|
|
||||||
# section.
|
|
||||||
#
|
|
||||||
# Note that the placeholder must be written '%(app)s', including the
|
|
||||||
# trailing 's'.
|
|
||||||
#
|
|
||||||
# If this is not set, a default value is used.
|
|
||||||
#
|
|
||||||
#renew_email_subject: "Renew your %(app)s account"
|
|
||||||
|
|
||||||
# Directory in which Synapse will try to find templates for the HTML files to
|
|
||||||
# serve to the user when trying to renew an account. If not set, default
|
|
||||||
# templates from within the Synapse package will be used.
|
|
||||||
#
|
|
||||||
#template_dir: "res/templates"
|
|
||||||
|
|
||||||
# File within 'template_dir' giving the HTML to be displayed to the user after
|
|
||||||
# they successfully renewed their account. If not set, default text is used.
|
|
||||||
#
|
|
||||||
#account_renewed_html_path: "account_renewed.html"
|
|
||||||
|
|
||||||
# File within 'template_dir' giving the HTML to be displayed when the user
|
|
||||||
# tries to renew an account with an invalid renewal token. If not set,
|
|
||||||
# default text is used.
|
|
||||||
#
|
|
||||||
#invalid_token_html_path: "invalid_token.html"
|
|
||||||
|
|
||||||
# Time that a user's session remains valid for, after they log in.
|
# Time that a user's session remains valid for, after they log in.
|
||||||
#
|
#
|
||||||
# Note that this is not currently compatible with guest logins.
|
# Note that this is not currently compatible with guest logins.
|
||||||
@@ -1233,9 +1192,9 @@ account_validity:
|
|||||||
#
|
#
|
||||||
#allowed_local_3pids:
|
#allowed_local_3pids:
|
||||||
# - medium: email
|
# - medium: email
|
||||||
# pattern: '.*@matrix\.org'
|
# pattern: '^[^@]+@matrix\.org$'
|
||||||
# - medium: email
|
# - medium: email
|
||||||
# pattern: '.*@vector\.im'
|
# pattern: '^[^@]+@vector\.im$'
|
||||||
# - medium: msisdn
|
# - medium: msisdn
|
||||||
# pattern: '\+44'
|
# pattern: '\+44'
|
||||||
|
|
||||||
@@ -1400,6 +1359,91 @@ account_threepid_delegates:
|
|||||||
#auto_join_rooms_for_guests: false
|
#auto_join_rooms_for_guests: false
|
||||||
|
|
||||||
|
|
||||||
|
## Account Validity ##
|
||||||
|
|
||||||
|
# Optional account validity configuration. This allows for accounts to be denied
|
||||||
|
# any request after a given period.
|
||||||
|
#
|
||||||
|
# Once this feature is enabled, Synapse will look for registered users without an
|
||||||
|
# expiration date at startup and will add one to every account it found using the
|
||||||
|
# current settings at that time.
|
||||||
|
# This means that, if a validity period is set, and Synapse is restarted (it will
|
||||||
|
# then derive an expiration date from the current validity period), and some time
|
||||||
|
# after that the validity period changes and Synapse is restarted, the users'
|
||||||
|
# expiration dates won't be updated unless their account is manually renewed. This
|
||||||
|
# date will be randomly selected within a range [now + period - d ; now + period],
|
||||||
|
# where d is equal to 10% of the validity period.
|
||||||
|
#
|
||||||
|
account_validity:
|
||||||
|
# The account validity feature is disabled by default. Uncomment the
|
||||||
|
# following line to enable it.
|
||||||
|
#
|
||||||
|
#enabled: true
|
||||||
|
|
||||||
|
# The period after which an account is valid after its registration. When
|
||||||
|
# renewing the account, its validity period will be extended by this amount
|
||||||
|
# of time. This parameter is required when using the account validity
|
||||||
|
# feature.
|
||||||
|
#
|
||||||
|
#period: 6w
|
||||||
|
|
||||||
|
# The amount of time before an account's expiry date at which Synapse will
|
||||||
|
# send an email to the account's email address with a renewal link. By
|
||||||
|
# default, no such emails are sent.
|
||||||
|
#
|
||||||
|
# If you enable this setting, you will also need to fill out the 'email' and
|
||||||
|
# 'public_baseurl' configuration sections.
|
||||||
|
#
|
||||||
|
#renew_at: 1w
|
||||||
|
|
||||||
|
# The subject of the email sent out with the renewal link. '%(app)s' can be
|
||||||
|
# used as a placeholder for the 'app_name' parameter from the 'email'
|
||||||
|
# section.
|
||||||
|
#
|
||||||
|
# Note that the placeholder must be written '%(app)s', including the
|
||||||
|
# trailing 's'.
|
||||||
|
#
|
||||||
|
# If this is not set, a default value is used.
|
||||||
|
#
|
||||||
|
#renew_email_subject: "Renew your %(app)s account"
|
||||||
|
|
||||||
|
# Directory in which Synapse will try to find templates for the HTML files to
|
||||||
|
# serve to the user when trying to renew an account. If not set, default
|
||||||
|
# templates from within the Synapse package will be used.
|
||||||
|
#
|
||||||
|
# The currently available templates are:
|
||||||
|
#
|
||||||
|
# * account_renewed.html: Displayed to the user after they have successfully
|
||||||
|
# renewed their account.
|
||||||
|
#
|
||||||
|
# * account_previously_renewed.html: Displayed to the user if they attempt to
|
||||||
|
# renew their account with a token that is valid, but that has already
|
||||||
|
# been used. In this case the account is not renewed again.
|
||||||
|
#
|
||||||
|
# * invalid_token.html: Displayed to the user when they try to renew an account
|
||||||
|
# with an unknown or invalid renewal token.
|
||||||
|
#
|
||||||
|
# See https://github.com/matrix-org/synapse/tree/master/synapse/res/templates for
|
||||||
|
# default template contents.
|
||||||
|
#
|
||||||
|
# The file name of some of these templates can be configured below for legacy
|
||||||
|
# reasons.
|
||||||
|
#
|
||||||
|
#template_dir: "res/templates"
|
||||||
|
|
||||||
|
# A custom file name for the 'account_renewed.html' template.
|
||||||
|
#
|
||||||
|
# If not set, the file is assumed to be named "account_renewed.html".
|
||||||
|
#
|
||||||
|
#account_renewed_html_path: "account_renewed.html"
|
||||||
|
|
||||||
|
# A custom file name for the 'invalid_token.html' template.
|
||||||
|
#
|
||||||
|
# If not set, the file is assumed to be named "invalid_token.html".
|
||||||
|
#
|
||||||
|
#invalid_token_html_path: "invalid_token.html"
|
||||||
|
|
||||||
|
|
||||||
## Metrics ###
|
## Metrics ###
|
||||||
|
|
||||||
# Enable collection and rendering of performance metrics
|
# Enable collection and rendering of performance metrics
|
||||||
@@ -1438,14 +1482,32 @@ metrics_flags:
|
|||||||
|
|
||||||
## API Configuration ##
|
## API Configuration ##
|
||||||
|
|
||||||
# A list of event types that will be included in the room_invite_state
|
# Controls for the state that is shared with users who receive an invite
|
||||||
|
# to a room
|
||||||
#
|
#
|
||||||
#room_invite_state_types:
|
room_prejoin_state:
|
||||||
# - "m.room.join_rules"
|
# By default, the following state event types are shared with users who
|
||||||
# - "m.room.canonical_alias"
|
# receive invites to the room:
|
||||||
# - "m.room.avatar"
|
#
|
||||||
# - "m.room.encryption"
|
# - m.room.join_rules
|
||||||
# - "m.room.name"
|
# - m.room.canonical_alias
|
||||||
|
# - m.room.avatar
|
||||||
|
# - m.room.encryption
|
||||||
|
# - m.room.name
|
||||||
|
# - m.room.create
|
||||||
|
#
|
||||||
|
# Uncomment the following to disable these defaults (so that only the event
|
||||||
|
# types listed in 'additional_event_types' are shared). Defaults to 'false'.
|
||||||
|
#
|
||||||
|
#disable_default_event_types: true
|
||||||
|
|
||||||
|
# Additional state event types to share with users when they are invited
|
||||||
|
# to a room.
|
||||||
|
#
|
||||||
|
# By default, this list is empty (so only the default event types are shared).
|
||||||
|
#
|
||||||
|
#additional_event_types:
|
||||||
|
# - org.example.custom.event.type
|
||||||
|
|
||||||
|
|
||||||
# A list of application service config files to use
|
# A list of application service config files to use
|
||||||
@@ -1745,6 +1807,9 @@ saml2_config:
|
|||||||
# Note that, if this is changed, users authenticating via that provider
|
# Note that, if this is changed, users authenticating via that provider
|
||||||
# will no longer be recognised as the same user!
|
# will no longer be recognised as the same user!
|
||||||
#
|
#
|
||||||
|
# (Use "oidc" here if you are migrating from an old "oidc_config"
|
||||||
|
# configuration.)
|
||||||
|
#
|
||||||
# idp_name: A user-facing name for this identity provider, which is used to
|
# idp_name: A user-facing name for this identity provider, which is used to
|
||||||
# offer the user a choice of login mechanisms.
|
# offer the user a choice of login mechanisms.
|
||||||
#
|
#
|
||||||
@@ -1766,7 +1831,26 @@ saml2_config:
|
|||||||
#
|
#
|
||||||
# client_id: Required. oauth2 client id to use.
|
# client_id: Required. oauth2 client id to use.
|
||||||
#
|
#
|
||||||
# client_secret: Required. oauth2 client secret to use.
|
# client_secret: oauth2 client secret to use. May be omitted if
|
||||||
|
# client_secret_jwt_key is given, or if client_auth_method is 'none'.
|
||||||
|
#
|
||||||
|
# client_secret_jwt_key: Alternative to client_secret: details of a key used
|
||||||
|
# to create a JSON Web Token to be used as an OAuth2 client secret. If
|
||||||
|
# given, must be a dictionary with the following properties:
|
||||||
|
#
|
||||||
|
# key: a pem-encoded signing key. Must be a suitable key for the
|
||||||
|
# algorithm specified. Required unless 'key_file' is given.
|
||||||
|
#
|
||||||
|
# key_file: the path to file containing a pem-encoded signing key file.
|
||||||
|
# Required unless 'key' is given.
|
||||||
|
#
|
||||||
|
# jwt_header: a dictionary giving properties to include in the JWT
|
||||||
|
# header. Must include the key 'alg', giving the algorithm used to
|
||||||
|
# sign the JWT, such as "ES256", using the JWA identifiers in
|
||||||
|
# RFC7518.
|
||||||
|
#
|
||||||
|
# jwt_payload: an optional dictionary giving properties to include in
|
||||||
|
# the JWT payload. Normally this should include an 'iss' key.
|
||||||
#
|
#
|
||||||
# client_auth_method: auth method to use when exchanging the token. Valid
|
# client_auth_method: auth method to use when exchanging the token. Valid
|
||||||
# values are 'client_secret_basic' (default), 'client_secret_post' and
|
# values are 'client_secret_basic' (default), 'client_secret_post' and
|
||||||
@@ -1807,7 +1891,7 @@ saml2_config:
|
|||||||
# sub-properties:
|
# sub-properties:
|
||||||
#
|
#
|
||||||
# module: The class name of a custom mapping module. Default is
|
# module: The class name of a custom mapping module. Default is
|
||||||
# 'synapse.handlers.oidc_handler.JinjaOidcMappingProvider'.
|
# 'synapse.handlers.oidc.JinjaOidcMappingProvider'.
|
||||||
# See https://github.com/matrix-org/synapse/blob/master/docs/sso_mapping_providers.md#openid-mapping-providers
|
# See https://github.com/matrix-org/synapse/blob/master/docs/sso_mapping_providers.md#openid-mapping-providers
|
||||||
# for information on implementing a custom mapping provider.
|
# for information on implementing a custom mapping provider.
|
||||||
#
|
#
|
||||||
@@ -1841,6 +1925,24 @@ saml2_config:
|
|||||||
# which is set to the claims returned by the UserInfo Endpoint and/or
|
# which is set to the claims returned by the UserInfo Endpoint and/or
|
||||||
# in the ID Token.
|
# in the ID Token.
|
||||||
#
|
#
|
||||||
|
# It is possible to configure Synapse to only allow logins if certain attributes
|
||||||
|
# match particular values in the OIDC userinfo. The requirements can be listed under
|
||||||
|
# `attribute_requirements` as shown below. All of the listed attributes must
|
||||||
|
# match for the login to be permitted. Additional attributes can be added to
|
||||||
|
# userinfo by expanding the `scopes` section of the OIDC config to retrieve
|
||||||
|
# additional information from the OIDC provider.
|
||||||
|
#
|
||||||
|
# If the OIDC claim is a list, then the attribute must match any value in the list.
|
||||||
|
# Otherwise, it must exactly match the value of the claim. Using the example
|
||||||
|
# below, the `family_name` claim MUST be "Stephensson", but the `groups`
|
||||||
|
# claim MUST contain "admin".
|
||||||
|
#
|
||||||
|
# attribute_requirements:
|
||||||
|
# - attribute: family_name
|
||||||
|
# value: "Stephensson"
|
||||||
|
# - attribute: groups
|
||||||
|
# value: "admin"
|
||||||
|
#
|
||||||
# See https://github.com/matrix-org/synapse/blob/master/docs/openid.md
|
# See https://github.com/matrix-org/synapse/blob/master/docs/openid.md
|
||||||
# for information on how to configure these options.
|
# for information on how to configure these options.
|
||||||
#
|
#
|
||||||
@@ -1873,34 +1975,9 @@ oidc_providers:
|
|||||||
# localpart_template: "{{ user.login }}"
|
# localpart_template: "{{ user.login }}"
|
||||||
# display_name_template: "{{ user.name }}"
|
# display_name_template: "{{ user.name }}"
|
||||||
# email_template: "{{ user.email }}"
|
# email_template: "{{ user.email }}"
|
||||||
|
# attribute_requirements:
|
||||||
# For use with Keycloak
|
# - attribute: userGroup
|
||||||
#
|
# value: "synapseUsers"
|
||||||
#- idp_id: keycloak
|
|
||||||
# idp_name: Keycloak
|
|
||||||
# issuer: "https://127.0.0.1:8443/auth/realms/my_realm_name"
|
|
||||||
# client_id: "synapse"
|
|
||||||
# client_secret: "copy secret generated in Keycloak UI"
|
|
||||||
# scopes: ["openid", "profile"]
|
|
||||||
|
|
||||||
# For use with Github
|
|
||||||
#
|
|
||||||
#- idp_id: github
|
|
||||||
# idp_name: Github
|
|
||||||
# idp_brand: org.matrix.github
|
|
||||||
# discover: false
|
|
||||||
# issuer: "https://github.com/"
|
|
||||||
# client_id: "your-client-id" # TO BE FILLED
|
|
||||||
# client_secret: "your-client-secret" # TO BE FILLED
|
|
||||||
# authorization_endpoint: "https://github.com/login/oauth/authorize"
|
|
||||||
# token_endpoint: "https://github.com/login/oauth/access_token"
|
|
||||||
# userinfo_endpoint: "https://api.github.com/user"
|
|
||||||
# scopes: ["read:user"]
|
|
||||||
# user_mapping_provider:
|
|
||||||
# config:
|
|
||||||
# subject_claim: "id"
|
|
||||||
# localpart_template: "{{ user.login }}"
|
|
||||||
# display_name_template: "{{ user.name }}"
|
|
||||||
|
|
||||||
|
|
||||||
# Enable Central Authentication Service (CAS) for registration and login.
|
# Enable Central Authentication Service (CAS) for registration and login.
|
||||||
@@ -2228,8 +2305,8 @@ password_config:
|
|||||||
#require_uppercase: true
|
#require_uppercase: true
|
||||||
|
|
||||||
ui_auth:
|
ui_auth:
|
||||||
# The number of milliseconds to allow a user-interactive authentication
|
# The amount of time to allow a user-interactive authentication session
|
||||||
# session to be active.
|
# to be active.
|
||||||
#
|
#
|
||||||
# This defaults to 0, meaning the user is queried for their credentials
|
# This defaults to 0, meaning the user is queried for their credentials
|
||||||
# before every action, but this can be overridden to allow a single
|
# before every action, but this can be overridden to allow a single
|
||||||
@@ -2240,7 +2317,7 @@ ui_auth:
|
|||||||
# Uncomment below to allow for credential validation to last for 15
|
# Uncomment below to allow for credential validation to last for 15
|
||||||
# seconds.
|
# seconds.
|
||||||
#
|
#
|
||||||
#session_timeout: 15000
|
#session_timeout: "15s"
|
||||||
|
|
||||||
|
|
||||||
# Configuration for sending emails from Synapse.
|
# Configuration for sending emails from Synapse.
|
||||||
@@ -2530,19 +2607,35 @@ spam_checker:
|
|||||||
|
|
||||||
# User Directory configuration
|
# User Directory configuration
|
||||||
#
|
#
|
||||||
# 'enabled' defines whether users can search the user directory. If
|
user_directory:
|
||||||
# false then empty responses are returned to all queries. Defaults to
|
# Defines whether users can search the user directory. If false then
|
||||||
# true.
|
# empty responses are returned to all queries. Defaults to true.
|
||||||
#
|
#
|
||||||
# 'search_all_users' defines whether to search all users visible to your HS
|
# Uncomment to disable the user directory.
|
||||||
# when searching the user directory, rather than limiting to users visible
|
#
|
||||||
# in public rooms. Defaults to false. If you set it True, you'll have to
|
#enabled: false
|
||||||
# rebuild the user_directory search indexes, see
|
|
||||||
# https://github.com/matrix-org/synapse/blob/master/docs/user_directory.md
|
# Defines whether to search all users visible to your HS when searching
|
||||||
#
|
# the user directory, rather than limiting to users visible in public
|
||||||
#user_directory:
|
# rooms. Defaults to false.
|
||||||
# enabled: true
|
#
|
||||||
# search_all_users: false
|
# If you set it true, you'll have to rebuild the user_directory search
|
||||||
|
# indexes, see:
|
||||||
|
# https://github.com/matrix-org/synapse/blob/master/docs/user_directory.md
|
||||||
|
#
|
||||||
|
# Uncomment to return search results containing all known users, even if that
|
||||||
|
# user does not share a room with the requester.
|
||||||
|
#
|
||||||
|
#search_all_users: true
|
||||||
|
|
||||||
|
# Defines whether to prefer local users in search query results.
|
||||||
|
# If True, local users are more likely to appear above remote users
|
||||||
|
# when searching the user directory. Defaults to false.
|
||||||
|
#
|
||||||
|
# Uncomment to prefer local over remote users in user directory search
|
||||||
|
# results.
|
||||||
|
#
|
||||||
|
#prefer_local_users: true
|
||||||
|
|
||||||
|
|
||||||
# User Consent configuration
|
# User Consent configuration
|
||||||
@@ -2597,19 +2690,20 @@ spam_checker:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Local statistics collection. Used in populating the room directory.
|
# Settings for local room and user statistics collection. See
|
||||||
|
# docs/room_and_user_statistics.md.
|
||||||
#
|
#
|
||||||
# 'bucket_size' controls how large each statistics timeslice is. It can
|
stats:
|
||||||
# be defined in a human readable short form -- e.g. "1d", "1y".
|
# Uncomment the following to disable room and user statistics. Note that doing
|
||||||
#
|
# so may cause certain features (such as the room directory) not to work
|
||||||
# 'retention' controls how long historical statistics will be kept for.
|
# correctly.
|
||||||
# It can be defined in a human readable short form -- e.g. "1d", "1y".
|
#
|
||||||
#
|
#enabled: false
|
||||||
#
|
|
||||||
#stats:
|
# The size of each timeslice in the room_stats_historical and
|
||||||
# enabled: true
|
# user_stats_historical tables, as a time period. Defaults to "1d".
|
||||||
# bucket_size: 1d
|
#
|
||||||
# retention: 1y
|
#bucket_size: 1h
|
||||||
|
|
||||||
|
|
||||||
# Server Notices room configuration
|
# Server Notices room configuration
|
||||||
@@ -2724,7 +2818,8 @@ opentracing:
|
|||||||
#enabled: true
|
#enabled: true
|
||||||
|
|
||||||
# The list of homeservers we wish to send and receive span contexts and span baggage.
|
# The list of homeservers we wish to send and receive span contexts and span baggage.
|
||||||
# See docs/opentracing.rst
|
# See docs/opentracing.rst.
|
||||||
|
#
|
||||||
# This is a list of regexes which are matched against the server_name of the
|
# This is a list of regexes which are matched against the server_name of the
|
||||||
# homeserver.
|
# homeserver.
|
||||||
#
|
#
|
||||||
@@ -2733,19 +2828,26 @@ opentracing:
|
|||||||
#homeserver_whitelist:
|
#homeserver_whitelist:
|
||||||
# - ".*"
|
# - ".*"
|
||||||
|
|
||||||
|
# A list of the matrix IDs of users whose requests will always be traced,
|
||||||
|
# even if the tracing system would otherwise drop the traces due to
|
||||||
|
# probabilistic sampling.
|
||||||
|
#
|
||||||
|
# By default, the list is empty.
|
||||||
|
#
|
||||||
|
#force_tracing_for_users:
|
||||||
|
# - "@user1:server_name"
|
||||||
|
# - "@user2:server_name"
|
||||||
|
|
||||||
# Jaeger can be configured to sample traces at different rates.
|
# Jaeger can be configured to sample traces at different rates.
|
||||||
# All configuration options provided by Jaeger can be set here.
|
# All configuration options provided by Jaeger can be set here.
|
||||||
# Jaeger's configuration mostly related to trace sampling which
|
# Jaeger's configuration is mostly related to trace sampling which
|
||||||
# is documented here:
|
# is documented here:
|
||||||
# https://www.jaegertracing.io/docs/1.13/sampling/.
|
# https://www.jaegertracing.io/docs/latest/sampling/.
|
||||||
#
|
#
|
||||||
#jaeger_config:
|
#jaeger_config:
|
||||||
# sampler:
|
# sampler:
|
||||||
# type: const
|
# type: const
|
||||||
# param: 1
|
# param: 1
|
||||||
|
|
||||||
# Logging whether spans were started and reported
|
|
||||||
#
|
|
||||||
# logging:
|
# logging:
|
||||||
# false
|
# false
|
||||||
|
|
||||||
@@ -2814,3 +2916,18 @@ redis:
|
|||||||
# Optional password if configured on the Redis instance
|
# Optional password if configured on the Redis instance
|
||||||
#
|
#
|
||||||
#password: <secret_password>
|
#password: <secret_password>
|
||||||
|
|
||||||
|
|
||||||
|
# Enable experimental features in Synapse.
|
||||||
|
#
|
||||||
|
# Experimental features might break or be removed without a deprecation
|
||||||
|
# period.
|
||||||
|
#
|
||||||
|
experimental_features:
|
||||||
|
# Support for Spaces (MSC1772), it enables the following:
|
||||||
|
#
|
||||||
|
# * The Spaces Summary API (MSC2946).
|
||||||
|
# * Restricting room membership based on space membership (MSC3083).
|
||||||
|
#
|
||||||
|
# Uncomment to disable support for Spaces.
|
||||||
|
#spaces_enabled: false
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ The Python class is instantiated with two objects:
|
|||||||
* An instance of `synapse.module_api.ModuleApi`.
|
* An instance of `synapse.module_api.ModuleApi`.
|
||||||
|
|
||||||
It then implements methods which return a boolean to alter behavior in Synapse.
|
It then implements methods which return a boolean to alter behavior in Synapse.
|
||||||
|
All the methods must be defined.
|
||||||
|
|
||||||
There's a generic method for checking every event (`check_event_for_spam`), as
|
There's a generic method for checking every event (`check_event_for_spam`), as
|
||||||
well as some specific methods:
|
well as some specific methods:
|
||||||
@@ -24,13 +25,18 @@ well as some specific methods:
|
|||||||
* `user_may_publish_room`
|
* `user_may_publish_room`
|
||||||
* `check_username_for_spam`
|
* `check_username_for_spam`
|
||||||
* `check_registration_for_spam`
|
* `check_registration_for_spam`
|
||||||
|
* `check_media_file_for_spam`
|
||||||
|
|
||||||
The details of the each of these methods (as well as their inputs and outputs)
|
The details of each of these methods (as well as their inputs and outputs)
|
||||||
are documented in the `synapse.events.spamcheck.SpamChecker` class.
|
are documented in the `synapse.events.spamcheck.SpamChecker` class.
|
||||||
|
|
||||||
The `ModuleApi` class provides a way for the custom spam checker class to
|
The `ModuleApi` class provides a way for the custom spam checker class to
|
||||||
call back into the homeserver internals.
|
call back into the homeserver internals.
|
||||||
|
|
||||||
|
Additionally, a `parse_config` method is mandatory and receives the plugin config
|
||||||
|
dictionary. After parsing, It must return an object which will be
|
||||||
|
passed to `__init__` later.
|
||||||
|
|
||||||
### Example
|
### Example
|
||||||
|
|
||||||
```python
|
```python
|
||||||
@@ -41,6 +47,10 @@ class ExampleSpamChecker:
|
|||||||
self.config = config
|
self.config = config
|
||||||
self.api = api
|
self.api = api
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def parse_config(config):
|
||||||
|
return config
|
||||||
|
|
||||||
async def check_event_for_spam(self, foo):
|
async def check_event_for_spam(self, foo):
|
||||||
return False # allow all events
|
return False # allow all events
|
||||||
|
|
||||||
@@ -59,7 +69,13 @@ class ExampleSpamChecker:
|
|||||||
async def check_username_for_spam(self, user_profile):
|
async def check_username_for_spam(self, user_profile):
|
||||||
return False # allow all usernames
|
return False # allow all usernames
|
||||||
|
|
||||||
async def check_registration_for_spam(self, email_threepid, username, request_info):
|
async def check_registration_for_spam(
|
||||||
|
self,
|
||||||
|
email_threepid,
|
||||||
|
username,
|
||||||
|
request_info,
|
||||||
|
auth_provider_id,
|
||||||
|
):
|
||||||
return RegistrationBehaviour.ALLOW # allow all registrations
|
return RegistrationBehaviour.ALLOW # allow all registrations
|
||||||
|
|
||||||
async def check_media_file_for_spam(self, file_wrapper, file_info):
|
async def check_media_file_for_spam(self, file_wrapper, file_info):
|
||||||
|
|||||||
@@ -67,8 +67,8 @@ A custom mapping provider must specify the following methods:
|
|||||||
- Arguments:
|
- Arguments:
|
||||||
- `userinfo` - A `authlib.oidc.core.claims.UserInfo` object to extract user
|
- `userinfo` - A `authlib.oidc.core.claims.UserInfo` object to extract user
|
||||||
information from.
|
information from.
|
||||||
- This method must return a string, which is the unique identifier for the
|
- This method must return a string, which is the unique, immutable identifier
|
||||||
user. Commonly the ``sub`` claim of the response.
|
for the user. Commonly the `sub` claim of the response.
|
||||||
* `map_user_attributes(self, userinfo, token, failures)`
|
* `map_user_attributes(self, userinfo, token, failures)`
|
||||||
- This method must be async.
|
- This method must be async.
|
||||||
- Arguments:
|
- Arguments:
|
||||||
@@ -87,7 +87,9 @@ A custom mapping provider must specify the following methods:
|
|||||||
`localpart` value, such as `john.doe1`.
|
`localpart` value, such as `john.doe1`.
|
||||||
- Returns a dictionary with two keys:
|
- Returns a dictionary with two keys:
|
||||||
- `localpart`: A string, used to generate the Matrix ID. If this is
|
- `localpart`: A string, used to generate the Matrix ID. If this is
|
||||||
`None`, the user is prompted to pick their own username.
|
`None`, the user is prompted to pick their own username. This is only used
|
||||||
|
during a user's first login. Once a localpart has been associated with a
|
||||||
|
remote user ID (see `get_remote_user_id`) it cannot be updated.
|
||||||
- `displayname`: An optional string, the display name for the user.
|
- `displayname`: An optional string, the display name for the user.
|
||||||
* `get_extra_attributes(self, userinfo, token)`
|
* `get_extra_attributes(self, userinfo, token)`
|
||||||
- This method must be async.
|
- This method must be async.
|
||||||
@@ -106,7 +108,7 @@ A custom mapping provider must specify the following methods:
|
|||||||
|
|
||||||
Synapse has a built-in OpenID mapping provider if a custom provider isn't
|
Synapse has a built-in OpenID mapping provider if a custom provider isn't
|
||||||
specified in the config. It is located at
|
specified in the config. It is located at
|
||||||
[`synapse.handlers.oidc_handler.JinjaOidcMappingProvider`](../synapse/handlers/oidc_handler.py).
|
[`synapse.handlers.oidc.JinjaOidcMappingProvider`](../synapse/handlers/oidc.py).
|
||||||
|
|
||||||
## SAML Mapping Providers
|
## SAML Mapping Providers
|
||||||
|
|
||||||
@@ -153,8 +155,8 @@ A custom mapping provider must specify the following methods:
|
|||||||
information from.
|
information from.
|
||||||
- `client_redirect_url` - A string, the URL that the client will be
|
- `client_redirect_url` - A string, the URL that the client will be
|
||||||
redirected to.
|
redirected to.
|
||||||
- This method must return a string, which is the unique identifier for the
|
- This method must return a string, which is the unique, immutable identifier
|
||||||
user. Commonly the ``uid`` claim of the response.
|
for the user. Commonly the `uid` claim of the response.
|
||||||
* `saml_response_to_user_attributes(self, saml_response, failures, client_redirect_url)`
|
* `saml_response_to_user_attributes(self, saml_response, failures, client_redirect_url)`
|
||||||
- Arguments:
|
- Arguments:
|
||||||
- `saml_response` - A `saml2.response.AuthnResponse` object to extract user
|
- `saml_response` - A `saml2.response.AuthnResponse` object to extract user
|
||||||
@@ -172,8 +174,10 @@ A custom mapping provider must specify the following methods:
|
|||||||
redirected to.
|
redirected to.
|
||||||
- This method must return a dictionary, which will then be used by Synapse
|
- This method must return a dictionary, which will then be used by Synapse
|
||||||
to build a new user. The following keys are allowed:
|
to build a new user. The following keys are allowed:
|
||||||
* `mxid_localpart` - The mxid localpart of the new user. If this is
|
* `mxid_localpart` - A string, the mxid localpart of the new user. If this is
|
||||||
`None`, the user is prompted to pick their own username.
|
`None`, the user is prompted to pick their own username. This is only used
|
||||||
|
during a user's first login. Once a localpart has been associated with a
|
||||||
|
remote user ID (see `get_remote_user_id`) it cannot be updated.
|
||||||
* `displayname` - The displayname of the new user. If not provided, will default to
|
* `displayname` - The displayname of the new user. If not provided, will default to
|
||||||
the value of `mxid_localpart`.
|
the value of `mxid_localpart`.
|
||||||
* `emails` - A list of emails for the new user. If not provided, will
|
* `emails` - A list of emails for the new user. If not provided, will
|
||||||
@@ -190,4 +194,4 @@ A custom mapping provider must specify the following methods:
|
|||||||
|
|
||||||
Synapse has a built-in SAML mapping provider if a custom provider isn't
|
Synapse has a built-in SAML mapping provider if a custom provider isn't
|
||||||
specified in the config. It is located at
|
specified in the config. It is located at
|
||||||
[`synapse.handlers.saml_handler.DefaultSamlMappingProvider`](../synapse/handlers/saml_handler.py).
|
[`synapse.handlers.saml.DefaultSamlMappingProvider`](../synapse/handlers/saml.py).
|
||||||
|
|||||||
@@ -65,3 +65,33 @@ systemctl restart matrix-synapse-worker@federation_reader.service
|
|||||||
systemctl enable matrix-synapse-worker@federation_writer.service
|
systemctl enable matrix-synapse-worker@federation_writer.service
|
||||||
systemctl restart matrix-synapse.target
|
systemctl restart matrix-synapse.target
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Hardening
|
||||||
|
|
||||||
|
**Optional:** If further hardening is desired, the file
|
||||||
|
`override-hardened.conf` may be copied from
|
||||||
|
`contrib/systemd/override-hardened.conf` in this repository to the location
|
||||||
|
`/etc/systemd/system/matrix-synapse.service.d/override-hardened.conf` (the
|
||||||
|
directory may have to be created). It enables certain sandboxing features in
|
||||||
|
systemd to further secure the synapse service. You may read the comments to
|
||||||
|
understand what the override file is doing. The same file will need to be copied
|
||||||
|
to
|
||||||
|
`/etc/systemd/system/matrix-synapse-worker@.service.d/override-hardened-worker.conf`
|
||||||
|
(this directory may also have to be created) in order to apply the same
|
||||||
|
hardening options to any worker processes.
|
||||||
|
|
||||||
|
Once these files have been copied to their appropriate locations, simply reload
|
||||||
|
systemd's manager config files and restart all Synapse services to apply the hardening options. They will automatically
|
||||||
|
be applied at every restart as long as the override files are present at the
|
||||||
|
specified locations.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
systemctl daemon-reload
|
||||||
|
|
||||||
|
# Restart services
|
||||||
|
systemctl restart matrix-synapse.target
|
||||||
|
```
|
||||||
|
|
||||||
|
In order to see their effect, you may run `systemd-analyze security
|
||||||
|
matrix-synapse.service` before and after applying the hardening options to see
|
||||||
|
the changes being applied at a glance.
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ AssertPathExists=/etc/matrix-synapse/workers/%i.yaml
|
|||||||
|
|
||||||
# This service should be restarted when the synapse target is restarted.
|
# This service should be restarted when the synapse target is restarted.
|
||||||
PartOf=matrix-synapse.target
|
PartOf=matrix-synapse.target
|
||||||
|
ReloadPropagatedFrom=matrix-synapse.target
|
||||||
|
|
||||||
# if this is started at the same time as the main, let the main process start
|
# if this is started at the same time as the main, let the main process start
|
||||||
# first, to initialise the database schema.
|
# first, to initialise the database schema.
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ Description=Synapse master
|
|||||||
|
|
||||||
# This service should be restarted when the synapse target is restarted.
|
# This service should be restarted when the synapse target is restarted.
|
||||||
PartOf=matrix-synapse.target
|
PartOf=matrix-synapse.target
|
||||||
|
ReloadPropagatedFrom=matrix-synapse.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=notify
|
Type=notify
|
||||||
|
|||||||
@@ -220,10 +220,6 @@ Asks the server for the current position of all streams.
|
|||||||
|
|
||||||
Acknowledge receipt of some federation data
|
Acknowledge receipt of some federation data
|
||||||
|
|
||||||
#### REMOVE_PUSHER (C)
|
|
||||||
|
|
||||||
Inform the server a pusher should be removed
|
|
||||||
|
|
||||||
### REMOTE_SERVER_UP (S, C)
|
### REMOTE_SERVER_UP (S, C)
|
||||||
|
|
||||||
Inform other processes that a remote server may have come back online.
|
Inform other processes that a remote server may have come back online.
|
||||||
|
|||||||
@@ -7,6 +7,6 @@ who are present in a publicly viewable room present on the server.
|
|||||||
|
|
||||||
The directory info is stored in various tables, which can (typically after
|
The directory info is stored in various tables, which can (typically after
|
||||||
DB corruption) get stale or out of sync. If this happens, for now the
|
DB corruption) get stale or out of sync. If this happens, for now the
|
||||||
solution to fix it is to execute the SQL [here](../synapse/storage/databases/main/schema/delta/53/user_dir_populate.sql)
|
solution to fix it is to execute the SQL [here](https://github.com/matrix-org/synapse/blob/master/synapse/storage/schema/main/delta/53/user_dir_populate.sql)
|
||||||
and then restart synapse. This should then start a background task to
|
and then restart synapse. This should then start a background task to
|
||||||
flush the current tables and regenerate the directory.
|
flush the current tables and regenerate the directory.
|
||||||
|
|||||||
@@ -232,7 +232,6 @@ expressions:
|
|||||||
# Registration/login requests
|
# Registration/login requests
|
||||||
^/_matrix/client/(api/v1|r0|unstable)/login$
|
^/_matrix/client/(api/v1|r0|unstable)/login$
|
||||||
^/_matrix/client/(r0|unstable)/register$
|
^/_matrix/client/(r0|unstable)/register$
|
||||||
^/_matrix/client/(r0|unstable)/auth/.*/fallback/web$
|
|
||||||
|
|
||||||
# Event sending requests
|
# Event sending requests
|
||||||
^/_matrix/client/(api/v1|r0|unstable)/rooms/.*/redact
|
^/_matrix/client/(api/v1|r0|unstable)/rooms/.*/redact
|
||||||
@@ -276,7 +275,8 @@ using):
|
|||||||
|
|
||||||
Ensure that all SSO logins go to a single process.
|
Ensure that all SSO logins go to a single process.
|
||||||
For multiple workers not handling the SSO endpoints properly, see
|
For multiple workers not handling the SSO endpoints properly, see
|
||||||
[#7530](https://github.com/matrix-org/synapse/issues/7530).
|
[#7530](https://github.com/matrix-org/synapse/issues/7530) and
|
||||||
|
[#9427](https://github.com/matrix-org/synapse/issues/9427).
|
||||||
|
|
||||||
Note that a HTTP listener with `client` and `federation` resources must be
|
Note that a HTTP listener with `client` and `federation` resources must be
|
||||||
configured in the `worker_listeners` option in the worker config.
|
configured in the `worker_listeners` option in the worker config.
|
||||||
|
|||||||
28
mypy.ini
28
mypy.ini
@@ -1,12 +1,14 @@
|
|||||||
[mypy]
|
[mypy]
|
||||||
namespace_packages = True
|
namespace_packages = True
|
||||||
plugins = mypy_zope:plugin, scripts-dev/mypy_synapse_plugin.py
|
plugins = mypy_zope:plugin, scripts-dev/mypy_synapse_plugin.py
|
||||||
follow_imports = silent
|
follow_imports = normal
|
||||||
check_untyped_defs = True
|
check_untyped_defs = True
|
||||||
show_error_codes = True
|
show_error_codes = True
|
||||||
show_traceback = True
|
show_traceback = True
|
||||||
mypy_path = stubs
|
mypy_path = stubs
|
||||||
warn_unreachable = True
|
warn_unreachable = True
|
||||||
|
local_partial_types = True
|
||||||
|
no_implicit_optional = True
|
||||||
|
|
||||||
# To find all folders that pass mypy you run:
|
# To find all folders that pass mypy you run:
|
||||||
#
|
#
|
||||||
@@ -20,9 +22,11 @@ files =
|
|||||||
synapse/crypto,
|
synapse/crypto,
|
||||||
synapse/event_auth.py,
|
synapse/event_auth.py,
|
||||||
synapse/events/builder.py,
|
synapse/events/builder.py,
|
||||||
synapse/events/validator.py,
|
|
||||||
synapse/events/spamcheck.py,
|
synapse/events/spamcheck.py,
|
||||||
|
synapse/events/third_party_rules.py,
|
||||||
|
synapse/events/validator.py,
|
||||||
synapse/federation,
|
synapse/federation,
|
||||||
|
synapse/groups,
|
||||||
synapse/handlers,
|
synapse/handlers,
|
||||||
synapse/http/client.py,
|
synapse/http/client.py,
|
||||||
synapse/http/federation/matrix_federation_agent.py,
|
synapse/http/federation/matrix_federation_agent.py,
|
||||||
@@ -67,13 +71,21 @@ files =
|
|||||||
synapse/types.py,
|
synapse/types.py,
|
||||||
synapse/util/async_helpers.py,
|
synapse/util/async_helpers.py,
|
||||||
synapse/util/caches,
|
synapse/util/caches,
|
||||||
|
synapse/util/daemonize.py,
|
||||||
|
synapse/util/hash.py,
|
||||||
|
synapse/util/iterutils.py,
|
||||||
synapse/util/metrics.py,
|
synapse/util/metrics.py,
|
||||||
|
synapse/util/macaroons.py,
|
||||||
|
synapse/util/module_loader.py,
|
||||||
|
synapse/util/msisdn.py,
|
||||||
synapse/util/stringutils.py,
|
synapse/util/stringutils.py,
|
||||||
|
synapse/visibility.py,
|
||||||
tests/replication,
|
tests/replication,
|
||||||
tests/test_utils,
|
tests/test_utils,
|
||||||
tests/handlers/test_password_providers.py,
|
tests/handlers/test_password_providers.py,
|
||||||
tests/rest/client/v1/test_login.py,
|
tests/rest/client/v1/test_login.py,
|
||||||
tests/rest/client/v2_alpha/test_auth.py,
|
tests/rest/client/v2_alpha/test_auth.py,
|
||||||
|
tests/util/test_itertools.py,
|
||||||
tests/util/test_stream_change_cache.py
|
tests/util/test_stream_change_cache.py
|
||||||
|
|
||||||
[mypy-pymacaroons.*]
|
[mypy-pymacaroons.*]
|
||||||
@@ -115,9 +127,6 @@ ignore_missing_imports = True
|
|||||||
[mypy-saml2.*]
|
[mypy-saml2.*]
|
||||||
ignore_missing_imports = True
|
ignore_missing_imports = True
|
||||||
|
|
||||||
[mypy-unpaddedbase64]
|
|
||||||
ignore_missing_imports = True
|
|
||||||
|
|
||||||
[mypy-canonicaljson]
|
[mypy-canonicaljson]
|
||||||
ignore_missing_imports = True
|
ignore_missing_imports = True
|
||||||
|
|
||||||
@@ -168,3 +177,12 @@ ignore_missing_imports = True
|
|||||||
|
|
||||||
[mypy-txacme.*]
|
[mypy-txacme.*]
|
||||||
ignore_missing_imports = True
|
ignore_missing_imports = True
|
||||||
|
|
||||||
|
[mypy-pympler.*]
|
||||||
|
ignore_missing_imports = True
|
||||||
|
|
||||||
|
[mypy-phonenumbers.*]
|
||||||
|
ignore_missing_imports = True
|
||||||
|
|
||||||
|
[mypy-ijson.*]
|
||||||
|
ignore_missing_imports = True
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
showcontent = true
|
showcontent = true
|
||||||
|
|
||||||
[tool.black]
|
[tool.black]
|
||||||
target-version = ['py35']
|
target-version = ['py36']
|
||||||
exclude = '''
|
exclude = '''
|
||||||
|
|
||||||
(
|
(
|
||||||
|
|||||||
@@ -18,22 +18,21 @@ import threading
|
|||||||
from concurrent.futures import ThreadPoolExecutor
|
from concurrent.futures import ThreadPoolExecutor
|
||||||
|
|
||||||
DISTS = (
|
DISTS = (
|
||||||
"debian:stretch",
|
|
||||||
"debian:buster",
|
"debian:buster",
|
||||||
"debian:bullseye",
|
"debian:bullseye",
|
||||||
"debian:sid",
|
"debian:sid",
|
||||||
"ubuntu:xenial",
|
"ubuntu:bionic", # 18.04 LTS (our EOL forced by Py36 on 2021-12-23)
|
||||||
"ubuntu:bionic",
|
"ubuntu:focal", # 20.04 LTS (our EOL forced by Py38 on 2024-10-14)
|
||||||
"ubuntu:focal",
|
"ubuntu:groovy", # 20.10 (EOL 2021-07-07)
|
||||||
"ubuntu:groovy",
|
"ubuntu:hirsute", # 21.04 (EOL 2022-01-05)
|
||||||
)
|
)
|
||||||
|
|
||||||
DESC = '''\
|
DESC = """\
|
||||||
Builds .debs for synapse, using a Docker image for the build environment.
|
Builds .debs for synapse, using a Docker image for the build environment.
|
||||||
|
|
||||||
By default, builds for all known distributions, but a list of distributions
|
By default, builds for all known distributions, but a list of distributions
|
||||||
can be passed on the commandline for debugging.
|
can be passed on the commandline for debugging.
|
||||||
'''
|
"""
|
||||||
|
|
||||||
|
|
||||||
class Builder(object):
|
class Builder(object):
|
||||||
@@ -43,21 +42,21 @@ class Builder(object):
|
|||||||
self._lock = threading.Lock()
|
self._lock = threading.Lock()
|
||||||
self._failed = False
|
self._failed = False
|
||||||
|
|
||||||
def run_build(self, dist):
|
def run_build(self, dist, skip_tests=False):
|
||||||
"""Build deb for a single distribution"""
|
"""Build deb for a single distribution"""
|
||||||
|
|
||||||
if self._failed:
|
if self._failed:
|
||||||
print("not building %s due to earlier failure" % (dist, ))
|
print("not building %s due to earlier failure" % (dist,))
|
||||||
raise Exception("failed")
|
raise Exception("failed")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self._inner_build(dist)
|
self._inner_build(dist, skip_tests)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("build of %s failed: %s" % (dist, e), file=sys.stderr)
|
print("build of %s failed: %s" % (dist, e), file=sys.stderr)
|
||||||
self._failed = True
|
self._failed = True
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def _inner_build(self, dist):
|
def _inner_build(self, dist, skip_tests=False):
|
||||||
projdir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
|
projdir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
|
||||||
os.chdir(projdir)
|
os.chdir(projdir)
|
||||||
|
|
||||||
@@ -69,47 +68,65 @@ class Builder(object):
|
|||||||
# we tend to get source packages which are full of debs. (We could hack
|
# we tend to get source packages which are full of debs. (We could hack
|
||||||
# around that with more magic in the build_debian.sh script, but that
|
# around that with more magic in the build_debian.sh script, but that
|
||||||
# doesn't solve the problem for natively-run dpkg-buildpakage).
|
# doesn't solve the problem for natively-run dpkg-buildpakage).
|
||||||
debsdir = os.path.join(projdir, '../debs')
|
debsdir = os.path.join(projdir, "../debs")
|
||||||
os.makedirs(debsdir, exist_ok=True)
|
os.makedirs(debsdir, exist_ok=True)
|
||||||
|
|
||||||
if self.redirect_stdout:
|
if self.redirect_stdout:
|
||||||
logfile = os.path.join(debsdir, "%s.buildlog" % (tag, ))
|
logfile = os.path.join(debsdir, "%s.buildlog" % (tag,))
|
||||||
print("building %s: directing output to %s" % (dist, logfile))
|
print("building %s: directing output to %s" % (dist, logfile))
|
||||||
stdout = open(logfile, "w")
|
stdout = open(logfile, "w")
|
||||||
else:
|
else:
|
||||||
stdout = None
|
stdout = None
|
||||||
|
|
||||||
# first build a docker image for the build environment
|
# first build a docker image for the build environment
|
||||||
subprocess.check_call([
|
subprocess.check_call(
|
||||||
"docker", "build",
|
[
|
||||||
"--tag", "dh-venv-builder:" + tag,
|
"docker",
|
||||||
"--build-arg", "distro=" + dist,
|
"build",
|
||||||
"-f", "docker/Dockerfile-dhvirtualenv",
|
"--tag",
|
||||||
"docker",
|
"dh-venv-builder:" + tag,
|
||||||
], stdout=stdout, stderr=subprocess.STDOUT)
|
"--build-arg",
|
||||||
|
"distro=" + dist,
|
||||||
|
"-f",
|
||||||
|
"docker/Dockerfile-dhvirtualenv",
|
||||||
|
"docker",
|
||||||
|
],
|
||||||
|
stdout=stdout,
|
||||||
|
stderr=subprocess.STDOUT,
|
||||||
|
)
|
||||||
|
|
||||||
container_name = "synapse_build_" + tag
|
container_name = "synapse_build_" + tag
|
||||||
with self._lock:
|
with self._lock:
|
||||||
self.active_containers.add(container_name)
|
self.active_containers.add(container_name)
|
||||||
|
|
||||||
# then run the build itself
|
# then run the build itself
|
||||||
subprocess.check_call([
|
subprocess.check_call(
|
||||||
"docker", "run",
|
[
|
||||||
"--rm",
|
"docker",
|
||||||
"--name", container_name,
|
"run",
|
||||||
"--volume=" + projdir + ":/synapse/source:ro",
|
"--rm",
|
||||||
"--volume=" + debsdir + ":/debs",
|
"--name",
|
||||||
"-e", "TARGET_USERID=%i" % (os.getuid(), ),
|
container_name,
|
||||||
"-e", "TARGET_GROUPID=%i" % (os.getgid(), ),
|
"--volume=" + projdir + ":/synapse/source:ro",
|
||||||
"dh-venv-builder:" + tag,
|
"--volume=" + debsdir + ":/debs",
|
||||||
], stdout=stdout, stderr=subprocess.STDOUT)
|
"-e",
|
||||||
|
"TARGET_USERID=%i" % (os.getuid(),),
|
||||||
|
"-e",
|
||||||
|
"TARGET_GROUPID=%i" % (os.getgid(),),
|
||||||
|
"-e",
|
||||||
|
"DEB_BUILD_OPTIONS=%s" % ("nocheck" if skip_tests else ""),
|
||||||
|
"dh-venv-builder:" + tag,
|
||||||
|
],
|
||||||
|
stdout=stdout,
|
||||||
|
stderr=subprocess.STDOUT,
|
||||||
|
)
|
||||||
|
|
||||||
with self._lock:
|
with self._lock:
|
||||||
self.active_containers.remove(container_name)
|
self.active_containers.remove(container_name)
|
||||||
|
|
||||||
if stdout is not None:
|
if stdout is not None:
|
||||||
stdout.close()
|
stdout.close()
|
||||||
print("Completed build of %s" % (dist, ))
|
print("Completed build of %s" % (dist,))
|
||||||
|
|
||||||
def kill_containers(self):
|
def kill_containers(self):
|
||||||
with self._lock:
|
with self._lock:
|
||||||
@@ -117,40 +134,56 @@ class Builder(object):
|
|||||||
|
|
||||||
for c in active:
|
for c in active:
|
||||||
print("killing container %s" % (c,))
|
print("killing container %s" % (c,))
|
||||||
subprocess.run([
|
subprocess.run(
|
||||||
"docker", "kill", c,
|
[
|
||||||
], stdout=subprocess.DEVNULL)
|
"docker",
|
||||||
|
"kill",
|
||||||
|
c,
|
||||||
|
],
|
||||||
|
stdout=subprocess.DEVNULL,
|
||||||
|
)
|
||||||
with self._lock:
|
with self._lock:
|
||||||
self.active_containers.remove(c)
|
self.active_containers.remove(c)
|
||||||
|
|
||||||
|
|
||||||
def run_builds(dists, jobs=1):
|
def run_builds(dists, jobs=1, skip_tests=False):
|
||||||
builder = Builder(redirect_stdout=(jobs > 1))
|
builder = Builder(redirect_stdout=(jobs > 1))
|
||||||
|
|
||||||
def sig(signum, _frame):
|
def sig(signum, _frame):
|
||||||
print("Caught SIGINT")
|
print("Caught SIGINT")
|
||||||
builder.kill_containers()
|
builder.kill_containers()
|
||||||
|
|
||||||
signal.signal(signal.SIGINT, sig)
|
signal.signal(signal.SIGINT, sig)
|
||||||
|
|
||||||
with ThreadPoolExecutor(max_workers=jobs) as e:
|
with ThreadPoolExecutor(max_workers=jobs) as e:
|
||||||
res = e.map(builder.run_build, dists)
|
res = e.map(lambda dist: builder.run_build(dist, skip_tests), dists)
|
||||||
|
|
||||||
# make sure we consume the iterable so that exceptions are raised.
|
# make sure we consume the iterable so that exceptions are raised.
|
||||||
for r in res:
|
for _ in res:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == "__main__":
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description=DESC,
|
description=DESC,
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-j', '--jobs', type=int, default=1,
|
"-j",
|
||||||
help='specify the number of builds to run in parallel',
|
"--jobs",
|
||||||
|
type=int,
|
||||||
|
default=1,
|
||||||
|
help="specify the number of builds to run in parallel",
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'dist', nargs='*', default=DISTS,
|
"--no-check",
|
||||||
help='a list of distributions to build for. Default: %(default)s',
|
action="store_true",
|
||||||
|
help="skip running tests after building",
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"dist",
|
||||||
|
nargs="*",
|
||||||
|
default=DISTS,
|
||||||
|
help="a list of distributions to build for. Default: %(default)s",
|
||||||
)
|
)
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
run_builds(dists=args.dist, jobs=args.jobs)
|
run_builds(dists=args.dist, jobs=args.jobs, skip_tests=args.no_check)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
#
|
#
|
||||||
# A script which checks that an appropriate news file has been added on this
|
# A script which checks that an appropriate news file has been added on this
|
||||||
# branch.
|
# branch.
|
||||||
|
|||||||
@@ -1,22 +1,68 @@
|
|||||||
#! /bin/bash -eu
|
#!/usr/bin/env bash
|
||||||
# This script is designed for developers who want to test their code
|
# This script is designed for developers who want to test their code
|
||||||
# against Complement.
|
# against Complement.
|
||||||
#
|
#
|
||||||
# It makes a Synapse image which represents the current checkout,
|
# It makes a Synapse image which represents the current checkout,
|
||||||
# then downloads Complement and runs it with that image.
|
# builds a synapse-complement image on top, then runs tests with it.
|
||||||
|
#
|
||||||
|
# By default the script will fetch the latest Complement master branch and
|
||||||
|
# run tests with that. This can be overridden to use a custom Complement
|
||||||
|
# checkout by setting the COMPLEMENT_DIR environment variable to the
|
||||||
|
# filepath of a local Complement checkout.
|
||||||
|
#
|
||||||
|
# By default Synapse is run in monolith mode. This can be overridden by
|
||||||
|
# setting the WORKERS environment variable.
|
||||||
|
#
|
||||||
|
# A regular expression of test method names can be supplied as the first
|
||||||
|
# argument to the script. Complement will then only run those tests. If
|
||||||
|
# no regex is supplied, all tests are run. For example;
|
||||||
|
#
|
||||||
|
# ./complement.sh "TestOutboundFederation(Profile|Send)"
|
||||||
|
#
|
||||||
|
|
||||||
|
# Exit if a line returns a non-zero exit code
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Change to the repository root
|
||||||
cd "$(dirname $0)/.."
|
cd "$(dirname $0)/.."
|
||||||
|
|
||||||
|
# Check for a user-specified Complement checkout
|
||||||
|
if [[ -z "$COMPLEMENT_DIR" ]]; then
|
||||||
|
echo "COMPLEMENT_DIR not set. Fetching the latest Complement checkout..."
|
||||||
|
wget -Nq https://github.com/matrix-org/complement/archive/master.tar.gz
|
||||||
|
tar -xzf master.tar.gz
|
||||||
|
COMPLEMENT_DIR=complement-master
|
||||||
|
echo "Checkout available at 'complement-master'"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If we're using workers, modify the docker files slightly.
|
||||||
|
if [[ -n "$WORKERS" ]]; then
|
||||||
|
BASE_IMAGE=matrixdotorg/synapse-workers
|
||||||
|
BASE_DOCKERFILE=docker/Dockerfile-workers
|
||||||
|
export COMPLEMENT_BASE_IMAGE=complement-synapse-workers
|
||||||
|
COMPLEMENT_DOCKERFILE=SynapseWorkers.Dockerfile
|
||||||
|
# And provide some more configuration to complement.
|
||||||
|
export COMPLEMENT_CA=true
|
||||||
|
export COMPLEMENT_VERSION_CHECK_ITERATIONS=500
|
||||||
|
else
|
||||||
|
BASE_IMAGE=matrixdotorg/synapse
|
||||||
|
BASE_DOCKERFILE=docker/Dockerfile
|
||||||
|
export COMPLEMENT_BASE_IMAGE=complement-synapse
|
||||||
|
COMPLEMENT_DOCKERFILE=Synapse.Dockerfile
|
||||||
|
fi
|
||||||
|
|
||||||
# Build the base Synapse image from the local checkout
|
# Build the base Synapse image from the local checkout
|
||||||
docker build -t matrixdotorg/synapse:latest -f docker/Dockerfile .
|
docker build -t $BASE_IMAGE -f "$BASE_DOCKERFILE" .
|
||||||
|
# Build the Synapse monolith image from Complement, based on the above image we just built
|
||||||
|
docker build -t $COMPLEMENT_BASE_IMAGE -f "$COMPLEMENT_DIR/dockerfiles/$COMPLEMENT_DOCKERFILE" "$COMPLEMENT_DIR/dockerfiles"
|
||||||
|
|
||||||
# Download Complement
|
cd "$COMPLEMENT_DIR"
|
||||||
wget -N https://github.com/matrix-org/complement/archive/master.tar.gz
|
|
||||||
tar -xzf master.tar.gz
|
|
||||||
cd complement-master
|
|
||||||
|
|
||||||
# Build the Synapse image from Complement, based on the above image we just built
|
EXTRA_COMPLEMENT_ARGS=""
|
||||||
docker build -t complement-synapse -f dockerfiles/Synapse.Dockerfile ./dockerfiles
|
if [[ -n "$1" ]]; then
|
||||||
|
# A test name regex has been set, supply it to Complement
|
||||||
|
EXTRA_COMPLEMENT_ARGS+="-run $1 "
|
||||||
|
fi
|
||||||
|
|
||||||
# Run the tests on the resulting image!
|
# Run the tests!
|
||||||
COMPLEMENT_BASE_IMAGE=complement-synapse go test -v -count=1 ./tests
|
go test -v -tags synapse_blacklist,msc2946,msc3083 -count=1 $EXTRA_COMPLEMENT_ARGS ./tests
|
||||||
|
|||||||
@@ -1,10 +1,15 @@
|
|||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
# Find linting errors in Synapse's default config file.
|
# Find linting errors in Synapse's default config file.
|
||||||
# Exits with 0 if there are no problems, or another code otherwise.
|
# Exits with 0 if there are no problems, or another code otherwise.
|
||||||
|
|
||||||
|
# cd to the root of the repository
|
||||||
|
cd `dirname $0`/..
|
||||||
|
|
||||||
|
# Restore backup of sample config upon script exit
|
||||||
|
trap "mv docs/sample_config.yaml.bak docs/sample_config.yaml" EXIT
|
||||||
|
|
||||||
# Fix non-lowercase true/false values
|
# Fix non-lowercase true/false values
|
||||||
sed -i.bak -E "s/: +True/: true/g; s/: +False/: false/g;" docs/sample_config.yaml
|
sed -i.bak -E "s/: +True/: true/g; s/: +False/: false/g;" docs/sample_config.yaml
|
||||||
rm docs/sample_config.yaml.bak
|
|
||||||
|
|
||||||
# Check if anything changed
|
# Check if anything changed
|
||||||
git diff --exit-code docs/sample_config.yaml
|
diff docs/sample_config.yaml docs/sample_config.yaml.bak
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user