UPGRADE.rst 47 KB

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