UPGRADE.rst 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431
  1. Upgrading Synapse
  2. =================
  3. Before upgrading check if any special steps are required to upgrade from the
  4. what you currently have installed to current version of synapse. The extra
  5. instructions that may be required are listed later in this document.
  6. 1. If synapse was installed in a virtualenv then active that virtualenv before
  7. upgrading. If synapse is installed in a virtualenv in ``~/.synapse/`` then
  8. run:
  9. .. code:: bash
  10. source ~/.synapse/bin/activate
  11. 2. If synapse was installed using pip then upgrade to the latest version by
  12. running:
  13. .. code:: bash
  14. pip install --upgrade matrix-synapse
  15. # restart synapse
  16. synctl restart
  17. If synapse was installed using git then upgrade to the latest version by
  18. running:
  19. .. code:: bash
  20. # Pull the latest version of the master branch.
  21. git pull
  22. # Update the versions of synapse's python dependencies.
  23. python synapse/python_dependencies.py | xargs pip install --upgrade
  24. # restart synapse
  25. ./synctl restart
  26. To check whether your update was sucessful, you can check the Server header
  27. returned by the Client-Server API:
  28. .. code:: bash
  29. # replace <host.name> with the hostname of your synapse homeserver.
  30. # You may need to specify a port (eg, :8448) if your server is not
  31. # configured on port 443.
  32. curl -kv https://<host.name>/_matrix/client/versions 2>&1 | grep "Server:"
  33. Upgrading to v0.99.0
  34. ====================
  35. In preparation for Synapse v1.0, you must update your TLS certificates from
  36. self-signed ones to verifiable ones signed by a trusted root CA.
  37. If you do not already have a certificate for your domain, the easiest way to get
  38. one is with Synapse's new ACME support, which will use the ACME protocol to
  39. provision a certificate automatically. By default, certificates will be obtained
  40. from the publicly trusted CA Let's Encrypt.
  41. For a sample configuration, please inspect the new ACME section in the example
  42. generated config by running the ``generate-config`` executable. For example::
  43. ~/synapse/env3/bin/generate-config
  44. You will need to provide Let's Encrypt (or other ACME provider) access to your
  45. Synapse ACME challenge responder on port 80, at the domain of your homeserver.
  46. This requires you either change the port of the ACME listener provided by
  47. Synapse to a high port and reverse proxy to it, or use a tool like authbind to
  48. allow Synapse to listen on port 80 without root access. (Do not run Synapse with
  49. root permissions!)
  50. You will need to back up or delete your self signed TLS certificate
  51. (``example.com.tls.crt`` and ``example.com.tls.key``), Synapse's ACME
  52. implementation will not overwrite them.
  53. You may wish to use alternate methods such as Certbot to obtain a certificate
  54. from Let's Encrypt, depending on your server configuration. Of course, if you
  55. already have a valid certificate for your homeserver's domain, that can be
  56. placed in Synapse's config directory without the need for ACME.
  57. Upgrading to v0.34.0
  58. ====================
  59. 1. This release is the first to fully support Python 3. Synapse will now run on
  60. Python versions 3.5, or 3.6 (as well as 2.7). We recommend switching to
  61. Python 3, as it has been shown to give performance improvements.
  62. For users who have installed Synapse into a virtualenv, we recommend doing
  63. this by creating a new virtualenv. For example::
  64. virtualenv -p python3 ~/synapse/env3
  65. source ~/synapse/env3/bin/activate
  66. pip install matrix-synapse
  67. You can then start synapse as normal, having activated the new virtualenv::
  68. cd ~/synapse
  69. source env3/bin/activate
  70. synctl start
  71. Users who have installed from distribution packages should see the relevant
  72. package documentation. See below for notes on Debian packages.
  73. * When upgrading to Python 3, you **must** make sure that your log files are
  74. configured as UTF-8, by adding ``encoding: utf8`` to the
  75. ``RotatingFileHandler`` configuration (if you have one) in your
  76. ``<server>.log.config`` file. For example, if your ``log.config`` file
  77. contains::
  78. handlers:
  79. file:
  80. class: logging.handlers.RotatingFileHandler
  81. formatter: precise
  82. filename: homeserver.log
  83. maxBytes: 104857600
  84. backupCount: 10
  85. filters: [context]
  86. console:
  87. class: logging.StreamHandler
  88. formatter: precise
  89. filters: [context]
  90. Then you should update this to be::
  91. handlers:
  92. file:
  93. class: logging.handlers.RotatingFileHandler
  94. formatter: precise
  95. filename: homeserver.log
  96. maxBytes: 104857600
  97. backupCount: 10
  98. filters: [context]
  99. encoding: utf8
  100. console:
  101. class: logging.StreamHandler
  102. formatter: precise
  103. filters: [context]
  104. There is no need to revert this change if downgrading to Python 2.
  105. We are also making available Debian packages which will run Synapse on
  106. Python 3. You can switch to these packages with ``apt-get install
  107. matrix-synapse-py3``, however, please read `debian/NEWS
  108. <https://github.com/matrix-org/synapse/blob/release-v0.34.0/debian/NEWS>`_
  109. before doing so. The existing ``matrix-synapse`` packages will continue to
  110. use Python 2 for the time being.
  111. 2. This release removes the ``riot.im`` from the default list of trusted
  112. identity servers.
  113. If ``riot.im`` is in your homeserver's list of
  114. ``trusted_third_party_id_servers``, you should remove it. It was added in
  115. case a hypothetical future identity server was put there. If you don't
  116. remove it, users may be unable to deactivate their accounts.
  117. 3. This release no longer installs the (unmaintained) Matrix Console web client
  118. as part of the default installation. It is possible to re-enable it by
  119. installing it separately and setting the ``web_client_location`` config
  120. option, but please consider switching to another client.
  121. Upgrading to v0.33.7
  122. ====================
  123. This release removes the example email notification templates from
  124. ``res/templates`` (they are now internal to the python package). This should
  125. only affect you if you (a) deploy your Synapse instance from a git checkout or
  126. a github snapshot URL, and (b) have email notifications enabled.
  127. If you have email notifications enabled, you should ensure that
  128. ``email.template_dir`` is either configured to point at a directory where you
  129. have installed customised templates, or leave it unset to use the default
  130. templates.
  131. Upgrading to v0.27.3
  132. ====================
  133. This release expands the anonymous usage stats sent if the opt-in
  134. ``report_stats`` configuration is set to ``true``. We now capture RSS memory
  135. and cpu use at a very coarse level. This requires administrators to install
  136. the optional ``psutil`` python module.
  137. We would appreciate it if you could assist by ensuring this module is available
  138. and ``report_stats`` is enabled. This will let us see if performance changes to
  139. synapse are having an impact to the general community.
  140. Upgrading to v0.15.0
  141. ====================
  142. If you want to use the new URL previewing API (/_matrix/media/r0/preview_url)
  143. then you have to explicitly enable it in the config and update your dependencies
  144. dependencies. See README.rst for details.
  145. Upgrading to v0.11.0
  146. ====================
  147. This release includes the option to send anonymous usage stats to matrix.org,
  148. and requires that administrators explictly opt in or out by setting the
  149. ``report_stats`` option to either ``true`` or ``false``.
  150. We would really appreciate it if you could help our project out by reporting
  151. anonymized usage statistics from your homeserver. Only very basic aggregate
  152. data (e.g. number of users) will be reported, but it helps us to track the
  153. growth of the Matrix community, and helps us to make Matrix a success, as well
  154. as to convince other networks that they should peer with us.
  155. Upgrading to v0.9.0
  156. ===================
  157. Application services have had a breaking API change in this version.
  158. They can no longer register themselves with a home server using the AS HTTP API. This
  159. decision was made because a compromised application service with free reign to register
  160. any regex in effect grants full read/write access to the home server if a regex of ``.*``
  161. is used. An attack where a compromised AS re-registers itself with ``.*`` was deemed too
  162. big of a security risk to ignore, and so the ability to register with the HS remotely has
  163. been removed.
  164. It has been replaced by specifying a list of application service registrations in
  165. ``homeserver.yaml``::
  166. app_service_config_files: ["registration-01.yaml", "registration-02.yaml"]
  167. Where ``registration-01.yaml`` looks like::
  168. url: <String> # e.g. "https://my.application.service.com"
  169. as_token: <String>
  170. hs_token: <String>
  171. sender_localpart: <String> # This is a new field which denotes the user_id localpart when using the AS token
  172. namespaces:
  173. users:
  174. - exclusive: <Boolean>
  175. regex: <String> # e.g. "@prefix_.*"
  176. aliases:
  177. - exclusive: <Boolean>
  178. regex: <String>
  179. rooms:
  180. - exclusive: <Boolean>
  181. regex: <String>
  182. Upgrading to v0.8.0
  183. ===================
  184. Servers which use captchas will need to add their public key to::
  185. static/client/register/register_config.js
  186. window.matrixRegistrationConfig = {
  187. recaptcha_public_key: "YOUR_PUBLIC_KEY"
  188. };
  189. This is required in order to support registration fallback (typically used on
  190. mobile devices).
  191. Upgrading to v0.7.0
  192. ===================
  193. New dependencies are:
  194. - pydenticon
  195. - simplejson
  196. - syutil
  197. - matrix-angular-sdk
  198. To pull in these dependencies in a virtual env, run::
  199. python synapse/python_dependencies.py | xargs -n 1 pip install
  200. Upgrading to v0.6.0
  201. ===================
  202. To pull in new dependencies, run::
  203. python setup.py develop --user
  204. This update includes a change to the database schema. To upgrade you first need
  205. to upgrade the database by running::
  206. python scripts/upgrade_db_to_v0.6.0.py <db> <server_name> <signing_key>
  207. Where `<db>` is the location of the database, `<server_name>` is the
  208. server name as specified in the synapse configuration, and `<signing_key>` is
  209. the location of the signing key as specified in the synapse configuration.
  210. This may take some time to complete. Failures of signatures and content hashes
  211. can safely be ignored.
  212. Upgrading to v0.5.1
  213. ===================
  214. Depending on precisely when you installed v0.5.0 you may have ended up with
  215. a stale release of the reference matrix webclient installed as a python module.
  216. To uninstall it and ensure you are depending on the latest module, please run::
  217. $ pip uninstall syweb
  218. Upgrading to v0.5.0
  219. ===================
  220. The webclient has been split out into a seperate repository/pacakage in this
  221. release. Before you restart your homeserver you will need to pull in the
  222. webclient package by running::
  223. python setup.py develop --user
  224. This release completely changes the database schema and so requires upgrading
  225. it before starting the new version of the homeserver.
  226. The script "database-prepare-for-0.5.0.sh" should be used to upgrade the
  227. database. This will save all user information, such as logins and profiles,
  228. but will otherwise purge the database. This includes messages, which
  229. rooms the home server was a member of and room alias mappings.
  230. If you would like to keep your history, please take a copy of your database
  231. file and ask for help in #matrix:matrix.org. The upgrade process is,
  232. unfortunately, non trivial and requires human intervention to resolve any
  233. resulting conflicts during the upgrade process.
  234. Before running the command the homeserver should be first completely
  235. shutdown. To run it, simply specify the location of the database, e.g.:
  236. ./scripts/database-prepare-for-0.5.0.sh "homeserver.db"
  237. Once this has successfully completed it will be safe to restart the
  238. homeserver. You may notice that the homeserver takes a few seconds longer to
  239. restart than usual as it reinitializes the database.
  240. On startup of the new version, users can either rejoin remote rooms using room
  241. aliases or by being reinvited. Alternatively, if any other homeserver sends a
  242. message to a room that the homeserver was previously in the local HS will
  243. automatically rejoin the room.
  244. Upgrading to v0.4.0
  245. ===================
  246. This release needs an updated syutil version. Run::
  247. python setup.py develop
  248. You will also need to upgrade your configuration as the signing key format has
  249. changed. Run::
  250. python -m synapse.app.homeserver --config-path <CONFIG> --generate-config
  251. Upgrading to v0.3.0
  252. ===================
  253. This registration API now closely matches the login API. This introduces a bit
  254. more backwards and forwards between the HS and the client, but this improves
  255. the overall flexibility of the API. You can now GET on /register to retrieve a list
  256. of valid registration flows. Upon choosing one, they are submitted in the same
  257. way as login, e.g::
  258. {
  259. type: m.login.password,
  260. user: foo,
  261. password: bar
  262. }
  263. The default HS supports 2 flows, with and without Identity Server email
  264. authentication. Enabling captcha on the HS will add in an extra step to all
  265. flows: ``m.login.recaptcha`` which must be completed before you can transition
  266. to the next stage. There is a new login type: ``m.login.email.identity`` which
  267. contains the ``threepidCreds`` key which were previously sent in the original
  268. register request. For more information on this, see the specification.
  269. Web Client
  270. ----------
  271. The VoIP specification has changed between v0.2.0 and v0.3.0. Users should
  272. refresh any browser tabs to get the latest web client code. Users on
  273. v0.2.0 of the web client will not be able to call those on v0.3.0 and
  274. vice versa.
  275. Upgrading to v0.2.0
  276. ===================
  277. The home server now requires setting up of SSL config before it can run. To
  278. automatically generate default config use::
  279. $ python synapse/app/homeserver.py \
  280. --server-name machine.my.domain.name \
  281. --bind-port 8448 \
  282. --config-path homeserver.config \
  283. --generate-config
  284. This config can be edited if desired, for example to specify a different SSL
  285. certificate to use. Once done you can run the home server using::
  286. $ python synapse/app/homeserver.py --config-path homeserver.config
  287. See the README.rst for more information.
  288. Also note that some config options have been renamed, including:
  289. - "host" to "server-name"
  290. - "database" to "database-path"
  291. - "port" to "bind-port" and "unsecure-port"
  292. Upgrading to v0.0.1
  293. ===================
  294. This release completely changes the database schema and so requires upgrading
  295. it before starting the new version of the homeserver.
  296. The script "database-prepare-for-0.0.1.sh" should be used to upgrade the
  297. database. This will save all user information, such as logins and profiles,
  298. but will otherwise purge the database. This includes messages, which
  299. rooms the home server was a member of and room alias mappings.
  300. Before running the command the homeserver should be first completely
  301. shutdown. To run it, simply specify the location of the database, e.g.:
  302. ./scripts/database-prepare-for-0.0.1.sh "homeserver.db"
  303. Once this has successfully completed it will be safe to restart the
  304. homeserver. You may notice that the homeserver takes a few seconds longer to
  305. restart than usual as it reinitializes the database.
  306. On startup of the new version, users can either rejoin remote rooms using room
  307. aliases or by being reinvited. Alternatively, if any other homeserver sends a
  308. message to a room that the homeserver was previously in the local HS will
  309. automatically rejoin the room.