Merge remote-tracking branch 'upstream/develop' into hs/upload-limits
This commit is contained in:
commit
b3e005de18
|
@ -0,0 +1,48 @@
|
||||||
|
version: 2
|
||||||
|
jobs:
|
||||||
|
sytestpy2:
|
||||||
|
machine: true
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- run: docker pull matrixdotorg/sytest-synapsepy2
|
||||||
|
- run: docker run --rm -it -v $(pwd)\:/src -v $(pwd)/logs\:/logs matrixdotorg/sytest-synapsepy2
|
||||||
|
- store_artifacts:
|
||||||
|
path: ~/project/logs
|
||||||
|
destination: logs
|
||||||
|
sytestpy2postgres:
|
||||||
|
machine: true
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- run: docker pull matrixdotorg/sytest-synapsepy2
|
||||||
|
- run: docker run --rm -it -v $(pwd)\:/src -v $(pwd)/logs\:/logs -e POSTGRES=1 matrixdotorg/sytest-synapsepy2
|
||||||
|
- store_artifacts:
|
||||||
|
path: ~/project/logs
|
||||||
|
destination: logs
|
||||||
|
sytestpy3:
|
||||||
|
machine: true
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- run: docker pull matrixdotorg/sytest-synapsepy3
|
||||||
|
- run: docker run --rm -it -v $(pwd)\:/src -v $(pwd)/logs\:/logs hawkowl/sytestpy3
|
||||||
|
- store_artifacts:
|
||||||
|
path: ~/project/logs
|
||||||
|
destination: logs
|
||||||
|
sytestpy3postgres:
|
||||||
|
machine: true
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- run: docker pull matrixdotorg/sytest-synapsepy3
|
||||||
|
- run: docker run --rm -it -v $(pwd)\:/src -v $(pwd)/logs\:/logs -e POSTGRES=1 matrixdotorg/sytest-synapsepy3
|
||||||
|
- store_artifacts:
|
||||||
|
path: ~/project/logs
|
||||||
|
destination: logs
|
||||||
|
|
||||||
|
workflows:
|
||||||
|
version: 2
|
||||||
|
build:
|
||||||
|
jobs:
|
||||||
|
- sytestpy2
|
||||||
|
- sytestpy2postgres
|
||||||
|
# Currently broken while the Python 3 port is incomplete
|
||||||
|
# - sytestpy3
|
||||||
|
# - sytestpy3postgres
|
|
@ -3,3 +3,6 @@ Dockerfile
|
||||||
.gitignore
|
.gitignore
|
||||||
demo/etc
|
demo/etc
|
||||||
tox.ini
|
tox.ini
|
||||||
|
synctl
|
||||||
|
.git/*
|
||||||
|
.tox/*
|
||||||
|
|
|
@ -27,8 +27,9 @@ Describe here the problem that you are experiencing, or the feature you are requ
|
||||||
|
|
||||||
Describe how what happens differs from what you expected.
|
Describe how what happens differs from what you expected.
|
||||||
|
|
||||||
If you can identify any relevant log snippets from _homeserver.log_, please include
|
<!-- If you can identify any relevant log snippets from _homeserver.log_, please include
|
||||||
those here (please be careful to remove any personal or private data):
|
those (please be careful to remove any personal or private data). Please surround them with
|
||||||
|
``` (three backticks, on a line on their own), so that they are formatted legibly. -->
|
||||||
|
|
||||||
### Version information
|
### Version information
|
||||||
|
|
||||||
|
|
10
.travis.yml
10
.travis.yml
|
@ -8,6 +8,9 @@ before_script:
|
||||||
- git remote set-branches --add origin develop
|
- git remote set-branches --add origin develop
|
||||||
- git fetch origin develop
|
- git fetch origin develop
|
||||||
|
|
||||||
|
services:
|
||||||
|
- postgresql
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
fast_finish: true
|
fast_finish: true
|
||||||
include:
|
include:
|
||||||
|
@ -20,6 +23,9 @@ matrix:
|
||||||
- python: 2.7
|
- python: 2.7
|
||||||
env: TOX_ENV=py27
|
env: TOX_ENV=py27
|
||||||
|
|
||||||
|
- python: 2.7
|
||||||
|
env: TOX_ENV=py27-postgres TRIAL_FLAGS="-j 4"
|
||||||
|
|
||||||
- python: 3.6
|
- python: 3.6
|
||||||
env: TOX_ENV=py36
|
env: TOX_ENV=py36
|
||||||
|
|
||||||
|
@ -29,6 +35,10 @@ matrix:
|
||||||
- python: 3.6
|
- python: 3.6
|
||||||
env: TOX_ENV=check-newsfragment
|
env: TOX_ENV=check-newsfragment
|
||||||
|
|
||||||
|
allow_failures:
|
||||||
|
- python: 2.7
|
||||||
|
env: TOX_ENV=py27-postgres TRIAL_FLAGS="-j 4"
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- pip install tox
|
- pip install tox
|
||||||
|
|
||||||
|
|
|
@ -62,4 +62,7 @@ Christoph Witzany <christoph at web.crofting.com>
|
||||||
* Add LDAP support for authentication
|
* Add LDAP support for authentication
|
||||||
|
|
||||||
Pierre Jaury <pierre at jaury.eu>
|
Pierre Jaury <pierre at jaury.eu>
|
||||||
* Docker packaging
|
* Docker packaging
|
||||||
|
|
||||||
|
Serban Constantin <serban.constantin at gmail dot com>
|
||||||
|
* Small bug fix
|
82
CHANGES.md
82
CHANGES.md
|
@ -1,3 +1,85 @@
|
||||||
|
Synapse 0.33.2 (2018-08-09)
|
||||||
|
===========================
|
||||||
|
|
||||||
|
No significant changes.
|
||||||
|
|
||||||
|
|
||||||
|
Synapse 0.33.2rc1 (2018-08-07)
|
||||||
|
==============================
|
||||||
|
|
||||||
|
Features
|
||||||
|
--------
|
||||||
|
|
||||||
|
- add support for the lazy_loaded_members filter as per MSC1227 ([\#2970](https://github.com/matrix-org/synapse/issues/2970))
|
||||||
|
- add support for the include_redundant_members filter param as per MSC1227 ([\#3331](https://github.com/matrix-org/synapse/issues/3331))
|
||||||
|
- Add metrics to track resource usage by background processes ([\#3553](https://github.com/matrix-org/synapse/issues/3553), [\#3556](https://github.com/matrix-org/synapse/issues/3556), [\#3604](https://github.com/matrix-org/synapse/issues/3604), [\#3610](https://github.com/matrix-org/synapse/issues/3610))
|
||||||
|
- Add `code` label to `synapse_http_server_response_time_seconds` prometheus metric ([\#3554](https://github.com/matrix-org/synapse/issues/3554))
|
||||||
|
- Add support for client_reader to handle more APIs ([\#3555](https://github.com/matrix-org/synapse/issues/3555), [\#3597](https://github.com/matrix-org/synapse/issues/3597))
|
||||||
|
- make the /context API filter & lazy-load aware as per MSC1227 ([\#3567](https://github.com/matrix-org/synapse/issues/3567))
|
||||||
|
- Add ability to limit number of monthly active users on the server ([\#3630](https://github.com/matrix-org/synapse/issues/3630))
|
||||||
|
- When we fail to join a room over federation, pass the error code back to the client. ([\#3639](https://github.com/matrix-org/synapse/issues/3639))
|
||||||
|
- Add a new /admin/register API for non-interactively creating users. ([\#3415](https://github.com/matrix-org/synapse/issues/3415))
|
||||||
|
|
||||||
|
|
||||||
|
Bugfixes
|
||||||
|
--------
|
||||||
|
|
||||||
|
- Make /directory/list API return 404 for room not found instead of 400 ([\#2952](https://github.com/matrix-org/synapse/issues/2952))
|
||||||
|
- Default inviter_display_name to mxid for email invites ([\#3391](https://github.com/matrix-org/synapse/issues/3391))
|
||||||
|
- Don't generate TURN credentials if no TURN config options are set ([\#3514](https://github.com/matrix-org/synapse/issues/3514))
|
||||||
|
- Correctly announce deleted devices over federation ([\#3520](https://github.com/matrix-org/synapse/issues/3520))
|
||||||
|
- Catch failures saving metrics captured by Measure, and instead log the faulty metrics information for further analysis. ([\#3548](https://github.com/matrix-org/synapse/issues/3548))
|
||||||
|
- Unicode passwords are now normalised before hashing, preventing the instance where two different devices or browsers might send a different UTF-8 sequence for the password. ([\#3569](https://github.com/matrix-org/synapse/issues/3569))
|
||||||
|
- Fix potential stack overflow and deadlock under heavy load ([\#3570](https://github.com/matrix-org/synapse/issues/3570))
|
||||||
|
- Respond with M_NOT_FOUND when profiles are not found locally or over federation. Fixes #3585 ([\#3585](https://github.com/matrix-org/synapse/issues/3585))
|
||||||
|
- Fix failure to persist events over federation under load ([\#3601](https://github.com/matrix-org/synapse/issues/3601))
|
||||||
|
- Fix updating of cached remote profiles ([\#3605](https://github.com/matrix-org/synapse/issues/3605))
|
||||||
|
- Fix 'tuple index out of range' error ([\#3607](https://github.com/matrix-org/synapse/issues/3607))
|
||||||
|
- Only import secrets when available (fix for py < 3.6) ([\#3626](https://github.com/matrix-org/synapse/issues/3626))
|
||||||
|
|
||||||
|
|
||||||
|
Internal Changes
|
||||||
|
----------------
|
||||||
|
|
||||||
|
- Remove redundant checks on who_forgot_in_room ([\#3350](https://github.com/matrix-org/synapse/issues/3350))
|
||||||
|
- Remove unnecessary event re-signing hacks ([\#3367](https://github.com/matrix-org/synapse/issues/3367))
|
||||||
|
- Rewrite cache list decorator ([\#3384](https://github.com/matrix-org/synapse/issues/3384))
|
||||||
|
- Move v1-only REST APIs into their own module. ([\#3460](https://github.com/matrix-org/synapse/issues/3460))
|
||||||
|
- Replace more instances of Python 2-only iteritems and itervalues uses. ([\#3562](https://github.com/matrix-org/synapse/issues/3562))
|
||||||
|
- Refactor EventContext to accept state during init ([\#3577](https://github.com/matrix-org/synapse/issues/3577))
|
||||||
|
- Improve Dockerfile and docker-compose instructions ([\#3543](https://github.com/matrix-org/synapse/issues/3543))
|
||||||
|
- Release notes are now in the Markdown format. ([\#3552](https://github.com/matrix-org/synapse/issues/3552))
|
||||||
|
- add config for pep8 ([\#3559](https://github.com/matrix-org/synapse/issues/3559))
|
||||||
|
- Merge Linearizer and Limiter ([\#3571](https://github.com/matrix-org/synapse/issues/3571), [\#3572](https://github.com/matrix-org/synapse/issues/3572))
|
||||||
|
- Lazily load state on master process when using workers to reduce DB consumption ([\#3579](https://github.com/matrix-org/synapse/issues/3579), [\#3581](https://github.com/matrix-org/synapse/issues/3581), [\#3582](https://github.com/matrix-org/synapse/issues/3582), [\#3584](https://github.com/matrix-org/synapse/issues/3584))
|
||||||
|
- Fixes and optimisations for resolve_state_groups ([\#3586](https://github.com/matrix-org/synapse/issues/3586))
|
||||||
|
- Improve logging for exceptions when handling PDUs ([\#3587](https://github.com/matrix-org/synapse/issues/3587))
|
||||||
|
- Add some measure blocks to persist_events ([\#3590](https://github.com/matrix-org/synapse/issues/3590))
|
||||||
|
- Fix some random logcontext leaks. ([\#3591](https://github.com/matrix-org/synapse/issues/3591), [\#3606](https://github.com/matrix-org/synapse/issues/3606))
|
||||||
|
- Speed up calculating state deltas in persist_event loop ([\#3592](https://github.com/matrix-org/synapse/issues/3592))
|
||||||
|
- Attempt to reduce amount of state pulled out of DB during persist_events ([\#3595](https://github.com/matrix-org/synapse/issues/3595))
|
||||||
|
- Fix a documentation typo in on_make_leave_request ([\#3609](https://github.com/matrix-org/synapse/issues/3609))
|
||||||
|
- Make EventStore inherit from EventFederationStore ([\#3612](https://github.com/matrix-org/synapse/issues/3612))
|
||||||
|
- Remove some redundant joins on event_edges.room_id ([\#3613](https://github.com/matrix-org/synapse/issues/3613))
|
||||||
|
- Stop populating events.content ([\#3614](https://github.com/matrix-org/synapse/issues/3614))
|
||||||
|
- Update the /send_leave path registration to use event_id rather than a transaction ID. ([\#3616](https://github.com/matrix-org/synapse/issues/3616))
|
||||||
|
- Refactor FederationHandler to move DB writes into separate functions ([\#3621](https://github.com/matrix-org/synapse/issues/3621))
|
||||||
|
- Remove unused field "pdu_failures" from transactions. ([\#3628](https://github.com/matrix-org/synapse/issues/3628))
|
||||||
|
- rename replication_layer to federation_client ([\#3634](https://github.com/matrix-org/synapse/issues/3634))
|
||||||
|
- Factor out exception handling in federation_client ([\#3638](https://github.com/matrix-org/synapse/issues/3638))
|
||||||
|
- Refactor location of docker build script. ([\#3644](https://github.com/matrix-org/synapse/issues/3644))
|
||||||
|
- Update CONTRIBUTING to mention newsfragments. ([\#3645](https://github.com/matrix-org/synapse/issues/3645))
|
||||||
|
|
||||||
|
|
||||||
|
Synapse 0.33.1 (2018-08-02)
|
||||||
|
===========================
|
||||||
|
|
||||||
|
SECURITY FIXES
|
||||||
|
--------------
|
||||||
|
|
||||||
|
- Fix a potential issue where servers could request events for rooms they have not joined. ([\#3641](https://github.com/matrix-org/synapse/issues/3641))
|
||||||
|
- Fix a potential issue where users could see events in private rooms before they joined. ([\#3642](https://github.com/matrix-org/synapse/issues/3642))
|
||||||
|
|
||||||
Synapse 0.33.0 (2018-07-19)
|
Synapse 0.33.0 (2018-07-19)
|
||||||
===========================
|
===========================
|
||||||
|
|
||||||
|
|
|
@ -30,11 +30,11 @@ use github's pull request workflow to review the contribution, and either ask
|
||||||
you to make any refinements needed or merge it and make them ourselves. The
|
you to make any refinements needed or merge it and make them ourselves. The
|
||||||
changes will then land on master when we next do a release.
|
changes will then land on master when we next do a release.
|
||||||
|
|
||||||
We use `Jenkins <http://matrix.org/jenkins>`_ and
|
We use `Jenkins <http://matrix.org/jenkins>`_ and
|
||||||
`Travis <https://travis-ci.org/matrix-org/synapse>`_ for continuous
|
`Travis <https://travis-ci.org/matrix-org/synapse>`_ for continuous
|
||||||
integration. All pull requests to synapse get automatically tested by Travis;
|
integration. All pull requests to synapse get automatically tested by Travis;
|
||||||
the Jenkins builds require an adminstrator to start them. If your change
|
the Jenkins builds require an adminstrator to start them. If your change
|
||||||
breaks the build, this will be shown in github, so please keep an eye on the
|
breaks the build, this will be shown in github, so please keep an eye on the
|
||||||
pull request for feedback.
|
pull request for feedback.
|
||||||
|
|
||||||
Code style
|
Code style
|
||||||
|
@ -51,22 +51,22 @@ makes it horribly hard to review otherwise.
|
||||||
Changelog
|
Changelog
|
||||||
~~~~~~~~~
|
~~~~~~~~~
|
||||||
|
|
||||||
All changes, even minor ones, need a corresponding changelog
|
All changes, even minor ones, need a corresponding changelog / newsfragment
|
||||||
entry. These are managed by Towncrier
|
entry. These are managed by Towncrier
|
||||||
(https://github.com/hawkowl/towncrier).
|
(https://github.com/hawkowl/towncrier).
|
||||||
|
|
||||||
To create a changelog entry, make a new file in the ``changelog.d``
|
To create a changelog entry, make a new file in the ``changelog.d``
|
||||||
file named in the format of ``issuenumberOrPR.type``. The type can be
|
file named in the format of ``PRnumber.type``. The type can be
|
||||||
one of ``feature``, ``bugfix``, ``removal`` (also used for
|
one of ``feature``, ``bugfix``, ``removal`` (also used for
|
||||||
deprecations), or ``misc`` (for internal-only changes). The content of
|
deprecations), or ``misc`` (for internal-only changes). The content of
|
||||||
the file is your changelog entry, which can contain RestructuredText
|
the file is your changelog entry, which can contain RestructuredText
|
||||||
formatting. A note of contributors is welcomed in changelogs for
|
formatting. A note of contributors is welcomed in changelogs for
|
||||||
non-misc changes (the content of misc changes is not displayed).
|
non-misc changes (the content of misc changes is not displayed).
|
||||||
|
|
||||||
For example, a fix for a bug reported in #1234 would have its
|
For example, a fix in PR #1234 would have its changelog entry in
|
||||||
changelog entry in ``changelog.d/1234.bugfix``, and contain content
|
``changelog.d/1234.bugfix``, and contain content like "The security levels of
|
||||||
like "The security levels of Florbs are now validated when
|
Florbs are now validated when recieved over federation. Contributed by Jane
|
||||||
recieved over federation. Contributed by Jane Matrix".
|
Matrix".
|
||||||
|
|
||||||
Attribution
|
Attribution
|
||||||
~~~~~~~~~~~
|
~~~~~~~~~~~
|
||||||
|
@ -125,7 +125,7 @@ the contribution or otherwise have the right to contribute it to Matrix::
|
||||||
personal information I submit with it, including my sign-off) is
|
personal information I submit with it, including my sign-off) is
|
||||||
maintained indefinitely and may be redistributed consistent with
|
maintained indefinitely and may be redistributed consistent with
|
||||||
this project or the open source license(s) involved.
|
this project or the open source license(s) involved.
|
||||||
|
|
||||||
If you agree to this for your contribution, then all that's needed is to
|
If you agree to this for your contribution, then all that's needed is to
|
||||||
include the line in your commit or pull request comment::
|
include the line in your commit or pull request comment::
|
||||||
|
|
||||||
|
|
19
Dockerfile
19
Dockerfile
|
@ -1,19 +0,0 @@
|
||||||
FROM docker.io/python:2-alpine3.7
|
|
||||||
|
|
||||||
RUN apk add --no-cache --virtual .nacl_deps su-exec build-base libffi-dev zlib-dev libressl-dev libjpeg-turbo-dev linux-headers postgresql-dev libxslt-dev
|
|
||||||
|
|
||||||
COPY . /synapse
|
|
||||||
|
|
||||||
# A wheel cache may be provided in ./cache for faster build
|
|
||||||
RUN cd /synapse \
|
|
||||||
&& pip install --upgrade pip setuptools psycopg2 lxml \
|
|
||||||
&& mkdir -p /synapse/cache \
|
|
||||||
&& pip install -f /synapse/cache --upgrade --process-dependency-links . \
|
|
||||||
&& mv /synapse/contrib/docker/start.py /synapse/contrib/docker/conf / \
|
|
||||||
&& rm -rf setup.py setup.cfg synapse
|
|
||||||
|
|
||||||
VOLUME ["/data"]
|
|
||||||
|
|
||||||
EXPOSE 8008/tcp 8448/tcp
|
|
||||||
|
|
||||||
ENTRYPOINT ["/start.py"]
|
|
|
@ -35,3 +35,5 @@ recursive-include changelog.d *
|
||||||
|
|
||||||
prune .github
|
prune .github
|
||||||
prune demo/etc
|
prune demo/etc
|
||||||
|
prune docker
|
||||||
|
prune .circleci
|
||||||
|
|
13
README.rst
13
README.rst
|
@ -157,12 +157,19 @@ if you prefer.
|
||||||
|
|
||||||
In case of problems, please see the _`Troubleshooting` section below.
|
In case of problems, please see the _`Troubleshooting` section below.
|
||||||
|
|
||||||
There is an offical synapse image available at https://hub.docker.com/r/matrixdotorg/synapse/tags/ which can be used with the docker-compose file available at `contrib/docker`. Further information on this including configuration options is available in `contrib/docker/README.md`.
|
There is an offical synapse image available at
|
||||||
|
https://hub.docker.com/r/matrixdotorg/synapse/tags/ which can be used with
|
||||||
|
the docker-compose file available at `contrib/docker <contrib/docker>`_. Further information on
|
||||||
|
this including configuration options is available in the README on
|
||||||
|
hub.docker.com.
|
||||||
|
|
||||||
Alternatively, Andreas Peters (previously Silvio Fricke) has contributed a Dockerfile to automate a synapse server in a single Docker image, at https://hub.docker.com/r/avhost/docker-matrix/tags/
|
Alternatively, Andreas Peters (previously Silvio Fricke) has contributed a
|
||||||
|
Dockerfile to automate a synapse server in a single Docker image, at
|
||||||
|
https://hub.docker.com/r/avhost/docker-matrix/tags/
|
||||||
|
|
||||||
Also, Martin Giess has created an auto-deployment process with vagrant/ansible,
|
Also, Martin Giess has created an auto-deployment process with vagrant/ansible,
|
||||||
tested with VirtualBox/AWS/DigitalOcean - see https://github.com/EMnify/matrix-synapse-auto-deploy
|
tested with VirtualBox/AWS/DigitalOcean - see
|
||||||
|
https://github.com/EMnify/matrix-synapse-auto-deploy
|
||||||
for details.
|
for details.
|
||||||
|
|
||||||
Configuring synapse
|
Configuring synapse
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Add support for the SNI extension to federation TLS connections
|
|
@ -1 +0,0 @@
|
||||||
add support for the lazy_loaded_members filter as per MSC1227
|
|
|
@ -1 +0,0 @@
|
||||||
add support for the include_redundant_members filter param as per MSC1227
|
|
|
@ -1 +0,0 @@
|
||||||
Remove redundant checks on who_forgot_in_room
|
|
|
@ -1 +0,0 @@
|
||||||
Remove unnecessary event re-signing hacks
|
|
|
@ -1 +0,0 @@
|
||||||
Default inviter_display_name to mxid for email invites
|
|
|
@ -0,0 +1 @@
|
||||||
|
The test suite now can run under PostgreSQL.
|
|
@ -1 +0,0 @@
|
||||||
Don't generate TURN credentials if no TURN config options are set
|
|
|
@ -1 +0,0 @@
|
||||||
Correctly announce deleted devices over federation
|
|
|
@ -1 +0,0 @@
|
||||||
Catch failures saving metrics captured by Measure, and instead log the faulty metrics information for further analysis.
|
|
|
@ -1 +0,0 @@
|
||||||
Release notes are now in the Markdown format.
|
|
|
@ -1 +0,0 @@
|
||||||
Add metrics to track resource usage by background processes
|
|
|
@ -1 +0,0 @@
|
||||||
Add `code` label to `synapse_http_server_response_time_seconds` prometheus metric
|
|
|
@ -1 +0,0 @@
|
||||||
Add support for client_reader to handle more APIs
|
|
|
@ -1 +0,0 @@
|
||||||
Add metrics to track resource usage by background processes
|
|
|
@ -1 +0,0 @@
|
||||||
add config for pep8
|
|
|
@ -0,0 +1 @@
|
||||||
|
speed up /members API and add `at` and `membership` params as per MSC1227
|
|
@ -1 +0,0 @@
|
||||||
Fix potential stack overflow and deadlock under heavy load
|
|
|
@ -1 +0,0 @@
|
||||||
Merge Linearizer and Limiter
|
|
|
@ -1 +0,0 @@
|
||||||
Merge Linearizer and Limiter
|
|
|
@ -1 +0,0 @@
|
||||||
Lazily load state on master process when using workers to reduce DB consumption
|
|
|
@ -1 +0,0 @@
|
||||||
Lazily load state on master process when using workers to reduce DB consumption
|
|
|
@ -1 +0,0 @@
|
||||||
Lazily load state on master process when using workers to reduce DB consumption
|
|
|
@ -1 +0,0 @@
|
||||||
Lazily load state on master process when using workers to reduce DB consumption
|
|
|
@ -1 +0,0 @@
|
||||||
Fixes and optimisations for resolve_state_groups
|
|
|
@ -1 +0,0 @@
|
||||||
Improve logging for exceptions when handling PDUs
|
|
|
@ -1 +0,0 @@
|
||||||
Add some measure blocks to persist_events
|
|
|
@ -1 +0,0 @@
|
||||||
Fix some random logcontext leaks.
|
|
|
@ -1 +0,0 @@
|
||||||
Speed up calculating state deltas in persist_event loop
|
|
|
@ -1 +0,0 @@
|
||||||
Attempt to reduce amount of state pulled out of DB during persist_events
|
|
|
@ -1 +0,0 @@
|
||||||
Add support for client_reader to handle more APIs
|
|
|
@ -1 +0,0 @@
|
||||||
Fix failure to persist events over federation under load
|
|
|
@ -1 +0,0 @@
|
||||||
Add metrics to track resource usage by background processes
|
|
|
@ -1 +0,0 @@
|
||||||
Fix updating of cached remote profiles
|
|
|
@ -1 +0,0 @@
|
||||||
Fix some random logcontext leaks.
|
|
|
@ -1 +0,0 @@
|
||||||
Fix 'tuple index out of range' error
|
|
|
@ -1 +0,0 @@
|
||||||
Fix a documentation typo in on_make_leave_request
|
|
|
@ -1 +0,0 @@
|
||||||
Add metrics to track resource usage by background processes
|
|
|
@ -1 +0,0 @@
|
||||||
Remove some redundant joins on event_edges.room_id
|
|
|
@ -1 +0,0 @@
|
||||||
Stop populating events.content
|
|
|
@ -1 +0,0 @@
|
||||||
Update the /send_leave path registration to use event_id rather than a transaction ID.
|
|
|
@ -0,0 +1 @@
|
||||||
|
Refactor HTTP replication endpoints to reduce code duplication
|
|
@ -0,0 +1 @@
|
||||||
|
Add ability to limit number of monthly active users on the server
|
|
@ -0,0 +1 @@
|
||||||
|
Tests now correctly execute on Python 3.
|
|
@ -0,0 +1 @@
|
||||||
|
Support more federation endpoints on workers
|
|
@ -0,0 +1 @@
|
||||||
|
Basic support for room versioning
|
|
@ -0,0 +1 @@
|
||||||
|
Ability to disable client/server Synapse via conf toggle
|
|
@ -0,0 +1 @@
|
||||||
|
Fix occasional glitches in the synapse_event_persisted_position metric
|
|
@ -0,0 +1 @@
|
||||||
|
Sytests can now be run inside a Docker container.
|
|
@ -0,0 +1 @@
|
||||||
|
Fix bug on deleting 3pid when using identity servers that don't support unbind API
|
|
@ -0,0 +1 @@
|
||||||
|
Ability to whitelist specific threepids against monthly active user limiting
|
|
@ -0,0 +1 @@
|
||||||
|
Add some metrics for the appservice and federation event sending loops
|
|
@ -0,0 +1 @@
|
||||||
|
Update docker base image from alpine 3.7 to 3.8.
|
|
@ -0,0 +1 @@
|
||||||
|
Where server is disabled, block ability for locked out users to read new messages
|
|
@ -0,0 +1 @@
|
||||||
|
Make the tests pass on Twisted < 18.7.0
|
|
@ -0,0 +1 @@
|
||||||
|
Don’t ship recaptcha_ajax.js, use it directly from Google
|
|
@ -0,0 +1 @@
|
||||||
|
Rename synapse.util.async to synapse.util.async_helpers to mitigate async becoming a keyword on Python 3.7.
|
|
@ -0,0 +1 @@
|
||||||
|
Synapse's tests are now formatted with the black autoformatter.
|
|
@ -0,0 +1 @@
|
||||||
|
Fixes test_reap_monthly_active_users so it passes under postgres
|
|
@ -0,0 +1 @@
|
||||||
|
Implemented a new testing base class to reduce test boilerplate.
|
|
@ -0,0 +1 @@
|
||||||
|
set admin uri via config, to be used in error messages where the user should contact the administrator
|
|
@ -0,0 +1 @@
|
||||||
|
Fix mau blocking calulation bug on login
|
|
@ -0,0 +1 @@
|
||||||
|
Rename MAU prometheus metrics
|
|
@ -0,0 +1 @@
|
||||||
|
Fix missing yield in synapse.storage.monthly_active_users.initialise_reserved_users
|
|
@ -1,29 +1,5 @@
|
||||||
# Synapse Docker
|
# Synapse Docker
|
||||||
|
|
||||||
The `matrixdotorg/synapse` Docker image will run Synapse as a single process. It does not provide a
|
|
||||||
database server or a TURN server, you should run these separately.
|
|
||||||
|
|
||||||
If you run a Postgres server, you should simply include it in the same Compose
|
|
||||||
project or set the proper environment variables and the image will automatically
|
|
||||||
use that server.
|
|
||||||
|
|
||||||
## Build
|
|
||||||
|
|
||||||
Build the docker image with the `docker build` command from the root of the synapse repository.
|
|
||||||
|
|
||||||
```
|
|
||||||
docker build -t docker.io/matrixdotorg/synapse .
|
|
||||||
```
|
|
||||||
|
|
||||||
The `-t` option sets the image tag. Official images are tagged `matrixdotorg/synapse:<version>` where `<version>` is the same as the release tag in the synapse git repository.
|
|
||||||
|
|
||||||
You may have a local Python wheel cache available, in which case copy the relevant packages in the ``cache/`` directory at the root of the project.
|
|
||||||
|
|
||||||
## Run
|
|
||||||
|
|
||||||
This image is designed to run either with an automatically generated configuration
|
|
||||||
file or with a custom configuration that requires manual edition.
|
|
||||||
|
|
||||||
### Automated configuration
|
### Automated configuration
|
||||||
|
|
||||||
It is recommended that you use Docker Compose to run your containers, including
|
It is recommended that you use Docker Compose to run your containers, including
|
||||||
|
@ -60,94 +36,6 @@ Then, customize your configuration and run the server:
|
||||||
docker-compose up -d
|
docker-compose up -d
|
||||||
```
|
```
|
||||||
|
|
||||||
### Without Compose
|
### More information
|
||||||
|
|
||||||
If you do not wish to use Compose, you may still run this image using plain
|
For more information on required environment variables and mounts, see the main docker documentation at [/docker/README.md](../../docker/README.md)
|
||||||
Docker commands. Note that the following is just a guideline and you may need
|
|
||||||
to add parameters to the docker run command to account for the network situation
|
|
||||||
with your postgres database.
|
|
||||||
|
|
||||||
```
|
|
||||||
docker run \
|
|
||||||
-d \
|
|
||||||
--name synapse \
|
|
||||||
-v ${DATA_PATH}:/data \
|
|
||||||
-e SYNAPSE_SERVER_NAME=my.matrix.host \
|
|
||||||
-e SYNAPSE_REPORT_STATS=yes \
|
|
||||||
docker.io/matrixdotorg/synapse:latest
|
|
||||||
```
|
|
||||||
|
|
||||||
## Volumes
|
|
||||||
|
|
||||||
The image expects a single volume, located at ``/data``, that will hold:
|
|
||||||
|
|
||||||
* temporary files during uploads;
|
|
||||||
* uploaded media and thumbnails;
|
|
||||||
* the SQLite database if you do not configure postgres;
|
|
||||||
* the appservices configuration.
|
|
||||||
|
|
||||||
You are free to use separate volumes depending on storage endpoints at your
|
|
||||||
disposal. For instance, ``/data/media`` coud be stored on a large but low
|
|
||||||
performance hdd storage while other files could be stored on high performance
|
|
||||||
endpoints.
|
|
||||||
|
|
||||||
In order to setup an application service, simply create an ``appservices``
|
|
||||||
directory in the data volume and write the application service Yaml
|
|
||||||
configuration file there. Multiple application services are supported.
|
|
||||||
|
|
||||||
## Environment
|
|
||||||
|
|
||||||
Unless you specify a custom path for the configuration file, a very generic
|
|
||||||
file will be generated, based on the following environment settings.
|
|
||||||
These are a good starting point for setting up your own deployment.
|
|
||||||
|
|
||||||
Global settings:
|
|
||||||
|
|
||||||
* ``UID``, the user id Synapse will run as [default 991]
|
|
||||||
* ``GID``, the group id Synapse will run as [default 991]
|
|
||||||
* ``SYNAPSE_CONFIG_PATH``, path to a custom config file
|
|
||||||
|
|
||||||
If ``SYNAPSE_CONFIG_PATH`` is set, you should generate a configuration file
|
|
||||||
then customize it manually. No other environment variable is required.
|
|
||||||
|
|
||||||
Otherwise, a dynamic configuration file will be used. The following environment
|
|
||||||
variables are available for configuration:
|
|
||||||
|
|
||||||
* ``SYNAPSE_SERVER_NAME`` (mandatory), the current server public hostname.
|
|
||||||
* ``SYNAPSE_REPORT_STATS``, (mandatory, ``yes`` or ``no``), enable anonymous
|
|
||||||
statistics reporting back to the Matrix project which helps us to get funding.
|
|
||||||
* ``SYNAPSE_NO_TLS``, set this variable to disable TLS in Synapse (use this if
|
|
||||||
you run your own TLS-capable reverse proxy).
|
|
||||||
* ``SYNAPSE_ENABLE_REGISTRATION``, set this variable to enable registration on
|
|
||||||
the Synapse instance.
|
|
||||||
* ``SYNAPSE_ALLOW_GUEST``, set this variable to allow guest joining this server.
|
|
||||||
* ``SYNAPSE_EVENT_CACHE_SIZE``, the event cache size [default `10K`].
|
|
||||||
* ``SYNAPSE_CACHE_FACTOR``, the cache factor [default `0.5`].
|
|
||||||
* ``SYNAPSE_RECAPTCHA_PUBLIC_KEY``, set this variable to the recaptcha public
|
|
||||||
key in order to enable recaptcha upon registration.
|
|
||||||
* ``SYNAPSE_RECAPTCHA_PRIVATE_KEY``, set this variable to the recaptcha private
|
|
||||||
key in order to enable recaptcha upon registration.
|
|
||||||
* ``SYNAPSE_TURN_URIS``, set this variable to the coma-separated list of TURN
|
|
||||||
uris to enable TURN for this homeserver.
|
|
||||||
* ``SYNAPSE_TURN_SECRET``, set this to the TURN shared secret if required.
|
|
||||||
|
|
||||||
Shared secrets, that will be initialized to random values if not set:
|
|
||||||
|
|
||||||
* ``SYNAPSE_REGISTRATION_SHARED_SECRET``, secret for registrering users if
|
|
||||||
registration is disable.
|
|
||||||
* ``SYNAPSE_MACAROON_SECRET_KEY`` secret for signing access tokens
|
|
||||||
to the server.
|
|
||||||
|
|
||||||
Database specific values (will use SQLite if not set):
|
|
||||||
|
|
||||||
* `POSTGRES_DB` - The database name for the synapse postgres database. [default: `synapse`]
|
|
||||||
* `POSTGRES_HOST` - The host of the postgres database if you wish to use postgresql instead of sqlite3. [default: `db` which is useful when using a container on the same docker network in a compose file where the postgres service is called `db`]
|
|
||||||
* `POSTGRES_PASSWORD` - The password for the synapse postgres database. **If this is set then postgres will be used instead of sqlite3.** [default: none] **NOTE**: You are highly encouraged to use postgresql! Please use the compose file to make it easier to deploy.
|
|
||||||
* `POSTGRES_USER` - The user for the synapse postgres database. [default: `matrix`]
|
|
||||||
|
|
||||||
Mail server specific values (will not send emails if not set):
|
|
||||||
|
|
||||||
* ``SYNAPSE_SMTP_HOST``, hostname to the mail server.
|
|
||||||
* ``SYNAPSE_SMTP_PORT``, TCP port for accessing the mail server [default ``25``].
|
|
||||||
* ``SYNAPSE_SMTP_USER``, username for authenticating against the mail server if any.
|
|
||||||
* ``SYNAPSE_SMTP_PASSWORD``, password for authenticating against the mail server if any.
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ version: '3'
|
||||||
services:
|
services:
|
||||||
|
|
||||||
synapse:
|
synapse:
|
||||||
|
build: ../..
|
||||||
image: docker.io/matrixdotorg/synapse:latest
|
image: docker.io/matrixdotorg/synapse:latest
|
||||||
# Since snyapse does not retry to connect to the database, restart upon
|
# Since snyapse does not retry to connect to the database, restart upon
|
||||||
# failure
|
# failure
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
# Using the Synapse Grafana dashboard
|
||||||
|
|
||||||
|
0. Set up Prometheus and Grafana. Out of scope for this readme. Useful documentation about using Grafana with Prometheus: http://docs.grafana.org/features/datasources/prometheus/
|
||||||
|
1. Have your Prometheus scrape your Synapse. https://github.com/matrix-org/synapse/blob/master/docs/metrics-howto.rst
|
||||||
|
2. Import dashboard into Grafana. Download `synapse.json`. Import it to Grafana and select the correct Prometheus datasource. http://docs.grafana.org/reference/export_import/
|
||||||
|
3. Set up additional recording rules
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,35 @@
|
||||||
|
FROM docker.io/python:2-alpine3.8
|
||||||
|
|
||||||
|
RUN apk add --no-cache --virtual .nacl_deps \
|
||||||
|
build-base \
|
||||||
|
libffi-dev \
|
||||||
|
libjpeg-turbo-dev \
|
||||||
|
libressl-dev \
|
||||||
|
libxslt-dev \
|
||||||
|
linux-headers \
|
||||||
|
postgresql-dev \
|
||||||
|
su-exec \
|
||||||
|
zlib-dev
|
||||||
|
|
||||||
|
COPY . /synapse
|
||||||
|
|
||||||
|
# A wheel cache may be provided in ./cache for faster build
|
||||||
|
RUN cd /synapse \
|
||||||
|
&& pip install --upgrade \
|
||||||
|
lxml \
|
||||||
|
pip \
|
||||||
|
psycopg2 \
|
||||||
|
setuptools \
|
||||||
|
&& mkdir -p /synapse/cache \
|
||||||
|
&& pip install -f /synapse/cache --upgrade --process-dependency-links . \
|
||||||
|
&& mv /synapse/docker/start.py /synapse/docker/conf / \
|
||||||
|
&& rm -rf \
|
||||||
|
setup.cfg \
|
||||||
|
setup.py \
|
||||||
|
synapse
|
||||||
|
|
||||||
|
VOLUME ["/data"]
|
||||||
|
|
||||||
|
EXPOSE 8008/tcp 8448/tcp
|
||||||
|
|
||||||
|
ENTRYPOINT ["/start.py"]
|
|
@ -0,0 +1,124 @@
|
||||||
|
# Synapse Docker
|
||||||
|
|
||||||
|
This Docker image will run Synapse as a single process. It does not provide a database
|
||||||
|
server or a TURN server, you should run these separately.
|
||||||
|
|
||||||
|
## Run
|
||||||
|
|
||||||
|
We do not currently offer a `latest` image, as this has somewhat undefined semantics.
|
||||||
|
We instead release only tagged versions so upgrading between releases is entirely
|
||||||
|
within your control.
|
||||||
|
|
||||||
|
### Using docker-compose (easier)
|
||||||
|
|
||||||
|
This image is designed to run either with an automatically generated configuration
|
||||||
|
file or with a custom configuration that requires manual editing.
|
||||||
|
|
||||||
|
An easy way to make use of this image is via docker-compose. See the
|
||||||
|
[contrib/docker](../contrib/docker)
|
||||||
|
section of the synapse project for examples.
|
||||||
|
|
||||||
|
### Without Compose (harder)
|
||||||
|
|
||||||
|
If you do not wish to use Compose, you may still run this image using plain
|
||||||
|
Docker commands. Note that the following is just a guideline and you may need
|
||||||
|
to add parameters to the docker run command to account for the network situation
|
||||||
|
with your postgres database.
|
||||||
|
|
||||||
|
```
|
||||||
|
docker run \
|
||||||
|
-d \
|
||||||
|
--name synapse \
|
||||||
|
-v ${DATA_PATH}:/data \
|
||||||
|
-e SYNAPSE_SERVER_NAME=my.matrix.host \
|
||||||
|
-e SYNAPSE_REPORT_STATS=yes \
|
||||||
|
docker.io/matrixdotorg/synapse:latest
|
||||||
|
```
|
||||||
|
|
||||||
|
## Volumes
|
||||||
|
|
||||||
|
The image expects a single volume, located at ``/data``, that will hold:
|
||||||
|
|
||||||
|
* temporary files during uploads;
|
||||||
|
* uploaded media and thumbnails;
|
||||||
|
* the SQLite database if you do not configure postgres;
|
||||||
|
* the appservices configuration.
|
||||||
|
|
||||||
|
You are free to use separate volumes depending on storage endpoints at your
|
||||||
|
disposal. For instance, ``/data/media`` coud be stored on a large but low
|
||||||
|
performance hdd storage while other files could be stored on high performance
|
||||||
|
endpoints.
|
||||||
|
|
||||||
|
In order to setup an application service, simply create an ``appservices``
|
||||||
|
directory in the data volume and write the application service Yaml
|
||||||
|
configuration file there. Multiple application services are supported.
|
||||||
|
|
||||||
|
## Environment
|
||||||
|
|
||||||
|
Unless you specify a custom path for the configuration file, a very generic
|
||||||
|
file will be generated, based on the following environment settings.
|
||||||
|
These are a good starting point for setting up your own deployment.
|
||||||
|
|
||||||
|
Global settings:
|
||||||
|
|
||||||
|
* ``UID``, the user id Synapse will run as [default 991]
|
||||||
|
* ``GID``, the group id Synapse will run as [default 991]
|
||||||
|
* ``SYNAPSE_CONFIG_PATH``, path to a custom config file
|
||||||
|
|
||||||
|
If ``SYNAPSE_CONFIG_PATH`` is set, you should generate a configuration file
|
||||||
|
then customize it manually. No other environment variable is required.
|
||||||
|
|
||||||
|
Otherwise, a dynamic configuration file will be used. The following environment
|
||||||
|
variables are available for configuration:
|
||||||
|
|
||||||
|
* ``SYNAPSE_SERVER_NAME`` (mandatory), the current server public hostname.
|
||||||
|
* ``SYNAPSE_REPORT_STATS``, (mandatory, ``yes`` or ``no``), enable anonymous
|
||||||
|
statistics reporting back to the Matrix project which helps us to get funding.
|
||||||
|
* ``SYNAPSE_NO_TLS``, set this variable to disable TLS in Synapse (use this if
|
||||||
|
you run your own TLS-capable reverse proxy).
|
||||||
|
* ``SYNAPSE_ENABLE_REGISTRATION``, set this variable to enable registration on
|
||||||
|
the Synapse instance.
|
||||||
|
* ``SYNAPSE_ALLOW_GUEST``, set this variable to allow guest joining this server.
|
||||||
|
* ``SYNAPSE_EVENT_CACHE_SIZE``, the event cache size [default `10K`].
|
||||||
|
* ``SYNAPSE_CACHE_FACTOR``, the cache factor [default `0.5`].
|
||||||
|
* ``SYNAPSE_RECAPTCHA_PUBLIC_KEY``, set this variable to the recaptcha public
|
||||||
|
key in order to enable recaptcha upon registration.
|
||||||
|
* ``SYNAPSE_RECAPTCHA_PRIVATE_KEY``, set this variable to the recaptcha private
|
||||||
|
key in order to enable recaptcha upon registration.
|
||||||
|
* ``SYNAPSE_TURN_URIS``, set this variable to the coma-separated list of TURN
|
||||||
|
uris to enable TURN for this homeserver.
|
||||||
|
* ``SYNAPSE_TURN_SECRET``, set this to the TURN shared secret if required.
|
||||||
|
|
||||||
|
Shared secrets, that will be initialized to random values if not set:
|
||||||
|
|
||||||
|
* ``SYNAPSE_REGISTRATION_SHARED_SECRET``, secret for registrering users if
|
||||||
|
registration is disable.
|
||||||
|
* ``SYNAPSE_MACAROON_SECRET_KEY`` secret for signing access tokens
|
||||||
|
to the server.
|
||||||
|
|
||||||
|
Database specific values (will use SQLite if not set):
|
||||||
|
|
||||||
|
* `POSTGRES_DB` - The database name for the synapse postgres database. [default: `synapse`]
|
||||||
|
* `POSTGRES_HOST` - The host of the postgres database if you wish to use postgresql instead of sqlite3. [default: `db` which is useful when using a container on the same docker network in a compose file where the postgres service is called `db`]
|
||||||
|
* `POSTGRES_PASSWORD` - The password for the synapse postgres database. **If this is set then postgres will be used instead of sqlite3.** [default: none] **NOTE**: You are highly encouraged to use postgresql! Please use the compose file to make it easier to deploy.
|
||||||
|
* `POSTGRES_USER` - The user for the synapse postgres database. [default: `matrix`]
|
||||||
|
|
||||||
|
Mail server specific values (will not send emails if not set):
|
||||||
|
|
||||||
|
* ``SYNAPSE_SMTP_HOST``, hostname to the mail server.
|
||||||
|
* ``SYNAPSE_SMTP_PORT``, TCP port for accessing the mail server [default ``25``].
|
||||||
|
* ``SYNAPSE_SMTP_USER``, username for authenticating against the mail server if any.
|
||||||
|
* ``SYNAPSE_SMTP_PASSWORD``, password for authenticating against the mail server if any.
|
||||||
|
|
||||||
|
## Build
|
||||||
|
|
||||||
|
Build the docker image with the `docker build` command from the root of the synapse repository.
|
||||||
|
|
||||||
|
```
|
||||||
|
docker build -t docker.io/matrixdotorg/synapse . -f docker/Dockerfile
|
||||||
|
```
|
||||||
|
|
||||||
|
The `-t` option sets the image tag. Official images are tagged `matrixdotorg/synapse:<version>` where `<version>` is the same as the release tag in the synapse git repository.
|
||||||
|
|
||||||
|
You may have a local Python wheel cache available, in which case copy the relevant
|
||||||
|
packages in the ``cache/`` directory at the root of the project.
|
|
@ -173,10 +173,23 @@ endpoints matching the following regular expressions::
|
||||||
^/_matrix/federation/v1/backfill/
|
^/_matrix/federation/v1/backfill/
|
||||||
^/_matrix/federation/v1/get_missing_events/
|
^/_matrix/federation/v1/get_missing_events/
|
||||||
^/_matrix/federation/v1/publicRooms
|
^/_matrix/federation/v1/publicRooms
|
||||||
|
^/_matrix/federation/v1/query/
|
||||||
|
^/_matrix/federation/v1/make_join/
|
||||||
|
^/_matrix/federation/v1/make_leave/
|
||||||
|
^/_matrix/federation/v1/send_join/
|
||||||
|
^/_matrix/federation/v1/send_leave/
|
||||||
|
^/_matrix/federation/v1/invite/
|
||||||
|
^/_matrix/federation/v1/query_auth/
|
||||||
|
^/_matrix/federation/v1/event_auth/
|
||||||
|
^/_matrix/federation/v1/exchange_third_party_invite/
|
||||||
|
^/_matrix/federation/v1/send/
|
||||||
|
|
||||||
The above endpoints should all be routed to the federation_reader worker by the
|
The above endpoints should all be routed to the federation_reader worker by the
|
||||||
reverse-proxy configuration.
|
reverse-proxy configuration.
|
||||||
|
|
||||||
|
The `^/_matrix/federation/v1/send/` endpoint must only be handled by a single
|
||||||
|
instance.
|
||||||
|
|
||||||
``synapse.app.federation_sender``
|
``synapse.app.federation_sender``
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
package = "synapse"
|
package = "synapse"
|
||||||
filename = "CHANGES.md"
|
filename = "CHANGES.md"
|
||||||
directory = "changelog.d"
|
directory = "changelog.d"
|
||||||
issue_format = "[\\#{issue}](https://github.com/matrix-org/synapse/issues/{issue}>)"
|
issue_format = "[\\#{issue}](https://github.com/matrix-org/synapse/issues/{issue})"
|
||||||
|
|
||||||
[[tool.towncrier.type]]
|
[[tool.towncrier.type]]
|
||||||
directory = "feature"
|
directory = "feature"
|
||||||
|
|
|
@ -17,4 +17,4 @@
|
||||||
""" This is a reference implementation of a Matrix home server.
|
""" This is a reference implementation of a Matrix home server.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__version__ = "0.33.0"
|
__version__ = "0.33.2"
|
||||||
|
|
|
@ -213,7 +213,7 @@ class Auth(object):
|
||||||
default=[b""]
|
default=[b""]
|
||||||
)[0]
|
)[0]
|
||||||
if user and access_token and ip_addr:
|
if user and access_token and ip_addr:
|
||||||
self.store.insert_client_ip(
|
yield self.store.insert_client_ip(
|
||||||
user_id=user.to_string(),
|
user_id=user.to_string(),
|
||||||
access_token=access_token,
|
access_token=access_token,
|
||||||
ip=ip_addr,
|
ip=ip_addr,
|
||||||
|
@ -252,10 +252,10 @@ class Auth(object):
|
||||||
if ip_address not in app_service.ip_range_whitelist:
|
if ip_address not in app_service.ip_range_whitelist:
|
||||||
defer.returnValue((None, None))
|
defer.returnValue((None, None))
|
||||||
|
|
||||||
if "user_id" not in request.args:
|
if b"user_id" not in request.args:
|
||||||
defer.returnValue((app_service.sender, app_service))
|
defer.returnValue((app_service.sender, app_service))
|
||||||
|
|
||||||
user_id = request.args["user_id"][0]
|
user_id = request.args[b"user_id"][0].decode('utf8')
|
||||||
if app_service.sender == user_id:
|
if app_service.sender == user_id:
|
||||||
defer.returnValue((app_service.sender, app_service))
|
defer.returnValue((app_service.sender, app_service))
|
||||||
|
|
||||||
|
@ -773,3 +773,33 @@ class Auth(object):
|
||||||
raise AuthError(
|
raise AuthError(
|
||||||
403, "Guest access not allowed", errcode=Codes.GUEST_ACCESS_FORBIDDEN
|
403, "Guest access not allowed", errcode=Codes.GUEST_ACCESS_FORBIDDEN
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@defer.inlineCallbacks
|
||||||
|
def check_auth_blocking(self, user_id=None):
|
||||||
|
"""Checks if the user should be rejected for some external reason,
|
||||||
|
such as monthly active user limiting or global disable flag
|
||||||
|
|
||||||
|
Args:
|
||||||
|
user_id(str|None): If present, checks for presence against existing
|
||||||
|
MAU cohort
|
||||||
|
"""
|
||||||
|
if self.hs.config.hs_disabled:
|
||||||
|
raise AuthError(
|
||||||
|
403, self.hs.config.hs_disabled_message,
|
||||||
|
errcode=Codes.RESOURCE_LIMIT_EXCEED,
|
||||||
|
admin_uri=self.hs.config.admin_uri,
|
||||||
|
)
|
||||||
|
if self.hs.config.limit_usage_by_mau is True:
|
||||||
|
# If the user is already part of the MAU cohort
|
||||||
|
if user_id:
|
||||||
|
timestamp = yield self.store.user_last_seen_monthly_active(user_id)
|
||||||
|
if timestamp:
|
||||||
|
return
|
||||||
|
# Else if there is no room in the MAU bucket, bail
|
||||||
|
current_mau = yield self.store.get_monthly_active_count()
|
||||||
|
if current_mau >= self.hs.config.max_mau_value:
|
||||||
|
raise AuthError(
|
||||||
|
403, "Monthly Active User Limits AU Limit Exceeded",
|
||||||
|
admin_uri=self.hs.config.admin_uri,
|
||||||
|
errcode=Codes.RESOURCE_LIMIT_EXCEED
|
||||||
|
)
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright 2014-2016 OpenMarket Ltd
|
# Copyright 2014-2016 OpenMarket Ltd
|
||||||
# Copyright 2017 Vector Creations Ltd
|
# Copyright 2017 Vector Creations Ltd
|
||||||
|
# Copyright 2018 New Vector Ltd.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
@ -94,3 +95,11 @@ class RoomCreationPreset(object):
|
||||||
class ThirdPartyEntityKind(object):
|
class ThirdPartyEntityKind(object):
|
||||||
USER = "user"
|
USER = "user"
|
||||||
LOCATION = "location"
|
LOCATION = "location"
|
||||||
|
|
||||||
|
|
||||||
|
# the version we will give rooms which are created on this server
|
||||||
|
DEFAULT_ROOM_VERSION = "1"
|
||||||
|
|
||||||
|
# vdh-test-version is a placeholder to get room versioning support working and tested
|
||||||
|
# until we have a working v2.
|
||||||
|
KNOWN_ROOM_VERSIONS = {"1", "vdh-test-version"}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright 2014-2016 OpenMarket Ltd
|
# Copyright 2014-2016 OpenMarket Ltd
|
||||||
|
# Copyright 2018 New Vector Ltd.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
@ -55,6 +56,9 @@ class Codes(object):
|
||||||
SERVER_NOT_TRUSTED = "M_SERVER_NOT_TRUSTED"
|
SERVER_NOT_TRUSTED = "M_SERVER_NOT_TRUSTED"
|
||||||
CONSENT_NOT_GIVEN = "M_CONSENT_NOT_GIVEN"
|
CONSENT_NOT_GIVEN = "M_CONSENT_NOT_GIVEN"
|
||||||
CANNOT_LEAVE_SERVER_NOTICE_ROOM = "M_CANNOT_LEAVE_SERVER_NOTICE_ROOM"
|
CANNOT_LEAVE_SERVER_NOTICE_ROOM = "M_CANNOT_LEAVE_SERVER_NOTICE_ROOM"
|
||||||
|
RESOURCE_LIMIT_EXCEED = "M_RESOURCE_LIMIT_EXCEED"
|
||||||
|
UNSUPPORTED_ROOM_VERSION = "M_UNSUPPORTED_ROOM_VERSION"
|
||||||
|
INCOMPATIBLE_ROOM_VERSION = "M_INCOMPATIBLE_ROOM_VERSION"
|
||||||
|
|
||||||
|
|
||||||
class CodeMessageException(RuntimeError):
|
class CodeMessageException(RuntimeError):
|
||||||
|
@ -69,20 +73,6 @@ class CodeMessageException(RuntimeError):
|
||||||
self.code = code
|
self.code = code
|
||||||
self.msg = msg
|
self.msg = msg
|
||||||
|
|
||||||
def error_dict(self):
|
|
||||||
return cs_error(self.msg)
|
|
||||||
|
|
||||||
|
|
||||||
class MatrixCodeMessageException(CodeMessageException):
|
|
||||||
"""An error from a general matrix endpoint, eg. from a proxied Matrix API call.
|
|
||||||
|
|
||||||
Attributes:
|
|
||||||
errcode (str): Matrix error code e.g 'M_FORBIDDEN'
|
|
||||||
"""
|
|
||||||
def __init__(self, code, msg, errcode=Codes.UNKNOWN):
|
|
||||||
super(MatrixCodeMessageException, self).__init__(code, msg)
|
|
||||||
self.errcode = errcode
|
|
||||||
|
|
||||||
|
|
||||||
class SynapseError(CodeMessageException):
|
class SynapseError(CodeMessageException):
|
||||||
"""A base exception type for matrix errors which have an errcode and error
|
"""A base exception type for matrix errors which have an errcode and error
|
||||||
|
@ -108,38 +98,28 @@ class SynapseError(CodeMessageException):
|
||||||
self.errcode,
|
self.errcode,
|
||||||
)
|
)
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def from_http_response_exception(cls, err):
|
|
||||||
"""Make a SynapseError based on an HTTPResponseException
|
|
||||||
|
|
||||||
This is useful when a proxied request has failed, and we need to
|
class ProxiedRequestError(SynapseError):
|
||||||
decide how to map the failure onto a matrix error to send back to the
|
"""An error from a general matrix endpoint, eg. from a proxied Matrix API call.
|
||||||
client.
|
|
||||||
|
|
||||||
An attempt is made to parse the body of the http response as a matrix
|
Attributes:
|
||||||
error. If that succeeds, the errcode and error message from the body
|
errcode (str): Matrix error code e.g 'M_FORBIDDEN'
|
||||||
are used as the errcode and error message in the new synapse error.
|
"""
|
||||||
|
def __init__(self, code, msg, errcode=Codes.UNKNOWN, additional_fields=None):
|
||||||
|
super(ProxiedRequestError, self).__init__(
|
||||||
|
code, msg, errcode
|
||||||
|
)
|
||||||
|
if additional_fields is None:
|
||||||
|
self._additional_fields = {}
|
||||||
|
else:
|
||||||
|
self._additional_fields = dict(additional_fields)
|
||||||
|
|
||||||
Otherwise, the errcode is set to M_UNKNOWN, and the error message is
|
def error_dict(self):
|
||||||
set to the reason code from the HTTP response.
|
return cs_error(
|
||||||
|
self.msg,
|
||||||
Args:
|
self.errcode,
|
||||||
err (HttpResponseException):
|
**self._additional_fields
|
||||||
|
)
|
||||||
Returns:
|
|
||||||
SynapseError:
|
|
||||||
"""
|
|
||||||
# try to parse the body as json, to get better errcode/msg, but
|
|
||||||
# default to M_UNKNOWN with the HTTP status as the error text
|
|
||||||
try:
|
|
||||||
j = json.loads(err.response)
|
|
||||||
except ValueError:
|
|
||||||
j = {}
|
|
||||||
errcode = j.get('errcode', Codes.UNKNOWN)
|
|
||||||
errmsg = j.get('error', err.msg)
|
|
||||||
|
|
||||||
res = SynapseError(err.code, errmsg, errcode)
|
|
||||||
return res
|
|
||||||
|
|
||||||
|
|
||||||
class ConsentNotGivenError(SynapseError):
|
class ConsentNotGivenError(SynapseError):
|
||||||
|
@ -244,11 +224,16 @@ class NotFoundError(SynapseError):
|
||||||
|
|
||||||
class AuthError(SynapseError):
|
class AuthError(SynapseError):
|
||||||
"""An error raised when there was a problem authorising an event."""
|
"""An error raised when there was a problem authorising an event."""
|
||||||
|
def __init__(self, code, msg, errcode=Codes.FORBIDDEN, admin_uri=None):
|
||||||
|
self.admin_uri = admin_uri
|
||||||
|
super(AuthError, self).__init__(code, msg, errcode=errcode)
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def error_dict(self):
|
||||||
if "errcode" not in kwargs:
|
return cs_error(
|
||||||
kwargs["errcode"] = Codes.FORBIDDEN
|
self.msg,
|
||||||
super(AuthError, self).__init__(*args, **kwargs)
|
self.errcode,
|
||||||
|
admin_uri=self.admin_uri,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class EventSizeError(SynapseError):
|
class EventSizeError(SynapseError):
|
||||||
|
@ -308,12 +293,25 @@ class LimitExceededError(SynapseError):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def cs_exception(exception):
|
class IncompatibleRoomVersionError(SynapseError):
|
||||||
if isinstance(exception, CodeMessageException):
|
"""A server is trying to join a room whose version it does not support."""
|
||||||
return exception.error_dict()
|
|
||||||
else:
|
def __init__(self, room_version):
|
||||||
logger.error("Unknown exception type: %s", type(exception))
|
super(IncompatibleRoomVersionError, self).__init__(
|
||||||
return {}
|
code=400,
|
||||||
|
msg="Your homeserver does not support the features required to "
|
||||||
|
"join this room",
|
||||||
|
errcode=Codes.INCOMPATIBLE_ROOM_VERSION,
|
||||||
|
)
|
||||||
|
|
||||||
|
self._room_version = room_version
|
||||||
|
|
||||||
|
def error_dict(self):
|
||||||
|
return cs_error(
|
||||||
|
self.msg,
|
||||||
|
self.errcode,
|
||||||
|
room_version=self._room_version,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def cs_error(msg, code=Codes.UNKNOWN, **kwargs):
|
def cs_error(msg, code=Codes.UNKNOWN, **kwargs):
|
||||||
|
@ -372,7 +370,7 @@ class HttpResponseException(CodeMessageException):
|
||||||
Represents an HTTP-level failure of an outbound request
|
Represents an HTTP-level failure of an outbound request
|
||||||
|
|
||||||
Attributes:
|
Attributes:
|
||||||
response (str): body of response
|
response (bytes): body of response
|
||||||
"""
|
"""
|
||||||
def __init__(self, code, msg, response):
|
def __init__(self, code, msg, response):
|
||||||
"""
|
"""
|
||||||
|
@ -380,7 +378,39 @@ class HttpResponseException(CodeMessageException):
|
||||||
Args:
|
Args:
|
||||||
code (int): HTTP status code
|
code (int): HTTP status code
|
||||||
msg (str): reason phrase from HTTP response status line
|
msg (str): reason phrase from HTTP response status line
|
||||||
response (str): body of response
|
response (bytes): body of response
|
||||||
"""
|
"""
|
||||||
super(HttpResponseException, self).__init__(code, msg)
|
super(HttpResponseException, self).__init__(code, msg)
|
||||||
self.response = response
|
self.response = response
|
||||||
|
|
||||||
|
def to_synapse_error(self):
|
||||||
|
"""Make a SynapseError based on an HTTPResponseException
|
||||||
|
|
||||||
|
This is useful when a proxied request has failed, and we need to
|
||||||
|
decide how to map the failure onto a matrix error to send back to the
|
||||||
|
client.
|
||||||
|
|
||||||
|
An attempt is made to parse the body of the http response as a matrix
|
||||||
|
error. If that succeeds, the errcode and error message from the body
|
||||||
|
are used as the errcode and error message in the new synapse error.
|
||||||
|
|
||||||
|
Otherwise, the errcode is set to M_UNKNOWN, and the error message is
|
||||||
|
set to the reason code from the HTTP response.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
SynapseError:
|
||||||
|
"""
|
||||||
|
# try to parse the body as json, to get better errcode/msg, but
|
||||||
|
# default to M_UNKNOWN with the HTTP status as the error text
|
||||||
|
try:
|
||||||
|
j = json.loads(self.response)
|
||||||
|
except ValueError:
|
||||||
|
j = {}
|
||||||
|
|
||||||
|
if not isinstance(j, dict):
|
||||||
|
j = {}
|
||||||
|
|
||||||
|
errcode = j.pop('errcode', Codes.UNKNOWN)
|
||||||
|
errmsg = j.pop('error', self.msg)
|
||||||
|
|
||||||
|
return ProxiedRequestError(self.code, errmsg, errcode, j)
|
||||||
|
|
|
@ -39,7 +39,7 @@ from synapse.replication.slave.storage.events import SlavedEventStore
|
||||||
from synapse.replication.slave.storage.keys import SlavedKeyStore
|
from synapse.replication.slave.storage.keys import SlavedKeyStore
|
||||||
from synapse.replication.slave.storage.registration import SlavedRegistrationStore
|
from synapse.replication.slave.storage.registration import SlavedRegistrationStore
|
||||||
from synapse.replication.slave.storage.room import RoomStore
|
from synapse.replication.slave.storage.room import RoomStore
|
||||||
from synapse.replication.slave.storage.transactions import TransactionStore
|
from synapse.replication.slave.storage.transactions import SlavedTransactionStore
|
||||||
from synapse.replication.tcp.client import ReplicationClientHandler
|
from synapse.replication.tcp.client import ReplicationClientHandler
|
||||||
from synapse.rest.client.v1.room import (
|
from synapse.rest.client.v1.room import (
|
||||||
JoinedRoomMemberListRestServlet,
|
JoinedRoomMemberListRestServlet,
|
||||||
|
@ -66,7 +66,7 @@ class ClientReaderSlavedStore(
|
||||||
DirectoryStore,
|
DirectoryStore,
|
||||||
SlavedApplicationServiceStore,
|
SlavedApplicationServiceStore,
|
||||||
SlavedRegistrationStore,
|
SlavedRegistrationStore,
|
||||||
TransactionStore,
|
SlavedTransactionStore,
|
||||||
SlavedClientIpStore,
|
SlavedClientIpStore,
|
||||||
BaseSlavedStore,
|
BaseSlavedStore,
|
||||||
):
|
):
|
||||||
|
@ -168,11 +168,13 @@ def start(config_options):
|
||||||
database_engine = create_engine(config.database_config)
|
database_engine = create_engine(config.database_config)
|
||||||
|
|
||||||
tls_server_context_factory = context_factory.ServerContextFactory(config)
|
tls_server_context_factory = context_factory.ServerContextFactory(config)
|
||||||
|
tls_client_options_factory = context_factory.ClientTLSOptionsFactory(config)
|
||||||
|
|
||||||
ss = ClientReaderServer(
|
ss = ClientReaderServer(
|
||||||
config.server_name,
|
config.server_name,
|
||||||
db_config=config.database_config,
|
db_config=config.database_config,
|
||||||
tls_server_context_factory=tls_server_context_factory,
|
tls_server_context_factory=tls_server_context_factory,
|
||||||
|
tls_client_options_factory=tls_client_options_factory,
|
||||||
config=config,
|
config=config,
|
||||||
version_string="Synapse/" + get_version_string(synapse),
|
version_string="Synapse/" + get_version_string(synapse),
|
||||||
database_engine=database_engine,
|
database_engine=database_engine,
|
||||||
|
|
|
@ -43,7 +43,7 @@ from synapse.replication.slave.storage.pushers import SlavedPusherStore
|
||||||
from synapse.replication.slave.storage.receipts import SlavedReceiptsStore
|
from synapse.replication.slave.storage.receipts import SlavedReceiptsStore
|
||||||
from synapse.replication.slave.storage.registration import SlavedRegistrationStore
|
from synapse.replication.slave.storage.registration import SlavedRegistrationStore
|
||||||
from synapse.replication.slave.storage.room import RoomStore
|
from synapse.replication.slave.storage.room import RoomStore
|
||||||
from synapse.replication.slave.storage.transactions import TransactionStore
|
from synapse.replication.slave.storage.transactions import SlavedTransactionStore
|
||||||
from synapse.replication.tcp.client import ReplicationClientHandler
|
from synapse.replication.tcp.client import ReplicationClientHandler
|
||||||
from synapse.rest.client.v1.room import (
|
from synapse.rest.client.v1.room import (
|
||||||
JoinRoomAliasServlet,
|
JoinRoomAliasServlet,
|
||||||
|
@ -63,7 +63,7 @@ logger = logging.getLogger("synapse.app.event_creator")
|
||||||
|
|
||||||
class EventCreatorSlavedStore(
|
class EventCreatorSlavedStore(
|
||||||
DirectoryStore,
|
DirectoryStore,
|
||||||
TransactionStore,
|
SlavedTransactionStore,
|
||||||
SlavedProfileStore,
|
SlavedProfileStore,
|
||||||
SlavedAccountDataStore,
|
SlavedAccountDataStore,
|
||||||
SlavedPusherStore,
|
SlavedPusherStore,
|
||||||
|
@ -174,11 +174,13 @@ def start(config_options):
|
||||||
database_engine = create_engine(config.database_config)
|
database_engine = create_engine(config.database_config)
|
||||||
|
|
||||||
tls_server_context_factory = context_factory.ServerContextFactory(config)
|
tls_server_context_factory = context_factory.ServerContextFactory(config)
|
||||||
|
tls_client_options_factory = context_factory.ClientTLSOptionsFactory(config)
|
||||||
|
|
||||||
ss = EventCreatorServer(
|
ss = EventCreatorServer(
|
||||||
config.server_name,
|
config.server_name,
|
||||||
db_config=config.database_config,
|
db_config=config.database_config,
|
||||||
tls_server_context_factory=tls_server_context_factory,
|
tls_server_context_factory=tls_server_context_factory,
|
||||||
|
tls_client_options_factory=tls_client_options_factory,
|
||||||
config=config,
|
config=config,
|
||||||
version_string="Synapse/" + get_version_string(synapse),
|
version_string="Synapse/" + get_version_string(synapse),
|
||||||
database_engine=database_engine,
|
database_engine=database_engine,
|
||||||
|
|
|
@ -32,11 +32,16 @@ from synapse.http.site import SynapseSite
|
||||||
from synapse.metrics import RegistryProxy
|
from synapse.metrics import RegistryProxy
|
||||||
from synapse.metrics.resource import METRICS_PREFIX, MetricsResource
|
from synapse.metrics.resource import METRICS_PREFIX, MetricsResource
|
||||||
from synapse.replication.slave.storage._base import BaseSlavedStore
|
from synapse.replication.slave.storage._base import BaseSlavedStore
|
||||||
|
from synapse.replication.slave.storage.appservice import SlavedApplicationServiceStore
|
||||||
from synapse.replication.slave.storage.directory import DirectoryStore
|
from synapse.replication.slave.storage.directory import DirectoryStore
|
||||||
from synapse.replication.slave.storage.events import SlavedEventStore
|
from synapse.replication.slave.storage.events import SlavedEventStore
|
||||||
from synapse.replication.slave.storage.keys import SlavedKeyStore
|
from synapse.replication.slave.storage.keys import SlavedKeyStore
|
||||||
|
from synapse.replication.slave.storage.profile import SlavedProfileStore
|
||||||
|
from synapse.replication.slave.storage.push_rule import SlavedPushRuleStore
|
||||||
|
from synapse.replication.slave.storage.pushers import SlavedPusherStore
|
||||||
|
from synapse.replication.slave.storage.receipts import SlavedReceiptsStore
|
||||||
from synapse.replication.slave.storage.room import RoomStore
|
from synapse.replication.slave.storage.room import RoomStore
|
||||||
from synapse.replication.slave.storage.transactions import TransactionStore
|
from synapse.replication.slave.storage.transactions import SlavedTransactionStore
|
||||||
from synapse.replication.tcp.client import ReplicationClientHandler
|
from synapse.replication.tcp.client import ReplicationClientHandler
|
||||||
from synapse.server import HomeServer
|
from synapse.server import HomeServer
|
||||||
from synapse.storage.engines import create_engine
|
from synapse.storage.engines import create_engine
|
||||||
|
@ -49,11 +54,16 @@ logger = logging.getLogger("synapse.app.federation_reader")
|
||||||
|
|
||||||
|
|
||||||
class FederationReaderSlavedStore(
|
class FederationReaderSlavedStore(
|
||||||
|
SlavedProfileStore,
|
||||||
|
SlavedApplicationServiceStore,
|
||||||
|
SlavedPusherStore,
|
||||||
|
SlavedPushRuleStore,
|
||||||
|
SlavedReceiptsStore,
|
||||||
SlavedEventStore,
|
SlavedEventStore,
|
||||||
SlavedKeyStore,
|
SlavedKeyStore,
|
||||||
RoomStore,
|
RoomStore,
|
||||||
DirectoryStore,
|
DirectoryStore,
|
||||||
TransactionStore,
|
SlavedTransactionStore,
|
||||||
BaseSlavedStore,
|
BaseSlavedStore,
|
||||||
):
|
):
|
||||||
pass
|
pass
|
||||||
|
@ -143,11 +153,13 @@ def start(config_options):
|
||||||
database_engine = create_engine(config.database_config)
|
database_engine = create_engine(config.database_config)
|
||||||
|
|
||||||
tls_server_context_factory = context_factory.ServerContextFactory(config)
|
tls_server_context_factory = context_factory.ServerContextFactory(config)
|
||||||
|
tls_client_options_factory = context_factory.ClientTLSOptionsFactory(config)
|
||||||
|
|
||||||
ss = FederationReaderServer(
|
ss = FederationReaderServer(
|
||||||
config.server_name,
|
config.server_name,
|
||||||
db_config=config.database_config,
|
db_config=config.database_config,
|
||||||
tls_server_context_factory=tls_server_context_factory,
|
tls_server_context_factory=tls_server_context_factory,
|
||||||
|
tls_client_options_factory=tls_client_options_factory,
|
||||||
config=config,
|
config=config,
|
||||||
version_string="Synapse/" + get_version_string(synapse),
|
version_string="Synapse/" + get_version_string(synapse),
|
||||||
database_engine=database_engine,
|
database_engine=database_engine,
|
||||||
|
|
|
@ -36,11 +36,11 @@ from synapse.replication.slave.storage.events import SlavedEventStore
|
||||||
from synapse.replication.slave.storage.presence import SlavedPresenceStore
|
from synapse.replication.slave.storage.presence import SlavedPresenceStore
|
||||||
from synapse.replication.slave.storage.receipts import SlavedReceiptsStore
|
from synapse.replication.slave.storage.receipts import SlavedReceiptsStore
|
||||||
from synapse.replication.slave.storage.registration import SlavedRegistrationStore
|
from synapse.replication.slave.storage.registration import SlavedRegistrationStore
|
||||||
from synapse.replication.slave.storage.transactions import TransactionStore
|
from synapse.replication.slave.storage.transactions import SlavedTransactionStore
|
||||||
from synapse.replication.tcp.client import ReplicationClientHandler
|
from synapse.replication.tcp.client import ReplicationClientHandler
|
||||||
from synapse.server import HomeServer
|
from synapse.server import HomeServer
|
||||||
from synapse.storage.engines import create_engine
|
from synapse.storage.engines import create_engine
|
||||||
from synapse.util.async import Linearizer
|
from synapse.util.async_helpers import Linearizer
|
||||||
from synapse.util.httpresourcetree import create_resource_tree
|
from synapse.util.httpresourcetree import create_resource_tree
|
||||||
from synapse.util.logcontext import LoggingContext, run_in_background
|
from synapse.util.logcontext import LoggingContext, run_in_background
|
||||||
from synapse.util.manhole import manhole
|
from synapse.util.manhole import manhole
|
||||||
|
@ -50,7 +50,7 @@ logger = logging.getLogger("synapse.app.federation_sender")
|
||||||
|
|
||||||
|
|
||||||
class FederationSenderSlaveStore(
|
class FederationSenderSlaveStore(
|
||||||
SlavedDeviceInboxStore, TransactionStore, SlavedReceiptsStore, SlavedEventStore,
|
SlavedDeviceInboxStore, SlavedTransactionStore, SlavedReceiptsStore, SlavedEventStore,
|
||||||
SlavedRegistrationStore, SlavedDeviceStore, SlavedPresenceStore,
|
SlavedRegistrationStore, SlavedDeviceStore, SlavedPresenceStore,
|
||||||
):
|
):
|
||||||
def __init__(self, db_conn, hs):
|
def __init__(self, db_conn, hs):
|
||||||
|
@ -186,11 +186,13 @@ def start(config_options):
|
||||||
config.send_federation = True
|
config.send_federation = True
|
||||||
|
|
||||||
tls_server_context_factory = context_factory.ServerContextFactory(config)
|
tls_server_context_factory = context_factory.ServerContextFactory(config)
|
||||||
|
tls_client_options_factory = context_factory.ClientTLSOptionsFactory(config)
|
||||||
|
|
||||||
ps = FederationSenderServer(
|
ps = FederationSenderServer(
|
||||||
config.server_name,
|
config.server_name,
|
||||||
db_config=config.database_config,
|
db_config=config.database_config,
|
||||||
tls_server_context_factory=tls_server_context_factory,
|
tls_server_context_factory=tls_server_context_factory,
|
||||||
|
tls_client_options_factory=tls_client_options_factory,
|
||||||
config=config,
|
config=config,
|
||||||
version_string="Synapse/" + get_version_string(synapse),
|
version_string="Synapse/" + get_version_string(synapse),
|
||||||
database_engine=database_engine,
|
database_engine=database_engine,
|
||||||
|
|
|
@ -208,11 +208,13 @@ def start(config_options):
|
||||||
database_engine = create_engine(config.database_config)
|
database_engine = create_engine(config.database_config)
|
||||||
|
|
||||||
tls_server_context_factory = context_factory.ServerContextFactory(config)
|
tls_server_context_factory = context_factory.ServerContextFactory(config)
|
||||||
|
tls_client_options_factory = context_factory.ClientTLSOptionsFactory(config)
|
||||||
|
|
||||||
ss = FrontendProxyServer(
|
ss = FrontendProxyServer(
|
||||||
config.server_name,
|
config.server_name,
|
||||||
db_config=config.database_config,
|
db_config=config.database_config,
|
||||||
tls_server_context_factory=tls_server_context_factory,
|
tls_server_context_factory=tls_server_context_factory,
|
||||||
|
tls_client_options_factory=tls_client_options_factory,
|
||||||
config=config,
|
config=config,
|
||||||
version_string="Synapse/" + get_version_string(synapse),
|
version_string="Synapse/" + get_version_string(synapse),
|
||||||
database_engine=database_engine,
|
database_engine=database_engine,
|
||||||
|
|
|
@ -20,6 +20,8 @@ import sys
|
||||||
|
|
||||||
from six import iteritems
|
from six import iteritems
|
||||||
|
|
||||||
|
from prometheus_client import Gauge
|
||||||
|
|
||||||
from twisted.application import service
|
from twisted.application import service
|
||||||
from twisted.internet import defer, reactor
|
from twisted.internet import defer, reactor
|
||||||
from twisted.web.resource import EncodingResourceWrapper, NoResource
|
from twisted.web.resource import EncodingResourceWrapper, NoResource
|
||||||
|
@ -300,6 +302,11 @@ class SynapseHomeServer(HomeServer):
|
||||||
quit_with_error(e.message)
|
quit_with_error(e.message)
|
||||||
|
|
||||||
|
|
||||||
|
# Gauges to expose monthly active user control metrics
|
||||||
|
current_mau_gauge = Gauge("synapse_admin_mau:current", "Current MAU")
|
||||||
|
max_mau_gauge = Gauge("synapse_admin_mau:max", "MAU Limit")
|
||||||
|
|
||||||
|
|
||||||
def setup(config_options):
|
def setup(config_options):
|
||||||
"""
|
"""
|
||||||
Args:
|
Args:
|
||||||
|
@ -331,6 +338,7 @@ def setup(config_options):
|
||||||
events.USE_FROZEN_DICTS = config.use_frozen_dicts
|
events.USE_FROZEN_DICTS = config.use_frozen_dicts
|
||||||
|
|
||||||
tls_server_context_factory = context_factory.ServerContextFactory(config)
|
tls_server_context_factory = context_factory.ServerContextFactory(config)
|
||||||
|
tls_client_options_factory = context_factory.ClientTLSOptionsFactory(config)
|
||||||
|
|
||||||
database_engine = create_engine(config.database_config)
|
database_engine = create_engine(config.database_config)
|
||||||
config.database_config["args"]["cp_openfun"] = database_engine.on_new_connection
|
config.database_config["args"]["cp_openfun"] = database_engine.on_new_connection
|
||||||
|
@ -339,6 +347,7 @@ def setup(config_options):
|
||||||
config.server_name,
|
config.server_name,
|
||||||
db_config=config.database_config,
|
db_config=config.database_config,
|
||||||
tls_server_context_factory=tls_server_context_factory,
|
tls_server_context_factory=tls_server_context_factory,
|
||||||
|
tls_client_options_factory=tls_client_options_factory,
|
||||||
config=config,
|
config=config,
|
||||||
version_string="Synapse/" + get_version_string(synapse),
|
version_string="Synapse/" + get_version_string(synapse),
|
||||||
database_engine=database_engine,
|
database_engine=database_engine,
|
||||||
|
@ -512,6 +521,27 @@ def run(hs):
|
||||||
# table will decrease
|
# table will decrease
|
||||||
clock.looping_call(generate_user_daily_visit_stats, 5 * 60 * 1000)
|
clock.looping_call(generate_user_daily_visit_stats, 5 * 60 * 1000)
|
||||||
|
|
||||||
|
# monthly active user limiting functionality
|
||||||
|
clock.looping_call(
|
||||||
|
hs.get_datastore().reap_monthly_active_users, 1000 * 60 * 60
|
||||||
|
)
|
||||||
|
|
||||||
|
@defer.inlineCallbacks
|
||||||
|
def generate_monthly_active_users():
|
||||||
|
count = 0
|
||||||
|
if hs.config.limit_usage_by_mau:
|
||||||
|
count = yield hs.get_datastore().get_monthly_active_count()
|
||||||
|
current_mau_gauge.set(float(count))
|
||||||
|
max_mau_gauge.set(float(hs.config.max_mau_value))
|
||||||
|
|
||||||
|
hs.get_datastore().initialise_reserved_users(
|
||||||
|
hs.config.mau_limits_reserved_threepids
|
||||||
|
)
|
||||||
|
generate_monthly_active_users()
|
||||||
|
if hs.config.limit_usage_by_mau:
|
||||||
|
clock.looping_call(generate_monthly_active_users, 5 * 60 * 1000)
|
||||||
|
# End of monthly active user settings
|
||||||
|
|
||||||
if hs.config.report_stats:
|
if hs.config.report_stats:
|
||||||
logger.info("Scheduling stats reporting for 3 hour intervals")
|
logger.info("Scheduling stats reporting for 3 hour intervals")
|
||||||
clock.looping_call(start_phone_stats_home, 3 * 60 * 60 * 1000)
|
clock.looping_call(start_phone_stats_home, 3 * 60 * 60 * 1000)
|
||||||
|
|
|
@ -34,7 +34,7 @@ from synapse.replication.slave.storage._base import BaseSlavedStore
|
||||||
from synapse.replication.slave.storage.appservice import SlavedApplicationServiceStore
|
from synapse.replication.slave.storage.appservice import SlavedApplicationServiceStore
|
||||||
from synapse.replication.slave.storage.client_ips import SlavedClientIpStore
|
from synapse.replication.slave.storage.client_ips import SlavedClientIpStore
|
||||||
from synapse.replication.slave.storage.registration import SlavedRegistrationStore
|
from synapse.replication.slave.storage.registration import SlavedRegistrationStore
|
||||||
from synapse.replication.slave.storage.transactions import TransactionStore
|
from synapse.replication.slave.storage.transactions import SlavedTransactionStore
|
||||||
from synapse.replication.tcp.client import ReplicationClientHandler
|
from synapse.replication.tcp.client import ReplicationClientHandler
|
||||||
from synapse.rest.media.v0.content_repository import ContentRepoResource
|
from synapse.rest.media.v0.content_repository import ContentRepoResource
|
||||||
from synapse.server import HomeServer
|
from synapse.server import HomeServer
|
||||||
|
@ -52,7 +52,7 @@ class MediaRepositorySlavedStore(
|
||||||
SlavedApplicationServiceStore,
|
SlavedApplicationServiceStore,
|
||||||
SlavedRegistrationStore,
|
SlavedRegistrationStore,
|
||||||
SlavedClientIpStore,
|
SlavedClientIpStore,
|
||||||
TransactionStore,
|
SlavedTransactionStore,
|
||||||
BaseSlavedStore,
|
BaseSlavedStore,
|
||||||
MediaRepositoryStore,
|
MediaRepositoryStore,
|
||||||
):
|
):
|
||||||
|
@ -155,11 +155,13 @@ def start(config_options):
|
||||||
database_engine = create_engine(config.database_config)
|
database_engine = create_engine(config.database_config)
|
||||||
|
|
||||||
tls_server_context_factory = context_factory.ServerContextFactory(config)
|
tls_server_context_factory = context_factory.ServerContextFactory(config)
|
||||||
|
tls_client_options_factory = context_factory.ClientTLSOptionsFactory(config)
|
||||||
|
|
||||||
ss = MediaRepositoryServer(
|
ss = MediaRepositoryServer(
|
||||||
config.server_name,
|
config.server_name,
|
||||||
db_config=config.database_config,
|
db_config=config.database_config,
|
||||||
tls_server_context_factory=tls_server_context_factory,
|
tls_server_context_factory=tls_server_context_factory,
|
||||||
|
tls_client_options_factory=tls_client_options_factory,
|
||||||
config=config,
|
config=config,
|
||||||
version_string="Synapse/" + get_version_string(synapse),
|
version_string="Synapse/" + get_version_string(synapse),
|
||||||
database_engine=database_engine,
|
database_engine=database_engine,
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue