upgrade.html 89 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450
  1. <!DOCTYPE HTML>
  2. <html lang="en" class="sidebar-visible no-js light">
  3. <head>
  4. <!-- Book generated using mdBook -->
  5. <meta charset="UTF-8">
  6. <title>Upgrading between Synapse Versions - Synapse</title>
  7. <!-- Custom HTML head -->
  8. <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  9. <meta name="description" content="">
  10. <meta name="viewport" content="width=device-width, initial-scale=1">
  11. <meta name="theme-color" content="#ffffff" />
  12. <link rel="icon" href="favicon.svg">
  13. <link rel="shortcut icon" href="favicon.png">
  14. <link rel="stylesheet" href="css/variables.css">
  15. <link rel="stylesheet" href="css/general.css">
  16. <link rel="stylesheet" href="css/chrome.css">
  17. <link rel="stylesheet" href="css/print.css" media="print">
  18. <!-- Fonts -->
  19. <link rel="stylesheet" href="FontAwesome/css/font-awesome.css">
  20. <link rel="stylesheet" href="fonts/fonts.css">
  21. <!-- Highlight.js Stylesheets -->
  22. <link rel="stylesheet" href="highlight.css">
  23. <link rel="stylesheet" href="tomorrow-night.css">
  24. <link rel="stylesheet" href="ayu-highlight.css">
  25. <!-- Custom theme stylesheets -->
  26. <link rel="stylesheet" href="docs/website_files/table-of-contents.css">
  27. <link rel="stylesheet" href="docs/website_files/remove-nav-buttons.css">
  28. <link rel="stylesheet" href="docs/website_files/indent-section-headers.css">
  29. </head>
  30. <body>
  31. <!-- Provide site root to javascript -->
  32. <script type="text/javascript">
  33. var path_to_root = "";
  34. var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "navy" : "light";
  35. </script>
  36. <!-- Work around some values being stored in localStorage wrapped in quotes -->
  37. <script type="text/javascript">
  38. try {
  39. var theme = localStorage.getItem('mdbook-theme');
  40. var sidebar = localStorage.getItem('mdbook-sidebar');
  41. if (theme.startsWith('"') && theme.endsWith('"')) {
  42. localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1));
  43. }
  44. if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
  45. localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1));
  46. }
  47. } catch (e) { }
  48. </script>
  49. <!-- Set the theme before any content is loaded, prevents flash -->
  50. <script type="text/javascript">
  51. var theme;
  52. try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { }
  53. if (theme === null || theme === undefined) { theme = default_theme; }
  54. var html = document.querySelector('html');
  55. html.classList.remove('no-js')
  56. html.classList.remove('light')
  57. html.classList.add(theme);
  58. html.classList.add('js');
  59. </script>
  60. <!-- Hide / unhide sidebar before it is displayed -->
  61. <script type="text/javascript">
  62. var html = document.querySelector('html');
  63. var sidebar = 'hidden';
  64. if (document.body.clientWidth >= 1080) {
  65. try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { }
  66. sidebar = sidebar || 'visible';
  67. }
  68. html.classList.remove('sidebar-visible');
  69. html.classList.add("sidebar-" + sidebar);
  70. </script>
  71. <nav id="sidebar" class="sidebar" aria-label="Table of contents">
  72. <div class="sidebar-scrollbox">
  73. <ol class="chapter"><li class="chapter-item expanded affix "><li class="part-title">Introduction</li><li class="chapter-item expanded "><a href="welcome_and_overview.html">Welcome and Overview</a></li><li class="chapter-item expanded affix "><li class="part-title">Setup</li><li class="chapter-item expanded "><a href="setup/installation.html">Installation</a></li><li class="chapter-item expanded "><a href="postgres.html">Using Postgres</a></li><li class="chapter-item expanded "><a href="reverse_proxy.html">Configuring a Reverse Proxy</a></li><li class="chapter-item expanded "><a href="setup/forward_proxy.html">Configuring a Forward/Outbound Proxy</a></li><li class="chapter-item expanded "><a href="turn-howto.html">Configuring a Turn Server</a></li><li class="chapter-item expanded "><a href="delegate.html">Delegation</a></li><li class="chapter-item expanded affix "><li class="part-title">Upgrading</li><li class="chapter-item expanded "><a href="upgrade.html" class="active">Upgrading between Synapse Versions</a></li><li class="chapter-item expanded "><a href="MSC1711_certificates_FAQ.html">Upgrading from pre-Synapse 1.0</a></li><li class="chapter-item expanded affix "><li class="part-title">Usage</li><li class="chapter-item expanded "><a href="federate.html">Federation</a></li><li class="chapter-item expanded "><a href="usage/configuration/index.html">Configuration</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="usage/configuration/homeserver_sample_config.html">Homeserver Sample Config File</a></li><li class="chapter-item expanded "><a href="usage/configuration/logging_sample_config.html">Logging Sample Config File</a></li><li class="chapter-item expanded "><a href="structured_logging.html">Structured Logging</a></li><li class="chapter-item expanded "><a href="templates.html">Templates</a></li><li class="chapter-item expanded "><a href="usage/configuration/user_authentication/index.html">User Authentication</a></li><li><ol class="section"><li class="chapter-item expanded "><div>Single-Sign On</div></li><li><ol class="section"><li class="chapter-item expanded "><a href="openid.html">OpenID Connect</a></li><li class="chapter-item expanded "><div>SAML</div></li><li class="chapter-item expanded "><div>CAS</div></li><li class="chapter-item expanded "><a href="sso_mapping_providers.html">SSO Mapping Providers</a></li></ol></li><li class="chapter-item expanded "><a href="password_auth_providers.html">Password Auth Providers</a></li><li class="chapter-item expanded "><a href="jwt.html">JSON Web Tokens</a></li></ol></li><li class="chapter-item expanded "><a href="CAPTCHA_SETUP.html">Registration Captcha</a></li><li class="chapter-item expanded "><a href="application_services.html">Application Services</a></li><li class="chapter-item expanded "><a href="server_notices.html">Server Notices</a></li><li class="chapter-item expanded "><a href="consent_tracking.html">Consent Tracking</a></li><li class="chapter-item expanded "><a href="development/url_previews.html">URL Previews</a></li><li class="chapter-item expanded "><a href="user_directory.html">User Directory</a></li><li class="chapter-item expanded "><a href="message_retention_policies.html">Message Retention Policies</a></li><li class="chapter-item expanded "><a href="modules/index.html">Pluggable Modules</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="modules/writing_a_module.html">Writing a module</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="modules/spam_checker_callbacks.html">Spam checker callbacks</a></li><li class="chapter-item expanded "><a href="modules/third_party_rules_callbacks.html">Third-party rules callbacks</a></li><li class="chapter-item expanded "><a href="modules/presence_router_callbacks.html">Presence router callbacks</a></li><li class="chapter-item expanded "><a href="modules/account_validity_callbacks.html">Account validity callbacks</a></li><li class="chapter-item expanded "><a href="modules/porting_legacy_module.html">Porting a legacy module to the new interface</a></li></ol></li></ol></li><li class="chapter-item expanded "><a href="workers.html">Workers</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="synctl_workers.html">Using synctl with Workers</a></li><li class="chapter-item expanded "><a href="systemd-with-workers/index.html">Systemd</a></li></ol></li></ol></li><li class="chapter-item expanded "><a href="usage/administration/index.html">Administration</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="usage/administration/admin_api/index.html">Admin API</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="admin_api/account_validity.html">Account Validity</a></li><li class="chapter-item expanded "><a href="admin_api/delete_group.html">Delete Group</a></li><li class="chapter-item expanded "><a href="admin_api/event_reports.html">Event Reports</a></li><li class="chapter-item expanded "><a href="admin_api/media_admin_api.html">Media</a></li><li class="chapter-item expanded "><a href="admin_api/purge_history_api.html">Purge History</a></li><li class="chapter-item expanded "><a href="admin_api/register_api.html">Register Users</a></li><li class="chapter-item expanded "><a href="usage/administration/admin_api/registration_tokens.html">Registration Tokens</a></li><li class="chapter-item expanded "><a href="admin_api/room_membership.html">Manipulate Room Membership</a></li><li class="chapter-item expanded "><a href="admin_api/rooms.html">Rooms</a></li><li class="chapter-item expanded "><a href="admin_api/server_notices.html">Server Notices</a></li><li class="chapter-item expanded "><a href="admin_api/statistics.html">Statistics</a></li><li class="chapter-item expanded "><a href="admin_api/user_admin_api.html">Users</a></li><li class="chapter-item expanded "><a href="admin_api/version_api.html">Server Version</a></li></ol></li><li class="chapter-item expanded "><a href="manhole.html">Manhole</a></li><li class="chapter-item expanded "><a href="metrics-howto.html">Monitoring</a></li><li class="chapter-item expanded "><a href="usage/administration/request_log.html">Request log format</a></li><li class="chapter-item expanded "><div>Scripts</div></li></ol></li><li class="chapter-item expanded "><li class="part-title">Development</li><li class="chapter-item expanded "><a href="development/contributing_guide.html">Contributing Guide</a></li><li class="chapter-item expanded "><a href="code_style.html">Code Style</a></li><li class="chapter-item expanded "><a href="development/git.html">Git Usage</a></li><li class="chapter-item expanded "><div>Testing</div></li><li class="chapter-item expanded "><a href="opentracing.html">OpenTracing</a></li><li class="chapter-item expanded "><a href="development/database_schema.html">Database Schemas</a></li><li class="chapter-item expanded "><div>Synapse Architecture</div></li><li><ol class="section"><li class="chapter-item expanded "><a href="log_contexts.html">Log Contexts</a></li><li class="chapter-item expanded "><a href="replication.html">Replication</a></li><li class="chapter-item expanded "><a href="tcp_replication.html">TCP Replication</a></li></ol></li><li class="chapter-item expanded "><a href="development/internal_documentation/index.html">Internal Documentation</a></li><li><ol class="section"><li class="chapter-item expanded "><div>Single Sign-On</div></li><li><ol class="section"><li class="chapter-item expanded "><a href="development/saml.html">SAML</a></li><li class="chapter-item expanded "><a href="development/cas.html">CAS</a></li></ol></li><li class="chapter-item expanded "><a href="development/room-dag-concepts.html">Room DAG concepts</a></li><li class="chapter-item expanded "><div>State Resolution</div></li><li><ol class="section"><li class="chapter-item expanded "><a href="auth_chain_difference_algorithm.html">The Auth Chain Difference Algorithm</a></li></ol></li><li class="chapter-item expanded "><a href="media_repository.html">Media Repository</a></li><li class="chapter-item expanded "><a href="room_and_user_statistics.html">Room and User Statistics</a></li></ol></li><li class="chapter-item expanded "><div>Scripts</div></li><li class="chapter-item expanded affix "><li class="part-title">Other</li><li class="chapter-item expanded "><a href="deprecation_policy.html">Dependency Deprecation Policy</a></li></ol>
  74. </div>
  75. <div id="sidebar-resize-handle" class="sidebar-resize-handle"></div>
  76. </nav>
  77. <div id="page-wrapper" class="page-wrapper">
  78. <div class="page">
  79. <div id="menu-bar-hover-placeholder"></div>
  80. <div id="menu-bar" class="menu-bar sticky bordered">
  81. <div class="left-buttons">
  82. <button id="sidebar-toggle" class="icon-button" type="button" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
  83. <i class="fa fa-bars"></i>
  84. </button>
  85. <button id="theme-toggle" class="icon-button" type="button" title="Change theme" aria-label="Change theme" aria-haspopup="true" aria-expanded="false" aria-controls="theme-list">
  86. <i class="fa fa-paint-brush"></i>
  87. </button>
  88. <ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu">
  89. <li role="none"><button role="menuitem" class="theme" id="light">Light (default)</button></li>
  90. <li role="none"><button role="menuitem" class="theme" id="rust">Rust</button></li>
  91. <li role="none"><button role="menuitem" class="theme" id="coal">Coal</button></li>
  92. <li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li>
  93. <li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li>
  94. </ul>
  95. <button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar">
  96. <i class="fa fa-search"></i>
  97. </button>
  98. </div>
  99. <h1 class="menu-title">Synapse</h1>
  100. <div class="right-buttons">
  101. <a href="print.html" title="Print this book" aria-label="Print this book">
  102. <i id="print-button" class="fa fa-print"></i>
  103. </a>
  104. <a href="https://github.com/matrix-org/synapse" title="Git repository" aria-label="Git repository">
  105. <i id="git-repository-button" class="fa fa-github"></i>
  106. </a>
  107. <a href="https://github.com/matrix-org/synapse/edit/develop/docs/upgrade.md" title="Suggest an edit" aria-label="Suggest an edit">
  108. <i id="git-edit-button" class="fa fa-edit"></i>
  109. </a>
  110. </div>
  111. </div>
  112. <div id="search-wrapper" class="hidden">
  113. <form id="searchbar-outer" class="searchbar-outer">
  114. <input type="search" id="searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="searchresults-outer" aria-describedby="searchresults-header">
  115. </form>
  116. <div id="searchresults-outer" class="searchresults-outer hidden">
  117. <div id="searchresults-header" class="searchresults-header"></div>
  118. <ul id="searchresults">
  119. </ul>
  120. </div>
  121. </div>
  122. <!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM -->
  123. <script type="text/javascript">
  124. document.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible');
  125. document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible');
  126. Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) {
  127. link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1);
  128. });
  129. </script>
  130. <div id="content" class="content">
  131. <main>
  132. <!-- Page table of contents -->
  133. <div class="sidetoc">
  134. <nav class="pagetoc"></nav>
  135. </div>
  136. <h1 id="upgrading-synapse"><a class="header" href="#upgrading-synapse">Upgrading Synapse</a></h1>
  137. <p>Before upgrading check if any special steps are required to upgrade from
  138. the version you currently have installed to the current version of
  139. Synapse. The extra instructions that may be required are listed later in
  140. this document.</p>
  141. <ul>
  142. <li>
  143. <p>Check that your versions of Python and PostgreSQL are still
  144. supported.</p>
  145. <p>Synapse follows upstream lifecycles for <a href="https://endoflife.date/python">Python</a> and
  146. <a href="https://endoflife.date/postgresql">PostgreSQL</a>, and removes support for versions
  147. which are no longer maintained.</p>
  148. <p>The website <a href="https://endoflife.date">https://endoflife.date</a> also offers convenient
  149. summaries.</p>
  150. </li>
  151. <li>
  152. <p>If Synapse was installed using <a href="setup/installation.html#prebuilt-packages">prebuilt
  153. packages</a>, you will need to follow the
  154. normal process for upgrading those packages.</p>
  155. </li>
  156. <li>
  157. <p>If Synapse was installed from source, then:</p>
  158. <ol>
  159. <li>
  160. <p>Activate the virtualenv before upgrading. For example, if
  161. Synapse is installed in a virtualenv in <code>~/synapse/env</code> then
  162. run:</p>
  163. <pre><code class="language-bash">source ~/synapse/env/bin/activate
  164. </code></pre>
  165. </li>
  166. <li>
  167. <p>If Synapse was installed using pip then upgrade to the latest
  168. version by running:</p>
  169. <pre><code class="language-bash">pip install --upgrade matrix-synapse
  170. </code></pre>
  171. <p>If Synapse was installed using git then upgrade to the latest
  172. version by running:</p>
  173. <pre><code class="language-bash">git pull
  174. pip install --upgrade .
  175. </code></pre>
  176. </li>
  177. <li>
  178. <p>Restart Synapse:</p>
  179. <pre><code class="language-bash">./synctl restart
  180. </code></pre>
  181. </li>
  182. </ol>
  183. </li>
  184. </ul>
  185. <p>To check whether your update was successful, you can check the running
  186. server version with:</p>
  187. <pre><code class="language-bash"># you may need to replace 'localhost:8008' if synapse is not configured
  188. # to listen on port 8008.
  189. curl http://localhost:8008/_synapse/admin/v1/server_version
  190. </code></pre>
  191. <h2 id="rolling-back-to-older-versions"><a class="header" href="#rolling-back-to-older-versions">Rolling back to older versions</a></h2>
  192. <p>Rolling back to previous releases can be difficult, due to database
  193. schema changes between releases. Where we have been able to test the
  194. rollback process, this will be noted below.</p>
  195. <p>In general, you will need to undo any changes made during the upgrade
  196. process, for example:</p>
  197. <ul>
  198. <li>
  199. <p>pip:</p>
  200. <pre><code class="language-bash">source env/bin/activate
  201. # replace `1.3.0` accordingly:
  202. pip install matrix-synapse==1.3.0
  203. </code></pre>
  204. </li>
  205. <li>
  206. <p>Debian:</p>
  207. <pre><code class="language-bash"># replace `1.3.0` and `stretch` accordingly:
  208. wget https://packages.matrix.org/debian/pool/main/m/matrix-synapse-py3/matrix-synapse-py3_1.3.0+stretch1_amd64.deb
  209. dpkg -i matrix-synapse-py3_1.3.0+stretch1_amd64.deb
  210. </code></pre>
  211. </li>
  212. </ul>
  213. <h1 id="upgrading-to-v1430"><a class="header" href="#upgrading-to-v1430">Upgrading to v1.43.0</a></h1>
  214. <h2 id="the-spaces-summary-apis-can-now-be-handled-by-workers"><a class="header" href="#the-spaces-summary-apis-can-now-be-handled-by-workers">The spaces summary APIs can now be handled by workers</a></h2>
  215. <p>The <a href="https://matrix-org.github.io/synapse/latest/workers.html#available-worker-applications">available worker applications documentation</a>
  216. has been updated to reflect that calls to the <code>/spaces</code>, <code>/hierarchy</code>, and
  217. <code>/summary</code> endpoints can now be routed to workers for both client API and
  218. federation requests.</p>
  219. <h1 id="upgrading-to-v1420"><a class="header" href="#upgrading-to-v1420">Upgrading to v1.42.0</a></h1>
  220. <h2 id="removal-of-old-room-admin-api"><a class="header" href="#removal-of-old-room-admin-api">Removal of old Room Admin API</a></h2>
  221. <p>The following admin APIs were deprecated in <a href="https://github.com/matrix-org/synapse/blob/v1.25.0/CHANGES.md#removal-warning">Synapse 1.25</a>
  222. (released on 2021-01-13) and have now been removed:</p>
  223. <ul>
  224. <li><code>POST /_synapse/admin/v1/purge_room</code></li>
  225. <li><code>POST /_synapse/admin/v1/shutdown_room/&lt;room_id&gt;</code></li>
  226. </ul>
  227. <p>Any scripts still using the above APIs should be converted to use the
  228. <a href="https://matrix-org.github.io/synapse/latest/admin_api/rooms.html#delete-room-api">Delete Room API</a>.</p>
  229. <h2 id="user-interactive-authentication-fallback-templates-can-now-display-errors"><a class="header" href="#user-interactive-authentication-fallback-templates-can-now-display-errors">User-interactive authentication fallback templates can now display errors</a></h2>
  230. <p>This may affect you if you make use of custom HTML templates for the
  231. <a href="../synapse/res/templates/recaptcha.html">reCAPTCHA</a> or
  232. <a href="../synapse/res/templates/terms.html">terms</a> fallback pages.</p>
  233. <p>The template is now provided an <code>error</code> variable if the authentication
  234. process failed. See the default templates linked above for an example.</p>
  235. <h2 id="removal-of-out-of-date-email-pushers"><a class="header" href="#removal-of-out-of-date-email-pushers">Removal of out-of-date email pushers</a></h2>
  236. <p>Users will stop receiving message updates via email for addresses that were
  237. once, but not still, linked to their account.</p>
  238. <h1 id="upgrading-to-v1410"><a class="header" href="#upgrading-to-v1410">Upgrading to v1.41.0</a></h1>
  239. <h2 id="add-support-for-routing-outbound-http-requests-via-a-proxy-for-federation"><a class="header" href="#add-support-for-routing-outbound-http-requests-via-a-proxy-for-federation">Add support for routing outbound HTTP requests via a proxy for federation</a></h2>
  240. <p>Since Synapse 1.6.0 (2019-11-26) you can set a proxy for outbound HTTP requests via
  241. http_proxy/https_proxy environment variables. This proxy was set for:</p>
  242. <ul>
  243. <li>push</li>
  244. <li>url previews</li>
  245. <li>phone-home stats</li>
  246. <li>recaptcha validation</li>
  247. <li>CAS auth validation</li>
  248. <li>OpenID Connect</li>
  249. <li>Federation (checking public key revocation)</li>
  250. </ul>
  251. <p>In this version we have added support for outbound requests for:</p>
  252. <ul>
  253. <li>Outbound federation</li>
  254. <li>Downloading remote media</li>
  255. <li>Fetching public keys of other servers</li>
  256. </ul>
  257. <p>These requests use the same proxy configuration. If you have a proxy configuration we
  258. recommend to verify the configuration. It may be necessary to adjust the <code>no_proxy</code>
  259. environment variable.</p>
  260. <p>See <a href="setup/forward_proxy.html">using a forward proxy with Synapse documentation</a> for
  261. details.</p>
  262. <h2 id="deprecation-of-template_dir"><a class="header" href="#deprecation-of-template_dir">Deprecation of <code>template_dir</code></a></h2>
  263. <p>The <code>template_dir</code> settings in the <code>sso</code>, <code>account_validity</code> and <code>email</code> sections of the
  264. configuration file are now deprecated. Server admins should use the new
  265. <code>templates.custom_template_directory</code> setting in the configuration file and use one single
  266. custom template directory for all aforementioned features. Template file names remain
  267. unchanged. See <a href="https://matrix-org.github.io/synapse/latest/templates.html">the related documentation</a>
  268. for more information and examples.</p>
  269. <p>We plan to remove support for these settings in October 2021.</p>
  270. <h2 id="_synapseadminv1usersuseridmedia-must-be-handled-by-media-workers"><a class="header" href="#_synapseadminv1usersuseridmedia-must-be-handled-by-media-workers"><code>/_synapse/admin/v1/users/{userId}/media</code> must be handled by media workers</a></h2>
  271. <p>The <a href="https://matrix-org.github.io/synapse/latest/workers.html#synapseappmedia_repository">media repository worker documentation</a>
  272. has been updated to reflect that calls to <code>/_synapse/admin/v1/users/{userId}/media</code>
  273. must now be handled by media repository workers. This is due to the new <code>DELETE</code> method
  274. of this endpoint modifying the media store.</p>
  275. <h1 id="upgrading-to-v1390"><a class="header" href="#upgrading-to-v1390">Upgrading to v1.39.0</a></h1>
  276. <h2 id="deprecation-of-the-current-third-party-rules-module-interface"><a class="header" href="#deprecation-of-the-current-third-party-rules-module-interface">Deprecation of the current third-party rules module interface</a></h2>
  277. <p>The current third-party rules module interface is deprecated in favour of the new generic
  278. modules system introduced in Synapse v1.37.0. Authors of third-party rules modules can refer
  279. to <a href="modules.html#porting-an-existing-module-that-uses-the-old-interface">this documentation</a>
  280. to update their modules. Synapse administrators can refer to <a href="modules.html#using-modules">this documentation</a>
  281. to update their configuration once the modules they are using have been updated.</p>
  282. <p>We plan to remove support for the current third-party rules interface in September 2021.</p>
  283. <h1 id="upgrading-to-v1380"><a class="header" href="#upgrading-to-v1380">Upgrading to v1.38.0</a></h1>
  284. <h2 id="re-indexing-of-events-table-on-postgres-databases"><a class="header" href="#re-indexing-of-events-table-on-postgres-databases">Re-indexing of <code>events</code> table on Postgres databases</a></h2>
  285. <p>This release includes a database schema update which requires re-indexing one of
  286. the larger tables in the database, <code>events</code>. This could result in increased
  287. disk I/O for several hours or days after upgrading while the migration
  288. completes. Furthermore, because we have to keep the old indexes until the new
  289. indexes are ready, it could result in a significant, temporary, increase in
  290. disk space.</p>
  291. <p>To get a rough idea of the disk space required, check the current size of one
  292. of the indexes. For example, from a <code>psql</code> shell, run the following sql:</p>
  293. <pre><code class="language-sql">SELECT pg_size_pretty(pg_relation_size('events_order_room'));
  294. </code></pre>
  295. <p>We need to rebuild <strong>four</strong> indexes, so you will need to multiply this result
  296. by four to give an estimate of the disk space required. For example, on one
  297. particular server:</p>
  298. <pre><code>synapse=# select pg_size_pretty(pg_relation_size('events_order_room'));
  299. pg_size_pretty
  300. ----------------
  301. 288 MB
  302. (1 row)
  303. </code></pre>
  304. <p>On this server, it would be wise to ensure that at least 1152MB are free.</p>
  305. <p>The additional disk space will be freed once the migration completes.</p>
  306. <p>SQLite databases are unaffected by this change.</p>
  307. <h1 id="upgrading-to-v1370"><a class="header" href="#upgrading-to-v1370">Upgrading to v1.37.0</a></h1>
  308. <h2 id="deprecation-of-the-current-spam-checker-interface"><a class="header" href="#deprecation-of-the-current-spam-checker-interface">Deprecation of the current spam checker interface</a></h2>
  309. <p>The current spam checker interface is deprecated in favour of a new generic modules system.
  310. Authors of spam checker modules can refer to <a href="modules.html#porting-an-existing-module-that-uses-the-old-interface">this
  311. documentation</a>
  312. to update their modules. Synapse administrators can refer to <a href="modules.html#using-modules">this
  313. documentation</a>
  314. to update their configuration once the modules they are using have been updated.</p>
  315. <p>We plan to remove support for the current spam checker interface in August 2021.</p>
  316. <p>More module interfaces will be ported over to this new generic system in future versions
  317. of Synapse.</p>
  318. <h1 id="upgrading-to-v1340"><a class="header" href="#upgrading-to-v1340">Upgrading to v1.34.0</a></h1>
  319. <h2 id="room_invite_state_types-configuration-setting"><a class="header" href="#room_invite_state_types-configuration-setting"><code>room_invite_state_types</code> configuration setting</a></h2>
  320. <p>The <code>room_invite_state_types</code> configuration setting has been deprecated
  321. and replaced with <code>room_prejoin_state</code>. See the <a href="https://github.com/matrix-org/synapse/blob/v1.34.0/docs/sample_config.yaml#L1515">sample configuration
  322. file</a>.</p>
  323. <p>If you have set <code>room_invite_state_types</code> to the default value you
  324. should simply remove it from your configuration file. The default value
  325. used to be:</p>
  326. <pre><code class="language-yaml">room_invite_state_types:
  327. - &quot;m.room.join_rules&quot;
  328. - &quot;m.room.canonical_alias&quot;
  329. - &quot;m.room.avatar&quot;
  330. - &quot;m.room.encryption&quot;
  331. - &quot;m.room.name&quot;
  332. </code></pre>
  333. <p>If you have customised this value, you should remove
  334. <code>room_invite_state_types</code> and configure <code>room_prejoin_state</code> instead.</p>
  335. <h1 id="upgrading-to-v1330"><a class="header" href="#upgrading-to-v1330">Upgrading to v1.33.0</a></h1>
  336. <h2 id="account-validity-html-templates-can-now-display-a-users-expiration-date"><a class="header" href="#account-validity-html-templates-can-now-display-a-users-expiration-date">Account Validity HTML templates can now display a user's expiration date</a></h2>
  337. <p>This may affect you if you have enabled the account validity feature,
  338. and have made use of a custom HTML template specified by the
  339. <code>account_validity.template_dir</code> or
  340. <code>account_validity.account_renewed_html_path</code> Synapse config options.</p>
  341. <p>The template can now accept an <code>expiration_ts</code> variable, which
  342. represents the unix timestamp in milliseconds for the future date of
  343. which their account has been renewed until. See the <a href="https://github.com/matrix-org/synapse/blob/release-v1.33.0/synapse/res/templates/account_renewed.html">default
  344. template</a>
  345. for an example of usage.</p>
  346. <p>ALso note that a new HTML template, <code>account_previously_renewed.html</code>,
  347. has been added. This is is shown to users when they attempt to renew
  348. their account with a valid renewal token that has already been used
  349. before. The default template contents can been found
  350. <a href="https://github.com/matrix-org/synapse/blob/release-v1.33.0/synapse/res/templates/account_previously_renewed.html">here</a>,
  351. and can also accept an <code>expiration_ts</code> variable. This template replaces
  352. the error message users would previously see upon attempting to use a
  353. valid renewal token more than once.</p>
  354. <h1 id="upgrading-to-v1320"><a class="header" href="#upgrading-to-v1320">Upgrading to v1.32.0</a></h1>
  355. <h2 id="regression-causing-connected-prometheus-instances-to-become-overwhelmed"><a class="header" href="#regression-causing-connected-prometheus-instances-to-become-overwhelmed">Regression causing connected Prometheus instances to become overwhelmed</a></h2>
  356. <p>This release introduces <a href="https://github.com/matrix-org/synapse/issues/9853">a
  357. regression</a> that can
  358. overwhelm connected Prometheus instances. This issue is not present in
  359. Synapse v1.32.0rc1.</p>
  360. <p>If you have been affected, please downgrade to 1.31.0. You then may need
  361. to remove excess writeahead logs in order for Prometheus to recover.
  362. Instructions for doing so are provided
  363. <a href="https://github.com/matrix-org/synapse/pull/9854#issuecomment-823472183">here</a>.</p>
  364. <h2 id="dropping-support-for-old-python-postgres-and-sqlite-versions"><a class="header" href="#dropping-support-for-old-python-postgres-and-sqlite-versions">Dropping support for old Python, Postgres and SQLite versions</a></h2>
  365. <p>In line with our <a href="deprecation_policy.html">deprecation policy</a>,
  366. we've dropped support for Python 3.5 and PostgreSQL 9.5, as they are no
  367. longer supported upstream.</p>
  368. <p>This release of Synapse requires Python 3.6+ and PostgresSQL 9.6+ or
  369. SQLite 3.22+.</p>
  370. <h2 id="removal-of-old-list-accounts-admin-api"><a class="header" href="#removal-of-old-list-accounts-admin-api">Removal of old List Accounts Admin API</a></h2>
  371. <p>The deprecated v1 &quot;list accounts&quot; admin API
  372. (<code>GET /_synapse/admin/v1/users/&lt;user_id&gt;</code>) has been removed in this
  373. version.</p>
  374. <p>The <a href="admin_api/user_admin_api.html#list-accounts">v2 list accounts API</a>
  375. has been available since Synapse 1.7.0 (2019-12-13), and is accessible
  376. under <code>GET /_synapse/admin/v2/users</code>.</p>
  377. <p>The deprecation of the old endpoint was announced with Synapse 1.28.0
  378. (released on 2021-02-25).</p>
  379. <h2 id="application-services-must-use-type-mloginapplication_service-when-registering-users"><a class="header" href="#application-services-must-use-type-mloginapplication_service-when-registering-users">Application Services must use type <code>m.login.application_service</code> when registering users</a></h2>
  380. <p>In compliance with the <a href="https://matrix.org/docs/spec/application_service/r0.1.2#server-admin-style-permissions">Application Service
  381. spec</a>,
  382. Application Services are now required to use the
  383. <code>m.login.application_service</code> type when registering users via the
  384. <code>/_matrix/client/r0/register</code> endpoint. This behaviour was deprecated in
  385. Synapse v1.30.0.</p>
  386. <p>Please ensure your Application Services are up to date.</p>
  387. <h1 id="upgrading-to-v1290"><a class="header" href="#upgrading-to-v1290">Upgrading to v1.29.0</a></h1>
  388. <h2 id="requirement-for-x-forwarded-proto-header"><a class="header" href="#requirement-for-x-forwarded-proto-header">Requirement for X-Forwarded-Proto header</a></h2>
  389. <p>When using Synapse with a reverse proxy (in particular, when using the
  390. [x_forwarded]{.title-ref} option on an HTTP listener), Synapse now
  391. expects to receive an [X-Forwarded-Proto]{.title-ref} header on incoming
  392. HTTP requests. If it is not set, Synapse will log a warning on each
  393. received request.</p>
  394. <p>To avoid the warning, administrators using a reverse proxy should ensure
  395. that the reverse proxy sets [X-Forwarded-Proto]{.title-ref} header to
  396. [https]{.title-ref} or [http]{.title-ref} to indicate the protocol used
  397. by the client.</p>
  398. <p>Synapse also requires the [Host]{.title-ref} header to be preserved.</p>
  399. <p>See the <a href="reverse_proxy.html">reverse proxy documentation</a>, where the
  400. example configurations have been updated to show how to set these
  401. headers.</p>
  402. <p>(Users of <a href="https://caddyserver.com/">Caddy</a> are unaffected, since we
  403. believe it sets [X-Forwarded-Proto]{.title-ref} by default.)</p>
  404. <h1 id="upgrading-to-v1270"><a class="header" href="#upgrading-to-v1270">Upgrading to v1.27.0</a></h1>
  405. <h2 id="changes-to-callback-uri-for-oauth2--openid-connect-and-saml2"><a class="header" href="#changes-to-callback-uri-for-oauth2--openid-connect-and-saml2">Changes to callback URI for OAuth2 / OpenID Connect and SAML2</a></h2>
  406. <p>This version changes the URI used for callbacks from OAuth2 and SAML2
  407. identity providers:</p>
  408. <ul>
  409. <li>
  410. <p>If your server is configured for single sign-on via an OpenID
  411. Connect or OAuth2 identity provider, you will need to add
  412. <code>[synapse public baseurl]/_synapse/client/oidc/callback</code> to the list
  413. of permitted &quot;redirect URIs&quot; at the identity provider.</p>
  414. <p>See the <a href="openid.html">OpenID docs</a> for more information on setting
  415. up OpenID Connect.</p>
  416. </li>
  417. <li>
  418. <p>If your server is configured for single sign-on via a SAML2 identity
  419. provider, you will need to add
  420. <code>[synapse public baseurl]/_synapse/client/saml2/authn_response</code> as a
  421. permitted &quot;ACS location&quot; (also known as &quot;allowed callback URLs&quot;)
  422. at the identity provider.</p>
  423. <p>The &quot;Issuer&quot; in the &quot;AuthnRequest&quot; to the SAML2 identity
  424. provider is also updated to
  425. <code>[synapse public baseurl]/_synapse/client/saml2/metadata.xml</code>. If
  426. your SAML2 identity provider uses this property to validate or
  427. otherwise identify Synapse, its configuration will need to be
  428. updated to use the new URL. Alternatively you could create a new,
  429. separate &quot;EntityDescriptor&quot; in your SAML2 identity provider with
  430. the new URLs and leave the URLs in the existing &quot;EntityDescriptor&quot;
  431. as they were.</p>
  432. </li>
  433. </ul>
  434. <h2 id="changes-to-html-templates"><a class="header" href="#changes-to-html-templates">Changes to HTML templates</a></h2>
  435. <p>The HTML templates for SSO and email notifications now have <a href="https://jinja.palletsprojects.com/en/2.11.x/api/#autoescaping">Jinja2's
  436. autoescape</a>
  437. enabled for files ending in <code>.html</code>, <code>.htm</code>, and <code>.xml</code>. If you have
  438. customised these templates and see issues when viewing them you might
  439. need to update them. It is expected that most configurations will need
  440. no changes.</p>
  441. <p>If you have customised the templates <em>names</em> for these templates, it is
  442. recommended to verify they end in <code>.html</code> to ensure autoescape is
  443. enabled.</p>
  444. <p>The above applies to the following templates:</p>
  445. <ul>
  446. <li><code>add_threepid.html</code></li>
  447. <li><code>add_threepid_failure.html</code></li>
  448. <li><code>add_threepid_success.html</code></li>
  449. <li><code>notice_expiry.html</code></li>
  450. <li><code>notice_expiry.html</code></li>
  451. <li><code>notif_mail.html</code> (which, by default, includes <code>room.html</code> and
  452. <code>notif.html</code>)</li>
  453. <li><code>password_reset.html</code></li>
  454. <li><code>password_reset_confirmation.html</code></li>
  455. <li><code>password_reset_failure.html</code></li>
  456. <li><code>password_reset_success.html</code></li>
  457. <li><code>registration.html</code></li>
  458. <li><code>registration_failure.html</code></li>
  459. <li><code>registration_success.html</code></li>
  460. <li><code>sso_account_deactivated.html</code></li>
  461. <li><code>sso_auth_bad_user.html</code></li>
  462. <li><code>sso_auth_confirm.html</code></li>
  463. <li><code>sso_auth_success.html</code></li>
  464. <li><code>sso_error.html</code></li>
  465. <li><code>sso_login_idp_picker.html</code></li>
  466. <li><code>sso_redirect_confirm.html</code></li>
  467. </ul>
  468. <h1 id="upgrading-to-v1260"><a class="header" href="#upgrading-to-v1260">Upgrading to v1.26.0</a></h1>
  469. <h2 id="rolling-back-to-v1250-after-a-failed-upgrade"><a class="header" href="#rolling-back-to-v1250-after-a-failed-upgrade">Rolling back to v1.25.0 after a failed upgrade</a></h2>
  470. <p>v1.26.0 includes a lot of large changes. If something problematic
  471. occurs, you may want to roll-back to a previous version of Synapse.
  472. Because v1.26.0 also includes a new database schema version, reverting
  473. that version is also required alongside the generic rollback
  474. instructions mentioned above. In short, to roll back to v1.25.0 you need
  475. to:</p>
  476. <ol>
  477. <li>
  478. <p>Stop the server</p>
  479. </li>
  480. <li>
  481. <p>Decrease the schema version in the database:</p>
  482. <pre><code class="language-sql">UPDATE schema_version SET version = 58;
  483. </code></pre>
  484. </li>
  485. <li>
  486. <p>Delete the ignored users &amp; chain cover data:</p>
  487. <pre><code class="language-sql">DROP TABLE IF EXISTS ignored_users;
  488. UPDATE rooms SET has_auth_chain_index = false;
  489. </code></pre>
  490. <p>For PostgreSQL run:</p>
  491. <pre><code class="language-sql">TRUNCATE event_auth_chain_links;
  492. TRUNCATE event_auth_chains;
  493. </code></pre>
  494. <p>For SQLite run:</p>
  495. <pre><code class="language-sql">DELETE FROM event_auth_chain_links;
  496. DELETE FROM event_auth_chains;
  497. </code></pre>
  498. </li>
  499. <li>
  500. <p>Mark the deltas as not run (so they will re-run on upgrade).</p>
  501. <pre><code class="language-sql">DELETE FROM applied_schema_deltas WHERE version = 59 AND file = &quot;59/01ignored_user.py&quot;;
  502. DELETE FROM applied_schema_deltas WHERE version = 59 AND file = &quot;59/06chain_cover_index.sql&quot;;
  503. </code></pre>
  504. </li>
  505. <li>
  506. <p>Downgrade Synapse by following the instructions for your
  507. installation method in the &quot;Rolling back to older versions&quot;
  508. section above.</p>
  509. </li>
  510. </ol>
  511. <h1 id="upgrading-to-v1250"><a class="header" href="#upgrading-to-v1250">Upgrading to v1.25.0</a></h1>
  512. <h2 id="last-release-supporting-python-35"><a class="header" href="#last-release-supporting-python-35">Last release supporting Python 3.5</a></h2>
  513. <p>This is the last release of Synapse which guarantees support with Python
  514. 3.5, which passed its upstream End of Life date several months ago.</p>
  515. <p>We will attempt to maintain support through March 2021, but without
  516. guarantees.</p>
  517. <p>In the future, Synapse will follow upstream schedules for ending support
  518. of older versions of Python and PostgreSQL. Please upgrade to at least
  519. Python 3.6 and PostgreSQL 9.6 as soon as possible.</p>
  520. <h2 id="blacklisting-ip-ranges"><a class="header" href="#blacklisting-ip-ranges">Blacklisting IP ranges</a></h2>
  521. <p>Synapse v1.25.0 includes new settings, <code>ip_range_blacklist</code> and
  522. <code>ip_range_whitelist</code>, for controlling outgoing requests from Synapse for
  523. federation, identity servers, push, and for checking key validity for
  524. third-party invite events. The previous setting,
  525. <code>federation_ip_range_blacklist</code>, is deprecated. The new
  526. <code>ip_range_blacklist</code> defaults to private IP ranges if it is not defined.</p>
  527. <p>If you have never customised <code>federation_ip_range_blacklist</code> it is
  528. recommended that you remove that setting.</p>
  529. <p>If you have customised <code>federation_ip_range_blacklist</code> you should update
  530. the setting name to <code>ip_range_blacklist</code>.</p>
  531. <p>If you have a custom push server that is reached via private IP space
  532. you may need to customise <code>ip_range_blacklist</code> or <code>ip_range_whitelist</code>.</p>
  533. <h1 id="upgrading-to-v1240"><a class="header" href="#upgrading-to-v1240">Upgrading to v1.24.0</a></h1>
  534. <h2 id="custom-openid-connect-mapping-provider-breaking-change"><a class="header" href="#custom-openid-connect-mapping-provider-breaking-change">Custom OpenID Connect mapping provider breaking change</a></h2>
  535. <p>This release allows the OpenID Connect mapping provider to perform
  536. normalisation of the localpart of the Matrix ID. This allows for the
  537. mapping provider to specify different algorithms, instead of the
  538. <a href="https://matrix.org/docs/spec/appendices#mapping-from-other-character-sets">default
  539. way</a>.</p>
  540. <p>If your Synapse configuration uses a custom mapping provider
  541. ([oidc_config.user_mapping_provider.module]{.title-ref} is specified and
  542. not equal to
  543. [synapse.handlers.oidc_handler.JinjaOidcMappingProvider]{.title-ref})
  544. then you <em>must</em> ensure that [map_user_attributes]{.title-ref} of the
  545. mapping provider performs some normalisation of the
  546. [localpart]{.title-ref} returned. To match previous behaviour you can
  547. use the [map_username_to_mxid_localpart]{.title-ref} function provided
  548. by Synapse. An example is shown below:</p>
  549. <pre><code class="language-python">from synapse.types import map_username_to_mxid_localpart
  550. class MyMappingProvider:
  551. def map_user_attributes(self, userinfo, token):
  552. # ... your custom logic ...
  553. sso_user_id = ...
  554. localpart = map_username_to_mxid_localpart(sso_user_id)
  555. return {&quot;localpart&quot;: localpart}
  556. </code></pre>
  557. <h2 id="removal-historical-synapse-admin-api"><a class="header" href="#removal-historical-synapse-admin-api">Removal historical Synapse Admin API</a></h2>
  558. <p>Historically, the Synapse Admin API has been accessible under:</p>
  559. <ul>
  560. <li><code>/_matrix/client/api/v1/admin</code></li>
  561. <li><code>/_matrix/client/unstable/admin</code></li>
  562. <li><code>/_matrix/client/r0/admin</code></li>
  563. <li><code>/_synapse/admin/v1</code></li>
  564. </ul>
  565. <p>The endpoints with <code>/_matrix/client/*</code> prefixes have been removed as of
  566. v1.24.0. The Admin API is now only accessible under:</p>
  567. <ul>
  568. <li><code>/_synapse/admin/v1</code></li>
  569. </ul>
  570. <p>The only exception is the [/admin/whois]{.title-ref} endpoint, which is
  571. <a href="https://matrix.org/docs/spec/client_server/r0.6.1#get-matrix-client-r0-admin-whois-userid">also available via the client-server
  572. API</a>.</p>
  573. <p>The deprecation of the old endpoints was announced with Synapse 1.20.0
  574. (released on 2020-09-22) and makes it easier for homeserver admins to
  575. lock down external access to the Admin API endpoints.</p>
  576. <h1 id="upgrading-to-v1230"><a class="header" href="#upgrading-to-v1230">Upgrading to v1.23.0</a></h1>
  577. <h2 id="structured-logging-configuration-breaking-changes"><a class="header" href="#structured-logging-configuration-breaking-changes">Structured logging configuration breaking changes</a></h2>
  578. <p>This release deprecates use of the <code>structured: true</code> logging
  579. configuration for structured logging. If your logging configuration
  580. contains <code>structured: true</code> then it should be modified based on the
  581. <a href="structured_logging.html">structured logging documentation</a>.</p>
  582. <p>The <code>structured</code> and <code>drains</code> logging options are now deprecated and
  583. should be replaced by standard logging configuration of <code>handlers</code> and
  584. <code>formatters</code>.</p>
  585. <p>A future will release of Synapse will make using <code>structured: true</code> an
  586. error.</p>
  587. <h1 id="upgrading-to-v1220"><a class="header" href="#upgrading-to-v1220">Upgrading to v1.22.0</a></h1>
  588. <h2 id="thirdpartyeventrules-breaking-changes"><a class="header" href="#thirdpartyeventrules-breaking-changes">ThirdPartyEventRules breaking changes</a></h2>
  589. <p>This release introduces a backwards-incompatible change to modules
  590. making use of <code>ThirdPartyEventRules</code> in Synapse. If you make use of a
  591. module defined under the <code>third_party_event_rules</code> config option, please
  592. make sure it is updated to handle the below change:</p>
  593. <p>The <code>http_client</code> argument is no longer passed to modules as they are
  594. initialised. Instead, modules are expected to make use of the
  595. <code>http_client</code> property on the <code>ModuleApi</code> class. Modules are now passed
  596. a <code>module_api</code> argument during initialisation, which is an instance of
  597. <code>ModuleApi</code>. <code>ModuleApi</code> instances have a <code>http_client</code> property which
  598. acts the same as the <code>http_client</code> argument previously passed to
  599. <code>ThirdPartyEventRules</code> modules.</p>
  600. <h1 id="upgrading-to-v1210"><a class="header" href="#upgrading-to-v1210">Upgrading to v1.21.0</a></h1>
  601. <h2 id="forwarding-_synapseclient-through-your-reverse-proxy"><a class="header" href="#forwarding-_synapseclient-through-your-reverse-proxy">Forwarding <code>/_synapse/client</code> through your reverse proxy</a></h2>
  602. <p>The <a href="reverse_proxy.html">reverse proxy documentation</a>
  603. has been updated to include reverse proxy directives for
  604. <code>/_synapse/client/*</code> endpoints. As the user password reset flow now uses
  605. endpoints under this prefix, <strong>you must update your reverse proxy
  606. configurations for user password reset to work</strong>.</p>
  607. <p>Additionally, note that the <a href="workers.html">Synapse worker documentation</a> has been updated to</p>
  608. <p>: state that the <code>/_synapse/client/password_reset/email/submit_token</code>
  609. endpoint can be handled</p>
  610. <p>by all workers. If you make use of Synapse's worker feature, please
  611. update your reverse proxy configuration to reflect this change.</p>
  612. <h2 id="new-html-templates"><a class="header" href="#new-html-templates">New HTML templates</a></h2>
  613. <p>A new HTML template,
  614. <a href="https://github.com/matrix-org/synapse/blob/develop/synapse/res/templates/password_reset_confirmation.html">password_reset_confirmation.html</a>,
  615. has been added to the <code>synapse/res/templates</code> directory. If you are
  616. using a custom template directory, you may want to copy the template
  617. over and modify it.</p>
  618. <p>Note that as of v1.20.0, templates do not need to be included in custom
  619. template directories for Synapse to start. The default templates will be
  620. used if a custom template cannot be found.</p>
  621. <p>This page will appear to the user after clicking a password reset link
  622. that has been emailed to them.</p>
  623. <p>To complete password reset, the page must include a way to make a
  624. [POST]{.title-ref} request to
  625. <code>/_synapse/client/password_reset/{medium}/submit_token</code> with the query
  626. parameters from the original link, presented as a URL-encoded form. See
  627. the file itself for more details.</p>
  628. <h2 id="updated-single-sign-on-html-templates"><a class="header" href="#updated-single-sign-on-html-templates">Updated Single Sign-on HTML Templates</a></h2>
  629. <p>The <code>saml_error.html</code> template was removed from Synapse and replaced
  630. with the <code>sso_error.html</code> template. If your Synapse is configured to use
  631. SAML and a custom <code>sso_redirect_confirm_template_dir</code> configuration then
  632. any customisations of the <code>saml_error.html</code> template will need to be
  633. merged into the <code>sso_error.html</code> template. These templates are similar,
  634. but the parameters are slightly different:</p>
  635. <ul>
  636. <li>The <code>msg</code> parameter should be renamed to <code>error_description</code>.</li>
  637. <li>There is no longer a <code>code</code> parameter for the response code.</li>
  638. <li>A string <code>error</code> parameter is available that includes a short hint
  639. of why a user is seeing the error page.</li>
  640. </ul>
  641. <h1 id="upgrading-to-v1180"><a class="header" href="#upgrading-to-v1180">Upgrading to v1.18.0</a></h1>
  642. <h2 id="docker--py3title-ref-suffix-will-be-removed-in-future-versions"><a class="header" href="#docker--py3title-ref-suffix-will-be-removed-in-future-versions">Docker [-py3]{.title-ref} suffix will be removed in future versions</a></h2>
  643. <p>From 10th August 2020, we will no longer publish Docker images with the
  644. [-py3]{.title-ref} tag suffix. The images tagged with the
  645. [-py3]{.title-ref} suffix have been identical to the non-suffixed tags
  646. since release 0.99.0, and the suffix is obsolete.</p>
  647. <p>On 10th August, we will remove the [latest-py3]{.title-ref} tag.
  648. Existing per-release tags (such as [v1.18.0-py3]{.title-ref}) will not
  649. be removed, but no new [-py3]{.title-ref} tags will be added.</p>
  650. <p>Scripts relying on the [-py3]{.title-ref} suffix will need to be
  651. updated.</p>
  652. <h2 id="redis-replication-is-now-recommended-in-lieu-of-tcp-replication"><a class="header" href="#redis-replication-is-now-recommended-in-lieu-of-tcp-replication">Redis replication is now recommended in lieu of TCP replication</a></h2>
  653. <p>When setting up worker processes, we now recommend the use of a Redis
  654. server for replication. <strong>The old direct TCP connection method is
  655. deprecated and will be removed in a future release.</strong> See
  656. <a href="workers.html">workers</a> for more details.</p>
  657. <h1 id="upgrading-to-v1140"><a class="header" href="#upgrading-to-v1140">Upgrading to v1.14.0</a></h1>
  658. <p>This version includes a database update which is run as part of the
  659. upgrade, and which may take a couple of minutes in the case of a large
  660. server. Synapse will not respond to HTTP requests while this update is
  661. taking place.</p>
  662. <h1 id="upgrading-to-v1130"><a class="header" href="#upgrading-to-v1130">Upgrading to v1.13.0</a></h1>
  663. <h2 id="incorrect-database-migration-in-old-synapse-versions"><a class="header" href="#incorrect-database-migration-in-old-synapse-versions">Incorrect database migration in old synapse versions</a></h2>
  664. <p>A bug was introduced in Synapse 1.4.0 which could cause the room
  665. directory to be incomplete or empty if Synapse was upgraded directly
  666. from v1.2.1 or earlier, to versions between v1.4.0 and v1.12.x.</p>
  667. <p>This will <em>not</em> be a problem for Synapse installations which were:</p>
  668. <p>: - created at v1.4.0 or later,
  669. - upgraded via v1.3.x, or
  670. - upgraded straight from v1.2.1 or earlier to v1.13.0 or later.</p>
  671. <p>If completeness of the room directory is a concern, installations which
  672. are affected can be repaired as follows:</p>
  673. <ol>
  674. <li>
  675. <p>Run the following sql from a [psql]{.title-ref} or
  676. [sqlite3]{.title-ref} console:</p>
  677. <pre><code class="language-sql">INSERT INTO background_updates (update_name, progress_json, depends_on) VALUES
  678. ('populate_stats_process_rooms', '{}', 'current_state_events_membership');
  679. INSERT INTO background_updates (update_name, progress_json, depends_on) VALUES
  680. ('populate_stats_process_users', '{}', 'populate_stats_process_rooms');
  681. </code></pre>
  682. </li>
  683. <li>
  684. <p>Restart synapse.</p>
  685. </li>
  686. </ol>
  687. <h2 id="new-single-sign-on-html-templates"><a class="header" href="#new-single-sign-on-html-templates">New Single Sign-on HTML Templates</a></h2>
  688. <p>New templates (<code>sso_auth_confirm.html</code>, <code>sso_auth_success.html</code>, and
  689. <code>sso_account_deactivated.html</code>) were added to Synapse. If your Synapse
  690. is configured to use SSO and a custom
  691. <code>sso_redirect_confirm_template_dir</code> configuration then these templates
  692. will need to be copied from
  693. <a href="synapse/res/templates">synapse/res/templates</a> into that directory.</p>
  694. <h2 id="synapse-sso-plugins-method-deprecation"><a class="header" href="#synapse-sso-plugins-method-deprecation">Synapse SSO Plugins Method Deprecation</a></h2>
  695. <p>Plugins using the <code>complete_sso_login</code> method of
  696. <code>synapse.module_api.ModuleApi</code> should update to using the async/await
  697. version <code>complete_sso_login_async</code> which includes additional checks. The
  698. non-async version is considered deprecated.</p>
  699. <h2 id="rolling-back-to-v1124-after-a-failed-upgrade"><a class="header" href="#rolling-back-to-v1124-after-a-failed-upgrade">Rolling back to v1.12.4 after a failed upgrade</a></h2>
  700. <p>v1.13.0 includes a lot of large changes. If something problematic
  701. occurs, you may want to roll-back to a previous version of Synapse.
  702. Because v1.13.0 also includes a new database schema version, reverting
  703. that version is also required alongside the generic rollback
  704. instructions mentioned above. In short, to roll back to v1.12.4 you need
  705. to:</p>
  706. <ol>
  707. <li>
  708. <p>Stop the server</p>
  709. </li>
  710. <li>
  711. <p>Decrease the schema version in the database:</p>
  712. <pre><code class="language-sql">UPDATE schema_version SET version = 57;
  713. </code></pre>
  714. </li>
  715. <li>
  716. <p>Downgrade Synapse by following the instructions for your
  717. installation method in the &quot;Rolling back to older versions&quot;
  718. section above.</p>
  719. </li>
  720. </ol>
  721. <h1 id="upgrading-to-v1120"><a class="header" href="#upgrading-to-v1120">Upgrading to v1.12.0</a></h1>
  722. <p>This version includes a database update which is run as part of the
  723. upgrade, and which may take some time (several hours in the case of a
  724. large server). Synapse will not respond to HTTP requests while this
  725. update is taking place.</p>
  726. <p>This is only likely to be a problem in the case of a server which is
  727. participating in many rooms.</p>
  728. <ol start="0">
  729. <li>
  730. <p>As with all upgrades, it is recommended that you have a recent
  731. backup of your database which can be used for recovery in the event
  732. of any problems.</p>
  733. </li>
  734. <li>
  735. <p>As an initial check to see if you will be affected, you can try
  736. running the following query from the [psql]{.title-ref} or
  737. [sqlite3]{.title-ref} console. It is safe to run it while Synapse is
  738. still running.</p>
  739. <pre><code class="language-sql">SELECT MAX(q.v) FROM (
  740. SELECT (
  741. SELECT ej.json AS v
  742. FROM state_events se INNER JOIN event_json ej USING (event_id)
  743. WHERE se.room_id=rooms.room_id AND se.type='m.room.create' AND se.state_key=''
  744. LIMIT 1
  745. ) FROM rooms WHERE rooms.room_version IS NULL
  746. ) q;
  747. </code></pre>
  748. <p>This query will take about the same amount of time as the upgrade
  749. process: ie, if it takes 5 minutes, then it is likely that Synapse
  750. will be unresponsive for 5 minutes during the upgrade.</p>
  751. <p>If you consider an outage of this duration to be acceptable, no
  752. further action is necessary and you can simply start Synapse 1.12.0.</p>
  753. <p>If you would prefer to reduce the downtime, continue with the steps
  754. below.</p>
  755. </li>
  756. <li>
  757. <p>The easiest workaround for this issue is to manually create a new
  758. index before upgrading. On PostgreSQL, his can be done as follows:</p>
  759. <pre><code class="language-sql">CREATE INDEX CONCURRENTLY tmp_upgrade_1_12_0_index
  760. ON state_events(room_id) WHERE type = 'm.room.create';
  761. </code></pre>
  762. <p>The above query may take some time, but is also safe to run while
  763. Synapse is running.</p>
  764. <p>We assume that no SQLite users have databases large enough to be
  765. affected. If you <em>are</em> affected, you can run a similar query,
  766. omitting the <code>CONCURRENTLY</code> keyword. Note however that this
  767. operation may in itself cause Synapse to stop running for some time.
  768. Synapse admins are reminded that <a href="postgres.html">SQLite is not recommended for use
  769. outside a test environment</a>.</p>
  770. </li>
  771. <li>
  772. <p>Once the index has been created, the <code>SELECT</code> query in step 1 above
  773. should complete quickly. It is therefore safe to upgrade to Synapse
  774. 1.12.0.</p>
  775. </li>
  776. <li>
  777. <p>Once Synapse 1.12.0 has successfully started and is responding to
  778. HTTP requests, the temporary index can be removed:</p>
  779. <pre><code class="language-sql">DROP INDEX tmp_upgrade_1_12_0_index;
  780. </code></pre>
  781. </li>
  782. </ol>
  783. <h1 id="upgrading-to-v1100"><a class="header" href="#upgrading-to-v1100">Upgrading to v1.10.0</a></h1>
  784. <p>Synapse will now log a warning on start up if used with a PostgreSQL
  785. database that has a non-recommended locale set.</p>
  786. <p>See <a href="postgres.html">Postgres</a> for details.</p>
  787. <h1 id="upgrading-to-v180"><a class="header" href="#upgrading-to-v180">Upgrading to v1.8.0</a></h1>
  788. <p>Specifying a <code>log_file</code> config option will now cause Synapse to refuse
  789. to start, and should be replaced by with the <code>log_config</code> option.
  790. Support for the <code>log_file</code> option was removed in v1.3.0 and has since
  791. had no effect.</p>
  792. <h1 id="upgrading-to-v170"><a class="header" href="#upgrading-to-v170">Upgrading to v1.7.0</a></h1>
  793. <p>In an attempt to configure Synapse in a privacy preserving way, the
  794. default behaviours of <code>allow_public_rooms_without_auth</code> and
  795. <code>allow_public_rooms_over_federation</code> have been inverted. This means that
  796. by default, only authenticated users querying the Client/Server API will
  797. be able to query the room directory, and relatedly that the server will
  798. not share room directory information with other servers over federation.</p>
  799. <p>If your installation does not explicitly set these settings one way or
  800. the other and you want either setting to be <code>true</code> then it will
  801. necessary to update your homeserver configuration file accordingly.</p>
  802. <p>For more details on the surrounding context see our
  803. <a href="https://matrix.org/blog/2019/11/09/avoiding-unwelcome-visitors-on-private-matrix-servers">explainer</a>.</p>
  804. <h1 id="upgrading-to-v150"><a class="header" href="#upgrading-to-v150">Upgrading to v1.5.0</a></h1>
  805. <p>This release includes a database migration which may take several
  806. minutes to complete if there are a large number (more than a million or
  807. so) of entries in the <code>devices</code> table. This is only likely to a be a
  808. problem on very large installations.</p>
  809. <h1 id="upgrading-to-v140"><a class="header" href="#upgrading-to-v140">Upgrading to v1.4.0</a></h1>
  810. <h2 id="new-custom-templates"><a class="header" href="#new-custom-templates">New custom templates</a></h2>
  811. <p>If you have configured a custom template directory with the
  812. <code>email.template_dir</code> option, be aware that there are new templates
  813. regarding registration and threepid management (see below) that must be
  814. included.</p>
  815. <ul>
  816. <li><code>registration.html</code> and <code>registration.txt</code></li>
  817. <li><code>registration_success.html</code> and <code>registration_failure.html</code></li>
  818. <li><code>add_threepid.html</code> and <code>add_threepid.txt</code></li>
  819. <li><code>add_threepid_failure.html</code> and <code>add_threepid_success.html</code></li>
  820. </ul>
  821. <p>Synapse will expect these files to exist inside the configured template
  822. directory, and <strong>will fail to start</strong> if they are absent. To view the
  823. default templates, see
  824. <a href="https://github.com/matrix-org/synapse/tree/master/synapse/res/templates">synapse/res/templates</a>.</p>
  825. <h2 id="3pid-verification-changes"><a class="header" href="#3pid-verification-changes">3pid verification changes</a></h2>
  826. <p><strong>Note: As of this release, users will be unable to add phone numbers or
  827. email addresses to their accounts, without changes to the Synapse
  828. configuration. This includes adding an email address during
  829. registration.</strong></p>
  830. <p>It is possible for a user to associate an email address or phone number
  831. with their account, for a number of reasons:</p>
  832. <ul>
  833. <li>for use when logging in, as an alternative to the user id.</li>
  834. <li>in the case of email, as an alternative contact to help with account
  835. recovery.</li>
  836. <li>in the case of email, to receive notifications of missed messages.</li>
  837. </ul>
  838. <p>Before an email address or phone number can be added to a user's
  839. account, or before such an address is used to carry out a
  840. password-reset, Synapse must confirm the operation with the owner of the
  841. email address or phone number. It does this by sending an email or text
  842. giving the user a link or token to confirm receipt. This process is
  843. known as '3pid verification'. ('3pid', or 'threepid', stands for
  844. third-party identifier, and we use it to refer to external identifiers
  845. such as email addresses and phone numbers.)</p>
  846. <p>Previous versions of Synapse delegated the task of 3pid verification to
  847. an identity server by default. In most cases this server is <code>vector.im</code>
  848. or <code>matrix.org</code>.</p>
  849. <p>In Synapse 1.4.0, for security and privacy reasons, the homeserver will
  850. no longer delegate this task to an identity server by default. Instead,
  851. the server administrator will need to explicitly decide how they would
  852. like the verification messages to be sent.</p>
  853. <p>In the medium term, the <code>vector.im</code> and <code>matrix.org</code> identity servers
  854. will disable support for delegated 3pid verification entirely. However,
  855. in order to ease the transition, they will retain the capability for a
  856. limited period. Delegated email verification will be disabled on Monday
  857. 2nd December 2019 (giving roughly 2 months notice). Disabling delegated
  858. SMS verification will follow some time after that once SMS verification
  859. support lands in Synapse.</p>
  860. <p>Once delegated 3pid verification support has been disabled in the
  861. <code>vector.im</code> and <code>matrix.org</code> identity servers, all Synapse versions that
  862. depend on those instances will be unable to verify email and phone
  863. numbers through them. There are no imminent plans to remove delegated
  864. 3pid verification from Sydent generally. (Sydent is the identity server
  865. project that backs the <code>vector.im</code> and <code>matrix.org</code> instances).</p>
  866. <h3 id="email"><a class="header" href="#email">Email</a></h3>
  867. <p>Following upgrade, to continue verifying email (e.g. as part of the
  868. registration process), admins can either:-</p>
  869. <ul>
  870. <li>Configure Synapse to use an email server.</li>
  871. <li>Run or choose an identity server which allows delegated email
  872. verification and delegate to it.</li>
  873. </ul>
  874. <h4 id="configure-smtp-in-synapse"><a class="header" href="#configure-smtp-in-synapse">Configure SMTP in Synapse</a></h4>
  875. <p>To configure an SMTP server for Synapse, modify the configuration
  876. section headed <code>email</code>, and be sure to have at least the
  877. <code>smtp_host, smtp_port</code> and <code>notif_from</code> fields filled out.</p>
  878. <p>You may also need to set <code>smtp_user</code>, <code>smtp_pass</code>, and
  879. <code>require_transport_security</code>.</p>
  880. <p>See the <a href="usage/configuration/homeserver_sample_config.html">sample configuration file</a>
  881. for more details on these settings.</p>
  882. <h4 id="delegate-email-to-an-identity-server"><a class="header" href="#delegate-email-to-an-identity-server">Delegate email to an identity server</a></h4>
  883. <p>Some admins will wish to continue using email verification as part of
  884. the registration process, but will not immediately have an appropriate
  885. SMTP server at hand.</p>
  886. <p>To this end, we will continue to support email verification delegation
  887. via the <code>vector.im</code> and <code>matrix.org</code> identity servers for two months.
  888. Support for delegated email verification will be disabled on Monday 2nd
  889. December.</p>
  890. <p>The <code>account_threepid_delegates</code> dictionary defines whether the
  891. homeserver should delegate an external server (typically an <a href="https://matrix.org/docs/spec/identity_service/r0.2.1">identity
  892. server</a>) to handle
  893. sending confirmation messages via email and SMS.</p>
  894. <p>So to delegate email verification, in <code>homeserver.yaml</code>, set
  895. <code>account_threepid_delegates.email</code> to the base URL of an identity
  896. server. For example:</p>
  897. <pre><code class="language-yaml">account_threepid_delegates:
  898. email: https://example.com # Delegate email sending to example.com
  899. </code></pre>
  900. <p>Note that <code>account_threepid_delegates.email</code> replaces the deprecated
  901. <code>email.trust_identity_server_for_password_resets</code>: if
  902. <code>email.trust_identity_server_for_password_resets</code> is set to <code>true</code>, and
  903. <code>account_threepid_delegates.email</code> is not set, then the first entry in
  904. <code>trusted_third_party_id_servers</code> will be used as the
  905. <code>account_threepid_delegate</code> for email. This is to ensure compatibility
  906. with existing Synapse installs that set up external server handling for
  907. these tasks before v1.4.0. If
  908. <code>email.trust_identity_server_for_password_resets</code> is <code>true</code> and no
  909. trusted identity server domains are configured, Synapse will report an
  910. error and refuse to start.</p>
  911. <p>If <code>email.trust_identity_server_for_password_resets</code> is <code>false</code> or
  912. absent and no <code>email</code> delegate is configured in
  913. <code>account_threepid_delegates</code>, then Synapse will send email verification
  914. messages itself, using the configured SMTP server (see above). that
  915. type.</p>
  916. <h3 id="phone-numbers"><a class="header" href="#phone-numbers">Phone numbers</a></h3>
  917. <p>Synapse does not support phone-number verification itself, so the only
  918. way to maintain the ability for users to add phone numbers to their
  919. accounts will be by continuing to delegate phone number verification to
  920. the <code>matrix.org</code> and <code>vector.im</code> identity servers (or another identity
  921. server that supports SMS sending).</p>
  922. <p>The <code>account_threepid_delegates</code> dictionary defines whether the
  923. homeserver should delegate an external server (typically an <a href="https://matrix.org/docs/spec/identity_service/r0.2.1">identity
  924. server</a>) to handle
  925. sending confirmation messages via email and SMS.</p>
  926. <p>So to delegate phone number verification, in <code>homeserver.yaml</code>, set
  927. <code>account_threepid_delegates.msisdn</code> to the base URL of an identity
  928. server. For example:</p>
  929. <pre><code class="language-yaml">account_threepid_delegates:
  930. msisdn: https://example.com # Delegate sms sending to example.com
  931. </code></pre>
  932. <p>The <code>matrix.org</code> and <code>vector.im</code> identity servers will continue to
  933. support delegated phone number verification via SMS until such time as
  934. it is possible for admins to configure their servers to perform phone
  935. number verification directly. More details will follow in a future
  936. release.</p>
  937. <h2 id="rolling-back-to-v131"><a class="header" href="#rolling-back-to-v131">Rolling back to v1.3.1</a></h2>
  938. <p>If you encounter problems with v1.4.0, it should be possible to roll
  939. back to v1.3.1, subject to the following:</p>
  940. <ul>
  941. <li>
  942. <p>The 'room statistics' engine was heavily reworked in this release
  943. (see <a href="https://github.com/matrix-org/synapse/pull/5971">#5971</a>),
  944. including significant changes to the database schema, which are not
  945. easily reverted. This will cause the room statistics engine to stop
  946. updating when you downgrade.</p>
  947. <p>The room statistics are essentially unused in v1.3.1 (in future
  948. versions of Synapse, they will be used to populate the room
  949. directory), so there should be no loss of functionality. However,
  950. the statistics engine will write errors to the logs, which can be
  951. avoided by setting the following in <code>homeserver.yaml</code>:</p>
  952. <pre><code class="language-yaml">stats:
  953. enabled: false
  954. </code></pre>
  955. <p>Don't forget to re-enable it when you upgrade again, in preparation
  956. for its use in the room directory!</p>
  957. </li>
  958. </ul>
  959. <h1 id="upgrading-to-v120"><a class="header" href="#upgrading-to-v120">Upgrading to v1.2.0</a></h1>
  960. <p>Some counter metrics have been renamed, with the old names deprecated.
  961. See <a href="metrics-howto.html#renaming-of-metrics--deprecation-of-old-names-in-12">the metrics
  962. documentation</a>
  963. for details.</p>
  964. <h1 id="upgrading-to-v110"><a class="header" href="#upgrading-to-v110">Upgrading to v1.1.0</a></h1>
  965. <p>Synapse v1.1.0 removes support for older Python and PostgreSQL versions,
  966. as outlined in <a href="https://matrix.org/blog/2019/04/08/synapse-deprecating-postgres-9-4-and-python-2-x">our deprecation
  967. notice</a>.</p>
  968. <h2 id="minimum-python-version"><a class="header" href="#minimum-python-version">Minimum Python Version</a></h2>
  969. <p>Synapse v1.1.0 has a minimum Python requirement of Python 3.5. Python
  970. 3.6 or Python 3.7 are recommended as they have improved internal string
  971. handling, significantly reducing memory usage.</p>
  972. <p>If you use current versions of the Matrix.org-distributed Debian
  973. packages or Docker images, action is not required.</p>
  974. <p>If you install Synapse in a Python virtual environment, please see
  975. &quot;Upgrading to v0.34.0&quot; for notes on setting up a new virtualenv under
  976. Python 3.</p>
  977. <h2 id="minimum-postgresql-version"><a class="header" href="#minimum-postgresql-version">Minimum PostgreSQL Version</a></h2>
  978. <p>If using PostgreSQL under Synapse, you will need to use PostgreSQL 9.5
  979. or above. Please see the <a href="https://www.postgresql.org/docs/11/upgrading.html">PostgreSQL
  980. documentation</a> for
  981. more details on upgrading your database.</p>
  982. <h1 id="upgrading-to-v10"><a class="header" href="#upgrading-to-v10">Upgrading to v1.0</a></h1>
  983. <h2 id="validation-of-tls-certificates"><a class="header" href="#validation-of-tls-certificates">Validation of TLS certificates</a></h2>
  984. <p>Synapse v1.0 is the first release to enforce validation of TLS
  985. certificates for the federation API. It is therefore essential that your
  986. certificates are correctly configured. See the
  987. <a href="MSC1711_certificates_FAQ.html">FAQ</a> for more information.</p>
  988. <p>Note, v1.0 installations will also no longer be able to federate with
  989. servers that have not correctly configured their certificates.</p>
  990. <p>In rare cases, it may be desirable to disable certificate checking: for
  991. example, it might be essential to be able to federate with a given
  992. legacy server in a closed federation. This can be done in one of two
  993. ways:-</p>
  994. <ul>
  995. <li>Configure the global switch <code>federation_verify_certificates</code> to
  996. <code>false</code>.</li>
  997. <li>Configure a whitelist of server domains to trust via
  998. <code>federation_certificate_verification_whitelist</code>.</li>
  999. </ul>
  1000. <p>See the <a href="usage/configuration/homeserver_sample_config.html">sample configuration file</a>
  1001. for more details on these settings.</p>
  1002. <h2 id="email-1"><a class="header" href="#email-1">Email</a></h2>
  1003. <p>When a user requests a password reset, Synapse will send an email to the
  1004. user to confirm the request.</p>
  1005. <p>Previous versions of Synapse delegated the job of sending this email to
  1006. an identity server. If the identity server was somehow malicious or
  1007. became compromised, it would be theoretically possible to hijack an
  1008. account through this means.</p>
  1009. <p>Therefore, by default, Synapse v1.0 will send the confirmation email
  1010. itself. If Synapse is not configured with an SMTP server, password reset
  1011. via email will be disabled.</p>
  1012. <p>To configure an SMTP server for Synapse, modify the configuration
  1013. section headed <code>email</code>, and be sure to have at least the <code>smtp_host</code>,
  1014. <code>smtp_port</code> and <code>notif_from</code> fields filled out. You may also need to set
  1015. <code>smtp_user</code>, <code>smtp_pass</code>, and <code>require_transport_security</code>.</p>
  1016. <p>If you are absolutely certain that you wish to continue using an
  1017. identity server for password resets, set
  1018. <code>trust_identity_server_for_password_resets</code> to <code>true</code>.</p>
  1019. <p>See the <a href="usage/configuration/homeserver_sample_config.html">sample configuration file</a>
  1020. for more details on these settings.</p>
  1021. <h2 id="new-email-templates"><a class="header" href="#new-email-templates">New email templates</a></h2>
  1022. <p>Some new templates have been added to the default template directory for the purpose of
  1023. the homeserver sending its own password reset emails. If you have configured a
  1024. custom <code>template_dir</code> in your Synapse config, these files will need to be added.</p>
  1025. <p><code>password_reset.html</code> and <code>password_reset.txt</code> are HTML and plain text
  1026. templates respectively that contain the contents of what will be emailed
  1027. to the user upon attempting to reset their password via email.
  1028. <code>password_reset_success.html</code> and <code>password_reset_failure.html</code> are HTML
  1029. files that the content of which (assuming no redirect URL is set) will
  1030. be shown to the user after they attempt to click the link in the email
  1031. sent to them.</p>
  1032. <h1 id="upgrading-to-v0990"><a class="header" href="#upgrading-to-v0990">Upgrading to v0.99.0</a></h1>
  1033. <p>Please be aware that, before Synapse v1.0 is released around March 2019,
  1034. you will need to replace any self-signed certificates with those
  1035. verified by a root CA. Information on how to do so can be found at the
  1036. ACME docs.</p>
  1037. <p>For more information on configuring TLS certificates see the
  1038. <a href="MSC1711_certificates_FAQ.html">FAQ</a>.</p>
  1039. <h1 id="upgrading-to-v0340"><a class="header" href="#upgrading-to-v0340">Upgrading to v0.34.0</a></h1>
  1040. <ol>
  1041. <li>
  1042. <p>This release is the first to fully support Python 3. Synapse will
  1043. now run on Python versions 3.5, or 3.6 (as well as 2.7). We
  1044. recommend switching to Python 3, as it has been shown to give
  1045. performance improvements.</p>
  1046. <p>For users who have installed Synapse into a virtualenv, we recommend
  1047. doing this by creating a new virtualenv. For example:</p>
  1048. <pre><code>virtualenv -p python3 ~/synapse/env3
  1049. source ~/synapse/env3/bin/activate
  1050. pip install matrix-synapse
  1051. </code></pre>
  1052. <p>You can then start synapse as normal, having activated the new
  1053. virtualenv:</p>
  1054. <pre><code>cd ~/synapse
  1055. source env3/bin/activate
  1056. synctl start
  1057. </code></pre>
  1058. <p>Users who have installed from distribution packages should see the
  1059. relevant package documentation. See below for notes on Debian
  1060. packages.</p>
  1061. <ul>
  1062. <li>
  1063. <p>When upgrading to Python 3, you <strong>must</strong> make sure that your log
  1064. files are configured as UTF-8, by adding <code>encoding: utf8</code> to the
  1065. <code>RotatingFileHandler</code> configuration (if you have one) in your
  1066. <code>&lt;server&gt;.log.config</code> file. For example, if your <code>log.config</code>
  1067. file contains:</p>
  1068. <pre><code>handlers:
  1069. file:
  1070. class: logging.handlers.RotatingFileHandler
  1071. formatter: precise
  1072. filename: homeserver.log
  1073. maxBytes: 104857600
  1074. backupCount: 10
  1075. filters: [context]
  1076. console:
  1077. class: logging.StreamHandler
  1078. formatter: precise
  1079. filters: [context]
  1080. </code></pre>
  1081. <p>Then you should update this to be:</p>
  1082. <pre><code>handlers:
  1083. file:
  1084. class: logging.handlers.RotatingFileHandler
  1085. formatter: precise
  1086. filename: homeserver.log
  1087. maxBytes: 104857600
  1088. backupCount: 10
  1089. filters: [context]
  1090. encoding: utf8
  1091. console:
  1092. class: logging.StreamHandler
  1093. formatter: precise
  1094. filters: [context]
  1095. </code></pre>
  1096. <p>There is no need to revert this change if downgrading to
  1097. Python 2.</p>
  1098. </li>
  1099. </ul>
  1100. <p>We are also making available Debian packages which will run Synapse
  1101. on Python 3. You can switch to these packages with
  1102. <code>apt-get install matrix-synapse-py3</code>, however, please read
  1103. <a href="https://github.com/matrix-org/synapse/blob/release-v0.34.0/debian/NEWS">debian/NEWS</a>
  1104. before doing so. The existing <code>matrix-synapse</code> packages will
  1105. continue to use Python 2 for the time being.</p>
  1106. </li>
  1107. <li>
  1108. <p>This release removes the <code>riot.im</code> from the default list of trusted
  1109. identity servers.</p>
  1110. <p>If <code>riot.im</code> is in your homeserver's list of
  1111. <code>trusted_third_party_id_servers</code>, you should remove it. It was added
  1112. in case a hypothetical future identity server was put there. If you
  1113. don't remove it, users may be unable to deactivate their accounts.</p>
  1114. </li>
  1115. <li>
  1116. <p>This release no longer installs the (unmaintained) Matrix Console
  1117. web client as part of the default installation. It is possible to
  1118. re-enable it by installing it separately and setting the
  1119. <code>web_client_location</code> config option, but please consider switching
  1120. to another client.</p>
  1121. </li>
  1122. </ol>
  1123. <h1 id="upgrading-to-v0337"><a class="header" href="#upgrading-to-v0337">Upgrading to v0.33.7</a></h1>
  1124. <p>This release removes the example email notification templates from
  1125. <code>res/templates</code> (they are now internal to the python package). This
  1126. should only affect you if you (a) deploy your Synapse instance from a
  1127. git checkout or a github snapshot URL, and (b) have email notifications
  1128. enabled.</p>
  1129. <p>If you have email notifications enabled, you should ensure that
  1130. <code>email.template_dir</code> is either configured to point at a directory where
  1131. you have installed customised templates, or leave it unset to use the
  1132. default templates.</p>
  1133. <h1 id="upgrading-to-v0273"><a class="header" href="#upgrading-to-v0273">Upgrading to v0.27.3</a></h1>
  1134. <p>This release expands the anonymous usage stats sent if the opt-in
  1135. <code>report_stats</code> configuration is set to <code>true</code>. We now capture RSS memory
  1136. and cpu use at a very coarse level. This requires administrators to
  1137. install the optional <code>psutil</code> python module.</p>
  1138. <p>We would appreciate it if you could assist by ensuring this module is
  1139. available and <code>report_stats</code> is enabled. This will let us see if
  1140. performance changes to synapse are having an impact to the general
  1141. community.</p>
  1142. <h1 id="upgrading-to-v0150"><a class="header" href="#upgrading-to-v0150">Upgrading to v0.15.0</a></h1>
  1143. <p>If you want to use the new URL previewing API
  1144. (<code>/_matrix/media/r0/preview_url</code>) then you have to explicitly enable it
  1145. in the config and update your dependencies dependencies. See README.rst
  1146. for details.</p>
  1147. <h1 id="upgrading-to-v0110"><a class="header" href="#upgrading-to-v0110">Upgrading to v0.11.0</a></h1>
  1148. <p>This release includes the option to send anonymous usage stats to
  1149. matrix.org, and requires that administrators explictly opt in or out by
  1150. setting the <code>report_stats</code> option to either <code>true</code> or <code>false</code>.</p>
  1151. <p>We would really appreciate it if you could help our project out by
  1152. reporting anonymized usage statistics from your homeserver. Only very
  1153. basic aggregate data (e.g. number of users) will be reported, but it
  1154. helps us to track the growth of the Matrix community, and helps us to
  1155. make Matrix a success, as well as to convince other networks that they
  1156. should peer with us.</p>
  1157. <h1 id="upgrading-to-v090"><a class="header" href="#upgrading-to-v090">Upgrading to v0.9.0</a></h1>
  1158. <p>Application services have had a breaking API change in this version.</p>
  1159. <p>They can no longer register themselves with a home server using the AS
  1160. HTTP API. This decision was made because a compromised application
  1161. service with free reign to register any regex in effect grants full
  1162. read/write access to the home server if a regex of <code>.*</code> is used. An
  1163. attack where a compromised AS re-registers itself with <code>.*</code> was deemed
  1164. too big of a security risk to ignore, and so the ability to register
  1165. with the HS remotely has been removed.</p>
  1166. <p>It has been replaced by specifying a list of application service
  1167. registrations in <code>homeserver.yaml</code>:</p>
  1168. <pre><code>app_service_config_files: [&quot;registration-01.yaml&quot;, &quot;registration-02.yaml&quot;]
  1169. </code></pre>
  1170. <p>Where <code>registration-01.yaml</code> looks like:</p>
  1171. <pre><code>url: &lt;String&gt; # e.g. &quot;https://my.application.service.com&quot;
  1172. as_token: &lt;String&gt;
  1173. hs_token: &lt;String&gt;
  1174. sender_localpart: &lt;String&gt; # This is a new field which denotes the user_id localpart when using the AS token
  1175. namespaces:
  1176. users:
  1177. - exclusive: &lt;Boolean&gt;
  1178. regex: &lt;String&gt; # e.g. &quot;@prefix_.*&quot;
  1179. aliases:
  1180. - exclusive: &lt;Boolean&gt;
  1181. regex: &lt;String&gt;
  1182. rooms:
  1183. - exclusive: &lt;Boolean&gt;
  1184. regex: &lt;String&gt;
  1185. </code></pre>
  1186. <h1 id="upgrading-to-v080"><a class="header" href="#upgrading-to-v080">Upgrading to v0.8.0</a></h1>
  1187. <p>Servers which use captchas will need to add their public key to:</p>
  1188. <pre><code>static/client/register/register_config.js
  1189. window.matrixRegistrationConfig = {
  1190. recaptcha_public_key: &quot;YOUR_PUBLIC_KEY&quot;
  1191. };
  1192. </code></pre>
  1193. <p>This is required in order to support registration fallback (typically
  1194. used on mobile devices).</p>
  1195. <h1 id="upgrading-to-v070"><a class="header" href="#upgrading-to-v070">Upgrading to v0.7.0</a></h1>
  1196. <p>New dependencies are:</p>
  1197. <ul>
  1198. <li>pydenticon</li>
  1199. <li>simplejson</li>
  1200. <li>syutil</li>
  1201. <li>matrix-angular-sdk</li>
  1202. </ul>
  1203. <p>To pull in these dependencies in a virtual env, run:</p>
  1204. <pre><code>python synapse/python_dependencies.py | xargs -n 1 pip install
  1205. </code></pre>
  1206. <h1 id="upgrading-to-v060"><a class="header" href="#upgrading-to-v060">Upgrading to v0.6.0</a></h1>
  1207. <p>To pull in new dependencies, run:</p>
  1208. <pre><code>python setup.py develop --user
  1209. </code></pre>
  1210. <p>This update includes a change to the database schema. To upgrade you
  1211. first need to upgrade the database by running:</p>
  1212. <pre><code>python scripts/upgrade_db_to_v0.6.0.py &lt;db&gt; &lt;server_name&gt; &lt;signing_key&gt;
  1213. </code></pre>
  1214. <p>Where [<db>]{.title-ref} is the location of the database,
  1215. [&lt;server_name&gt;]{.title-ref} is the server name as specified in the
  1216. synapse configuration, and [&lt;signing_key&gt;]{.title-ref} is the location
  1217. of the signing key as specified in the synapse configuration.</p>
  1218. <p>This may take some time to complete. Failures of signatures and content
  1219. hashes can safely be ignored.</p>
  1220. <h1 id="upgrading-to-v051"><a class="header" href="#upgrading-to-v051">Upgrading to v0.5.1</a></h1>
  1221. <p>Depending on precisely when you installed v0.5.0 you may have ended up
  1222. with a stale release of the reference matrix webclient installed as a
  1223. python module. To uninstall it and ensure you are depending on the
  1224. latest module, please run:</p>
  1225. <pre><code>$ pip uninstall syweb
  1226. </code></pre>
  1227. <h1 id="upgrading-to-v050"><a class="header" href="#upgrading-to-v050">Upgrading to v0.5.0</a></h1>
  1228. <p>The webclient has been split out into a seperate repository/pacakage in
  1229. this release. Before you restart your homeserver you will need to pull
  1230. in the webclient package by running:</p>
  1231. <pre><code>python setup.py develop --user
  1232. </code></pre>
  1233. <p>This release completely changes the database schema and so requires
  1234. upgrading it before starting the new version of the homeserver.</p>
  1235. <p>The script &quot;database-prepare-for-0.5.0.sh&quot; should be used to upgrade
  1236. the database. This will save all user information, such as logins and
  1237. profiles, but will otherwise purge the database. This includes messages,
  1238. which rooms the home server was a member of and room alias mappings.</p>
  1239. <p>If you would like to keep your history, please take a copy of your
  1240. database file and ask for help in #matrix:matrix.org. The upgrade
  1241. process is, unfortunately, non trivial and requires human intervention
  1242. to resolve any resulting conflicts during the upgrade process.</p>
  1243. <p>Before running the command the homeserver should be first completely
  1244. shutdown. To run it, simply specify the location of the database, e.g.:</p>
  1245. <blockquote>
  1246. <p>./scripts/database-prepare-for-0.5.0.sh &quot;homeserver.db&quot;</p>
  1247. </blockquote>
  1248. <p>Once this has successfully completed it will be safe to restart the
  1249. homeserver. You may notice that the homeserver takes a few seconds
  1250. longer to restart than usual as it reinitializes the database.</p>
  1251. <p>On startup of the new version, users can either rejoin remote rooms
  1252. using room aliases or by being reinvited. Alternatively, if any other
  1253. homeserver sends a message to a room that the homeserver was previously
  1254. in the local HS will automatically rejoin the room.</p>
  1255. <h1 id="upgrading-to-v040"><a class="header" href="#upgrading-to-v040">Upgrading to v0.4.0</a></h1>
  1256. <p>This release needs an updated syutil version. Run:</p>
  1257. <pre><code>python setup.py develop
  1258. </code></pre>
  1259. <p>You will also need to upgrade your configuration as the signing key
  1260. format has changed. Run:</p>
  1261. <pre><code>python -m synapse.app.homeserver --config-path &lt;CONFIG&gt; --generate-config
  1262. </code></pre>
  1263. <h1 id="upgrading-to-v030"><a class="header" href="#upgrading-to-v030">Upgrading to v0.3.0</a></h1>
  1264. <p>This registration API now closely matches the login API. This introduces
  1265. a bit more backwards and forwards between the HS and the client, but
  1266. this improves the overall flexibility of the API. You can now GET on
  1267. /register to retrieve a list of valid registration flows. Upon choosing
  1268. one, they are submitted in the same way as login, e.g:</p>
  1269. <pre><code>{
  1270. type: m.login.password,
  1271. user: foo,
  1272. password: bar
  1273. }
  1274. </code></pre>
  1275. <p>The default HS supports 2 flows, with and without Identity Server email
  1276. authentication. Enabling captcha on the HS will add in an extra step to
  1277. all flows: <code>m.login.recaptcha</code> which must be completed before you can
  1278. transition to the next stage. There is a new login type:
  1279. <code>m.login.email.identity</code> which contains the <code>threepidCreds</code> key which
  1280. were previously sent in the original register request. For more
  1281. information on this, see the specification.</p>
  1282. <h2 id="web-client"><a class="header" href="#web-client">Web Client</a></h2>
  1283. <p>The VoIP specification has changed between v0.2.0 and v0.3.0. Users
  1284. should refresh any browser tabs to get the latest web client code. Users
  1285. on v0.2.0 of the web client will not be able to call those on v0.3.0 and
  1286. vice versa.</p>
  1287. <h1 id="upgrading-to-v020"><a class="header" href="#upgrading-to-v020">Upgrading to v0.2.0</a></h1>
  1288. <p>The home server now requires setting up of SSL config before it can run.
  1289. To automatically generate default config use:</p>
  1290. <pre><code>$ python synapse/app/homeserver.py \
  1291. --server-name machine.my.domain.name \
  1292. --bind-port 8448 \
  1293. --config-path homeserver.config \
  1294. --generate-config
  1295. </code></pre>
  1296. <p>This config can be edited if desired, for example to specify a different
  1297. SSL certificate to use. Once done you can run the home server using:</p>
  1298. <pre><code>$ python synapse/app/homeserver.py --config-path homeserver.config
  1299. </code></pre>
  1300. <p>See the README.rst for more information.</p>
  1301. <p>Also note that some config options have been renamed, including:</p>
  1302. <ul>
  1303. <li>&quot;host&quot; to &quot;server-name&quot;</li>
  1304. <li>&quot;database&quot; to &quot;database-path&quot;</li>
  1305. <li>&quot;port&quot; to &quot;bind-port&quot; and &quot;unsecure-port&quot;</li>
  1306. </ul>
  1307. <h1 id="upgrading-to-v001"><a class="header" href="#upgrading-to-v001">Upgrading to v0.0.1</a></h1>
  1308. <p>This release completely changes the database schema and so requires
  1309. upgrading it before starting the new version of the homeserver.</p>
  1310. <p>The script &quot;database-prepare-for-0.0.1.sh&quot; should be used to upgrade
  1311. the database. This will save all user information, such as logins and
  1312. profiles, but will otherwise purge the database. This includes messages,
  1313. which rooms the home server was a member of and room alias mappings.</p>
  1314. <p>Before running the command the homeserver should be first completely
  1315. shutdown. To run it, simply specify the location of the database, e.g.:</p>
  1316. <blockquote>
  1317. <p>./scripts/database-prepare-for-0.0.1.sh &quot;homeserver.db&quot;</p>
  1318. </blockquote>
  1319. <p>Once this has successfully completed it will be safe to restart the
  1320. homeserver. You may notice that the homeserver takes a few seconds
  1321. longer to restart than usual as it reinitializes the database.</p>
  1322. <p>On startup of the new version, users can either rejoin remote rooms
  1323. using room aliases or by being reinvited. Alternatively, if any other
  1324. homeserver sends a message to a room that the homeserver was previously
  1325. in the local HS will automatically rejoin the room.</p>
  1326. </main>
  1327. <nav class="nav-wrapper" aria-label="Page navigation">
  1328. <!-- Mobile navigation buttons -->
  1329. <a rel="prev" href="delegate.html" class="mobile-nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
  1330. <i class="fa fa-angle-left"></i>
  1331. </a>
  1332. <a rel="next" href="MSC1711_certificates_FAQ.html" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
  1333. <i class="fa fa-angle-right"></i>
  1334. </a>
  1335. <div style="clear: both"></div>
  1336. </nav>
  1337. </div>
  1338. </div>
  1339. <nav class="nav-wide-wrapper" aria-label="Page navigation">
  1340. <a rel="prev" href="delegate.html" class="nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
  1341. <i class="fa fa-angle-left"></i>
  1342. </a>
  1343. <a rel="next" href="MSC1711_certificates_FAQ.html" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
  1344. <i class="fa fa-angle-right"></i>
  1345. </a>
  1346. </nav>
  1347. </div>
  1348. <script type="text/javascript">
  1349. window.playground_copyable = true;
  1350. </script>
  1351. <script src="elasticlunr.min.js" type="text/javascript" charset="utf-8"></script>
  1352. <script src="mark.min.js" type="text/javascript" charset="utf-8"></script>
  1353. <script src="searcher.js" type="text/javascript" charset="utf-8"></script>
  1354. <script src="clipboard.min.js" type="text/javascript" charset="utf-8"></script>
  1355. <script src="highlight.js" type="text/javascript" charset="utf-8"></script>
  1356. <script src="book.js" type="text/javascript" charset="utf-8"></script>
  1357. <!-- Custom JS scripts -->
  1358. <script type="text/javascript" src="docs/website_files/table-of-contents.js"></script>
  1359. </body>
  1360. </html>