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

Commit 2184f61

Browse files
authored
Various improvements to the docs (#7899)
1 parent 3345c16 commit 2184f61

File tree

10 files changed

+153
-100
lines changed

10 files changed

+153
-100
lines changed

INSTALL.md

Lines changed: 95 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
- [Choosing your server name](#choosing-your-server-name)
2+
- [Picking a database engine](#picking-a-database-engine)
23
- [Installing Synapse](#installing-synapse)
34
- [Installing from source](#installing-from-source)
45
- [Platform-Specific Instructions](#platform-specific-instructions)
56
- [Prebuilt packages](#prebuilt-packages)
67
- [Setting up Synapse](#setting-up-synapse)
78
- [TLS certificates](#tls-certificates)
9+
- [Client Well-Known URI](#client-well-known-uri)
810
- [Email](#email)
911
- [Registering a user](#registering-a-user)
1012
- [Setting up a TURN server](#setting-up-a-turn-server)
@@ -27,6 +29,25 @@ that your email address is probably `user@example.com` rather than
2729
`user@email.example.com`) - but doing so may require more advanced setup: see
2830
[Setting up Federation](docs/federate.md).
2931

32+
# Picking a database engine
33+
34+
Synapse offers two database engines:
35+
* [PostgreSQL](https://www.postgresql.org)
36+
* [SQLite](https://sqlite.org/)
37+
38+
Almost all installations should opt to use PostgreSQL. Advantages include:
39+
40+
* significant performance improvements due to the superior threading and
41+
caching model, smarter query optimiser
42+
* allowing the DB to be run on separate hardware
43+
44+
For information on how to install and use PostgreSQL, please see
45+
[docs/postgres.md](docs/postgres.md)
46+
47+
By default Synapse uses SQLite and in doing so trades performance for convenience.
48+
SQLite is only recommended in Synapse for testing purposes or for servers with
49+
light workloads.
50+
3051
# Installing Synapse
3152

3253
## Installing from source
@@ -234,17 +255,18 @@ for a number of platforms.
234255

235256
There is an offical synapse image available at
236257
https://hub.docker.com/r/matrixdotorg/synapse which can be used with
237-
the docker-compose file available at [contrib/docker](contrib/docker). Further information on
238-
this including configuration options is available in the README on
239-
hub.docker.com.
258+
the docker-compose file available at [contrib/docker](contrib/docker). Further
259+
information on this including configuration options is available in the README
260+
on hub.docker.com.
240261

241262
Alternatively, Andreas Peters (previously Silvio Fricke) has contributed a
242263
Dockerfile to automate a synapse server in a single Docker image, at
243264
https://hub.docker.com/r/avhost/docker-matrix/tags/
244265

245266
Slavi Pantaleev has created an Ansible playbook,
246267
which installs the offical Docker image of Matrix Synapse
247-
along with many other Matrix-related services (Postgres database, riot-web, coturn, mxisd, SSL support, etc.).
268+
along with many other Matrix-related services (Postgres database, Element, coturn,
269+
ma1sd, SSL support, etc.).
248270
For more details, see
249271
https://github.com/spantaleev/matrix-docker-ansible-deploy
250272

@@ -277,22 +299,27 @@ The fingerprint of the repository signing key (as shown by `gpg
277299
/usr/share/keyrings/matrix-org-archive-keyring.gpg`) is
278300
`AAF9AE843A7584B5A3E4CD2BCF45A512DE2DA058`.
279301

280-
#### Downstream Debian/Ubuntu packages
302+
#### Downstream Debian packages
281303

282-
For `buster` and `sid`, Synapse is available in the Debian repositories and
283-
it should be possible to install it with simply:
304+
We do not recommend using the packages from the default Debian `buster`
305+
repository at this time, as they are old and suffer from known security
306+
vulnerabilities. You can install the latest version of Synapse from
307+
[our repository](#matrixorg-packages) or from `buster-backports`. Please
308+
see the [Debian documentation](https://backports.debian.org/Instructions/)
309+
for information on how to use backports.
310+
311+
If you are using Debian `sid` or testing, Synapse is available in the default
312+
repositories and it should be possible to install it simply with:
284313

285314
```
286315
sudo apt install matrix-synapse
287316
```
288317

289-
There is also a version of `matrix-synapse` in `stretch-backports`. Please see
290-
the [Debian documentation on
291-
backports](https://backports.debian.org/Instructions/) for information on how
292-
to use them.
318+
#### Downstream Ubuntu packages
293319

294-
We do not recommend using the packages in downstream Ubuntu at this time, as
295-
they are old and suffer from known security vulnerabilities.
320+
We do not recommend using the packages in the default Ubuntu repository
321+
at this time, as they are old and suffer from known security vulnerabilities.
322+
The latest version of Synapse can be installed from [our repository](#matrixorg-packages).
296323

297324
### Fedora
298325

@@ -419,6 +446,60 @@ so, you will need to edit `homeserver.yaml`, as follows:
419446
For a more detailed guide to configuring your server for federation, see
420447
[federate.md](docs/federate.md).
421448

449+
## Client Well-Known URI
450+
451+
Setting up the client Well-Known URI is optional but if you set it up, it will
452+
allow users to enter their full username (e.g. `@user:<server_name>`) into clients
453+
which support well-known lookup to automatically configure the homeserver and
454+
identity server URLs. This is useful so that users don't have to memorize or think
455+
about the actual homeserver URL you are using.
456+
457+
The URL `https://<server_name>/.well-known/matrix/client` should return JSON in
458+
the following format.
459+
460+
```
461+
{
462+
"m.homeserver": {
463+
"base_url": "https://<matrix.example.com>"
464+
}
465+
}
466+
```
467+
468+
It can optionally contain identity server information as well.
469+
470+
```
471+
{
472+
"m.homeserver": {
473+
"base_url": "https://<matrix.example.com>"
474+
},
475+
"m.identity_server": {
476+
"base_url": "https://<identity.example.com>"
477+
}
478+
}
479+
```
480+
481+
To work in browser based clients, the file must be served with the appropriate
482+
Cross-Origin Resource Sharing (CORS) headers. A recommended value would be
483+
`Access-Control-Allow-Origin: *` which would allow all browser based clients to
484+
view it.
485+
486+
In nginx this would be something like:
487+
```
488+
location /.well-known/matrix/client {
489+
return 200 '{"m.homeserver": {"base_url": "https://<matrix.example.com>"}}';
490+
add_header Content-Type application/json;
491+
add_header Access-Control-Allow-Origin *;
492+
}
493+
```
494+
495+
You should also ensure the `public_baseurl` option in `homeserver.yaml` is set
496+
correctly. `public_baseurl` should be set to the URL that clients will use to
497+
connect to your server. This is the same URL you put for the `m.homeserver`
498+
`base_url` above.
499+
500+
```
501+
public_baseurl: "https://<matrix.example.com>"
502+
```
422503

423504
## Email
424505

@@ -437,7 +518,7 @@ email will be disabled.
437518

438519
## Registering a user
439520

440-
The easiest way to create a new user is to do so from a client like [Riot](https://riot.im).
521+
The easiest way to create a new user is to do so from a client like [Element](https://element.io/).
441522

442523
Alternatively you can do so from the command line if you have installed via pip.
443524

README.rst

Lines changed: 7 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ which handle:
4545
- Eventually-consistent cryptographically secure synchronisation of room
4646
state across a global open network of federated servers and services
4747
- Sending and receiving extensible messages in a room with (optional)
48-
end-to-end encryption[1]
48+
end-to-end encryption
4949
- Inviting, joining, leaving, kicking, banning room members
5050
- Managing user accounts (registration, login, logout)
5151
- Using 3rd Party IDs (3PIDs) such as email addresses, phone numbers,
@@ -82,9 +82,6 @@ at the `Matrix spec <https://matrix.org/docs/spec>`_, and experiment with the
8282

8383
Thanks for using Matrix!
8484

85-
[1] End-to-end encryption is currently in beta: `blog post <https://matrix.org/blog/2016/11/21/matrixs-olm-end-to-end-encryption-security-assessment-released-and-implemented-cross-platform-on-riot-at-last>`_.
86-
87-
8885
Support
8986
=======
9087

@@ -115,12 +112,11 @@ Unless you are running a test instance of Synapse on your local machine, in
115112
general, you will need to enable TLS support before you can successfully
116113
connect from a client: see `<INSTALL.md#tls-certificates>`_.
117114

118-
An easy way to get started is to login or register via Riot at
119-
https://riot.im/app/#/login or https://riot.im/app/#/register respectively.
115+
An easy way to get started is to login or register via Element at
116+
https://app.element.io/#/login or https://app.element.io/#/register respectively.
120117
You will need to change the server you are logging into from ``matrix.org``
121118
and instead specify a Homeserver URL of ``https://<server_name>:8448``
122119
(or just ``https://<server_name>`` if you are using a reverse proxy).
123-
(Leave the identity server as the default - see `Identity servers`_.)
124120
If you prefer to use another client, refer to our
125121
`client breakdown <https://matrix.org/docs/projects/clients-matrix>`_.
126122

@@ -137,7 +133,7 @@ it, specify ``enable_registration: true`` in ``homeserver.yaml``. (It is then
137133
recommended to also set up CAPTCHA - see `<docs/CAPTCHA_SETUP.md>`_.)
138134

139135
Once ``enable_registration`` is set to ``true``, it is possible to register a
140-
user via `riot.im <https://riot.im/app/#/register>`_ or other Matrix clients.
136+
user via a Matrix client.
141137

142138
Your new user name will be formed partly from the ``server_name``, and partly
143139
from a localpart you specify when you create the account. Your name will take
@@ -183,30 +179,6 @@ versions of synapse.
183179

184180
.. _UPGRADE.rst: UPGRADE.rst
185181

186-
187-
Using PostgreSQL
188-
================
189-
190-
Synapse offers two database engines:
191-
* `PostgreSQL <https://www.postgresql.org>`_
192-
* `SQLite <https://sqlite.org/>`_
193-
194-
Almost all installations should opt to use PostgreSQL. Advantages include:
195-
196-
* significant performance improvements due to the superior threading and
197-
caching model, smarter query optimiser
198-
* allowing the DB to be run on separate hardware
199-
* allowing basic active/backup high-availability with a "hot spare" synapse
200-
pointing at the same DB master, as well as enabling DB replication in
201-
synapse itself.
202-
203-
For information on how to install and use PostgreSQL, please see
204-
`docs/postgres.md <docs/postgres.md>`_.
205-
206-
By default Synapse uses SQLite and in doing so trades performance for convenience.
207-
SQLite is only recommended in Synapse for testing purposes or for servers with
208-
light workloads.
209-
210182
.. _reverse-proxy:
211183

212184
Using a reverse proxy with Synapse
@@ -255,10 +227,9 @@ email address.
255227
Password reset
256228
==============
257229

258-
If a user has registered an email address to their account using an identity
259-
server, they can request a password-reset token via clients such as Riot.
260-
261-
A manual password reset can be done via direct database access as follows.
230+
Users can reset their password through their client. Alternatively, a server admin
231+
can reset a users password using the `admin API <docs/admin_api/user_admin_api.rst#reset-password>`_
232+
or by directly editing the database as shown below.
262233

263234
First calculate the hash of the new password::
264235

changelog.d/7899.doc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Document how to set up a Client Well-Known file and fix several pieces of outdated documentation.

debian/changelog

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
matrix-synapse-py3 (1.xx.0) stable; urgency=medium
2+
3+
[ Synapse Packaging team ]
4+
* New synapse release 1.xx.0.
5+
6+
[ Aaron Raimist ]
7+
* Fix outdated documentation for SYNAPSE_CACHE_FACTOR
8+
9+
-- Synapse Packaging team <packages@matrix.org> XXXXX
10+
111
matrix-synapse-py3 (1.17.0) stable; urgency=medium
212

313
* New synapse release 1.17.0.

debian/matrix-synapse.default

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# Specify environment variables used when running Synapse
2-
# SYNAPSE_CACHE_FACTOR=1 (default)
2+
# SYNAPSE_CACHE_FACTOR=0.5 (default)

debian/synctl.ronn

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,20 @@ Configuration file may be generated as follows:
4646
## ENVIRONMENT
4747

4848
* `SYNAPSE_CACHE_FACTOR`:
49-
Synapse's architecture is quite RAM hungry currently - a lot of
50-
recent room data and metadata is deliberately cached in RAM in
51-
order to speed up common requests. This will be improved in
52-
future, but for now the easiest way to either reduce the RAM usage
53-
(at the risk of slowing things down) is to set the
54-
SYNAPSE_CACHE_FACTOR environment variable. Roughly speaking, a
55-
SYNAPSE_CACHE_FACTOR of 1.0 will max out at around 3-4GB of
56-
resident memory - this is what we currently run the matrix.org
57-
on. The default setting is currently 0.1, which is probably around
58-
a ~700MB footprint. You can dial it down further to 0.02 if
59-
desired, which targets roughly ~512MB. Conversely you can dial it
60-
up if you need performance for lots of users and have a box with a
61-
lot of RAM.
49+
Synapse's architecture is quite RAM hungry currently - we deliberately
50+
cache a lot of recent room data and metadata in RAM in order to speed up
51+
common requests. We'll improve this in the future, but for now the easiest
52+
way to either reduce the RAM usage (at the risk of slowing things down)
53+
is to set the almost-undocumented ``SYNAPSE_CACHE_FACTOR`` environment
54+
variable. The default is 0.5, which can be decreased to reduce RAM usage
55+
in memory constrained enviroments, or increased if performance starts to
56+
degrade.
57+
58+
However, degraded performance due to a low cache factor, common on
59+
machines with slow disks, often leads to explosions in memory use due
60+
backlogged requests. In this case, reducing the cache factor will make
61+
things worse. Instead, try increasing it drastically. 2.0 is a good
62+
starting value.
6263

6364
## COPYRIGHT
6465

docs/.sample_config_header.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,16 @@
1010
# homeserver.yaml. Instead, if you are starting from scratch, please generate
1111
# a fresh config using Synapse by following the instructions in INSTALL.md.
1212

13+
# Configuration options that take a time period can be set using a number
14+
# followed by a letter. Letters have the following meanings:
15+
# s = second
16+
# m = minute
17+
# h = hour
18+
# d = day
19+
# w = week
20+
# y = year
21+
# For example, setting redaction_retention_period: 5m would remove redacted
22+
# messages from the database after 5 minutes, rather than 5 months.
23+
1324
################################################################################
1425

docs/postgres.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,9 @@ to do step 2.
188188

189189
It is safe to at any time kill the port script and restart it.
190190

191+
Note that the database may take up significantly more (25% - 100% more)
192+
space on disk after porting to Postgres.
193+
191194
### Using the port script
192195

193196
Firstly, shut down the currently running synapse server and copy its

docs/sample_config.yaml

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,17 @@
1010
# homeserver.yaml. Instead, if you are starting from scratch, please generate
1111
# a fresh config using Synapse by following the instructions in INSTALL.md.
1212

13+
# Configuration options that take a time period can be set using a number
14+
# followed by a letter. Letters have the following meanings:
15+
# s = second
16+
# m = minute
17+
# h = hour
18+
# d = day
19+
# w = week
20+
# y = year
21+
# For example, setting redaction_retention_period: 5m would remove redacted
22+
# messages from the database after 5 minutes, rather than 5 months.
23+
1324
################################################################################
1425

1526
# Configuration file for Synapse.
@@ -1149,24 +1160,6 @@ account_validity:
11491160
#
11501161
#default_identity_server: https://matrix.org
11511162

1152-
# The list of identity servers trusted to verify third party
1153-
# identifiers by this server.
1154-
#
1155-
# Also defines the ID server which will be called when an account is
1156-
# deactivated (one will be picked arbitrarily).
1157-
#
1158-
# Note: This option is deprecated. Since v0.99.4, Synapse has tracked which identity
1159-
# server a 3PID has been bound to. For 3PIDs bound before then, Synapse runs a
1160-
# background migration script, informing itself that the identity server all of its
1161-
# 3PIDs have been bound to is likely one of the below.
1162-
#
1163-
# As of Synapse v1.4.0, all other functionality of this option has been deprecated, and
1164-
# it is now solely used for the purposes of the background migration script, and can be
1165-
# removed once it has run.
1166-
#trusted_third_party_id_servers:
1167-
# - matrix.org
1168-
# - vector.im
1169-
11701163
# Handle threepid (email/phone etc) registration and password resets through a set of
11711164
# *trusted* identity servers. Note that this allows the configured identity server to
11721165
# reset passwords for accounts!

0 commit comments

Comments
 (0)