You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

upgrade.md 87 KiB

1 vuosi sitten
1 vuosi sitten
1 vuosi sitten
1 vuosi sitten
1 vuosi sitten
1 vuosi sitten
1 vuosi sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285
  1. # Upgrading Synapse
  2. Before upgrading check if any special steps are required to upgrade from
  3. the version you currently have installed to the current version of
  4. Synapse. The extra instructions that may be required are listed later in
  5. this document.
  6. - Check that your versions of Python and PostgreSQL are still
  7. supported.
  8. Synapse follows upstream lifecycles for [Python](https://endoflife.date/python) and
  9. [PostgreSQL](https://endoflife.date/postgresql), and removes support for versions
  10. which are no longer maintained.
  11. The website <https://endoflife.date> also offers convenient
  12. summaries.
  13. - If Synapse was installed using [prebuilt packages](setup/installation.md#prebuilt-packages),
  14. you will need to follow the normal process for upgrading those packages.
  15. - If Synapse was installed using pip then upgrade to the latest
  16. version by running:
  17. ```bash
  18. pip install --upgrade matrix-synapse
  19. ```
  20. - If Synapse was installed from source, then:
  21. 1. Obtain the latest version of the source code. Git users can run
  22. `git pull` to do this.
  23. 2. If you're running Synapse in a virtualenv, make sure to activate it before
  24. upgrading. For example, if Synapse is installed in a virtualenv in `~/synapse/env` then
  25. run:
  26. ```bash
  27. source ~/synapse/env/bin/activate
  28. pip install --upgrade .
  29. ```
  30. Include any relevant extras between square brackets, e.g. `pip install --upgrade ".[postgres,oidc]"`.
  31. 3. If you're using `poetry` to manage a Synapse installation, run:
  32. ```bash
  33. poetry install
  34. ```
  35. Include any relevant extras with `--extras`, e.g. `poetry install --extras postgres --extras oidc`.
  36. It's probably easiest to run `poetry install --extras all`.
  37. 4. Restart Synapse:
  38. ```bash
  39. synctl restart
  40. ```
  41. To check whether your update was successful, you can check the running
  42. server version with:
  43. ```bash
  44. # you may need to replace 'localhost:8008' if synapse is not configured
  45. # to listen on port 8008.
  46. curl http://localhost:8008/_synapse/admin/v1/server_version
  47. ```
  48. ## Rolling back to older versions
  49. Rolling back to previous releases can be difficult, due to database
  50. schema changes between releases. Where we have been able to test the
  51. rollback process, this will be noted below.
  52. In general, you will need to undo any changes made during the upgrade
  53. process, for example:
  54. - pip:
  55. ```bash
  56. source env/bin/activate
  57. # replace `1.3.0` accordingly:
  58. pip install matrix-synapse==1.3.0
  59. ```
  60. - Debian:
  61. ```bash
  62. # replace `1.3.0` and `stretch` accordingly:
  63. wget https://packages.matrix.org/debian/pool/main/m/matrix-synapse-py3/matrix-synapse-py3_1.3.0+stretch1_amd64.deb
  64. dpkg -i matrix-synapse-py3_1.3.0+stretch1_amd64.deb
  65. ```
  66. # Upgrading to v1.76.0
  67. ## Changes to the account data replication streams
  68. Synapse has changed the format of the account data and devices replication
  69. streams (between workers). This is a forwards- and backwards-incompatible
  70. change: v1.75 workers cannot process account data replicated by v1.76 workers,
  71. and vice versa.
  72. Once all workers are upgraded to v1.76 (or downgraded to v1.75), account data
  73. and device replication will resume as normal.
  74. ## Minimum version of Poetry is now 1.3.2
  75. The minimum supported version of Poetry is now 1.3.2 (previously 1.2.0, [since
  76. Synapse 1.67](#upgrading-to-v1670)). If you have used `poetry install` to
  77. install Synapse from a source checkout, you should upgrade poetry: see its
  78. [installation instructions](https://python-poetry.org/docs/#installation).
  79. For all other installation methods, no acction is required.
  80. # Upgrading to v1.74.0
  81. ## Unicode support in user search
  82. This version introduces optional support for an [improved user search dealing with Unicode characters](https://github.com/matrix-org/synapse/pull/14464).
  83. If you want to take advantage of this feature you need to install PyICU,
  84. the ICU native dependency and its development headers
  85. so that PyICU can build since no prebuilt wheels are available.
  86. You can follow [the PyICU documentation](https://pypi.org/project/PyICU/) to do so,
  87. and then do `pip install matrix-synapse[user-search]` for a PyPI install.
  88. Docker images and Debian packages need nothing specific as they already
  89. include or specify ICU as an explicit dependency.
  90. # Upgrading to v1.73.0
  91. ## Legacy Prometheus metric names have now been removed
  92. Synapse v1.69.0 included the deprecation of legacy Prometheus metric names
  93. and offered an option to disable them.
  94. Synapse v1.71.0 disabled legacy Prometheus metric names by default.
  95. This version, v1.73.0, removes those legacy Prometheus metric names entirely.
  96. This also means that the `enable_legacy_metrics` configuration option has been
  97. removed; it will no longer be possible to re-enable the legacy metric names.
  98. If you use metrics and have not yet updated your Grafana dashboard(s),
  99. Prometheus console(s) or alerting rule(s), please consider doing so when upgrading
  100. to this version.
  101. Note that the included Grafana dashboard was updated in v1.72.0 to correct some
  102. metric names which were missed when legacy metrics were disabled by default.
  103. See [v1.69.0: Deprecation of legacy Prometheus metric names](#deprecation-of-legacy-prometheus-metric-names)
  104. for more context.
  105. # Upgrading to v1.72.0
  106. ## Dropping support for PostgreSQL 10
  107. In line with our [deprecation policy](deprecation_policy.md), we've dropped
  108. support for PostgreSQL 10, as it is no longer supported upstream.
  109. This release of Synapse requires PostgreSQL 11+.
  110. # Upgrading to v1.71.0
  111. ## Removal of the `generate_short_term_login_token` module API method
  112. As announced with the release of [Synapse 1.69.0](#deprecation-of-the-generate_short_term_login_token-module-api-method), the deprecated `generate_short_term_login_token` module method has been removed.
  113. Modules relying on it can instead use the `create_login_token` method.
  114. ## Changes to the events received by application services (interest)
  115. To align with spec (changed in
  116. [MSC3905](https://github.com/matrix-org/matrix-spec-proposals/pull/3905)), Synapse now
  117. only considers local users to be interesting. In other words, the `users` namespace
  118. regex is only be applied against local users of the homeserver.
  119. Please note, this probably doesn't affect the expected behavior of your application
  120. service, since an interesting local user in a room still means all messages in the room
  121. (from local or remote users) will still be considered interesting. And matching a room
  122. with the `rooms` or `aliases` namespace regex will still consider all events sent in the
  123. room to be interesting to the application service.
  124. If one of your application service's `users` regex was intending to match a remote user,
  125. this will no longer match as you expect. The behavioral mismatch between matching all
  126. local users and some remote users is why the spec was changed/clarified and this
  127. caveat is no longer supported.
  128. ## Legacy Prometheus metric names are now disabled by default
  129. Synapse v1.71.0 disables legacy Prometheus metric names by default.
  130. For administrators that still rely on them and have not yet had chance to update their
  131. uses of the metrics, it's still possible to specify `enable_legacy_metrics: true` in
  132. the configuration to re-enable them temporarily.
  133. Synapse v1.73.0 will **remove legacy metric names altogether** and at that point,
  134. it will no longer be possible to re-enable them.
  135. If you do not use metrics or you have already updated your Grafana dashboard(s),
  136. Prometheus console(s) and alerting rule(s), there is no action needed.
  137. See [v1.69.0: Deprecation of legacy Prometheus metric names](#deprecation-of-legacy-prometheus-metric-names).
  138. # Upgrading to v1.69.0
  139. ## Changes to the receipts replication streams
  140. Synapse now includes information indicating if a receipt applies to a thread when
  141. replicating it to other workers. This is a forwards- and backwards-incompatible
  142. change: v1.68 and workers cannot process receipts replicated by v1.69 workers, and
  143. vice versa.
  144. Once all workers are upgraded to v1.69 (or downgraded to v1.68), receipts
  145. replication will resume as normal.
  146. ## Deprecation of legacy Prometheus metric names
  147. In current versions of Synapse, some Prometheus metrics are emitted under two different names,
  148. with one of the names being older but non-compliant with OpenMetrics and Prometheus conventions
  149. and one of the names being newer but compliant.
  150. Synapse v1.71.0 will turn the old metric names off *by default*.
  151. For administrators that still rely on them and have not had chance to update their
  152. uses of the metrics, it's possible to specify `enable_legacy_metrics: true` in
  153. the configuration to re-enable them temporarily.
  154. Synapse v1.73.0 will **remove legacy metric names altogether** and it will no longer
  155. be possible to re-enable them.
  156. The Grafana dashboard, Prometheus recording rules and Prometheus Consoles included
  157. in the `contrib` directory in the Synapse repository have been updated to no longer
  158. rely on the legacy names. These can be used on a current version of Synapse
  159. because current versions of Synapse emit both old and new names.
  160. You may need to update your alerting rules or any other rules that depend on
  161. the names of Prometheus metrics.
  162. If you want to test your changes before legacy names are disabled by default,
  163. you may specify `enable_legacy_metrics: false` in your homeserver configuration.
  164. A list of affected metrics is available on the [Metrics How-to page](https://matrix-org.github.io/synapse/v1.69/metrics-howto.html?highlight=metrics%20deprecated#renaming-of-metrics--deprecation-of-old-names-in-12).
  165. ## Deprecation of the `generate_short_term_login_token` module API method
  166. The following method of the module API has been deprecated, and is scheduled to
  167. be remove in v1.71.0:
  168. ```python
  169. def generate_short_term_login_token(
  170. self,
  171. user_id: str,
  172. duration_in_ms: int = (2 * 60 * 1000),
  173. auth_provider_id: str = "",
  174. auth_provider_session_id: Optional[str] = None,
  175. ) -> str:
  176. ...
  177. ```
  178. It has been replaced by an asynchronous equivalent:
  179. ```python
  180. async def create_login_token(
  181. self,
  182. user_id: str,
  183. duration_in_ms: int = (2 * 60 * 1000),
  184. auth_provider_id: Optional[str] = None,
  185. auth_provider_session_id: Optional[str] = None,
  186. ) -> str:
  187. ...
  188. ```
  189. Synapse will log a warning when a module uses the deprecated method, to help
  190. administrators find modules using it.
  191. # Upgrading to v1.68.0
  192. Two changes announced in the upgrade notes for v1.67.0 have now landed in v1.68.0.
  193. ## SQLite version requirement
  194. Synapse now requires a SQLite version of 3.27.0 or higher if SQLite is configured as
  195. Synapse's database.
  196. Installations using
  197. - Docker images [from `matrixdotorg`](https://hub.docker.com/r/matrixdotorg/synapse),
  198. - Debian packages [from Matrix.org](https://packages.matrix.org/), or
  199. - a PostgreSQL database
  200. are not affected.
  201. ## Rust requirement when building from source.
  202. Building from a source checkout of Synapse now requires a recent Rust compiler
  203. (currently Rust 1.58.1, but see also the
  204. [Platform Dependency Policy](https://matrix-org.github.io/synapse/latest/deprecation_policy.html)).
  205. Installations using
  206. - Docker images [from `matrixdotorg`](https://hub.docker.com/r/matrixdotorg/synapse),
  207. - Debian packages [from Matrix.org](https://packages.matrix.org/), or
  208. - PyPI wheels via `pip install matrix-synapse` (on supported platforms and architectures)
  209. will not be affected.
  210. # Upgrading to v1.67.0
  211. ## Direct TCP replication is no longer supported: migrate to Redis
  212. Redis support was added in v1.13.0 with it becoming the recommended method in
  213. v1.18.0. It replaced the old direct TCP connections (which was deprecated as of
  214. v1.18.0) to the main process. With Redis, rather than all the workers connecting
  215. to the main process, all the workers and the main process connect to Redis,
  216. which relays replication commands between processes. This can give a significant
  217. CPU saving on the main process and is a prerequisite for upcoming
  218. performance improvements.
  219. To migrate to Redis add the [`redis` config](./workers.md#shared-configuration),
  220. and remove the TCP `replication` listener from config of the master and
  221. `worker_replication_port` from worker config. Note that a HTTP listener with a
  222. `replication` resource is still required.
  223. ## Minimum version of Poetry is now v1.2.0
  224. The minimum supported version of poetry is now 1.2. This should only affect
  225. those installing from a source checkout.
  226. ## Rust requirement in the next release
  227. From the next major release (v1.68.0) installing Synapse from a source checkout
  228. will require a recent Rust compiler. Those using packages or
  229. `pip install matrix-synapse` will not be affected.
  230. The simplest way of installing Rust is via [rustup.rs](https://rustup.rs/)
  231. ## SQLite version requirement in the next release
  232. From the next major release (v1.68.0) Synapse will require SQLite 3.27.0 or
  233. higher. Synapse v1.67.0 will be the last major release supporting SQLite
  234. versions 3.22 to 3.26.
  235. Those using Docker images or Debian packages from Matrix.org will not be
  236. affected. If you have installed from source, you should check the version of
  237. SQLite used by Python with:
  238. ```shell
  239. python -c "import sqlite3; print(sqlite3.sqlite_version)"
  240. ```
  241. If this is too old, refer to your distribution for advice on upgrading.
  242. # Upgrading to v1.66.0
  243. ## Delegation of email validation no longer supported
  244. As of this version, Synapse no longer allows the tasks of verifying email address
  245. ownership, and password reset confirmation, to be delegated to an identity server.
  246. This removal was previously planned for Synapse 1.64.0, but was
  247. [delayed](https://github.com/matrix-org/synapse/issues/13421) until now to give
  248. homeserver administrators more notice of the change.
  249. To continue to allow users to add email addresses to their homeserver accounts,
  250. and perform password resets, make sure that Synapse is configured with a working
  251. email server in the [`email` configuration
  252. section](https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#email)
  253. (including, at a minimum, a `notif_from` setting.)
  254. Specifying an `email` setting under `account_threepid_delegates` will now cause
  255. an error at startup.
  256. # Upgrading to v1.64.0
  257. ## Deprecation of the ability to delegate e-mail verification to identity servers
  258. Synapse v1.66.0 will remove the ability to delegate the tasks of verifying email address ownership, and password reset confirmation, to an identity server.
  259. If you require your homeserver to verify e-mail addresses or to support password resets via e-mail, please configure your homeserver with SMTP access so that it can send e-mails on its own behalf.
  260. [Consult the configuration documentation for more information.](https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#email)
  261. The option that will be removed is `account_threepid_delegates.email`.
  262. ## Changes to the event replication streams
  263. Synapse now includes a flag indicating if an event is an outlier when
  264. replicating it to other workers. This is a forwards- and backwards-incompatible
  265. change: v1.63 and workers cannot process events replicated by v1.64 workers, and
  266. vice versa.
  267. Once all workers are upgraded to v1.64 (or downgraded to v1.63), event
  268. replication will resume as normal.
  269. ## frozendict release
  270. [frozendict 2.3.3](https://github.com/Marco-Sulla/python-frozendict/releases/tag/v2.3.3)
  271. has recently been released, which fixes a memory leak that occurs during `/sync`
  272. requests. We advise server administrators who installed Synapse via pip to upgrade
  273. frozendict with `pip install --upgrade frozendict`. The Docker image
  274. `matrixdotorg/synapse` and the Debian packages from `packages.matrix.org` already
  275. include the updated library.
  276. # Upgrading to v1.62.0
  277. ## New signatures for spam checker callbacks
  278. As a followup to changes in v1.60.0, the following spam-checker callbacks have changed signature:
  279. - `user_may_join_room`
  280. - `user_may_invite`
  281. - `user_may_send_3pid_invite`
  282. - `user_may_create_room`
  283. - `user_may_create_room_alias`
  284. - `user_may_publish_room`
  285. - `check_media_file_for_spam`
  286. For each of these methods, the previous callback signature has been deprecated.
  287. Whereas callbacks used to return `bool`, they should now return `Union["synapse.module_api.NOT_SPAM", "synapse.module_api.errors.Codes"]`.
  288. For instance, if your module implements `user_may_join_room` as follows:
  289. ```python
  290. async def user_may_join_room(self, user_id: str, room_id: str, is_invited: bool)
  291. if ...:
  292. # Request is spam
  293. return False
  294. # Request is not spam
  295. return True
  296. ```
  297. you should rewrite it as follows:
  298. ```python
  299. async def user_may_join_room(self, user_id: str, room_id: str, is_invited: bool)
  300. if ...:
  301. # Request is spam, mark it as forbidden (you may use some more precise error
  302. # code if it is useful).
  303. return synapse.module_api.errors.Codes.FORBIDDEN
  304. # Request is not spam, mark it as such.
  305. return synapse.module_api.NOT_SPAM
  306. ```
  307. # Upgrading to v1.61.0
  308. ## Removal of deprecated community/groups
  309. This release of Synapse will remove deprecated community/groups from codebase.
  310. ### Worker endpoints
  311. For those who have deployed workers, following worker endpoints will no longer
  312. exist and they can be removed from the reverse proxy configuration:
  313. - `^/_matrix/federation/v1/get_groups_publicised$`
  314. - `^/_matrix/client/(r0|v3|unstable)/joined_groups$`
  315. - `^/_matrix/client/(r0|v3|unstable)/publicised_groups$`
  316. - `^/_matrix/client/(r0|v3|unstable)/publicised_groups/`
  317. - `^/_matrix/federation/v1/groups/`
  318. - `^/_matrix/client/(r0|v3|unstable)/groups/`
  319. # Upgrading to v1.60.0
  320. ## Adding a new unique index to `state_group_edges` could fail if your database is corrupted
  321. This release of Synapse will add a unique index to the `state_group_edges` table, in order
  322. to prevent accidentally introducing duplicate information (for example, because a database
  323. backup was restored multiple times).
  324. Duplicate rows being present in this table could cause drastic performance problems; see
  325. [issue 11779](https://github.com/matrix-org/synapse/issues/11779) for more details.
  326. If your Synapse database already has had duplicate rows introduced into this table,
  327. this could fail, with either of these errors:
  328. **On Postgres:**
  329. ```
  330. synapse.storage.background_updates - 623 - INFO - background_updates-0 - Adding index state_group_edges_unique_idx to state_group_edges
  331. synapse.storage.background_updates - 282 - ERROR - background_updates-0 - Error doing update
  332. ...
  333. psycopg2.errors.UniqueViolation: could not create unique index "state_group_edges_unique_idx"
  334. DETAIL: Key (state_group, prev_state_group)=(2, 1) is duplicated.
  335. ```
  336. (The numbers may be different.)
  337. **On SQLite:**
  338. ```
  339. synapse.storage.background_updates - 623 - INFO - background_updates-0 - Adding index state_group_edges_unique_idx to state_group_edges
  340. synapse.storage.background_updates - 282 - ERROR - background_updates-0 - Error doing update
  341. ...
  342. sqlite3.IntegrityError: UNIQUE constraint failed: state_group_edges.state_group, state_group_edges.prev_state_group
  343. ```
  344. <details>
  345. <summary><b>Expand this section for steps to resolve this problem</b></summary>
  346. ### On Postgres
  347. Connect to your database with `psql`.
  348. ```sql
  349. BEGIN;
  350. DELETE FROM state_group_edges WHERE (ctid, state_group, prev_state_group) IN (
  351. SELECT row_id, state_group, prev_state_group
  352. FROM (
  353. SELECT
  354. ctid AS row_id,
  355. MIN(ctid) OVER (PARTITION BY state_group, prev_state_group) AS min_row_id,
  356. state_group,
  357. prev_state_group
  358. FROM state_group_edges
  359. ) AS t1
  360. WHERE row_id <> min_row_id
  361. );
  362. COMMIT;
  363. ```
  364. ### On SQLite
  365. At the command-line, use `sqlite3 path/to/your-homeserver-database.db`:
  366. ```sql
  367. BEGIN;
  368. DELETE FROM state_group_edges WHERE (rowid, state_group, prev_state_group) IN (
  369. SELECT row_id, state_group, prev_state_group
  370. FROM (
  371. SELECT
  372. rowid AS row_id,
  373. MIN(rowid) OVER (PARTITION BY state_group, prev_state_group) AS min_row_id,
  374. state_group,
  375. prev_state_group
  376. FROM state_group_edges
  377. )
  378. WHERE row_id <> min_row_id
  379. );
  380. COMMIT;
  381. ```
  382. ### For more details
  383. [This comment on issue 11779](https://github.com/matrix-org/synapse/issues/11779#issuecomment-1131545970)
  384. has queries that can be used to check a database for this problem in advance.
  385. </details>
  386. ## New signature for the spam checker callback `check_event_for_spam`
  387. The previous signature has been deprecated.
  388. Whereas `check_event_for_spam` callbacks used to return `Union[str, bool]`, they should now return `Union["synapse.module_api.NOT_SPAM", "synapse.module_api.errors.Codes"]`.
  389. This is part of an ongoing refactoring of the SpamChecker API to make it less ambiguous and more powerful.
  390. If your module implements `check_event_for_spam` as follows:
  391. ```python
  392. async def check_event_for_spam(event):
  393. if ...:
  394. # Event is spam
  395. return True
  396. # Event is not spam
  397. return False
  398. ```
  399. you should rewrite it as follows:
  400. ```python
  401. async def check_event_for_spam(event):
  402. if ...:
  403. # Event is spam, mark it as forbidden (you may use some more precise error
  404. # code if it is useful).
  405. return synapse.module_api.errors.Codes.FORBIDDEN
  406. # Event is not spam, mark it as such.
  407. return synapse.module_api.NOT_SPAM
  408. ```
  409. # Upgrading to v1.59.0
  410. ## Device name lookup over federation has been disabled by default
  411. The names of user devices are no longer visible to users on other homeservers by default.
  412. Device IDs are unaffected, as these are necessary to facilitate end-to-end encryption.
  413. To re-enable this functionality, set the
  414. [`allow_device_name_lookup_over_federation`](https://matrix-org.github.io/synapse/v1.59/usage/configuration/config_documentation.html#federation)
  415. homeserver config option to `true`.
  416. ## Deprecation of the `synapse.app.appservice` and `synapse.app.user_dir` worker application types
  417. The `synapse.app.appservice` worker application type allowed you to configure a
  418. single worker to use to notify application services of new events, as long
  419. as this functionality was disabled on the main process with `notify_appservices: False`.
  420. Further, the `synapse.app.user_dir` worker application type allowed you to configure
  421. a single worker to be responsible for updating the user directory, as long as this
  422. was disabled on the main process with `update_user_directory: False`.
  423. To unify Synapse's worker types, the `synapse.app.appservice` worker application
  424. type and the `notify_appservices` configuration option have been deprecated.
  425. The `synapse.app.user_dir` worker application type and `update_user_directory`
  426. configuration option have also been deprecated.
  427. To get the same functionality as was provided by the deprecated options, it's now recommended that the `synapse.app.generic_worker`
  428. worker application type is used and that the `notify_appservices_from_worker` and/or
  429. `update_user_directory_from_worker` options are set to the name of a worker.
  430. For the time being, the old options can be used alongside the new options to make
  431. it easier to transition between the two configurations, however please note that:
  432. - the options must not contradict each other (otherwise Synapse won't start); and
  433. - the `notify_appservices` and `update_user_directory` options will be removed in a future release of Synapse.
  434. Please see the [*Notifying Application Services*][v1_59_notify_ases_from] and
  435. [*Updating the User Directory*][v1_59_update_user_dir] sections of the worker
  436. documentation for more information.
  437. [v1_59_notify_ases_from]: workers.md#notifying-application-services
  438. [v1_59_update_user_dir]: workers.md#updating-the-user-directory
  439. # Upgrading to v1.58.0
  440. ## Groups/communities feature has been disabled by default
  441. The non-standard groups/communities feature in Synapse has been disabled by default
  442. and will be removed in Synapse v1.61.0.
  443. # Upgrading to v1.57.0
  444. ## Changes to database schema for application services
  445. Synapse v1.57.0 includes a [change](https://github.com/matrix-org/synapse/pull/12209) to the
  446. way transaction IDs are managed for application services. If your deployment uses a dedicated
  447. worker for application service traffic, **it must be stopped** when the database is upgraded
  448. (which normally happens when the main process is upgraded), to ensure the change is made safely
  449. without any risk of reusing transaction IDs.
  450. Deployments which do not use separate worker processes can be upgraded as normal. Similarly,
  451. deployments where no application services are in use can be upgraded as normal.
  452. <details>
  453. <summary><b>Recovering from an incorrect upgrade</b></summary>
  454. If the database schema is upgraded *without* stopping the worker responsible
  455. for AS traffic, then the following error may be given when attempting to start
  456. a Synapse worker or master process:
  457. ```
  458. **********************************************************************************
  459. Error during initialisation:
  460. Postgres sequence 'application_services_txn_id_seq' is inconsistent with associated
  461. table 'application_services_txns'. This can happen if Synapse has been downgraded and
  462. then upgraded again, or due to a bad migration.
  463. To fix this error, shut down Synapse (including any and all workers)
  464. and run the following SQL:
  465. SELECT setval('application_services_txn_id_seq', (
  466. SELECT GREATEST(MAX(txn_id), 0) FROM application_services_txns
  467. ));
  468. See docs/postgres.md for more information.
  469. There may be more information in the logs.
  470. **********************************************************************************
  471. ```
  472. This error may also be seen if Synapse is *downgraded* to an earlier version,
  473. and then upgraded again to v1.57.0 or later.
  474. In either case:
  475. 1. Ensure that the worker responsible for AS traffic is stopped.
  476. 2. Run the SQL command given in the error message via `psql`.
  477. Synapse should then start correctly.
  478. </details>
  479. # Upgrading to v1.56.0
  480. ## Open registration without verification is now disabled by default
  481. Synapse will refuse to start if registration is enabled without email, captcha, or token-based verification unless the new config
  482. flag `enable_registration_without_verification` is set to "true".
  483. ## Groups/communities feature has been deprecated
  484. The non-standard groups/communities feature in Synapse has been deprecated and will
  485. be disabled by default in Synapse v1.58.0.
  486. You can test disabling it by adding the following to your homeserver configuration:
  487. ```yaml
  488. experimental_features:
  489. groups_enabled: false
  490. ```
  491. ## Change in behaviour for PostgreSQL databases with unsafe locale
  492. Synapse now refuses to start when using PostgreSQL with non-`C` values for `COLLATE` and
  493. `CTYPE` unless the config flag `allow_unsafe_locale`, found in the database section of
  494. the configuration file, is set to `true`. See the [PostgreSQL documentation](https://matrix-org.github.io/synapse/latest/postgres.html#fixing-incorrect-collate-or-ctype)
  495. for more information and instructions on how to fix a database with incorrect values.
  496. # Upgrading to v1.55.0
  497. ## `synctl` script has been moved
  498. The `synctl` script
  499. [has been made](https://github.com/matrix-org/synapse/pull/12140) an
  500. [entry point](https://packaging.python.org/en/latest/specifications/entry-points/)
  501. and no longer exists at the root of Synapse's source tree. If you wish to use
  502. `synctl` to manage your homeserver, you should invoke `synctl` directly, e.g.
  503. `synctl start` instead of `./synctl start` or `/path/to/synctl start`.
  504. You will need to ensure `synctl` is on your `PATH`.
  505. - This is automatically the case when using
  506. [Debian packages](https://packages.matrix.org/debian/) or
  507. [docker images](https://hub.docker.com/r/matrixdotorg/synapse)
  508. provided by Matrix.org.
  509. - When installing from a wheel, sdist, or PyPI, a `synctl` executable is added
  510. to your Python installation's `bin`. This should be on your `PATH`
  511. automatically, though you might need to activate a virtual environment
  512. depending on how you installed Synapse.
  513. ## Compatibility dropped for Mjolnir 1.3.1 and earlier
  514. Synapse v1.55.0 drops support for Mjolnir 1.3.1 and earlier.
  515. If you use the Mjolnir module to moderate your homeserver,
  516. please upgrade Mjolnir to version 1.3.2 or later before upgrading Synapse.
  517. # Upgrading to v1.54.0
  518. ## Legacy structured logging configuration removal
  519. This release removes support for the `structured: true` logging configuration
  520. which was deprecated in Synapse v1.23.0. If your logging configuration contains
  521. `structured: true` then it should be modified based on the
  522. [structured logging documentation](https://matrix-org.github.io/synapse/v1.56/structured_logging.html#upgrading-from-legacy-structured-logging-configuration).
  523. # Upgrading to v1.53.0
  524. ## Dropping support for `webclient` listeners and non-HTTP(S) `web_client_location`
  525. Per the deprecation notice in Synapse v1.51.0, listeners of type `webclient`
  526. are no longer supported and configuring them is a now a configuration error.
  527. Configuring a non-HTTP(S) `web_client_location` configuration is is now a
  528. configuration error. Since the `webclient` listener is no longer supported, this
  529. setting only applies to the root path `/` of Synapse's web server and no longer
  530. the `/_matrix/client/` path.
  531. ## Stablisation of MSC3231
  532. The unstable validity-check endpoint for the
  533. [Registration Tokens](https://spec.matrix.org/v1.2/client-server-api/#get_matrixclientv1registermloginregistration_tokenvalidity)
  534. feature has been stabilised and moved from:
  535. `/_matrix/client/unstable/org.matrix.msc3231/register/org.matrix.msc3231.login.registration_token/validity`
  536. to:
  537. `/_matrix/client/v1/register/m.login.registration_token/validity`
  538. Please update any relevant reverse proxy or firewall configurations appropriately.
  539. ## Time-based cache expiry is now enabled by default
  540. Formerly, entries in the cache were not evicted regardless of whether they were accessed after storing.
  541. This behavior has now changed. By default entries in the cache are now evicted after 30m of not being accessed.
  542. To change the default behavior, go to the `caches` section of the config and change the `expire_caches` and
  543. `cache_entry_ttl` flags as necessary. Please note that these flags replace the `expiry_time` flag in the config.
  544. The `expiry_time` flag will still continue to work, but it has been deprecated and will be removed in the future.
  545. ## Deprecation of `capability` `org.matrix.msc3283.*`
  546. The `capabilities` of MSC3283 from the REST API `/_matrix/client/r0/capabilities`
  547. becomes stable.
  548. The old `capabilities`
  549. - `org.matrix.msc3283.set_displayname`,
  550. - `org.matrix.msc3283.set_avatar_url` and
  551. - `org.matrix.msc3283.3pid_changes`
  552. are deprecated and scheduled to be removed in Synapse v1.54.0.
  553. The new `capabilities`
  554. - `m.set_displayname`,
  555. - `m.set_avatar_url` and
  556. - `m.3pid_changes`
  557. are now active by default.
  558. ## Removal of `user_may_create_room_with_invites`
  559. As announced with the release of [Synapse 1.47.0](#deprecation-of-the-user_may_create_room_with_invites-module-callback),
  560. the deprecated `user_may_create_room_with_invites` module callback has been removed.
  561. Modules relying on it can instead implement [`user_may_invite`](https://matrix-org.github.io/synapse/latest/modules/spam_checker_callbacks.html#user_may_invite)
  562. and use the [`get_room_state`](https://github.com/matrix-org/synapse/blob/872f23b95fa980a61b0866c1475e84491991fa20/synapse/module_api/__init__.py#L869-L876)
  563. module API to infer whether the invite is happening while creating a room (see [this function](https://github.com/matrix-org/synapse-domain-rule-checker/blob/e7d092dd9f2a7f844928771dbfd9fd24c2332e48/synapse_domain_rule_checker/__init__.py#L56-L89)
  564. as an example). Alternately, modules can also implement [`on_create_room`](https://matrix-org.github.io/synapse/latest/modules/third_party_rules_callbacks.html#on_create_room).
  565. # Upgrading to v1.52.0
  566. ## Twisted security release
  567. Note that [Twisted 22.1.0](https://github.com/twisted/twisted/releases/tag/twisted-22.1.0)
  568. has recently been released, which fixes a [security issue](https://github.com/twisted/twisted/security/advisories/GHSA-92x2-jw7w-xvvx)
  569. within the Twisted library. We do not believe Synapse is affected by this vulnerability,
  570. though we advise server administrators who installed Synapse via pip to upgrade Twisted
  571. with `pip install --upgrade Twisted treq` as a matter of good practice. The Docker image
  572. `matrixdotorg/synapse` and the Debian packages from `packages.matrix.org` are using the
  573. updated library.
  574. # Upgrading to v1.51.0
  575. ## Deprecation of `webclient` listeners and non-HTTP(S) `web_client_location`
  576. Listeners of type `webclient` are deprecated and scheduled to be removed in
  577. Synapse v1.53.0.
  578. Similarly, a non-HTTP(S) `web_client_location` configuration is deprecated and
  579. will become a configuration error in Synapse v1.53.0.
  580. # Upgrading to v1.50.0
  581. ## Dropping support for old Python and Postgres versions
  582. In line with our [deprecation policy](deprecation_policy.md),
  583. we've dropped support for Python 3.6 and PostgreSQL 9.6, as they are no
  584. longer supported upstream.
  585. This release of Synapse requires Python 3.7+ and PostgreSQL 10+.
  586. # Upgrading to v1.47.0
  587. ## Removal of old Room Admin API
  588. The following admin APIs were deprecated in [Synapse 1.34](https://github.com/matrix-org/synapse/blob/v1.34.0/CHANGES.md#deprecations-and-removals)
  589. (released on 2021-05-17) and have now been removed:
  590. - `POST /_synapse/admin/v1/<room_id>/delete`
  591. Any scripts still using the above APIs should be converted to use the
  592. [Delete Room API](https://matrix-org.github.io/synapse/latest/admin_api/rooms.html#delete-room-api).
  593. ## Deprecation of the `user_may_create_room_with_invites` module callback
  594. The `user_may_create_room_with_invites` is deprecated and will be removed in a future
  595. version of Synapse. Modules implementing this callback can instead implement
  596. [`user_may_invite`](https://matrix-org.github.io/synapse/latest/modules/spam_checker_callbacks.html#user_may_invite)
  597. and use the [`get_room_state`](https://github.com/matrix-org/synapse/blob/872f23b95fa980a61b0866c1475e84491991fa20/synapse/module_api/__init__.py#L869-L876)
  598. module API method to infer whether the invite is happening in the context of creating a
  599. room.
  600. We plan to remove this callback in January 2022.
  601. # Upgrading to v1.45.0
  602. ## Changes required to media storage provider modules when reading from the Synapse configuration object
  603. Media storage provider modules that read from the Synapse configuration object (i.e. that
  604. read the value of `hs.config.[...]`) now need to specify the configuration section they're
  605. reading from. This means that if a module reads the value of e.g. `hs.config.media_store_path`,
  606. it needs to replace it with `hs.config.media.media_store_path`.
  607. # Upgrading to v1.44.0
  608. ## The URL preview cache is no longer mirrored to storage providers
  609. The `url_cache/` and `url_cache_thumbnails/` directories in the media store are
  610. no longer mirrored to storage providers. These two directories can be safely
  611. deleted from any configured storage providers to reclaim space.
  612. # Upgrading to v1.43.0
  613. ## The spaces summary APIs can now be handled by workers
  614. The [available worker applications documentation](https://matrix-org.github.io/synapse/latest/workers.html#available-worker-applications)
  615. has been updated to reflect that calls to the `/spaces`, `/hierarchy`, and
  616. `/summary` endpoints can now be routed to workers for both client API and
  617. federation requests.
  618. # Upgrading to v1.42.0
  619. ## Removal of old Room Admin API
  620. The following admin APIs were deprecated in [Synapse 1.25](https://github.com/matrix-org/synapse/blob/v1.25.0/CHANGES.md#removal-warning)
  621. (released on 2021-01-13) and have now been removed:
  622. - `POST /_synapse/admin/v1/purge_room`
  623. - `POST /_synapse/admin/v1/shutdown_room/<room_id>`
  624. Any scripts still using the above APIs should be converted to use the
  625. [Delete Room API](https://matrix-org.github.io/synapse/latest/admin_api/rooms.html#delete-room-api).
  626. ## User-interactive authentication fallback templates can now display errors
  627. This may affect you if you make use of custom HTML templates for the
  628. [reCAPTCHA (`synapse/res/templates/recaptcha.html`)](https://github.com/matrix-org/synapse/tree/develop/synapse/res/templates/recaptcha.html) or
  629. [terms (`synapse/res/templates/terms.html`)](https://github.com/matrix-org/synapse/tree/develop/synapse/res/templates/terms.html) fallback pages.
  630. The template is now provided an `error` variable if the authentication
  631. process failed. See the default templates linked above for an example.
  632. ## Removal of out-of-date email pushers
  633. Users will stop receiving message updates via email for addresses that were
  634. once, but not still, linked to their account.
  635. # Upgrading to v1.41.0
  636. ## Add support for routing outbound HTTP requests via a proxy for federation
  637. Since Synapse 1.6.0 (2019-11-26) you can set a proxy for outbound HTTP requests via
  638. http_proxy/https_proxy environment variables. This proxy was set for:
  639. - push
  640. - url previews
  641. - phone-home stats
  642. - recaptcha validation
  643. - CAS auth validation
  644. - OpenID Connect
  645. - Federation (checking public key revocation)
  646. In this version we have added support for outbound requests for:
  647. - Outbound federation
  648. - Downloading remote media
  649. - Fetching public keys of other servers
  650. These requests use the same proxy configuration. If you have a proxy configuration we
  651. recommend to verify the configuration. It may be necessary to adjust the `no_proxy`
  652. environment variable.
  653. See [using a forward proxy with Synapse documentation](setup/forward_proxy.md) for
  654. details.
  655. ## Deprecation of `template_dir`
  656. The `template_dir` settings in the `sso`, `account_validity` and `email` sections of the
  657. configuration file are now deprecated. Server admins should use the new
  658. `templates.custom_template_directory` setting in the configuration file and use one single
  659. custom template directory for all aforementioned features. Template file names remain
  660. unchanged. See [the related documentation](https://matrix-org.github.io/synapse/latest/templates.html)
  661. for more information and examples.
  662. We plan to remove support for these settings in October 2021.
  663. ## `/_synapse/admin/v1/users/{userId}/media` must be handled by media workers
  664. The [media repository worker documentation](https://matrix-org.github.io/synapse/latest/workers.html#synapseappmedia_repository)
  665. has been updated to reflect that calls to `/_synapse/admin/v1/users/{userId}/media`
  666. must now be handled by media repository workers. This is due to the new `DELETE` method
  667. of this endpoint modifying the media store.
  668. # Upgrading to v1.39.0
  669. ## Deprecation of the current third-party rules module interface
  670. The current third-party rules module interface is deprecated in favour of the new generic
  671. modules system introduced in Synapse v1.37.0. Authors of third-party rules modules can refer
  672. to [this documentation](modules/porting_legacy_module.md)
  673. to update their modules. Synapse administrators can refer to [this documentation](modules/index.md)
  674. to update their configuration once the modules they are using have been updated.
  675. We plan to remove support for the current third-party rules interface in September 2021.
  676. # Upgrading to v1.38.0
  677. ## Re-indexing of `events` table on Postgres databases
  678. This release includes a database schema update which requires re-indexing one of
  679. the larger tables in the database, `events`. This could result in increased
  680. disk I/O for several hours or days after upgrading while the migration
  681. completes. Furthermore, because we have to keep the old indexes until the new
  682. indexes are ready, it could result in a significant, temporary, increase in
  683. disk space.
  684. To get a rough idea of the disk space required, check the current size of one
  685. of the indexes. For example, from a `psql` shell, run the following sql:
  686. ```sql
  687. SELECT pg_size_pretty(pg_relation_size('events_order_room'));
  688. ```
  689. We need to rebuild **four** indexes, so you will need to multiply this result
  690. by four to give an estimate of the disk space required. For example, on one
  691. particular server:
  692. ```
  693. synapse=# select pg_size_pretty(pg_relation_size('events_order_room'));
  694. pg_size_pretty
  695. ----------------
  696. 288 MB
  697. (1 row)
  698. ```
  699. On this server, it would be wise to ensure that at least 1152MB are free.
  700. The additional disk space will be freed once the migration completes.
  701. SQLite databases are unaffected by this change.
  702. # Upgrading to v1.37.0
  703. ## Deprecation of the current spam checker interface
  704. The current spam checker interface is deprecated in favour of a new generic modules system.
  705. Authors of spam checker modules can refer to [this
  706. documentation](modules/porting_legacy_module.md
  707. to update their modules. Synapse administrators can refer to [this
  708. documentation](modules/index.md)
  709. to update their configuration once the modules they are using have been updated.
  710. We plan to remove support for the current spam checker interface in August 2021.
  711. More module interfaces will be ported over to this new generic system in future versions
  712. of Synapse.
  713. # Upgrading to v1.34.0
  714. ## `room_invite_state_types` configuration setting
  715. The `room_invite_state_types` configuration setting has been deprecated
  716. and replaced with `room_prejoin_state`. See the [sample configuration
  717. file](https://github.com/matrix-org/synapse/blob/v1.34.0/docs/sample_config.yaml#L1515).
  718. If you have set `room_invite_state_types` to the default value you
  719. should simply remove it from your configuration file. The default value
  720. used to be:
  721. ```yaml
  722. room_invite_state_types:
  723. - "m.room.join_rules"
  724. - "m.room.canonical_alias"
  725. - "m.room.avatar"
  726. - "m.room.encryption"
  727. - "m.room.name"
  728. ```
  729. If you have customised this value, you should remove
  730. `room_invite_state_types` and configure `room_prejoin_state` instead.
  731. # Upgrading to v1.33.0
  732. ## Account Validity HTML templates can now display a user's expiration date
  733. This may affect you if you have enabled the account validity feature,
  734. and have made use of a custom HTML template specified by the
  735. `account_validity.template_dir` or
  736. `account_validity.account_renewed_html_path` Synapse config options.
  737. The template can now accept an `expiration_ts` variable, which
  738. represents the unix timestamp in milliseconds for the future date of
  739. which their account has been renewed until. See the [default
  740. template](https://github.com/matrix-org/synapse/blob/release-v1.33.0/synapse/res/templates/account_renewed.html)
  741. for an example of usage.
  742. ALso note that a new HTML template, `account_previously_renewed.html`,
  743. has been added. This is is shown to users when they attempt to renew
  744. their account with a valid renewal token that has already been used
  745. before. The default template contents can been found
  746. [here](https://github.com/matrix-org/synapse/blob/release-v1.33.0/synapse/res/templates/account_previously_renewed.html),
  747. and can also accept an `expiration_ts` variable. This template replaces
  748. the error message users would previously see upon attempting to use a
  749. valid renewal token more than once.
  750. # Upgrading to v1.32.0
  751. ## Regression causing connected Prometheus instances to become overwhelmed
  752. This release introduces [a
  753. regression](https://github.com/matrix-org/synapse/issues/9853) that can
  754. overwhelm connected Prometheus instances. This issue is not present in
  755. Synapse v1.32.0rc1.
  756. If you have been affected, please downgrade to 1.31.0. You then may need
  757. to remove excess writeahead logs in order for Prometheus to recover.
  758. Instructions for doing so are provided
  759. [here](https://github.com/matrix-org/synapse/pull/9854#issuecomment-823472183).
  760. ## Dropping support for old Python, Postgres and SQLite versions
  761. In line with our [deprecation policy](deprecation_policy.md),
  762. we've dropped support for Python 3.5 and PostgreSQL 9.5, as they are no
  763. longer supported upstream.
  764. This release of Synapse requires Python 3.6+ and PostgresSQL 9.6+ or
  765. SQLite 3.22+.
  766. ## Removal of old List Accounts Admin API
  767. The deprecated v1 "list accounts" admin API
  768. (`GET /_synapse/admin/v1/users/<user_id>`) has been removed in this
  769. version.
  770. The [v2 list accounts API](admin_api/user_admin_api.md#list-accounts)
  771. has been available since Synapse 1.7.0 (2019-12-13), and is accessible
  772. under `GET /_synapse/admin/v2/users`.
  773. The deprecation of the old endpoint was announced with Synapse 1.28.0
  774. (released on 2021-02-25).
  775. ## Application Services must use type `m.login.application_service` when registering users
  776. In compliance with the [Application Service
  777. spec](https://matrix.org/docs/spec/application_service/r0.1.2#server-admin-style-permissions),
  778. Application Services are now required to use the
  779. `m.login.application_service` type when registering users via the
  780. `/_matrix/client/r0/register` endpoint. This behaviour was deprecated in
  781. Synapse v1.30.0.
  782. Please ensure your Application Services are up to date.
  783. # Upgrading to v1.29.0
  784. ## Requirement for X-Forwarded-Proto header
  785. When using Synapse with a reverse proxy (in particular, when using the
  786. `x_forwarded` option on an HTTP listener), Synapse now
  787. expects to receive an `X-Forwarded-Proto` header on incoming
  788. HTTP requests. If it is not set, Synapse will log a warning on each
  789. received request.
  790. To avoid the warning, administrators using a reverse proxy should ensure
  791. that the reverse proxy sets `X-Forwarded-Proto` header to
  792. `https` or `http` to indicate the protocol used
  793. by the client.
  794. Synapse also requires the `Host` header to be preserved.
  795. See the [reverse proxy documentation](reverse_proxy.md), where the
  796. example configurations have been updated to show how to set these
  797. headers.
  798. (Users of [Caddy](https://caddyserver.com/) are unaffected, since we
  799. believe it sets `X-Forwarded-Proto` by default.)
  800. # Upgrading to v1.27.0
  801. ## Changes to callback URI for OAuth2 / OpenID Connect and SAML2
  802. This version changes the URI used for callbacks from OAuth2 and SAML2
  803. identity providers:
  804. - If your server is configured for single sign-on via an OpenID
  805. Connect or OAuth2 identity provider, you will need to add
  806. `[synapse public baseurl]/_synapse/client/oidc/callback` to the list
  807. of permitted "redirect URIs" at the identity provider.
  808. See the [OpenID docs](openid.md) for more information on setting
  809. up OpenID Connect.
  810. - If your server is configured for single sign-on via a SAML2 identity
  811. provider, you will need to add
  812. `[synapse public baseurl]/_synapse/client/saml2/authn_response` as a
  813. permitted "ACS location" (also known as "allowed callback URLs")
  814. at the identity provider.
  815. The "Issuer" in the "AuthnRequest" to the SAML2 identity
  816. provider is also updated to
  817. `[synapse public baseurl]/_synapse/client/saml2/metadata.xml`. If
  818. your SAML2 identity provider uses this property to validate or
  819. otherwise identify Synapse, its configuration will need to be
  820. updated to use the new URL. Alternatively you could create a new,
  821. separate "EntityDescriptor" in your SAML2 identity provider with
  822. the new URLs and leave the URLs in the existing "EntityDescriptor"
  823. as they were.
  824. ## Changes to HTML templates
  825. The HTML templates for SSO and email notifications now have [Jinja2's
  826. autoescape](https://jinja.palletsprojects.com/en/2.11.x/api/#autoescaping)
  827. enabled for files ending in `.html`, `.htm`, and `.xml`. If you have
  828. customised these templates and see issues when viewing them you might
  829. need to update them. It is expected that most configurations will need
  830. no changes.
  831. If you have customised the templates *names* for these templates, it is
  832. recommended to verify they end in `.html` to ensure autoescape is
  833. enabled.
  834. The above applies to the following templates:
  835. - `add_threepid.html`
  836. - `add_threepid_failure.html`
  837. - `add_threepid_success.html`
  838. - `notice_expiry.html`
  839. - `notice_expiry.html`
  840. - `notif_mail.html` (which, by default, includes `room.html` and
  841. `notif.html`)
  842. - `password_reset.html`
  843. - `password_reset_confirmation.html`
  844. - `password_reset_failure.html`
  845. - `password_reset_success.html`
  846. - `registration.html`
  847. - `registration_failure.html`
  848. - `registration_success.html`
  849. - `sso_account_deactivated.html`
  850. - `sso_auth_bad_user.html`
  851. - `sso_auth_confirm.html`
  852. - `sso_auth_success.html`
  853. - `sso_error.html`
  854. - `sso_login_idp_picker.html`
  855. - `sso_redirect_confirm.html`
  856. # Upgrading to v1.26.0
  857. ## Rolling back to v1.25.0 after a failed upgrade
  858. v1.26.0 includes a lot of large changes. If something problematic
  859. occurs, you may want to roll-back to a previous version of Synapse.
  860. Because v1.26.0 also includes a new database schema version, reverting
  861. that version is also required alongside the generic rollback
  862. instructions mentioned above. In short, to roll back to v1.25.0 you need
  863. to:
  864. 1. Stop the server
  865. 2. Decrease the schema version in the database:
  866. ```sql
  867. UPDATE schema_version SET version = 58;
  868. ```
  869. 3. Delete the ignored users & chain cover data:
  870. ```sql
  871. DROP TABLE IF EXISTS ignored_users;
  872. UPDATE rooms SET has_auth_chain_index = false;
  873. ```
  874. For PostgreSQL run:
  875. ```sql
  876. TRUNCATE event_auth_chain_links;
  877. TRUNCATE event_auth_chains;
  878. ```
  879. For SQLite run:
  880. ```sql
  881. DELETE FROM event_auth_chain_links;
  882. DELETE FROM event_auth_chains;
  883. ```
  884. 4. Mark the deltas as not run (so they will re-run on upgrade).
  885. ```sql
  886. DELETE FROM applied_schema_deltas WHERE version = 59 AND file = "59/01ignored_user.py";
  887. DELETE FROM applied_schema_deltas WHERE version = 59 AND file = "59/06chain_cover_index.sql";
  888. ```
  889. 5. Downgrade Synapse by following the instructions for your
  890. installation method in the "Rolling back to older versions"
  891. section above.
  892. # Upgrading to v1.25.0
  893. ## Last release supporting Python 3.5
  894. This is the last release of Synapse which guarantees support with Python
  895. 3.5, which passed its upstream End of Life date several months ago.
  896. We will attempt to maintain support through March 2021, but without
  897. guarantees.
  898. In the future, Synapse will follow upstream schedules for ending support
  899. of older versions of Python and PostgreSQL. Please upgrade to at least
  900. Python 3.6 and PostgreSQL 9.6 as soon as possible.
  901. ## Blacklisting IP ranges
  902. Synapse v1.25.0 includes new settings, `ip_range_blacklist` and
  903. `ip_range_whitelist`, for controlling outgoing requests from Synapse for
  904. federation, identity servers, push, and for checking key validity for
  905. third-party invite events. The previous setting,
  906. `federation_ip_range_blacklist`, is deprecated. The new
  907. `ip_range_blacklist` defaults to private IP ranges if it is not defined.
  908. If you have never customised `federation_ip_range_blacklist` it is
  909. recommended that you remove that setting.
  910. If you have customised `federation_ip_range_blacklist` you should update
  911. the setting name to `ip_range_blacklist`.
  912. If you have a custom push server that is reached via private IP space
  913. you may need to customise `ip_range_blacklist` or `ip_range_whitelist`.
  914. # Upgrading to v1.24.0
  915. ## Custom OpenID Connect mapping provider breaking change
  916. This release allows the OpenID Connect mapping provider to perform
  917. normalisation of the localpart of the Matrix ID. This allows for the
  918. mapping provider to specify different algorithms, instead of the
  919. [default
  920. way](<https://matrix.org/docs/spec/appendices#mapping-from-other-character-sets>).
  921. If your Synapse configuration uses a custom mapping provider
  922. (`oidc_config.user_mapping_provider.module` is specified and
  923. not equal to
  924. `synapse.handlers.oidc_handler.JinjaOidcMappingProvider`)
  925. then you *must* ensure that `map_user_attributes` of the
  926. mapping provider performs some normalisation of the
  927. `localpart` returned. To match previous behaviour you can
  928. use the `map_username_to_mxid_localpart` function provided
  929. by Synapse. An example is shown below:
  930. ```python
  931. from synapse.types import map_username_to_mxid_localpart
  932. class MyMappingProvider:
  933. def map_user_attributes(self, userinfo, token):
  934. # ... your custom logic ...
  935. sso_user_id = ...
  936. localpart = map_username_to_mxid_localpart(sso_user_id)
  937. return {"localpart": localpart}
  938. ```
  939. ## Removal historical Synapse Admin API
  940. Historically, the Synapse Admin API has been accessible under:
  941. - `/_matrix/client/api/v1/admin`
  942. - `/_matrix/client/unstable/admin`
  943. - `/_matrix/client/r0/admin`
  944. - `/_synapse/admin/v1`
  945. The endpoints with `/_matrix/client/*` prefixes have been removed as of
  946. v1.24.0. The Admin API is now only accessible under:
  947. - `/_synapse/admin/v1`
  948. The only exception is the `/admin/whois` endpoint, which is
  949. [also available via the client-server
  950. API](https://matrix.org/docs/spec/client_server/r0.6.1#get-matrix-client-r0-admin-whois-userid).
  951. The deprecation of the old endpoints was announced with Synapse 1.20.0
  952. (released on 2020-09-22) and makes it easier for homeserver admins to
  953. lock down external access to the Admin API endpoints.
  954. # Upgrading to v1.23.0
  955. ## Structured logging configuration breaking changes
  956. This release deprecates use of the `structured: true` logging
  957. configuration for structured logging. If your logging configuration
  958. contains `structured: true` then it should be modified based on the
  959. [structured logging documentation](https://matrix-org.github.io/synapse/v1.56/structured_logging.html#upgrading-from-legacy-structured-logging-configuration).
  960. The `structured` and `drains` logging options are now deprecated and
  961. should be replaced by standard logging configuration of `handlers` and
  962. `formatters`.
  963. A future will release of Synapse will make using `structured: true` an
  964. error.
  965. # Upgrading to v1.22.0
  966. ## ThirdPartyEventRules breaking changes
  967. This release introduces a backwards-incompatible change to modules
  968. making use of `ThirdPartyEventRules` in Synapse. If you make use of a
  969. module defined under the `third_party_event_rules` config option, please
  970. make sure it is updated to handle the below change:
  971. The `http_client` argument is no longer passed to modules as they are
  972. initialised. Instead, modules are expected to make use of the
  973. `http_client` property on the `ModuleApi` class. Modules are now passed
  974. a `module_api` argument during initialisation, which is an instance of
  975. `ModuleApi`. `ModuleApi` instances have a `http_client` property which
  976. acts the same as the `http_client` argument previously passed to
  977. `ThirdPartyEventRules` modules.
  978. # Upgrading to v1.21.0
  979. ## Forwarding `/_synapse/client` through your reverse proxy
  980. The [reverse proxy documentation](reverse_proxy.md)
  981. has been updated to include reverse proxy directives for
  982. `/_synapse/client/*` endpoints. As the user password reset flow now uses
  983. endpoints under this prefix, **you must update your reverse proxy
  984. configurations for user password reset to work**.
  985. Additionally, note that the [Synapse worker documentation](workers.md) has been updated to
  986. : state that the `/_synapse/client/password_reset/email/submit_token`
  987. endpoint can be handled
  988. by all workers. If you make use of Synapse's worker feature, please
  989. update your reverse proxy configuration to reflect this change.
  990. ## New HTML templates
  991. A new HTML template,
  992. [password_reset_confirmation.html](https://github.com/matrix-org/synapse/blob/develop/synapse/res/templates/password_reset_confirmation.html),
  993. has been added to the `synapse/res/templates` directory. If you are
  994. using a custom template directory, you may want to copy the template
  995. over and modify it.
  996. Note that as of v1.20.0, templates do not need to be included in custom
  997. template directories for Synapse to start. The default templates will be
  998. used if a custom template cannot be found.
  999. This page will appear to the user after clicking a password reset link
  1000. that has been emailed to them.
  1001. To complete password reset, the page must include a way to make a
  1002. `POST` request to
  1003. `/_synapse/client/password_reset/{medium}/submit_token` with the query
  1004. parameters from the original link, presented as a URL-encoded form. See
  1005. the file itself for more details.
  1006. ## Updated Single Sign-on HTML Templates
  1007. The `saml_error.html` template was removed from Synapse and replaced
  1008. with the `sso_error.html` template. If your Synapse is configured to use
  1009. SAML and a custom `sso_redirect_confirm_template_dir` configuration then
  1010. any customisations of the `saml_error.html` template will need to be
  1011. merged into the `sso_error.html` template. These templates are similar,
  1012. but the parameters are slightly different:
  1013. - The `msg` parameter should be renamed to `error_description`.
  1014. - There is no longer a `code` parameter for the response code.
  1015. - A string `error` parameter is available that includes a short hint
  1016. of why a user is seeing the error page.
  1017. # Upgrading to v1.18.0
  1018. ## Docker `-py3` suffix will be removed in future versions
  1019. From 10th August 2020, we will no longer publish Docker images with the
  1020. `-py3` tag suffix. The images tagged with the
  1021. `-py3` suffix have been identical to the non-suffixed tags
  1022. since release 0.99.0, and the suffix is obsolete.
  1023. On 10th August, we will remove the `latest-py3` tag.
  1024. Existing per-release tags (such as `v1.18.0-py3` will not
  1025. be removed, but no new `-py3` tags will be added.
  1026. Scripts relying on the `-py3` suffix will need to be
  1027. updated.
  1028. ## Redis replication is now recommended in lieu of TCP replication
  1029. When setting up worker processes, we now recommend the use of a Redis
  1030. server for replication. **The old direct TCP connection method is
  1031. deprecated and will be removed in a future release.** See
  1032. the [worker documentation](https://matrix-org.github.io/synapse/v1.66/workers.html) for more details.
  1033. # Upgrading to v1.14.0
  1034. This version includes a database update which is run as part of the
  1035. upgrade, and which may take a couple of minutes in the case of a large
  1036. server. Synapse will not respond to HTTP requests while this update is
  1037. taking place.
  1038. # Upgrading to v1.13.0
  1039. ## Incorrect database migration in old synapse versions
  1040. A bug was introduced in Synapse 1.4.0 which could cause the room
  1041. directory to be incomplete or empty if Synapse was upgraded directly
  1042. from v1.2.1 or earlier, to versions between v1.4.0 and v1.12.x.
  1043. This will *not* be a problem for Synapse installations which were:
  1044. : - created at v1.4.0 or later,
  1045. - upgraded via v1.3.x, or
  1046. - upgraded straight from v1.2.1 or earlier to v1.13.0 or later.
  1047. If completeness of the room directory is a concern, installations which
  1048. are affected can be repaired as follows:
  1049. 1. Run the following sql from a `psql` or
  1050. `sqlite3` console:
  1051. ```sql
  1052. INSERT INTO background_updates (update_name, progress_json, depends_on) VALUES
  1053. ('populate_stats_process_rooms', '{}', 'current_state_events_membership');
  1054. INSERT INTO background_updates (update_name, progress_json, depends_on) VALUES
  1055. ('populate_stats_process_users', '{}', 'populate_stats_process_rooms');
  1056. ```
  1057. 2. Restart synapse.
  1058. ## New Single Sign-on HTML Templates
  1059. New templates (`sso_auth_confirm.html`, `sso_auth_success.html`, and
  1060. `sso_account_deactivated.html`) were added to Synapse. If your Synapse
  1061. is configured to use SSO and a custom
  1062. `sso_redirect_confirm_template_dir` configuration then these templates
  1063. will need to be copied from
  1064. [`synapse/res/templates`](https://github.com/matrix-org/synapse/tree/develop/synapse/res/templates) into that directory.
  1065. ## Synapse SSO Plugins Method Deprecation
  1066. Plugins using the `complete_sso_login` method of
  1067. `synapse.module_api.ModuleApi` should update to using the async/await
  1068. version `complete_sso_login_async` which includes additional checks. The
  1069. non-async version is considered deprecated.
  1070. ## Rolling back to v1.12.4 after a failed upgrade
  1071. v1.13.0 includes a lot of large changes. If something problematic
  1072. occurs, you may want to roll-back to a previous version of Synapse.
  1073. Because v1.13.0 also includes a new database schema version, reverting
  1074. that version is also required alongside the generic rollback
  1075. instructions mentioned above. In short, to roll back to v1.12.4 you need
  1076. to:
  1077. 1. Stop the server
  1078. 2. Decrease the schema version in the database:
  1079. ```sql
  1080. UPDATE schema_version SET version = 57;
  1081. ```
  1082. 3. Downgrade Synapse by following the instructions for your
  1083. installation method in the "Rolling back to older versions"
  1084. section above.
  1085. # Upgrading to v1.12.0
  1086. This version includes a database update which is run as part of the
  1087. upgrade, and which may take some time (several hours in the case of a
  1088. large server). Synapse will not respond to HTTP requests while this
  1089. update is taking place.
  1090. This is only likely to be a problem in the case of a server which is
  1091. participating in many rooms.
  1092. 0. As with all upgrades, it is recommended that you have a recent
  1093. backup of your database which can be used for recovery in the event
  1094. of any problems.
  1095. 1. As an initial check to see if you will be affected, you can try
  1096. running the following query from the `psql` or
  1097. `sqlite3` console. It is safe to run it while Synapse is
  1098. still running.
  1099. ```sql
  1100. SELECT MAX(q.v) FROM (
  1101. SELECT (
  1102. SELECT ej.json AS v
  1103. FROM state_events se INNER JOIN event_json ej USING (event_id)
  1104. WHERE se.room_id=rooms.room_id AND se.type='m.room.create' AND se.state_key=''
  1105. LIMIT 1
  1106. ) FROM rooms WHERE rooms.room_version IS NULL
  1107. ) q;
  1108. ```
  1109. This query will take about the same amount of time as the upgrade
  1110. process: ie, if it takes 5 minutes, then it is likely that Synapse
  1111. will be unresponsive for 5 minutes during the upgrade.
  1112. If you consider an outage of this duration to be acceptable, no
  1113. further action is necessary and you can simply start Synapse 1.12.0.
  1114. If you would prefer to reduce the downtime, continue with the steps
  1115. below.
  1116. 2. The easiest workaround for this issue is to manually create a new
  1117. index before upgrading. On PostgreSQL, his can be done as follows:
  1118. ```sql
  1119. CREATE INDEX CONCURRENTLY tmp_upgrade_1_12_0_index
  1120. ON state_events(room_id) WHERE type = 'm.room.create';
  1121. ```
  1122. The above query may take some time, but is also safe to run while
  1123. Synapse is running.
  1124. We assume that no SQLite users have databases large enough to be
  1125. affected. If you *are* affected, you can run a similar query,
  1126. omitting the `CONCURRENTLY` keyword. Note however that this
  1127. operation may in itself cause Synapse to stop running for some time.
  1128. Synapse admins are reminded that [SQLite is not recommended for use
  1129. outside a test environment](postgres.md).
  1130. 3. Once the index has been created, the `SELECT` query in step 1 above
  1131. should complete quickly. It is therefore safe to upgrade to Synapse
  1132. 1.12.0.
  1133. 4. Once Synapse 1.12.0 has successfully started and is responding to
  1134. HTTP requests, the temporary index can be removed:
  1135. ```sql
  1136. DROP INDEX tmp_upgrade_1_12_0_index;
  1137. ```
  1138. # Upgrading to v1.10.0
  1139. Synapse will now log a warning on start up if used with a PostgreSQL
  1140. database that has a non-recommended locale set.
  1141. See [Postgres](postgres.md) for details.
  1142. # Upgrading to v1.8.0
  1143. Specifying a `log_file` config option will now cause Synapse to refuse
  1144. to start, and should be replaced by with the `log_config` option.
  1145. Support for the `log_file` option was removed in v1.3.0 and has since
  1146. had no effect.
  1147. # Upgrading to v1.7.0
  1148. In an attempt to configure Synapse in a privacy preserving way, the
  1149. default behaviours of `allow_public_rooms_without_auth` and
  1150. `allow_public_rooms_over_federation` have been inverted. This means that
  1151. by default, only authenticated users querying the Client/Server API will
  1152. be able to query the room directory, and relatedly that the server will
  1153. not share room directory information with other servers over federation.
  1154. If your installation does not explicitly set these settings one way or
  1155. the other and you want either setting to be `true` then it will
  1156. necessary to update your homeserver configuration file accordingly.
  1157. For more details on the surrounding context see our
  1158. [explainer](https://matrix.org/blog/2019/11/09/avoiding-unwelcome-visitors-on-private-matrix-servers).
  1159. # Upgrading to v1.5.0
  1160. This release includes a database migration which may take several
  1161. minutes to complete if there are a large number (more than a million or
  1162. so) of entries in the `devices` table. This is only likely to a be a
  1163. problem on very large installations.
  1164. # Upgrading to v1.4.0
  1165. ## New custom templates
  1166. If you have configured a custom template directory with the
  1167. `email.template_dir` option, be aware that there are new templates
  1168. regarding registration and threepid management (see below) that must be
  1169. included.
  1170. - `registration.html` and `registration.txt`
  1171. - `registration_success.html` and `registration_failure.html`
  1172. - `add_threepid.html` and `add_threepid.txt`
  1173. - `add_threepid_failure.html` and `add_threepid_success.html`
  1174. Synapse will expect these files to exist inside the configured template
  1175. directory, and **will fail to start** if they are absent. To view the
  1176. default templates, see
  1177. [synapse/res/templates](https://github.com/matrix-org/synapse/tree/master/synapse/res/templates).
  1178. ## 3pid verification changes
  1179. **Note: As of this release, users will be unable to add phone numbers or
  1180. email addresses to their accounts, without changes to the Synapse
  1181. configuration. This includes adding an email address during
  1182. registration.**
  1183. It is possible for a user to associate an email address or phone number
  1184. with their account, for a number of reasons:
  1185. - for use when logging in, as an alternative to the user id.
  1186. - in the case of email, as an alternative contact to help with account
  1187. recovery.
  1188. - in the case of email, to receive notifications of missed messages.
  1189. Before an email address or phone number can be added to a user's
  1190. account, or before such an address is used to carry out a
  1191. password-reset, Synapse must confirm the operation with the owner of the
  1192. email address or phone number. It does this by sending an email or text
  1193. giving the user a link or token to confirm receipt. This process is
  1194. known as '3pid verification'. ('3pid', or 'threepid', stands for
  1195. third-party identifier, and we use it to refer to external identifiers
  1196. such as email addresses and phone numbers.)
  1197. Previous versions of Synapse delegated the task of 3pid verification to
  1198. an identity server by default. In most cases this server is `vector.im`
  1199. or `matrix.org`.
  1200. In Synapse 1.4.0, for security and privacy reasons, the homeserver will
  1201. no longer delegate this task to an identity server by default. Instead,
  1202. the server administrator will need to explicitly decide how they would
  1203. like the verification messages to be sent.
  1204. In the medium term, the `vector.im` and `matrix.org` identity servers
  1205. will disable support for delegated 3pid verification entirely. However,
  1206. in order to ease the transition, they will retain the capability for a
  1207. limited period. Delegated email verification will be disabled on Monday
  1208. 2nd December 2019 (giving roughly 2 months notice). Disabling delegated
  1209. SMS verification will follow some time after that once SMS verification
  1210. support lands in Synapse.
  1211. Once delegated 3pid verification support has been disabled in the
  1212. `vector.im` and `matrix.org` identity servers, all Synapse versions that
  1213. depend on those instances will be unable to verify email and phone
  1214. numbers through them. There are no imminent plans to remove delegated
  1215. 3pid verification from Sydent generally. (Sydent is the identity server
  1216. project that backs the `vector.im` and `matrix.org` instances).
  1217. ### Email
  1218. Following upgrade, to continue verifying email (e.g. as part of the
  1219. registration process), admins can either:-
  1220. - Configure Synapse to use an email server.
  1221. - Run or choose an identity server which allows delegated email
  1222. verification and delegate to it.
  1223. #### Configure SMTP in Synapse
  1224. To configure an SMTP server for Synapse, modify the configuration
  1225. section headed `email`, and be sure to have at least the
  1226. `smtp_host, smtp_port` and `notif_from` fields filled out.
  1227. You may also need to set `smtp_user`, `smtp_pass`, and
  1228. `require_transport_security`.
  1229. See the [sample configuration file](usage/configuration/homeserver_sample_config.md)
  1230. for more details on these settings.
  1231. #### Delegate email to an identity server
  1232. Some admins will wish to continue using email verification as part of
  1233. the registration process, but will not immediately have an appropriate
  1234. SMTP server at hand.
  1235. To this end, we will continue to support email verification delegation
  1236. via the `vector.im` and `matrix.org` identity servers for two months.
  1237. Support for delegated email verification will be disabled on Monday 2nd
  1238. December.
  1239. The `account_threepid_delegates` dictionary defines whether the
  1240. homeserver should delegate an external server (typically an [identity
  1241. server](https://matrix.org/docs/spec/identity_service/r0.2.1)) to handle
  1242. sending confirmation messages via email and SMS.
  1243. So to delegate email verification, in `homeserver.yaml`, set
  1244. `account_threepid_delegates.email` to the base URL of an identity
  1245. server. For example:
  1246. ```yaml
  1247. account_threepid_delegates:
  1248. email: https://example.com # Delegate email sending to example.com
  1249. ```
  1250. Note that `account_threepid_delegates.email` replaces the deprecated
  1251. `email.trust_identity_server_for_password_resets`: if
  1252. `email.trust_identity_server_for_password_resets` is set to `true`, and
  1253. `account_threepid_delegates.email` is not set, then the first entry in
  1254. `trusted_third_party_id_servers` will be used as the
  1255. `account_threepid_delegate` for email. This is to ensure compatibility
  1256. with existing Synapse installs that set up external server handling for
  1257. these tasks before v1.4.0. If
  1258. `email.trust_identity_server_for_password_resets` is `true` and no
  1259. trusted identity server domains are configured, Synapse will report an
  1260. error and refuse to start.
  1261. If `email.trust_identity_server_for_password_resets` is `false` or
  1262. absent and no `email` delegate is configured in
  1263. `account_threepid_delegates`, then Synapse will send email verification
  1264. messages itself, using the configured SMTP server (see above). that
  1265. type.
  1266. ### Phone numbers
  1267. Synapse does not support phone-number verification itself, so the only
  1268. way to maintain the ability for users to add phone numbers to their
  1269. accounts will be by continuing to delegate phone number verification to
  1270. the `matrix.org` and `vector.im` identity servers (or another identity
  1271. server that supports SMS sending).
  1272. The `account_threepid_delegates` dictionary defines whether the
  1273. homeserver should delegate an external server (typically an [identity
  1274. server](https://matrix.org/docs/spec/identity_service/r0.2.1)) to handle
  1275. sending confirmation messages via email and SMS.
  1276. So to delegate phone number verification, in `homeserver.yaml`, set
  1277. `account_threepid_delegates.msisdn` to the base URL of an identity
  1278. server. For example:
  1279. ```yaml
  1280. account_threepid_delegates:
  1281. msisdn: https://example.com # Delegate sms sending to example.com
  1282. ```
  1283. The `matrix.org` and `vector.im` identity servers will continue to
  1284. support delegated phone number verification via SMS until such time as
  1285. it is possible for admins to configure their servers to perform phone
  1286. number verification directly. More details will follow in a future
  1287. release.
  1288. ## Rolling back to v1.3.1
  1289. If you encounter problems with v1.4.0, it should be possible to roll
  1290. back to v1.3.1, subject to the following:
  1291. - The 'room statistics' engine was heavily reworked in this release
  1292. (see [#5971](https://github.com/matrix-org/synapse/pull/5971)),
  1293. including significant changes to the database schema, which are not
  1294. easily reverted. This will cause the room statistics engine to stop
  1295. updating when you downgrade.
  1296. The room statistics are essentially unused in v1.3.1 (in future
  1297. versions of Synapse, they will be used to populate the room
  1298. directory), so there should be no loss of functionality. However,
  1299. the statistics engine will write errors to the logs, which can be
  1300. avoided by setting the following in `homeserver.yaml`:
  1301. ```yaml
  1302. stats:
  1303. enabled: false
  1304. ```
  1305. Don't forget to re-enable it when you upgrade again, in preparation
  1306. for its use in the room directory!
  1307. # Upgrading to v1.2.0
  1308. Some counter metrics have been renamed, with the old names deprecated.
  1309. See [the metrics
  1310. documentation](metrics-howto.md#renaming-of-metrics--deprecation-of-old-names-in-12)
  1311. for details.
  1312. # Upgrading to v1.1.0
  1313. Synapse v1.1.0 removes support for older Python and PostgreSQL versions,
  1314. as outlined in [our deprecation
  1315. notice](https://matrix.org/blog/2019/04/08/synapse-deprecating-postgres-9-4-and-python-2-x).
  1316. ## Minimum Python Version
  1317. Synapse v1.1.0 has a minimum Python requirement of Python 3.5. Python
  1318. 3.6 or Python 3.7 are recommended as they have improved internal string
  1319. handling, significantly reducing memory usage.
  1320. If you use current versions of the Matrix.org-distributed Debian
  1321. packages or Docker images, action is not required.
  1322. If you install Synapse in a Python virtual environment, please see
  1323. "Upgrading to v0.34.0" for notes on setting up a new virtualenv under
  1324. Python 3.
  1325. ## Minimum PostgreSQL Version
  1326. If using PostgreSQL under Synapse, you will need to use PostgreSQL 9.5
  1327. or above. Please see the [PostgreSQL
  1328. documentation](https://www.postgresql.org/docs/11/upgrading.html) for
  1329. more details on upgrading your database.
  1330. # Upgrading to v1.0
  1331. ## Validation of TLS certificates
  1332. Synapse v1.0 is the first release to enforce validation of TLS
  1333. certificates for the federation API. It is therefore essential that your
  1334. certificates are correctly configured.
  1335. Note, v1.0 installations will also no longer be able to federate with
  1336. servers that have not correctly configured their certificates.
  1337. In rare cases, it may be desirable to disable certificate checking: for
  1338. example, it might be essential to be able to federate with a given
  1339. legacy server in a closed federation. This can be done in one of two
  1340. ways:-
  1341. - Configure the global switch `federation_verify_certificates` to
  1342. `false`.
  1343. - Configure a whitelist of server domains to trust via
  1344. `federation_certificate_verification_whitelist`.
  1345. See the [sample configuration file](usage/configuration/homeserver_sample_config.md)
  1346. for more details on these settings.
  1347. ## Email
  1348. When a user requests a password reset, Synapse will send an email to the
  1349. user to confirm the request.
  1350. Previous versions of Synapse delegated the job of sending this email to
  1351. an identity server. If the identity server was somehow malicious or
  1352. became compromised, it would be theoretically possible to hijack an
  1353. account through this means.
  1354. Therefore, by default, Synapse v1.0 will send the confirmation email
  1355. itself. If Synapse is not configured with an SMTP server, password reset
  1356. via email will be disabled.
  1357. To configure an SMTP server for Synapse, modify the configuration
  1358. section headed `email`, and be sure to have at least the `smtp_host`,
  1359. `smtp_port` and `notif_from` fields filled out. You may also need to set
  1360. `smtp_user`, `smtp_pass`, and `require_transport_security`.
  1361. If you are absolutely certain that you wish to continue using an
  1362. identity server for password resets, set
  1363. `trust_identity_server_for_password_resets` to `true`.
  1364. See the [sample configuration file](usage/configuration/homeserver_sample_config.md)
  1365. for more details on these settings.
  1366. ## New email templates
  1367. Some new templates have been added to the default template directory for the purpose of
  1368. the homeserver sending its own password reset emails. If you have configured a
  1369. custom `template_dir` in your Synapse config, these files will need to be added.
  1370. `password_reset.html` and `password_reset.txt` are HTML and plain text
  1371. templates respectively that contain the contents of what will be emailed
  1372. to the user upon attempting to reset their password via email.
  1373. `password_reset_success.html` and `password_reset_failure.html` are HTML
  1374. files that the content of which (assuming no redirect URL is set) will
  1375. be shown to the user after they attempt to click the link in the email
  1376. sent to them.
  1377. # Upgrading to v0.99.0
  1378. Please be aware that, before Synapse v1.0 is released around March 2019,
  1379. you will need to replace any self-signed certificates with those
  1380. verified by a root CA. Information on how to do so can be found at the
  1381. ACME docs.
  1382. # Upgrading to v0.34.0
  1383. 1. This release is the first to fully support Python 3. Synapse will
  1384. now run on Python versions 3.5, or 3.6 (as well as 2.7). We
  1385. recommend switching to Python 3, as it has been shown to give
  1386. performance improvements.
  1387. For users who have installed Synapse into a virtualenv, we recommend
  1388. doing this by creating a new virtualenv. For example:
  1389. ```sh
  1390. virtualenv -p python3 ~/synapse/env3
  1391. source ~/synapse/env3/bin/activate
  1392. pip install matrix-synapse
  1393. ```
  1394. You can then start synapse as normal, having activated the new
  1395. virtualenv:
  1396. ```sh
  1397. cd ~/synapse
  1398. source env3/bin/activate
  1399. synctl start
  1400. ```
  1401. Users who have installed from distribution packages should see the
  1402. relevant package documentation. See below for notes on Debian
  1403. packages.
  1404. - When upgrading to Python 3, you **must** make sure that your log
  1405. files are configured as UTF-8, by adding `encoding: utf8` to the
  1406. `RotatingFileHandler` configuration (if you have one) in your
  1407. `<server>.log.config` file. For example, if your `log.config`
  1408. file contains:
  1409. ```yaml
  1410. handlers:
  1411. file:
  1412. class: logging.handlers.RotatingFileHandler
  1413. formatter: precise
  1414. filename: homeserver.log
  1415. maxBytes: 104857600
  1416. backupCount: 10
  1417. filters: [context]
  1418. console:
  1419. class: logging.StreamHandler
  1420. formatter: precise
  1421. filters: [context]
  1422. ```
  1423. Then you should update this to be:
  1424. ```yaml
  1425. handlers:
  1426. file:
  1427. class: logging.handlers.RotatingFileHandler
  1428. formatter: precise
  1429. filename: homeserver.log
  1430. maxBytes: 104857600
  1431. backupCount: 10
  1432. filters: [context]
  1433. encoding: utf8
  1434. console:
  1435. class: logging.StreamHandler
  1436. formatter: precise
  1437. filters: [context]
  1438. ```
  1439. There is no need to revert this change if downgrading to
  1440. Python 2.
  1441. We are also making available Debian packages which will run Synapse
  1442. on Python 3. You can switch to these packages with
  1443. `apt-get install matrix-synapse-py3`, however, please read
  1444. [debian/NEWS](https://github.com/matrix-org/synapse/blob/release-v0.34.0/debian/NEWS)
  1445. before doing so. The existing `matrix-synapse` packages will
  1446. continue to use Python 2 for the time being.
  1447. 2. This release removes the `riot.im` from the default list of trusted
  1448. identity servers.
  1449. If `riot.im` is in your homeserver's list of
  1450. `trusted_third_party_id_servers`, you should remove it. It was added
  1451. in case a hypothetical future identity server was put there. If you
  1452. don't remove it, users may be unable to deactivate their accounts.
  1453. 3. This release no longer installs the (unmaintained) Matrix Console
  1454. web client as part of the default installation. It is possible to
  1455. re-enable it by installing it separately and setting the
  1456. `web_client_location` config option, but please consider switching
  1457. to another client.
  1458. # Upgrading to v0.33.7
  1459. This release removes the example email notification templates from
  1460. `res/templates` (they are now internal to the python package). This
  1461. should only affect you if you (a) deploy your Synapse instance from a
  1462. git checkout or a github snapshot URL, and (b) have email notifications
  1463. enabled.
  1464. If you have email notifications enabled, you should ensure that
  1465. `email.template_dir` is either configured to point at a directory where
  1466. you have installed customised templates, or leave it unset to use the
  1467. default templates.
  1468. # Upgrading to v0.27.3
  1469. This release expands the anonymous usage stats sent if the opt-in
  1470. `report_stats` configuration is set to `true`. We now capture RSS memory
  1471. and cpu use at a very coarse level. This requires administrators to
  1472. install the optional `psutil` python module.
  1473. We would appreciate it if you could assist by ensuring this module is
  1474. available and `report_stats` is enabled. This will let us see if
  1475. performance changes to synapse are having an impact to the general
  1476. community.
  1477. # Upgrading to v0.15.0
  1478. If you want to use the new URL previewing API
  1479. (`/_matrix/media/r0/preview_url`) then you have to explicitly enable it
  1480. in the config and update your dependencies dependencies. See README.rst
  1481. for details.
  1482. # Upgrading to v0.11.0
  1483. This release includes the option to send anonymous usage stats to
  1484. matrix.org, and requires that administrators explictly opt in or out by
  1485. setting the `report_stats` option to either `true` or `false`.
  1486. We would really appreciate it if you could help our project out by
  1487. reporting anonymized usage statistics from your homeserver. Only very
  1488. basic aggregate data (e.g. number of users) will be reported, but it
  1489. helps us to track the growth of the Matrix community, and helps us to
  1490. make Matrix a success, as well as to convince other networks that they
  1491. should peer with us.
  1492. # Upgrading to v0.9.0
  1493. Application services have had a breaking API change in this version.
  1494. They can no longer register themselves with a home server using the AS
  1495. HTTP API. This decision was made because a compromised application
  1496. service with free reign to register any regex in effect grants full
  1497. read/write access to the home server if a regex of `.*` is used. An
  1498. attack where a compromised AS re-registers itself with `.*` was deemed
  1499. too big of a security risk to ignore, and so the ability to register
  1500. with the HS remotely has been removed.
  1501. It has been replaced by specifying a list of application service
  1502. registrations in `homeserver.yaml`:
  1503. ```yaml
  1504. app_service_config_files: ["registration-01.yaml", "registration-02.yaml"]
  1505. ```
  1506. Where `registration-01.yaml` looks like:
  1507. ```yaml
  1508. url: <String> # e.g. "https://my.application.service.com"
  1509. as_token: <String>
  1510. hs_token: <String>
  1511. sender_localpart: <String> # This is a new field which denotes the user_id localpart when using the AS token
  1512. namespaces:
  1513. users:
  1514. - exclusive: <Boolean>
  1515. regex: <String> # e.g. "@prefix_.*"
  1516. aliases:
  1517. - exclusive: <Boolean>
  1518. regex: <String>
  1519. rooms:
  1520. - exclusive: <Boolean>
  1521. regex: <String>
  1522. ```
  1523. # Upgrading to v0.8.0
  1524. Servers which use captchas will need to add their public key to:
  1525. static/client/register/register_config.js
  1526. window.matrixRegistrationConfig = {
  1527. recaptcha_public_key: "YOUR_PUBLIC_KEY"
  1528. };
  1529. This is required in order to support registration fallback (typically
  1530. used on mobile devices).
  1531. # Upgrading to v0.7.0
  1532. New dependencies are:
  1533. - pydenticon
  1534. - simplejson
  1535. - syutil
  1536. - matrix-angular-sdk
  1537. To pull in these dependencies in a virtual env, run:
  1538. python synapse/python_dependencies.py | xargs -n 1 pip install
  1539. # Upgrading to v0.6.0
  1540. To pull in new dependencies, run:
  1541. python setup.py develop --user
  1542. This update includes a change to the database schema. To upgrade you
  1543. first need to upgrade the database by running:
  1544. python scripts/upgrade_db_to_v0.6.0.py <db> <server_name> <signing_key>
  1545. Where `<db>` is the location of the database,
  1546. `<server_name>` is the server name as specified in the
  1547. synapse configuration, and `<signing_key>` is the location
  1548. of the signing key as specified in the synapse configuration.
  1549. This may take some time to complete. Failures of signatures and content
  1550. hashes can safely be ignored.
  1551. # Upgrading to v0.5.1
  1552. Depending on precisely when you installed v0.5.0 you may have ended up
  1553. with a stale release of the reference matrix webclient installed as a
  1554. python module. To uninstall it and ensure you are depending on the
  1555. latest module, please run:
  1556. $ pip uninstall syweb
  1557. # Upgrading to v0.5.0
  1558. The webclient has been split out into a seperate repository/pacakage in
  1559. this release. Before you restart your homeserver you will need to pull
  1560. in the webclient package by running:
  1561. python setup.py develop --user
  1562. This release completely changes the database schema and so requires
  1563. upgrading it before starting the new version of the homeserver.
  1564. The script "database-prepare-for-0.5.0.sh" should be used to upgrade
  1565. the database. This will save all user information, such as logins and
  1566. profiles, but will otherwise purge the database. This includes messages,
  1567. which rooms the home server was a member of and room alias mappings.
  1568. If you would like to keep your history, please take a copy of your
  1569. database file and ask for help in #matrix:matrix.org. The upgrade
  1570. process is, unfortunately, non trivial and requires human intervention
  1571. to resolve any resulting conflicts during the upgrade process.
  1572. Before running the command the homeserver should be first completely
  1573. shutdown. To run it, simply specify the location of the database, e.g.:
  1574. > ./scripts/database-prepare-for-0.5.0.sh "homeserver.db"
  1575. Once this has successfully completed it will be safe to restart the
  1576. homeserver. You may notice that the homeserver takes a few seconds
  1577. longer to restart than usual as it reinitializes the database.
  1578. On startup of the new version, users can either rejoin remote rooms
  1579. using room aliases or by being reinvited. Alternatively, if any other
  1580. homeserver sends a message to a room that the homeserver was previously
  1581. in the local HS will automatically rejoin the room.
  1582. # Upgrading to v0.4.0
  1583. This release needs an updated syutil version. Run:
  1584. python setup.py develop
  1585. You will also need to upgrade your configuration as the signing key
  1586. format has changed. Run:
  1587. python -m synapse.app.homeserver --config-path <CONFIG> --generate-config
  1588. # Upgrading to v0.3.0
  1589. This registration API now closely matches the login API. This introduces
  1590. a bit more backwards and forwards between the HS and the client, but
  1591. this improves the overall flexibility of the API. You can now GET on
  1592. /register to retrieve a list of valid registration flows. Upon choosing
  1593. one, they are submitted in the same way as login, e.g:
  1594. {
  1595. type: m.login.password,
  1596. user: foo,
  1597. password: bar
  1598. }
  1599. The default HS supports 2 flows, with and without Identity Server email
  1600. authentication. Enabling captcha on the HS will add in an extra step to
  1601. all flows: `m.login.recaptcha` which must be completed before you can
  1602. transition to the next stage. There is a new login type:
  1603. `m.login.email.identity` which contains the `threepidCreds` key which
  1604. were previously sent in the original register request. For more
  1605. information on this, see the specification.
  1606. ## Web Client
  1607. The VoIP specification has changed between v0.2.0 and v0.3.0. Users
  1608. should refresh any browser tabs to get the latest web client code. Users
  1609. on v0.2.0 of the web client will not be able to call those on v0.3.0 and
  1610. vice versa.
  1611. # Upgrading to v0.2.0
  1612. The home server now requires setting up of SSL config before it can run.
  1613. To automatically generate default config use:
  1614. $ python synapse/app/homeserver.py \
  1615. --server-name machine.my.domain.name \
  1616. --bind-port 8448 \
  1617. --config-path homeserver.config \
  1618. --generate-config
  1619. This config can be edited if desired, for example to specify a different
  1620. SSL certificate to use. Once done you can run the home server using:
  1621. $ python synapse/app/homeserver.py --config-path homeserver.config
  1622. See the README.rst for more information.
  1623. Also note that some config options have been renamed, including:
  1624. - "host" to "server-name"
  1625. - "database" to "database-path"
  1626. - "port" to "bind-port" and "unsecure-port"
  1627. # Upgrading to v0.0.1
  1628. This release completely changes the database schema and so requires
  1629. upgrading it before starting the new version of the homeserver.
  1630. The script "database-prepare-for-0.0.1.sh" should be used to upgrade
  1631. the database. This will save all user information, such as logins and
  1632. profiles, but will otherwise purge the database. This includes messages,
  1633. which rooms the home server was a member of and room alias mappings.
  1634. Before running the command the homeserver should be first completely
  1635. shutdown. To run it, simply specify the location of the database, e.g.:
  1636. > ./scripts/database-prepare-for-0.0.1.sh "homeserver.db"
  1637. Once this has successfully completed it will be safe to restart the
  1638. homeserver. You may notice that the homeserver takes a few seconds
  1639. longer to restart than usual as it reinitializes the database.
  1640. On startup of the new version, users can either rejoin remote rooms
  1641. using room aliases or by being reinvited. Alternatively, if any other
  1642. homeserver sends a message to a room that the homeserver was previously
  1643. in the local HS will automatically rejoin the room.