UPGRADE.rst 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556
  1. Upgrading Synapse
  2. =================
  3. Before upgrading check if any special steps are required to upgrade from the
  4. what you currently have installed to current version of synapse. The extra
  5. instructions that may be required are listed later in this document.
  6. 1. If synapse was installed in a virtualenv then activate that virtualenv before
  7. upgrading. If synapse is installed in a virtualenv in ``~/synapse/env`` then
  8. run:
  9. .. code:: bash
  10. source ~/synapse/env/bin/activate
  11. 2. If synapse was installed using pip then upgrade to the latest version by
  12. running:
  13. .. code:: bash
  14. pip install --upgrade matrix-synapse[all]
  15. # restart synapse
  16. synctl restart
  17. If synapse was installed using git then upgrade to the latest version by
  18. running:
  19. .. code:: bash
  20. # Pull the latest version of the master branch.
  21. git pull
  22. # Update synapse and its python dependencies.
  23. pip install --upgrade .[all]
  24. # restart synapse
  25. ./synctl restart
  26. To check whether your update was successful, you can check the Server header
  27. returned by the Client-Server API:
  28. .. code:: bash
  29. # replace <host.name> with the hostname of your synapse homeserver.
  30. # You may need to specify a port (eg, :8448) if your server is not
  31. # configured on port 443.
  32. curl -kv https://<host.name>/_matrix/client/versions 2>&1 | grep "Server:"
  33. Upgrading to v1.4.0
  34. ===================
  35. Config options
  36. --------------
  37. **Note: Registration by email address or phone number will not work in this release unless
  38. some config options are changed from their defaults.**
  39. This is due to Synapse v1.4.0 now defaulting to sending registration and password reset tokens
  40. itself. This is for security reasons as well as putting less reliance on identity servers.
  41. However, currently Synapse only supports sending emails, and does not have support for
  42. phone-based password reset or account registration. If Synapse is configured to handle these on
  43. its own, phone-based password resets and registration will be disabled. For Synapse to send
  44. emails, the ``email`` block of the config must be filled out. If not, then password resets and
  45. registration via email will be disabled entirely.
  46. This release also deprecates the ``email.trust_identity_server_for_password_resets`` option and
  47. replaces it with the ``account_threepid_delegates`` dictionary. This option defines whether the
  48. homeserver should delegate an external server (typically an `identity server
  49. <https://matrix.org/docs/spec/identity_service/r0.2.1>`_) to handle sending password reset or
  50. registration messages via email and SMS.
  51. If ``email.trust_identity_server_for_password_resets`` is set to ``true``, and
  52. ``account_threepid_delegates.email`` is not set, then the first entry in
  53. ``trusted_third_party_id_servers`` will be used as the account threepid delegate for email.
  54. This is to ensure compatibility with existing Synapse installs that set up external server
  55. handling for these tasks before v1.4.0. If ``email.trust_identity_server_for_password_resets``
  56. is ``true`` and no trusted identity server domains are configured, Synapse will throw an error.
  57. If ``email.trust_identity_server_for_password_resets`` is ``false`` or absent and a threepid
  58. type in ``account_threepid_delegates`` is not set to a domain, then Synapse will attempt to
  59. send password reset and registration messages for that type.
  60. Email templates
  61. ---------------
  62. If you have configured a custom template directory with the ``email.template_dir`` option, be
  63. aware that there are new templates regarding registration. ``registration.html`` and
  64. ``registration.txt`` have been added and contain the content that is sent to a client upon
  65. registering via an email address.
  66. ``registration_success.html`` and ``registration_failure.html`` are also new HTML templates
  67. that will be shown to the user when they click the link in their registration emai , either
  68. showing them a success or failure page (assuming a redirect URL is not configured).
  69. Synapse will expect these files to exist inside the configured template directory. To view the
  70. default templates, see `synapse/res/templates
  71. <https://github.com/matrix-org/synapse/tree/master/synapse/res/templates>`_.
  72. Upgrading to v1.2.0
  73. ===================
  74. Some counter metrics have been renamed, with the old names deprecated. See
  75. `the metrics documentation <docs/metrics-howto.rst#renaming-of-metrics--deprecation-of-old-names-in-12>`_
  76. for details.
  77. Upgrading to v1.1.0
  78. ===================
  79. Synapse v1.1.0 removes support for older Python and PostgreSQL versions, as
  80. outlined in `our deprecation notice <https://matrix.org/blog/2019/04/08/synapse-deprecating-postgres-9-4-and-python-2-x>`_.
  81. Minimum Python Version
  82. ----------------------
  83. Synapse v1.1.0 has a minimum Python requirement of Python 3.5. Python 3.6 or
  84. Python 3.7 are recommended as they have improved internal string handling,
  85. significantly reducing memory usage.
  86. If you use current versions of the Matrix.org-distributed Debian packages or
  87. Docker images, action is not required.
  88. If you install Synapse in a Python virtual environment, please see "Upgrading to
  89. v0.34.0" for notes on setting up a new virtualenv under Python 3.
  90. Minimum PostgreSQL Version
  91. --------------------------
  92. If using PostgreSQL under Synapse, you will need to use PostgreSQL 9.5 or above.
  93. Please see the
  94. `PostgreSQL documentation <https://www.postgresql.org/docs/11/upgrading.html>`_
  95. for more details on upgrading your database.
  96. Upgrading to v1.0
  97. =================
  98. Validation of TLS certificates
  99. ------------------------------
  100. Synapse v1.0 is the first release to enforce
  101. validation of TLS certificates for the federation API. It is therefore
  102. essential that your certificates are correctly configured. See the `FAQ
  103. <docs/MSC1711_certificates_FAQ.md>`_ for more information.
  104. Note, v1.0 installations will also no longer be able to federate with servers
  105. that have not correctly configured their certificates.
  106. In rare cases, it may be desirable to disable certificate checking: for
  107. example, it might be essential to be able to federate with a given legacy
  108. server in a closed federation. This can be done in one of two ways:-
  109. * Configure the global switch ``federation_verify_certificates`` to ``false``.
  110. * Configure a whitelist of server domains to trust via ``federation_certificate_verification_whitelist``.
  111. See the `sample configuration file <docs/sample_config.yaml>`_
  112. for more details on these settings.
  113. Email
  114. -----
  115. When a user requests a password reset, Synapse will send an email to the
  116. user to confirm the request.
  117. Previous versions of Synapse delegated the job of sending this email to an
  118. identity server. If the identity server was somehow malicious or became
  119. compromised, it would be theoretically possible to hijack an account through
  120. this means.
  121. Therefore, by default, Synapse v1.0 will send the confirmation email itself. If
  122. Synapse is not configured with an SMTP server, password reset via email will be
  123. disabled.
  124. To configure an SMTP server for Synapse, modify the configuration section
  125. headed ``email``, and be sure to have at least the ``smtp_host``, ``smtp_port``
  126. and ``notif_from`` fields filled out. You may also need to set ``smtp_user``,
  127. ``smtp_pass``, and ``require_transport_security``.
  128. If you are absolutely certain that you wish to continue using an identity
  129. server for password resets, set ``trust_identity_server_for_password_resets`` to ``true``.
  130. See the `sample configuration file <docs/sample_config.yaml>`_
  131. for more details on these settings.
  132. New email templates
  133. ---------------
  134. Some new templates have been added to the default template directory for the purpose of the
  135. homeserver sending its own password reset emails. If you have configured a custom
  136. ``template_dir`` in your Synapse config, these files will need to be added.
  137. ``password_reset.html`` and ``password_reset.txt`` are HTML and plain text templates
  138. respectively that contain the contents of what will be emailed to the user upon attempting to
  139. reset their password via email. ``password_reset_success.html`` and
  140. ``password_reset_failure.html`` are HTML files that the content of which (assuming no redirect
  141. URL is set) will be shown to the user after they attempt to click the link in the email sent
  142. to them.
  143. Upgrading to v0.99.0
  144. ====================
  145. Please be aware that, before Synapse v1.0 is released around March 2019, you
  146. will need to replace any self-signed certificates with those verified by a
  147. root CA. Information on how to do so can be found at `the ACME docs
  148. <docs/ACME.md>`_.
  149. For more information on configuring TLS certificates see the `FAQ <docs/MSC1711_certificates_FAQ.md>`_.
  150. Upgrading to v0.34.0
  151. ====================
  152. 1. This release is the first to fully support Python 3. Synapse will now run on
  153. Python versions 3.5, or 3.6 (as well as 2.7). We recommend switching to
  154. Python 3, as it has been shown to give performance improvements.
  155. For users who have installed Synapse into a virtualenv, we recommend doing
  156. this by creating a new virtualenv. For example::
  157. virtualenv -p python3 ~/synapse/env3
  158. source ~/synapse/env3/bin/activate
  159. pip install matrix-synapse
  160. You can then start synapse as normal, having activated the new virtualenv::
  161. cd ~/synapse
  162. source env3/bin/activate
  163. synctl start
  164. Users who have installed from distribution packages should see the relevant
  165. package documentation. See below for notes on Debian packages.
  166. * When upgrading to Python 3, you **must** make sure that your log files are
  167. configured as UTF-8, by adding ``encoding: utf8`` to the
  168. ``RotatingFileHandler`` configuration (if you have one) in your
  169. ``<server>.log.config`` file. For example, if your ``log.config`` file
  170. contains::
  171. handlers:
  172. file:
  173. class: logging.handlers.RotatingFileHandler
  174. formatter: precise
  175. filename: homeserver.log
  176. maxBytes: 104857600
  177. backupCount: 10
  178. filters: [context]
  179. console:
  180. class: logging.StreamHandler
  181. formatter: precise
  182. filters: [context]
  183. Then you should update this to be::
  184. handlers:
  185. file:
  186. class: logging.handlers.RotatingFileHandler
  187. formatter: precise
  188. filename: homeserver.log
  189. maxBytes: 104857600
  190. backupCount: 10
  191. filters: [context]
  192. encoding: utf8
  193. console:
  194. class: logging.StreamHandler
  195. formatter: precise
  196. filters: [context]
  197. There is no need to revert this change if downgrading to Python 2.
  198. We are also making available Debian packages which will run Synapse on
  199. Python 3. You can switch to these packages with ``apt-get install
  200. matrix-synapse-py3``, however, please read `debian/NEWS
  201. <https://github.com/matrix-org/synapse/blob/release-v0.34.0/debian/NEWS>`_
  202. before doing so. The existing ``matrix-synapse`` packages will continue to
  203. use Python 2 for the time being.
  204. 2. This release removes the ``riot.im`` from the default list of trusted
  205. identity servers.
  206. If ``riot.im`` is in your homeserver's list of
  207. ``trusted_third_party_id_servers``, you should remove it. It was added in
  208. case a hypothetical future identity server was put there. If you don't
  209. remove it, users may be unable to deactivate their accounts.
  210. 3. This release no longer installs the (unmaintained) Matrix Console web client
  211. as part of the default installation. It is possible to re-enable it by
  212. installing it separately and setting the ``web_client_location`` config
  213. option, but please consider switching to another client.
  214. Upgrading to v0.33.7
  215. ====================
  216. This release removes the example email notification templates from
  217. ``res/templates`` (they are now internal to the python package). This should
  218. only affect you if you (a) deploy your Synapse instance from a git checkout or
  219. a github snapshot URL, and (b) have email notifications enabled.
  220. If you have email notifications enabled, you should ensure that
  221. ``email.template_dir`` is either configured to point at a directory where you
  222. have installed customised templates, or leave it unset to use the default
  223. templates.
  224. Upgrading to v0.27.3
  225. ====================
  226. This release expands the anonymous usage stats sent if the opt-in
  227. ``report_stats`` configuration is set to ``true``. We now capture RSS memory
  228. and cpu use at a very coarse level. This requires administrators to install
  229. the optional ``psutil`` python module.
  230. We would appreciate it if you could assist by ensuring this module is available
  231. and ``report_stats`` is enabled. This will let us see if performance changes to
  232. synapse are having an impact to the general community.
  233. Upgrading to v0.15.0
  234. ====================
  235. If you want to use the new URL previewing API (/_matrix/media/r0/preview_url)
  236. then you have to explicitly enable it in the config and update your dependencies
  237. dependencies. See README.rst for details.
  238. Upgrading to v0.11.0
  239. ====================
  240. This release includes the option to send anonymous usage stats to matrix.org,
  241. and requires that administrators explictly opt in or out by setting the
  242. ``report_stats`` option to either ``true`` or ``false``.
  243. We would really appreciate it if you could help our project out by reporting
  244. anonymized usage statistics from your homeserver. Only very basic aggregate
  245. data (e.g. number of users) will be reported, but it helps us to track the
  246. growth of the Matrix community, and helps us to make Matrix a success, as well
  247. as to convince other networks that they should peer with us.
  248. Upgrading to v0.9.0
  249. ===================
  250. Application services have had a breaking API change in this version.
  251. They can no longer register themselves with a home server using the AS HTTP API. This
  252. decision was made because a compromised application service with free reign to register
  253. any regex in effect grants full read/write access to the home server if a regex of ``.*``
  254. is used. An attack where a compromised AS re-registers itself with ``.*`` was deemed too
  255. big of a security risk to ignore, and so the ability to register with the HS remotely has
  256. been removed.
  257. It has been replaced by specifying a list of application service registrations in
  258. ``homeserver.yaml``::
  259. app_service_config_files: ["registration-01.yaml", "registration-02.yaml"]
  260. Where ``registration-01.yaml`` looks like::
  261. url: <String> # e.g. "https://my.application.service.com"
  262. as_token: <String>
  263. hs_token: <String>
  264. sender_localpart: <String> # This is a new field which denotes the user_id localpart when using the AS token
  265. namespaces:
  266. users:
  267. - exclusive: <Boolean>
  268. regex: <String> # e.g. "@prefix_.*"
  269. aliases:
  270. - exclusive: <Boolean>
  271. regex: <String>
  272. rooms:
  273. - exclusive: <Boolean>
  274. regex: <String>
  275. Upgrading to v0.8.0
  276. ===================
  277. Servers which use captchas will need to add their public key to::
  278. static/client/register/register_config.js
  279. window.matrixRegistrationConfig = {
  280. recaptcha_public_key: "YOUR_PUBLIC_KEY"
  281. };
  282. This is required in order to support registration fallback (typically used on
  283. mobile devices).
  284. Upgrading to v0.7.0
  285. ===================
  286. New dependencies are:
  287. - pydenticon
  288. - simplejson
  289. - syutil
  290. - matrix-angular-sdk
  291. To pull in these dependencies in a virtual env, run::
  292. python synapse/python_dependencies.py | xargs -n 1 pip install
  293. Upgrading to v0.6.0
  294. ===================
  295. To pull in new dependencies, run::
  296. python setup.py develop --user
  297. This update includes a change to the database schema. To upgrade you first need
  298. to upgrade the database by running::
  299. python scripts/upgrade_db_to_v0.6.0.py <db> <server_name> <signing_key>
  300. Where `<db>` is the location of the database, `<server_name>` is the
  301. server name as specified in the synapse configuration, and `<signing_key>` is
  302. the location of the signing key as specified in the synapse configuration.
  303. This may take some time to complete. Failures of signatures and content hashes
  304. can safely be ignored.
  305. Upgrading to v0.5.1
  306. ===================
  307. Depending on precisely when you installed v0.5.0 you may have ended up with
  308. a stale release of the reference matrix webclient installed as a python module.
  309. To uninstall it and ensure you are depending on the latest module, please run::
  310. $ pip uninstall syweb
  311. Upgrading to v0.5.0
  312. ===================
  313. The webclient has been split out into a seperate repository/pacakage in this
  314. release. Before you restart your homeserver you will need to pull in the
  315. webclient package by running::
  316. python setup.py develop --user
  317. This release completely changes the database schema and so requires upgrading
  318. it before starting the new version of the homeserver.
  319. The script "database-prepare-for-0.5.0.sh" should be used to upgrade the
  320. database. This will save all user information, such as logins and profiles,
  321. but will otherwise purge the database. This includes messages, which
  322. rooms the home server was a member of and room alias mappings.
  323. If you would like to keep your history, please take a copy of your database
  324. file and ask for help in #matrix:matrix.org. The upgrade process is,
  325. unfortunately, non trivial and requires human intervention to resolve any
  326. resulting conflicts during the upgrade process.
  327. Before running the command the homeserver should be first completely
  328. shutdown. To run it, simply specify the location of the database, e.g.:
  329. ./scripts/database-prepare-for-0.5.0.sh "homeserver.db"
  330. Once this has successfully completed it will be safe to restart the
  331. homeserver. You may notice that the homeserver takes a few seconds longer to
  332. restart than usual as it reinitializes the database.
  333. On startup of the new version, users can either rejoin remote rooms using room
  334. aliases or by being reinvited. Alternatively, if any other homeserver sends a
  335. message to a room that the homeserver was previously in the local HS will
  336. automatically rejoin the room.
  337. Upgrading to v0.4.0
  338. ===================
  339. This release needs an updated syutil version. Run::
  340. python setup.py develop
  341. You will also need to upgrade your configuration as the signing key format has
  342. changed. Run::
  343. python -m synapse.app.homeserver --config-path <CONFIG> --generate-config
  344. Upgrading to v0.3.0
  345. ===================
  346. This registration API now closely matches the login API. This introduces a bit
  347. more backwards and forwards between the HS and the client, but this improves
  348. the overall flexibility of the API. You can now GET on /register to retrieve a list
  349. of valid registration flows. Upon choosing one, they are submitted in the same
  350. way as login, e.g::
  351. {
  352. type: m.login.password,
  353. user: foo,
  354. password: bar
  355. }
  356. The default HS supports 2 flows, with and without Identity Server email
  357. authentication. Enabling captcha on the HS will add in an extra step to all
  358. flows: ``m.login.recaptcha`` which must be completed before you can transition
  359. to the next stage. There is a new login type: ``m.login.email.identity`` which
  360. contains the ``threepidCreds`` key which were previously sent in the original
  361. register request. For more information on this, see the specification.
  362. Web Client
  363. ----------
  364. The VoIP specification has changed between v0.2.0 and v0.3.0. Users should
  365. refresh any browser tabs to get the latest web client code. Users on
  366. v0.2.0 of the web client will not be able to call those on v0.3.0 and
  367. vice versa.
  368. Upgrading to v0.2.0
  369. ===================
  370. The home server now requires setting up of SSL config before it can run. To
  371. automatically generate default config use::
  372. $ python synapse/app/homeserver.py \
  373. --server-name machine.my.domain.name \
  374. --bind-port 8448 \
  375. --config-path homeserver.config \
  376. --generate-config
  377. This config can be edited if desired, for example to specify a different SSL
  378. certificate to use. Once done you can run the home server using::
  379. $ python synapse/app/homeserver.py --config-path homeserver.config
  380. See the README.rst for more information.
  381. Also note that some config options have been renamed, including:
  382. - "host" to "server-name"
  383. - "database" to "database-path"
  384. - "port" to "bind-port" and "unsecure-port"
  385. Upgrading to v0.0.1
  386. ===================
  387. This release completely changes the database schema and so requires upgrading
  388. it before starting the new version of the homeserver.
  389. The script "database-prepare-for-0.0.1.sh" should be used to upgrade the
  390. database. This will save all user information, such as logins and profiles,
  391. but will otherwise purge the database. This includes messages, which
  392. rooms the home server was a member of and room alias mappings.
  393. Before running the command the homeserver should be first completely
  394. shutdown. To run it, simply specify the location of the database, e.g.:
  395. ./scripts/database-prepare-for-0.0.1.sh "homeserver.db"
  396. Once this has successfully completed it will be safe to restart the
  397. homeserver. You may notice that the homeserver takes a few seconds longer to
  398. restart than usual as it reinitializes the database.
  399. On startup of the new version, users can either rejoin remote rooms using room
  400. aliases or by being reinvited. Alternatively, if any other homeserver sends a
  401. message to a room that the homeserver was previously in the local HS will
  402. automatically rejoin the room.