UPGRADE.rst 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056
  1. Upgrading Synapse
  2. =================
  3. Before upgrading check if any special steps are required to upgrade from the
  4. version you currently have installed to the current version of Synapse. The extra
  5. instructions that may be required are listed later in this document.
  6. * If Synapse was installed using `prebuilt packages
  7. <INSTALL.md#prebuilt-packages>`_, you will need to follow the normal process
  8. for upgrading those packages.
  9. * If Synapse was installed from source, then:
  10. 1. Activate the virtualenv before upgrading. For example, if Synapse is
  11. installed in a virtualenv in ``~/synapse/env`` then run:
  12. .. code:: bash
  13. source ~/synapse/env/bin/activate
  14. 2. If Synapse was installed using pip then upgrade to the latest version by
  15. running:
  16. .. code:: bash
  17. pip install --upgrade matrix-synapse
  18. If Synapse was installed using git then upgrade to the latest version by
  19. running:
  20. .. code:: bash
  21. git pull
  22. pip install --upgrade .
  23. 3. Restart Synapse:
  24. .. code:: bash
  25. ./synctl restart
  26. To check whether your update was successful, you can check the running server
  27. version with:
  28. .. code:: bash
  29. # you may need to replace 'localhost:8008' if synapse is not configured
  30. # to listen on port 8008.
  31. curl http://localhost:8008/_synapse/admin/v1/server_version
  32. Rolling back to older versions
  33. ------------------------------
  34. Rolling back to previous releases can be difficult, due to database schema
  35. changes between releases. Where we have been able to test the rollback process,
  36. this will be noted below.
  37. In general, you will need to undo any changes made during the upgrade process,
  38. for example:
  39. * pip:
  40. .. code:: bash
  41. source env/bin/activate
  42. # replace `1.3.0` accordingly:
  43. pip install matrix-synapse==1.3.0
  44. * Debian:
  45. .. code:: bash
  46. # replace `1.3.0` and `stretch` accordingly:
  47. wget https://packages.matrix.org/debian/pool/main/m/matrix-synapse-py3/matrix-synapse-py3_1.3.0+stretch1_amd64.deb
  48. dpkg -i matrix-synapse-py3_1.3.0+stretch1_amd64.deb
  49. Upgrading to v1.24.0
  50. ====================
  51. Custom OpenID Connect mapping provider breaking change
  52. ------------------------------------------------------
  53. This release allows the OpenID Connect mapping provider to perform normalisation
  54. of the localpart of the Matrix ID. This allows for the mapping provider to
  55. specify different algorithms, instead of the [default way](https://matrix.org/docs/spec/appendices#mapping-from-other-character-sets).
  56. If your Synapse configuration uses a custom mapping provider
  57. (`oidc_config.user_mapping_provider.module` is specified and not equal to
  58. `synapse.handlers.oidc_handler.JinjaOidcMappingProvider`) then you *must* ensure
  59. that `map_user_attributes` of the mapping provider performs some normalisation
  60. of the `localpart` returned. To match previous behaviour you can use the
  61. `map_username_to_mxid_localpart` function provided by Synapse. An example is
  62. shown below:
  63. .. code-block:: python
  64. from synapse.types import map_username_to_mxid_localpart
  65. class MyMappingProvider:
  66. def map_user_attributes(self, userinfo, token):
  67. # ... your custom logic ...
  68. sso_user_id = ...
  69. localpart = map_username_to_mxid_localpart(sso_user_id)
  70. return {"localpart": localpart}
  71. Removal historical Synapse Admin API
  72. ------------------------------------
  73. Historically, the Synapse Admin API has been accessible under:
  74. * ``/_matrix/client/api/v1/admin``
  75. * ``/_matrix/client/unstable/admin``
  76. * ``/_matrix/client/r0/admin``
  77. * ``/_synapse/admin/v1``
  78. The endpoints with ``/_matrix/client/*`` prefixes have been removed as of v1.24.0.
  79. The Admin API is now only accessible under:
  80. * ``/_synapse/admin/v1``
  81. The only exception is the `/admin/whois` endpoint, which is
  82. `also available via the client-server API <https://matrix.org/docs/spec/client_server/r0.6.1#get-matrix-client-r0-admin-whois-userid>`_.
  83. The deprecation of the old endpoints was announced with Synapse 1.20.0 (released
  84. on 2020-09-22) and makes it easier for homeserver admins to lock down external
  85. access to the Admin API endpoints.
  86. Upgrading to v1.23.0
  87. ====================
  88. Structured logging configuration breaking changes
  89. -------------------------------------------------
  90. This release deprecates use of the ``structured: true`` logging configuration for
  91. structured logging. If your logging configuration contains ``structured: true``
  92. then it should be modified based on the `structured logging documentation
  93. <https://github.com/matrix-org/synapse/blob/master/docs/structured_logging.md>`_.
  94. The ``structured`` and ``drains`` logging options are now deprecated and should
  95. be replaced by standard logging configuration of ``handlers`` and ``formatters``.
  96. A future will release of Synapse will make using ``structured: true`` an error.
  97. Upgrading to v1.22.0
  98. ====================
  99. ThirdPartyEventRules breaking changes
  100. -------------------------------------
  101. This release introduces a backwards-incompatible change to modules making use of
  102. ``ThirdPartyEventRules`` in Synapse. If you make use of a module defined under the
  103. ``third_party_event_rules`` config option, please make sure it is updated to handle
  104. the below change:
  105. The ``http_client`` argument is no longer passed to modules as they are initialised. Instead,
  106. modules are expected to make use of the ``http_client`` property on the ``ModuleApi`` class.
  107. Modules are now passed a ``module_api`` argument during initialisation, which is an instance of
  108. ``ModuleApi``. ``ModuleApi`` instances have a ``http_client`` property which acts the same as
  109. the ``http_client`` argument previously passed to ``ThirdPartyEventRules`` modules.
  110. Upgrading to v1.21.0
  111. ====================
  112. Forwarding ``/_synapse/client`` through your reverse proxy
  113. ----------------------------------------------------------
  114. The `reverse proxy documentation
  115. <https://github.com/matrix-org/synapse/blob/develop/docs/reverse_proxy.md>`_ has been updated
  116. to include reverse proxy directives for ``/_synapse/client/*`` endpoints. As the user password
  117. reset flow now uses endpoints under this prefix, **you must update your reverse proxy
  118. configurations for user password reset to work**.
  119. Additionally, note that the `Synapse worker documentation
  120. <https://github.com/matrix-org/synapse/blob/develop/docs/workers.md>`_ has been updated to
  121. state that the ``/_synapse/client/password_reset/email/submit_token`` endpoint can be handled
  122. by all workers. If you make use of Synapse's worker feature, please update your reverse proxy
  123. configuration to reflect this change.
  124. New HTML templates
  125. ------------------
  126. A new HTML template,
  127. `password_reset_confirmation.html <https://github.com/matrix-org/synapse/blob/develop/synapse/res/templates/password_reset_confirmation.html>`_,
  128. has been added to the ``synapse/res/templates`` directory. If you are using a
  129. custom template directory, you may want to copy the template over and modify it.
  130. Note that as of v1.20.0, templates do not need to be included in custom template
  131. directories for Synapse to start. The default templates will be used if a custom
  132. template cannot be found.
  133. This page will appear to the user after clicking a password reset link that has
  134. been emailed to them.
  135. To complete password reset, the page must include a way to make a `POST`
  136. request to
  137. ``/_synapse/client/password_reset/{medium}/submit_token``
  138. with the query parameters from the original link, presented as a URL-encoded form. See the file
  139. itself for more details.
  140. Updated Single Sign-on HTML Templates
  141. -------------------------------------
  142. The ``saml_error.html`` template was removed from Synapse and replaced with the
  143. ``sso_error.html`` template. If your Synapse is configured to use SAML and a
  144. custom ``sso_redirect_confirm_template_dir`` configuration then any customisations
  145. of the ``saml_error.html`` template will need to be merged into the ``sso_error.html``
  146. template. These templates are similar, but the parameters are slightly different:
  147. * The ``msg`` parameter should be renamed to ``error_description``.
  148. * There is no longer a ``code`` parameter for the response code.
  149. * A string ``error`` parameter is available that includes a short hint of why a
  150. user is seeing the error page.
  151. Upgrading to v1.18.0
  152. ====================
  153. Docker `-py3` suffix will be removed in future versions
  154. -------------------------------------------------------
  155. 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.
  156. 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.
  157. Scripts relying on the `-py3` suffix will need to be updated.
  158. Redis replication is now recommended in lieu of TCP replication
  159. ---------------------------------------------------------------
  160. 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.**
  161. See `docs/workers.md <docs/workers.md>`_ for more details.
  162. Upgrading to v1.14.0
  163. ====================
  164. This version includes a database update which is run as part of the upgrade,
  165. and which may take a couple of minutes in the case of a large server. Synapse
  166. will not respond to HTTP requests while this update is taking place.
  167. Upgrading to v1.13.0
  168. ====================
  169. Incorrect database migration in old synapse versions
  170. ----------------------------------------------------
  171. A bug was introduced in Synapse 1.4.0 which could cause the room directory to
  172. be incomplete or empty if Synapse was upgraded directly from v1.2.1 or
  173. earlier, to versions between v1.4.0 and v1.12.x.
  174. This will *not* be a problem for Synapse installations which were:
  175. * created at v1.4.0 or later,
  176. * upgraded via v1.3.x, or
  177. * upgraded straight from v1.2.1 or earlier to v1.13.0 or later.
  178. If completeness of the room directory is a concern, installations which are
  179. affected can be repaired as follows:
  180. 1. Run the following sql from a `psql` or `sqlite3` console:
  181. .. code:: sql
  182. INSERT INTO background_updates (update_name, progress_json, depends_on) VALUES
  183. ('populate_stats_process_rooms', '{}', 'current_state_events_membership');
  184. INSERT INTO background_updates (update_name, progress_json, depends_on) VALUES
  185. ('populate_stats_process_users', '{}', 'populate_stats_process_rooms');
  186. 2. Restart synapse.
  187. New Single Sign-on HTML Templates
  188. ---------------------------------
  189. New templates (``sso_auth_confirm.html``, ``sso_auth_success.html``, and
  190. ``sso_account_deactivated.html``) were added to Synapse. If your Synapse is
  191. configured to use SSO and a custom ``sso_redirect_confirm_template_dir``
  192. configuration then these templates will need to be copied from
  193. `synapse/res/templates <synapse/res/templates>`_ into that directory.
  194. Synapse SSO Plugins Method Deprecation
  195. --------------------------------------
  196. Plugins using the ``complete_sso_login`` method of
  197. ``synapse.module_api.ModuleApi`` should update to using the async/await
  198. version ``complete_sso_login_async`` which includes additional checks. The
  199. non-async version is considered deprecated.
  200. Rolling back to v1.12.4 after a failed upgrade
  201. ----------------------------------------------
  202. v1.13.0 includes a lot of large changes. If something problematic occurs, you
  203. may want to roll-back to a previous version of Synapse. Because v1.13.0 also
  204. includes a new database schema version, reverting that version is also required
  205. alongside the generic rollback instructions mentioned above. In short, to roll
  206. back to v1.12.4 you need to:
  207. 1. Stop the server
  208. 2. Decrease the schema version in the database:
  209. .. code:: sql
  210. UPDATE schema_version SET version = 57;
  211. 3. Downgrade Synapse by following the instructions for your installation method
  212. in the "Rolling back to older versions" section above.
  213. Upgrading to v1.12.0
  214. ====================
  215. This version includes a database update which is run as part of the upgrade,
  216. and which may take some time (several hours in the case of a large
  217. server). Synapse will not respond to HTTP requests while this update is taking
  218. place.
  219. This is only likely to be a problem in the case of a server which is
  220. participating in many rooms.
  221. 0. As with all upgrades, it is recommended that you have a recent backup of
  222. your database which can be used for recovery in the event of any problems.
  223. 1. As an initial check to see if you will be affected, you can try running the
  224. following query from the `psql` or `sqlite3` console. It is safe to run it
  225. while Synapse is still running.
  226. .. code:: sql
  227. SELECT MAX(q.v) FROM (
  228. SELECT (
  229. SELECT ej.json AS v
  230. FROM state_events se INNER JOIN event_json ej USING (event_id)
  231. WHERE se.room_id=rooms.room_id AND se.type='m.room.create' AND se.state_key=''
  232. LIMIT 1
  233. ) FROM rooms WHERE rooms.room_version IS NULL
  234. ) q;
  235. This query will take about the same amount of time as the upgrade process: ie,
  236. if it takes 5 minutes, then it is likely that Synapse will be unresponsive for
  237. 5 minutes during the upgrade.
  238. If you consider an outage of this duration to be acceptable, no further
  239. action is necessary and you can simply start Synapse 1.12.0.
  240. If you would prefer to reduce the downtime, continue with the steps below.
  241. 2. The easiest workaround for this issue is to manually
  242. create a new index before upgrading. On PostgreSQL, his can be done as follows:
  243. .. code:: sql
  244. CREATE INDEX CONCURRENTLY tmp_upgrade_1_12_0_index
  245. ON state_events(room_id) WHERE type = 'm.room.create';
  246. The above query may take some time, but is also safe to run while Synapse is
  247. running.
  248. We assume that no SQLite users have databases large enough to be
  249. affected. If you *are* affected, you can run a similar query, omitting the
  250. ``CONCURRENTLY`` keyword. Note however that this operation may in itself cause
  251. Synapse to stop running for some time. Synapse admins are reminded that
  252. `SQLite is not recommended for use outside a test
  253. environment <https://github.com/matrix-org/synapse/blob/master/README.rst#using-postgresql>`_.
  254. 3. Once the index has been created, the ``SELECT`` query in step 1 above should
  255. complete quickly. It is therefore safe to upgrade to Synapse 1.12.0.
  256. 4. Once Synapse 1.12.0 has successfully started and is responding to HTTP
  257. requests, the temporary index can be removed:
  258. .. code:: sql
  259. DROP INDEX tmp_upgrade_1_12_0_index;
  260. Upgrading to v1.10.0
  261. ====================
  262. Synapse will now log a warning on start up if used with a PostgreSQL database
  263. that has a non-recommended locale set.
  264. See `docs/postgres.md <docs/postgres.md>`_ for details.
  265. Upgrading to v1.8.0
  266. ===================
  267. Specifying a ``log_file`` config option will now cause Synapse to refuse to
  268. start, and should be replaced by with the ``log_config`` option. Support for
  269. the ``log_file`` option was removed in v1.3.0 and has since had no effect.
  270. Upgrading to v1.7.0
  271. ===================
  272. In an attempt to configure Synapse in a privacy preserving way, the default
  273. behaviours of ``allow_public_rooms_without_auth`` and
  274. ``allow_public_rooms_over_federation`` have been inverted. This means that by
  275. default, only authenticated users querying the Client/Server API will be able
  276. to query the room directory, and relatedly that the server will not share
  277. room directory information with other servers over federation.
  278. If your installation does not explicitly set these settings one way or the other
  279. and you want either setting to be ``true`` then it will necessary to update
  280. your homeserver configuration file accordingly.
  281. For more details on the surrounding context see our `explainer
  282. <https://matrix.org/blog/2019/11/09/avoiding-unwelcome-visitors-on-private-matrix-servers>`_.
  283. Upgrading to v1.5.0
  284. ===================
  285. This release includes a database migration which may take several minutes to
  286. complete if there are a large number (more than a million or so) of entries in
  287. the ``devices`` table. This is only likely to a be a problem on very large
  288. installations.
  289. Upgrading to v1.4.0
  290. ===================
  291. New custom templates
  292. --------------------
  293. If you have configured a custom template directory with the
  294. ``email.template_dir`` option, be aware that there are new templates regarding
  295. registration and threepid management (see below) that must be included.
  296. * ``registration.html`` and ``registration.txt``
  297. * ``registration_success.html`` and ``registration_failure.html``
  298. * ``add_threepid.html`` and ``add_threepid.txt``
  299. * ``add_threepid_failure.html`` and ``add_threepid_success.html``
  300. Synapse will expect these files to exist inside the configured template
  301. directory, and **will fail to start** if they are absent.
  302. To view the default templates, see `synapse/res/templates
  303. <https://github.com/matrix-org/synapse/tree/master/synapse/res/templates>`_.
  304. 3pid verification changes
  305. -------------------------
  306. **Note: As of this release, users will be unable to add phone numbers or email
  307. addresses to their accounts, without changes to the Synapse configuration. This
  308. includes adding an email address during registration.**
  309. It is possible for a user to associate an email address or phone number
  310. with their account, for a number of reasons:
  311. * for use when logging in, as an alternative to the user id.
  312. * in the case of email, as an alternative contact to help with account recovery.
  313. * in the case of email, to receive notifications of missed messages.
  314. Before an email address or phone number can be added to a user's account,
  315. or before such an address is used to carry out a password-reset, Synapse must
  316. confirm the operation with the owner of the email address or phone number.
  317. It does this by sending an email or text giving the user a link or token to confirm
  318. receipt. This process is known as '3pid verification'. ('3pid', or 'threepid',
  319. stands for third-party identifier, and we use it to refer to external
  320. identifiers such as email addresses and phone numbers.)
  321. Previous versions of Synapse delegated the task of 3pid verification to an
  322. identity server by default. In most cases this server is ``vector.im`` or
  323. ``matrix.org``.
  324. In Synapse 1.4.0, for security and privacy reasons, the homeserver will no
  325. longer delegate this task to an identity server by default. Instead,
  326. the server administrator will need to explicitly decide how they would like the
  327. verification messages to be sent.
  328. In the medium term, the ``vector.im`` and ``matrix.org`` identity servers will
  329. disable support for delegated 3pid verification entirely. However, in order to
  330. ease the transition, they will retain the capability for a limited
  331. period. Delegated email verification will be disabled on Monday 2nd December
  332. 2019 (giving roughly 2 months notice). Disabling delegated SMS verification
  333. will follow some time after that once SMS verification support lands in
  334. Synapse.
  335. Once delegated 3pid verification support has been disabled in the ``vector.im`` and
  336. ``matrix.org`` identity servers, all Synapse versions that depend on those
  337. instances will be unable to verify email and phone numbers through them. There
  338. are no imminent plans to remove delegated 3pid verification from Sydent
  339. generally. (Sydent is the identity server project that backs the ``vector.im`` and
  340. ``matrix.org`` instances).
  341. Email
  342. ~~~~~
  343. Following upgrade, to continue verifying email (e.g. as part of the
  344. registration process), admins can either:-
  345. * Configure Synapse to use an email server.
  346. * Run or choose an identity server which allows delegated email verification
  347. and delegate to it.
  348. Configure SMTP in Synapse
  349. +++++++++++++++++++++++++
  350. To configure an SMTP server for Synapse, modify the configuration section
  351. headed ``email``, and be sure to have at least the ``smtp_host, smtp_port``
  352. and ``notif_from`` fields filled out.
  353. You may also need to set ``smtp_user``, ``smtp_pass``, and
  354. ``require_transport_security``.
  355. See the `sample configuration file <docs/sample_config.yaml>`_ for more details
  356. on these settings.
  357. Delegate email to an identity server
  358. ++++++++++++++++++++++++++++++++++++
  359. Some admins will wish to continue using email verification as part of the
  360. registration process, but will not immediately have an appropriate SMTP server
  361. at hand.
  362. To this end, we will continue to support email verification delegation via the
  363. ``vector.im`` and ``matrix.org`` identity servers for two months. Support for
  364. delegated email verification will be disabled on Monday 2nd December.
  365. The ``account_threepid_delegates`` dictionary defines whether the homeserver
  366. should delegate an external server (typically an `identity server
  367. <https://matrix.org/docs/spec/identity_service/r0.2.1>`_) to handle sending
  368. confirmation messages via email and SMS.
  369. So to delegate email verification, in ``homeserver.yaml``, set
  370. ``account_threepid_delegates.email`` to the base URL of an identity server. For
  371. example:
  372. .. code:: yaml
  373. account_threepid_delegates:
  374. email: https://example.com # Delegate email sending to example.com
  375. Note that ``account_threepid_delegates.email`` replaces the deprecated
  376. ``email.trust_identity_server_for_password_resets``: if
  377. ``email.trust_identity_server_for_password_resets`` is set to ``true``, and
  378. ``account_threepid_delegates.email`` is not set, then the first entry in
  379. ``trusted_third_party_id_servers`` will be used as the
  380. ``account_threepid_delegate`` for email. This is to ensure compatibility with
  381. existing Synapse installs that set up external server handling for these tasks
  382. before v1.4.0. If ``email.trust_identity_server_for_password_resets`` is
  383. ``true`` and no trusted identity server domains are configured, Synapse will
  384. report an error and refuse to start.
  385. If ``email.trust_identity_server_for_password_resets`` is ``false`` or absent
  386. and no ``email`` delegate is configured in ``account_threepid_delegates``,
  387. then Synapse will send email verification messages itself, using the configured
  388. SMTP server (see above).
  389. that type.
  390. Phone numbers
  391. ~~~~~~~~~~~~~
  392. Synapse does not support phone-number verification itself, so the only way to
  393. maintain the ability for users to add phone numbers to their accounts will be
  394. by continuing to delegate phone number verification to the ``matrix.org`` and
  395. ``vector.im`` identity servers (or another identity server that supports SMS
  396. sending).
  397. The ``account_threepid_delegates`` dictionary defines whether the homeserver
  398. should delegate an external server (typically an `identity server
  399. <https://matrix.org/docs/spec/identity_service/r0.2.1>`_) to handle sending
  400. confirmation messages via email and SMS.
  401. So to delegate phone number verification, in ``homeserver.yaml``, set
  402. ``account_threepid_delegates.msisdn`` to the base URL of an identity
  403. server. For example:
  404. .. code:: yaml
  405. account_threepid_delegates:
  406. msisdn: https://example.com # Delegate sms sending to example.com
  407. The ``matrix.org`` and ``vector.im`` identity servers will continue to support
  408. delegated phone number verification via SMS until such time as it is possible
  409. for admins to configure their servers to perform phone number verification
  410. directly. More details will follow in a future release.
  411. Rolling back to v1.3.1
  412. ----------------------
  413. If you encounter problems with v1.4.0, it should be possible to roll back to
  414. v1.3.1, subject to the following:
  415. * The 'room statistics' engine was heavily reworked in this release (see
  416. `#5971 <https://github.com/matrix-org/synapse/pull/5971>`_), including
  417. significant changes to the database schema, which are not easily
  418. reverted. This will cause the room statistics engine to stop updating when
  419. you downgrade.
  420. The room statistics are essentially unused in v1.3.1 (in future versions of
  421. Synapse, they will be used to populate the room directory), so there should
  422. be no loss of functionality. However, the statistics engine will write errors
  423. to the logs, which can be avoided by setting the following in
  424. `homeserver.yaml`:
  425. .. code:: yaml
  426. stats:
  427. enabled: false
  428. Don't forget to re-enable it when you upgrade again, in preparation for its
  429. use in the room directory!
  430. Upgrading to v1.2.0
  431. ===================
  432. Some counter metrics have been renamed, with the old names deprecated. See
  433. `the metrics documentation <docs/metrics-howto.md#renaming-of-metrics--deprecation-of-old-names-in-12>`_
  434. for details.
  435. Upgrading to v1.1.0
  436. ===================
  437. Synapse v1.1.0 removes support for older Python and PostgreSQL versions, as
  438. outlined in `our deprecation notice <https://matrix.org/blog/2019/04/08/synapse-deprecating-postgres-9-4-and-python-2-x>`_.
  439. Minimum Python Version
  440. ----------------------
  441. Synapse v1.1.0 has a minimum Python requirement of Python 3.5. Python 3.6 or
  442. Python 3.7 are recommended as they have improved internal string handling,
  443. significantly reducing memory usage.
  444. If you use current versions of the Matrix.org-distributed Debian packages or
  445. Docker images, action is not required.
  446. If you install Synapse in a Python virtual environment, please see "Upgrading to
  447. v0.34.0" for notes on setting up a new virtualenv under Python 3.
  448. Minimum PostgreSQL Version
  449. --------------------------
  450. If using PostgreSQL under Synapse, you will need to use PostgreSQL 9.5 or above.
  451. Please see the
  452. `PostgreSQL documentation <https://www.postgresql.org/docs/11/upgrading.html>`_
  453. for more details on upgrading your database.
  454. Upgrading to v1.0
  455. =================
  456. Validation of TLS certificates
  457. ------------------------------
  458. Synapse v1.0 is the first release to enforce
  459. validation of TLS certificates for the federation API. It is therefore
  460. essential that your certificates are correctly configured. See the `FAQ
  461. <docs/MSC1711_certificates_FAQ.md>`_ for more information.
  462. Note, v1.0 installations will also no longer be able to federate with servers
  463. that have not correctly configured their certificates.
  464. In rare cases, it may be desirable to disable certificate checking: for
  465. example, it might be essential to be able to federate with a given legacy
  466. server in a closed federation. This can be done in one of two ways:-
  467. * Configure the global switch ``federation_verify_certificates`` to ``false``.
  468. * Configure a whitelist of server domains to trust via ``federation_certificate_verification_whitelist``.
  469. See the `sample configuration file <docs/sample_config.yaml>`_
  470. for more details on these settings.
  471. Email
  472. -----
  473. When a user requests a password reset, Synapse will send an email to the
  474. user to confirm the request.
  475. Previous versions of Synapse delegated the job of sending this email to an
  476. identity server. If the identity server was somehow malicious or became
  477. compromised, it would be theoretically possible to hijack an account through
  478. this means.
  479. Therefore, by default, Synapse v1.0 will send the confirmation email itself. If
  480. Synapse is not configured with an SMTP server, password reset via email will be
  481. disabled.
  482. To configure an SMTP server for Synapse, modify the configuration section
  483. headed ``email``, and be sure to have at least the ``smtp_host``, ``smtp_port``
  484. and ``notif_from`` fields filled out. You may also need to set ``smtp_user``,
  485. ``smtp_pass``, and ``require_transport_security``.
  486. If you are absolutely certain that you wish to continue using an identity
  487. server for password resets, set ``trust_identity_server_for_password_resets`` to ``true``.
  488. See the `sample configuration file <docs/sample_config.yaml>`_
  489. for more details on these settings.
  490. New email templates
  491. ---------------
  492. Some new templates have been added to the default template directory for the purpose of the
  493. homeserver sending its own password reset emails. If you have configured a custom
  494. ``template_dir`` in your Synapse config, these files will need to be added.
  495. ``password_reset.html`` and ``password_reset.txt`` are HTML and plain text templates
  496. respectively that contain the contents of what will be emailed to the user upon attempting to
  497. reset their password via email. ``password_reset_success.html`` and
  498. ``password_reset_failure.html`` are HTML files that the content of which (assuming no redirect
  499. URL is set) will be shown to the user after they attempt to click the link in the email sent
  500. to them.
  501. Upgrading to v0.99.0
  502. ====================
  503. Please be aware that, before Synapse v1.0 is released around March 2019, you
  504. will need to replace any self-signed certificates with those verified by a
  505. root CA. Information on how to do so can be found at `the ACME docs
  506. <docs/ACME.md>`_.
  507. For more information on configuring TLS certificates see the `FAQ <docs/MSC1711_certificates_FAQ.md>`_.
  508. Upgrading to v0.34.0
  509. ====================
  510. 1. This release is the first to fully support Python 3. Synapse will now run on
  511. Python versions 3.5, or 3.6 (as well as 2.7). We recommend switching to
  512. Python 3, as it has been shown to give performance improvements.
  513. For users who have installed Synapse into a virtualenv, we recommend doing
  514. this by creating a new virtualenv. For example::
  515. virtualenv -p python3 ~/synapse/env3
  516. source ~/synapse/env3/bin/activate
  517. pip install matrix-synapse
  518. You can then start synapse as normal, having activated the new virtualenv::
  519. cd ~/synapse
  520. source env3/bin/activate
  521. synctl start
  522. Users who have installed from distribution packages should see the relevant
  523. package documentation. See below for notes on Debian packages.
  524. * When upgrading to Python 3, you **must** make sure that your log files are
  525. configured as UTF-8, by adding ``encoding: utf8`` to the
  526. ``RotatingFileHandler`` configuration (if you have one) in your
  527. ``<server>.log.config`` file. For example, if your ``log.config`` file
  528. contains::
  529. handlers:
  530. file:
  531. class: logging.handlers.RotatingFileHandler
  532. formatter: precise
  533. filename: homeserver.log
  534. maxBytes: 104857600
  535. backupCount: 10
  536. filters: [context]
  537. console:
  538. class: logging.StreamHandler
  539. formatter: precise
  540. filters: [context]
  541. Then you should update this to be::
  542. handlers:
  543. file:
  544. class: logging.handlers.RotatingFileHandler
  545. formatter: precise
  546. filename: homeserver.log
  547. maxBytes: 104857600
  548. backupCount: 10
  549. filters: [context]
  550. encoding: utf8
  551. console:
  552. class: logging.StreamHandler
  553. formatter: precise
  554. filters: [context]
  555. There is no need to revert this change if downgrading to Python 2.
  556. We are also making available Debian packages which will run Synapse on
  557. Python 3. You can switch to these packages with ``apt-get install
  558. matrix-synapse-py3``, however, please read `debian/NEWS
  559. <https://github.com/matrix-org/synapse/blob/release-v0.34.0/debian/NEWS>`_
  560. before doing so. The existing ``matrix-synapse`` packages will continue to
  561. use Python 2 for the time being.
  562. 2. This release removes the ``riot.im`` from the default list of trusted
  563. identity servers.
  564. If ``riot.im`` is in your homeserver's list of
  565. ``trusted_third_party_id_servers``, you should remove it. It was added in
  566. case a hypothetical future identity server was put there. If you don't
  567. remove it, users may be unable to deactivate their accounts.
  568. 3. This release no longer installs the (unmaintained) Matrix Console web client
  569. as part of the default installation. It is possible to re-enable it by
  570. installing it separately and setting the ``web_client_location`` config
  571. option, but please consider switching to another client.
  572. Upgrading to v0.33.7
  573. ====================
  574. This release removes the example email notification templates from
  575. ``res/templates`` (they are now internal to the python package). This should
  576. only affect you if you (a) deploy your Synapse instance from a git checkout or
  577. a github snapshot URL, and (b) have email notifications enabled.
  578. If you have email notifications enabled, you should ensure that
  579. ``email.template_dir`` is either configured to point at a directory where you
  580. have installed customised templates, or leave it unset to use the default
  581. templates.
  582. Upgrading to v0.27.3
  583. ====================
  584. This release expands the anonymous usage stats sent if the opt-in
  585. ``report_stats`` configuration is set to ``true``. We now capture RSS memory
  586. and cpu use at a very coarse level. This requires administrators to install
  587. the optional ``psutil`` python module.
  588. We would appreciate it if you could assist by ensuring this module is available
  589. and ``report_stats`` is enabled. This will let us see if performance changes to
  590. synapse are having an impact to the general community.
  591. Upgrading to v0.15.0
  592. ====================
  593. If you want to use the new URL previewing API (/_matrix/media/r0/preview_url)
  594. then you have to explicitly enable it in the config and update your dependencies
  595. dependencies. See README.rst for details.
  596. Upgrading to v0.11.0
  597. ====================
  598. This release includes the option to send anonymous usage stats to matrix.org,
  599. and requires that administrators explictly opt in or out by setting the
  600. ``report_stats`` option to either ``true`` or ``false``.
  601. We would really appreciate it if you could help our project out by reporting
  602. anonymized usage statistics from your homeserver. Only very basic aggregate
  603. data (e.g. number of users) will be reported, but it helps us to track the
  604. growth of the Matrix community, and helps us to make Matrix a success, as well
  605. as to convince other networks that they should peer with us.
  606. Upgrading to v0.9.0
  607. ===================
  608. Application services have had a breaking API change in this version.
  609. They can no longer register themselves with a home server using the AS HTTP API. This
  610. decision was made because a compromised application service with free reign to register
  611. any regex in effect grants full read/write access to the home server if a regex of ``.*``
  612. is used. An attack where a compromised AS re-registers itself with ``.*`` was deemed too
  613. big of a security risk to ignore, and so the ability to register with the HS remotely has
  614. been removed.
  615. It has been replaced by specifying a list of application service registrations in
  616. ``homeserver.yaml``::
  617. app_service_config_files: ["registration-01.yaml", "registration-02.yaml"]
  618. Where ``registration-01.yaml`` looks like::
  619. url: <String> # e.g. "https://my.application.service.com"
  620. as_token: <String>
  621. hs_token: <String>
  622. sender_localpart: <String> # This is a new field which denotes the user_id localpart when using the AS token
  623. namespaces:
  624. users:
  625. - exclusive: <Boolean>
  626. regex: <String> # e.g. "@prefix_.*"
  627. aliases:
  628. - exclusive: <Boolean>
  629. regex: <String>
  630. rooms:
  631. - exclusive: <Boolean>
  632. regex: <String>
  633. Upgrading to v0.8.0
  634. ===================
  635. Servers which use captchas will need to add their public key to::
  636. static/client/register/register_config.js
  637. window.matrixRegistrationConfig = {
  638. recaptcha_public_key: "YOUR_PUBLIC_KEY"
  639. };
  640. This is required in order to support registration fallback (typically used on
  641. mobile devices).
  642. Upgrading to v0.7.0
  643. ===================
  644. New dependencies are:
  645. - pydenticon
  646. - simplejson
  647. - syutil
  648. - matrix-angular-sdk
  649. To pull in these dependencies in a virtual env, run::
  650. python synapse/python_dependencies.py | xargs -n 1 pip install
  651. Upgrading to v0.6.0
  652. ===================
  653. To pull in new dependencies, run::
  654. python setup.py develop --user
  655. This update includes a change to the database schema. To upgrade you first need
  656. to upgrade the database by running::
  657. python scripts/upgrade_db_to_v0.6.0.py <db> <server_name> <signing_key>
  658. Where `<db>` is the location of the database, `<server_name>` is the
  659. server name as specified in the synapse configuration, and `<signing_key>` is
  660. the location of the signing key as specified in the synapse configuration.
  661. This may take some time to complete. Failures of signatures and content hashes
  662. can safely be ignored.
  663. Upgrading to v0.5.1
  664. ===================
  665. Depending on precisely when you installed v0.5.0 you may have ended up with
  666. a stale release of the reference matrix webclient installed as a python module.
  667. To uninstall it and ensure you are depending on the latest module, please run::
  668. $ pip uninstall syweb
  669. Upgrading to v0.5.0
  670. ===================
  671. The webclient has been split out into a seperate repository/pacakage in this
  672. release. Before you restart your homeserver you will need to pull in the
  673. webclient package by running::
  674. python setup.py develop --user
  675. This release completely changes the database schema and so requires upgrading
  676. it before starting the new version of the homeserver.
  677. The script "database-prepare-for-0.5.0.sh" should be used to upgrade the
  678. database. This will save all user information, such as logins and profiles,
  679. but will otherwise purge the database. This includes messages, which
  680. rooms the home server was a member of and room alias mappings.
  681. If you would like to keep your history, please take a copy of your database
  682. file and ask for help in #matrix:matrix.org. The upgrade process is,
  683. unfortunately, non trivial and requires human intervention to resolve any
  684. resulting conflicts during the upgrade process.
  685. Before running the command the homeserver should be first completely
  686. shutdown. To run it, simply specify the location of the database, e.g.:
  687. ./scripts/database-prepare-for-0.5.0.sh "homeserver.db"
  688. Once this has successfully completed it will be safe to restart the
  689. homeserver. You may notice that the homeserver takes a few seconds longer to
  690. restart than usual as it reinitializes the database.
  691. On startup of the new version, users can either rejoin remote rooms using room
  692. aliases or by being reinvited. Alternatively, if any other homeserver sends a
  693. message to a room that the homeserver was previously in the local HS will
  694. automatically rejoin the room.
  695. Upgrading to v0.4.0
  696. ===================
  697. This release needs an updated syutil version. Run::
  698. python setup.py develop
  699. You will also need to upgrade your configuration as the signing key format has
  700. changed. Run::
  701. python -m synapse.app.homeserver --config-path <CONFIG> --generate-config
  702. Upgrading to v0.3.0
  703. ===================
  704. This registration API now closely matches the login API. This introduces a bit
  705. more backwards and forwards between the HS and the client, but this improves
  706. the overall flexibility of the API. You can now GET on /register to retrieve a list
  707. of valid registration flows. Upon choosing one, they are submitted in the same
  708. way as login, e.g::
  709. {
  710. type: m.login.password,
  711. user: foo,
  712. password: bar
  713. }
  714. The default HS supports 2 flows, with and without Identity Server email
  715. authentication. Enabling captcha on the HS will add in an extra step to all
  716. flows: ``m.login.recaptcha`` which must be completed before you can transition
  717. to the next stage. There is a new login type: ``m.login.email.identity`` which
  718. contains the ``threepidCreds`` key which were previously sent in the original
  719. register request. For more information on this, see the specification.
  720. Web Client
  721. ----------
  722. The VoIP specification has changed between v0.2.0 and v0.3.0. Users should
  723. refresh any browser tabs to get the latest web client code. Users on
  724. v0.2.0 of the web client will not be able to call those on v0.3.0 and
  725. vice versa.
  726. Upgrading to v0.2.0
  727. ===================
  728. The home server now requires setting up of SSL config before it can run. To
  729. automatically generate default config use::
  730. $ python synapse/app/homeserver.py \
  731. --server-name machine.my.domain.name \
  732. --bind-port 8448 \
  733. --config-path homeserver.config \
  734. --generate-config
  735. This config can be edited if desired, for example to specify a different SSL
  736. certificate to use. Once done you can run the home server using::
  737. $ python synapse/app/homeserver.py --config-path homeserver.config
  738. See the README.rst for more information.
  739. Also note that some config options have been renamed, including:
  740. - "host" to "server-name"
  741. - "database" to "database-path"
  742. - "port" to "bind-port" and "unsecure-port"
  743. Upgrading to v0.0.1
  744. ===================
  745. This release completely changes the database schema and so requires upgrading
  746. it before starting the new version of the homeserver.
  747. The script "database-prepare-for-0.0.1.sh" should be used to upgrade the
  748. database. This will save all user information, such as logins and profiles,
  749. but will otherwise purge the database. This includes messages, which
  750. rooms the home server was a member of and room alias mappings.
  751. Before running the command the homeserver should be first completely
  752. shutdown. To run it, simply specify the location of the database, e.g.:
  753. ./scripts/database-prepare-for-0.0.1.sh "homeserver.db"
  754. Once this has successfully completed it will be safe to restart the
  755. homeserver. You may notice that the homeserver takes a few seconds longer to
  756. restart than usual as it reinitializes the database.
  757. On startup of the new version, users can either rejoin remote rooms using room
  758. aliases or by being reinvited. Alternatively, if any other homeserver sends a
  759. message to a room that the homeserver was previously in the local HS will
  760. automatically rejoin the room.