UPGRADE.rst 38 KB

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