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

Commit

Permalink
Merge pull request #53 from matrix-org/anoa/dinsic_release_1_18_x
Browse files Browse the repository at this point in the history
Merge Synapse release v1.18.0 into 'dinsic'
  • Loading branch information
anoadragon453 authored Aug 18, 2020
2 parents 21821c0 + 24652fb commit b90ecbe
Show file tree
Hide file tree
Showing 339 changed files with 12,791 additions and 6,905 deletions.
326 changes: 326 additions & 0 deletions CHANGES.md

Large diffs are not rendered by default.

12 changes: 5 additions & 7 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -405,13 +405,11 @@ so, you will need to edit `homeserver.yaml`, as follows:
```

* You will also need to uncomment the `tls_certificate_path` and
`tls_private_key_path` lines under the `TLS` section. You can either
point these settings at an existing certificate and key, or you can
enable Synapse's built-in ACME (Let's Encrypt) support. Instructions
for having Synapse automatically provision and renew federation
certificates through ACME can be found at [ACME.md](docs/ACME.md).
Note that, as pointed out in that document, this feature will not
work with installs set up after November 2019.
`tls_private_key_path` lines under the `TLS` section. You will need to manage
provisioning of these certificates yourself — Synapse had built-in ACME
support, but the ACMEv1 protocol Synapse implements is deprecated, not
allowed by LetsEncrypt for new sites, and will break for existing sites in
late 2020. See [ACME.md](docs/ACME.md).

If you are using your own certificate, be sure to use a `.pem` file that
includes the full certificate chain including any intermediate certificates
Expand Down
14 changes: 7 additions & 7 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -188,14 +188,10 @@ Using PostgreSQL
================

Synapse offers two database engines:
* `SQLite <https://sqlite.org/>`_
* `PostgreSQL <https://www.postgresql.org>`_
* `SQLite <https://sqlite.org/>`_

By default Synapse uses SQLite in and doing so trades performance for convenience.
SQLite is only recommended in Synapse for testing purposes or for servers with
light workloads.

Almost all installations should opt to use PostreSQL. Advantages include:
Almost all installations should opt to use PostgreSQL. Advantages include:

* significant performance improvements due to the superior threading and
caching model, smarter query optimiser
Expand All @@ -207,6 +203,10 @@ Almost all installations should opt to use PostreSQL. Advantages include:
For information on how to install and use PostgreSQL, please see
`docs/postgres.md <docs/postgres.md>`_.

By default Synapse uses SQLite and in doing so trades performance for convenience.
SQLite is only recommended in Synapse for testing purposes or for servers with
light workloads.

.. _reverse-proxy:

Using a reverse proxy with Synapse
Expand All @@ -215,7 +215,7 @@ Using a reverse proxy with Synapse
It is recommended to put a reverse proxy such as
`nginx <https://nginx.org/en/docs/http/ngx_http_proxy_module.html>`_,
`Apache <https://httpd.apache.org/docs/current/mod/mod_proxy_http.html>`_,
`Caddy <https://caddyserver.com/docs/proxy>`_ or
`Caddy <https://caddyserver.com/docs/quick-starts/reverse-proxy>`_ or
`HAProxy <https://www.haproxy.org/>`_ in front of Synapse. One advantage of
doing so is that it means that you can expose the default https port (443) to
Matrix clients without needing to run Synapse with root privileges.
Expand Down
18 changes: 18 additions & 0 deletions UPGRADE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,24 @@ for example:
wget https://packages.matrix.org/debian/pool/main/m/matrix-synapse-py3/matrix-synapse-py3_1.3.0+stretch1_amd64.deb
dpkg -i matrix-synapse-py3_1.3.0+stretch1_amd64.deb
Upgrading to v1.18.0
====================

Docker `-py3` suffix will be removed in future versions
-------------------------------------------------------

From 10th August 2020, we will no longer publish Docker images with the `-py3` tag suffix. The images tagged with the `-py3` suffix have been identical to the non-suffixed tags since release 0.99.0, and the suffix is obsolete.

On 10th August, we will remove the `latest-py3` tag. Existing per-release tags (such as `v1.18.0-py3`) will not be removed, but no new `-py3` tags will be added.

Scripts relying on the `-py3` suffix will need to be updated.

Redis replication is now recommended in lieu of TCP replication
---------------------------------------------------------------

When setting up worker processes, we now recommend the use of a Redis server for replication. **The old direct TCP connection method is deprecated and will be removed in a future release.**
See `docs/workers.md <docs/workers.md>`_ for more details.

Upgrading to v1.14.0
====================

Expand Down
1 change: 1 addition & 0 deletions changelog.d/53.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Merge mainline Synapse v1.18.0 into the `dinsic` branch.
21 changes: 10 additions & 11 deletions contrib/cmdclient/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
""" Starts a synapse client console. """
from __future__ import print_function

from twisted.internet import reactor, defer, threads
from http import TwistedHttpClient

import argparse
import cmd
import getpass
Expand All @@ -28,12 +25,14 @@
import sys
import time
import urllib
import urlparse
from http import TwistedHttpClient

import nacl.signing
import nacl.encoding
import nacl.signing
import urlparse
from signedjson.sign import SignatureVerifyException, verify_signed_json

from signedjson.sign import verify_signed_json, SignatureVerifyException
from twisted.internet import defer, reactor, threads

CONFIG_JSON = "cmdclient_config.json"

Expand Down Expand Up @@ -493,7 +492,7 @@ def do_list(self, line):
"list messages <roomid> from=END&to=START&limit=3"
"""
args = self._parse(line, ["type", "roomid", "qp"])
if not "type" in args or not "roomid" in args:
if "type" not in args or "roomid" not in args:
print("Must specify type and room ID.")
return
if args["type"] not in ["members", "messages"]:
Expand All @@ -508,7 +507,7 @@ def do_list(self, line):
try:
key_value = key_value_str.split("=")
qp[key_value[0]] = key_value[1]
except:
except Exception:
print("Bad query param: %s" % key_value)
return

Expand Down Expand Up @@ -585,7 +584,7 @@ def do_raw(self, line):
parsed_url = urlparse.urlparse(args["path"])
qp.update(urlparse.parse_qs(parsed_url.query))
args["path"] = parsed_url.path
except:
except Exception:
pass

reactor.callFromThread(
Expand Down Expand Up @@ -772,10 +771,10 @@ def main(server_url, identity_server_url, username, token, config_path):
syn_cmd.config = json.load(config)
try:
http_client.verbose = "on" == syn_cmd.config["verbose"]
except:
except Exception:
pass
print("Loaded config from %s" % config_path)
except:
except Exception:
pass

# Twisted-specific: Runs the command processor in Twisted's event loop
Expand Down
10 changes: 5 additions & 5 deletions contrib/cmdclient/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
# limitations under the License.

from __future__ import print_function
from twisted.web.client import Agent, readBody
from twisted.web.http_headers import Headers
from twisted.internet import defer, reactor

from pprint import pformat

import json
import urllib
from pprint import pformat

from twisted.internet import defer, reactor
from twisted.web.client import Agent, readBody
from twisted.web.http_headers import Headers


class HttpClient(object):
Expand Down
2 changes: 1 addition & 1 deletion contrib/docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ services:
- traefik.http.routers.https-synapse.tls.certResolver=le-ssl

db:
image: docker.io/postgres:10-alpine
image: docker.io/postgres:12-alpine
# Change that password, of course!
environment:
- POSTGRES_USER=synapse
Expand Down
55 changes: 21 additions & 34 deletions contrib/experiments/test_messaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,24 @@
"""


from synapse.federation import ReplicationHandler

from synapse.federation.units import Pdu

from synapse.util import origin_from_ucid

from synapse.app.homeserver import SynapseHomeServer

# from synapse.logging.utils import log_function

from twisted.internet import reactor, defer
from twisted.python import log

import argparse
import curses.wrapper
import json
import logging
import os
import re

import cursesio
import curses.wrapper

from twisted.internet import defer, reactor
from twisted.python import log

from synapse.app.homeserver import SynapseHomeServer
from synapse.federation import ReplicationHandler
from synapse.federation.units import Pdu
from synapse.util import origin_from_ucid

# from synapse.logging.utils import log_function


logger = logging.getLogger("example")
Expand All @@ -75,7 +72,7 @@ def on_line(self, line):
"""

try:
m = re.match("^join (\S+)$", line)
m = re.match(r"^join (\S+)$", line)
if m:
# The `sender` wants to join a room.
(room_name,) = m.groups()
Expand All @@ -84,7 +81,7 @@ def on_line(self, line):
# self.print_line("OK.")
return

m = re.match("^invite (\S+) (\S+)$", line)
m = re.match(r"^invite (\S+) (\S+)$", line)
if m:
# `sender` wants to invite someone to a room
room_name, invitee = m.groups()
Expand All @@ -93,7 +90,7 @@ def on_line(self, line):
# self.print_line("OK.")
return

m = re.match("^send (\S+) (.*)$", line)
m = re.match(r"^send (\S+) (.*)$", line)
if m:
# `sender` wants to message a room
room_name, body = m.groups()
Expand All @@ -102,7 +99,7 @@ def on_line(self, line):
# self.print_line("OK.")
return

m = re.match("^backfill (\S+)$", line)
m = re.match(r"^backfill (\S+)$", line)
if m:
# we want to backfill a room
(room_name,) = m.groups()
Expand Down Expand Up @@ -201,16 +198,6 @@ def on_receive_pdu(self, pdu):
% (pdu.context, pdu.pdu_type, json.dumps(pdu.content))
)

# def on_state_change(self, pdu):
##self.output.print_line("#%s (state) %s *** %s" %
##(pdu.context, pdu.state_key, pdu.pdu_type)
##)

# if "joinee" in pdu.content:
# self._on_join(pdu.context, pdu.content["joinee"])
# elif "invitee" in pdu.content:
# self._on_invite(pdu.origin, pdu.context, pdu.content["invitee"])

def _on_message(self, pdu):
""" We received a message
"""
Expand Down Expand Up @@ -314,7 +301,7 @@ def backfill(self, room_name, limit=5):
return self.replication_layer.backfill(dest, room_name, limit)

def _get_room_remote_servers(self, room_name):
return [i for i in self.joined_rooms.setdefault(room_name).servers]
return list(self.joined_rooms.setdefault(room_name).servers)

def _get_or_create_room(self, room_name):
return self.joined_rooms.setdefault(room_name, Room(room_name))
Expand All @@ -334,7 +321,7 @@ def main(stdscr):
user = args.user
server_name = origin_from_ucid(user)

## Set up logging ##
# Set up logging

root_logger = logging.getLogger()

Expand All @@ -354,7 +341,7 @@ def main(stdscr):
observer = log.PythonLoggingObserver()
observer.start()

## Set up synapse server
# Set up synapse server

curses_stdio = cursesio.CursesStdIO(stdscr)
input_output = InputOutput(curses_stdio, user)
Expand All @@ -368,16 +355,16 @@ def main(stdscr):

input_output.set_home_server(hs)

## Add input_output logger
# Add input_output logger
io_logger = IOLoggerHandler(input_output)
io_logger.setFormatter(formatter)
root_logger.addHandler(io_logger)

## Start! ##
# Start!

try:
port = int(server_name.split(":")[1])
except:
except Exception:
port = 12345

app_hs.get_http_server().start_listening(port)
Expand Down
Loading

0 comments on commit b90ecbe

Please sign in to comment.