upgrade.html 106 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563
  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 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 "><a href="usage/configuration/user_authentication/single_sign_on/index.html">Single-Sign On</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="openid.html">OpenID Connect</a></li><li class="chapter-item expanded "><a href="usage/configuration/user_authentication/single_sign_on/saml.html">SAML</a></li><li class="chapter-item expanded "><a href="usage/configuration/user_authentication/single_sign_on/cas.html">CAS</a></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><li class="chapter-item expanded "><a href="usage/configuration/user_authentication/refresh_tokens.html">Refresh 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/password_auth_provider_callbacks.html">Password auth provider callbacks</a></li><li class="chapter-item expanded "><a href="modules/background_update_controller_callbacks.html">Background update controller callbacks</a></li><li class="chapter-item expanded "><a href="modules/account_data_callbacks.html">Account data 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="usage/administration/admin_api/background_updates.html">Background Updates</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><li class="chapter-item expanded "><a href="usage/administration/admin_api/federation.html">Federation</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/understanding_synapse_through_grafana_graphs.html">Understanding Synapse Through Grafana Graphs</a></li><li class="chapter-item expanded "><a href="usage/administration/useful_sql_for_admins.html">Useful SQL for Admins</a></li><li class="chapter-item expanded "><a href="usage/administration/database_maintenance_tools.html">Database Maintenance Tools</a></li><li class="chapter-item expanded "><a href="usage/administration/state_groups.html">State Groups</a></li><li class="chapter-item expanded "><a href="usage/administration/request_log.html">Request log format</a></li><li class="chapter-item expanded "><a href="usage/administration/admin_faq.html">Admin FAQ</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/releases.html">Release Cycle</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><ol class="section"><li class="chapter-item expanded "><a href="development/demo.html">Demo scripts</a></li></ol></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 "><a href="development/experimental_features.html">Experimental features</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><li class="chapter-item expanded "><a href="other/running_synapse_on_single_board_computers.html">Running Synapse on a Single-Board Computer</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-v1570"><a class="header" href="#upgrading-to-v1570">Upgrading to v1.57.0</a></h1>
  214. <h2 id="changes-to-database-schema-for-application-services"><a class="header" href="#changes-to-database-schema-for-application-services">Changes to database schema for application services</a></h2>
  215. <p>Synapse v1.57.0 includes a <a href="https://github.com/matrix-org/synapse/pull/12209">change</a> to the
  216. way transaction IDs are managed for application services. If your deployment uses a dedicated
  217. worker for application service traffic, <strong>it must be stopped</strong> when the database is upgraded
  218. (which normally happens when the main process is upgraded), to ensure the change is made safely
  219. without any risk of reusing transaction IDs.</p>
  220. <p>Deployments which do not use separate worker processes can be upgraded as normal. Similarly,
  221. deployments where no application services are in use can be upgraded as normal.</p>
  222. <details>
  223. <summary><b>Recovering from an incorrect upgrade</b></summary>
  224. <p>If the database schema is upgraded <em>without</em> stopping the worker responsible
  225. for AS traffic, then the following error may be given when attempting to start
  226. a Synapse worker or master process:</p>
  227. <pre><code>**********************************************************************************
  228. Error during initialisation:
  229. Postgres sequence 'application_services_txn_id_seq' is inconsistent with associated
  230. table 'application_services_txns'. This can happen if Synapse has been downgraded and
  231. then upgraded again, or due to a bad migration.
  232. To fix this error, shut down Synapse (including any and all workers)
  233. and run the following SQL:
  234. SELECT setval('application_services_txn_id_seq', (
  235. SELECT GREATEST(MAX(txn_id), 0) FROM application_services_txns
  236. ));
  237. See docs/postgres.md for more information.
  238. There may be more information in the logs.
  239. **********************************************************************************
  240. </code></pre>
  241. <p>This error may also be seen if Synapse is <em>downgraded</em> to an earlier version,
  242. and then upgraded again to v1.57.0 or later.</p>
  243. <p>In either case:</p>
  244. <ol>
  245. <li>Ensure that the worker responsible for AS traffic is stopped.</li>
  246. <li>Run the SQL command given in the error message via <code>psql</code>.</li>
  247. </ol>
  248. <p>Synapse should then start correctly.</p>
  249. </details>
  250. <h1 id="upgrading-to-v1560"><a class="header" href="#upgrading-to-v1560">Upgrading to v1.56.0</a></h1>
  251. <h2 id="open-registration-without-verification-is-now-disabled-by-default"><a class="header" href="#open-registration-without-verification-is-now-disabled-by-default">Open registration without verification is now disabled by default</a></h2>
  252. <p>Synapse will refuse to start if registration is enabled without email, captcha, or token-based verification unless the new config
  253. flag <code>enable_registration_without_verification</code> is set to &quot;true&quot;.</p>
  254. <h2 id="groupscommunities-feature-has-been-deprecated"><a class="header" href="#groupscommunities-feature-has-been-deprecated">Groups/communities feature has been deprecated</a></h2>
  255. <p>The non-standard groups/communities feature in Synapse has been deprecated and will
  256. be disabled by default in Synapse v1.58.0.</p>
  257. <p>You can test disabling it by adding the following to your homeserver configuration:</p>
  258. <pre><code class="language-yaml">experimental_features:
  259. groups_enabled: false
  260. </code></pre>
  261. <h2 id="change-in-behaviour-for-postgresql-databases-with-unsafe-locale"><a class="header" href="#change-in-behaviour-for-postgresql-databases-with-unsafe-locale">Change in behaviour for PostgreSQL databases with unsafe locale</a></h2>
  262. <p>Synapse now refuses to start when using PostgreSQL with non-<code>C</code> values for <code>COLLATE</code> and
  263. <code>CTYPE</code> unless the config flag <code>allow_unsafe_locale</code>, found in the database section of
  264. the configuration file, is set to <code>true</code>. See the <a href="https://matrix-org.github.io/synapse/latest/postgres.html#fixing-incorrect-collate-or-ctype">PostgreSQL documentation</a>
  265. for more information and instructions on how to fix a database with incorrect values.</p>
  266. <h1 id="upgrading-to-v1550"><a class="header" href="#upgrading-to-v1550">Upgrading to v1.55.0</a></h1>
  267. <h2 id="synctl-script-has-been-moved"><a class="header" href="#synctl-script-has-been-moved"><code>synctl</code> script has been moved</a></h2>
  268. <p>The <code>synctl</code> script
  269. <a href="https://github.com/matrix-org/synapse/pull/12140">has been made</a> an
  270. <a href="https://packaging.python.org/en/latest/specifications/entry-points/">entry point</a>
  271. and no longer exists at the root of Synapse's source tree. If you wish to use
  272. <code>synctl</code> to manage your homeserver, you should invoke <code>synctl</code> directly, e.g.
  273. <code>synctl start</code> instead of <code>./synctl start</code> or <code>/path/to/synctl start</code>.</p>
  274. <p>You will need to ensure <code>synctl</code> is on your <code>PATH</code>.</p>
  275. <ul>
  276. <li>This is automatically the case when using
  277. <a href="https://packages.matrix.org/debian/">Debian packages</a> or
  278. <a href="https://hub.docker.com/r/matrixdotorg/synapse">docker images</a>
  279. provided by Matrix.org.</li>
  280. <li>When installing from a wheel, sdist, or PyPI, a <code>synctl</code> executable is added
  281. to your Python installation's <code>bin</code>. This should be on your <code>PATH</code>
  282. automatically, though you might need to activate a virtual environment
  283. depending on how you installed Synapse.</li>
  284. </ul>
  285. <h2 id="compatibility-dropped-for-mjolnir-131-and-earlier"><a class="header" href="#compatibility-dropped-for-mjolnir-131-and-earlier">Compatibility dropped for Mjolnir 1.3.1 and earlier</a></h2>
  286. <p>Synapse v1.55.0 drops support for Mjolnir 1.3.1 and earlier.
  287. If you use the Mjolnir module to moderate your homeserver,
  288. please upgrade Mjolnir to version 1.3.2 or later before upgrading Synapse.</p>
  289. <h1 id="upgrading-to-v1540"><a class="header" href="#upgrading-to-v1540">Upgrading to v1.54.0</a></h1>
  290. <h2 id="legacy-structured-logging-configuration-removal"><a class="header" href="#legacy-structured-logging-configuration-removal">Legacy structured logging configuration removal</a></h2>
  291. <p>This release removes support for the <code>structured: true</code> logging configuration
  292. which was deprecated in Synapse v1.23.0. If your logging configuration contains
  293. <code>structured: true</code> then it should be modified based on the
  294. <a href="https://matrix-org.github.io/synapse/v1.56/structured_logging.html#upgrading-from-legacy-structured-logging-configuration">structured logging documentation</a>.</p>
  295. <h1 id="upgrading-to-v1530"><a class="header" href="#upgrading-to-v1530">Upgrading to v1.53.0</a></h1>
  296. <h2 id="dropping-support-for-webclient-listeners-and-non-https-web_client_location"><a class="header" href="#dropping-support-for-webclient-listeners-and-non-https-web_client_location">Dropping support for <code>webclient</code> listeners and non-HTTP(S) <code>web_client_location</code></a></h2>
  297. <p>Per the deprecation notice in Synapse v1.51.0, listeners of type <code>webclient</code>
  298. are no longer supported and configuring them is a now a configuration error.</p>
  299. <p>Configuring a non-HTTP(S) <code>web_client_location</code> configuration is is now a
  300. configuration error. Since the <code>webclient</code> listener is no longer supported, this
  301. setting only applies to the root path <code>/</code> of Synapse's web server and no longer
  302. the <code>/_matrix/client/</code> path.</p>
  303. <h2 id="stablisation-of-msc3231"><a class="header" href="#stablisation-of-msc3231">Stablisation of MSC3231</a></h2>
  304. <p>The unstable validity-check endpoint for the
  305. <a href="https://spec.matrix.org/v1.2/client-server-api/#get_matrixclientv1registermloginregistration_tokenvalidity">Registration Tokens</a>
  306. feature has been stabilised and moved from:</p>
  307. <p><code>/_matrix/client/unstable/org.matrix.msc3231/register/org.matrix.msc3231.login.registration_token/validity</code></p>
  308. <p>to:</p>
  309. <p><code>/_matrix/client/v1/register/m.login.registration_token/validity</code></p>
  310. <p>Please update any relevant reverse proxy or firewall configurations appropriately.</p>
  311. <h2 id="time-based-cache-expiry-is-now-enabled-by-default"><a class="header" href="#time-based-cache-expiry-is-now-enabled-by-default">Time-based cache expiry is now enabled by default</a></h2>
  312. <p>Formerly, entries in the cache were not evicted regardless of whether they were accessed after storing.
  313. This behavior has now changed. By default entries in the cache are now evicted after 30m of not being accessed.
  314. To change the default behavior, go to the <code>caches</code> section of the config and change the <code>expire_caches</code> and
  315. <code>cache_entry_ttl</code> flags as necessary. Please note that these flags replace the <code>expiry_time</code> flag in the config.
  316. The <code>expiry_time</code> flag will still continue to work, but it has been deprecated and will be removed in the future.</p>
  317. <h2 id="deprecation-of-capability-orgmatrixmsc3283"><a class="header" href="#deprecation-of-capability-orgmatrixmsc3283">Deprecation of <code>capability</code> <code>org.matrix.msc3283.*</code></a></h2>
  318. <p>The <code>capabilities</code> of MSC3283 from the REST API <code>/_matrix/client/r0/capabilities</code>
  319. becomes stable.</p>
  320. <p>The old <code>capabilities</code></p>
  321. <ul>
  322. <li><code>org.matrix.msc3283.set_displayname</code>,</li>
  323. <li><code>org.matrix.msc3283.set_avatar_url</code> and</li>
  324. <li><code>org.matrix.msc3283.3pid_changes</code></li>
  325. </ul>
  326. <p>are deprecated and scheduled to be removed in Synapse v1.54.0.</p>
  327. <p>The new <code>capabilities</code></p>
  328. <ul>
  329. <li><code>m.set_displayname</code>,</li>
  330. <li><code>m.set_avatar_url</code> and</li>
  331. <li><code>m.3pid_changes</code></li>
  332. </ul>
  333. <p>are now active by default.</p>
  334. <h2 id="removal-of-user_may_create_room_with_invites"><a class="header" href="#removal-of-user_may_create_room_with_invites">Removal of <code>user_may_create_room_with_invites</code></a></h2>
  335. <p>As announced with the release of <a href="#deprecation-of-the-user_may_create_room_with_invites-module-callback">Synapse 1.47.0</a>,
  336. the deprecated <code>user_may_create_room_with_invites</code> module callback has been removed.</p>
  337. <p>Modules relying on it can instead implement <a href="https://matrix-org.github.io/synapse/latest/modules/spam_checker_callbacks.html#user_may_invite"><code>user_may_invite</code></a>
  338. and use the <a href="https://github.com/matrix-org/synapse/blob/872f23b95fa980a61b0866c1475e84491991fa20/synapse/module_api/__init__.py#L869-L876"><code>get_room_state</code></a>
  339. module API to infer whether the invite is happening while creating a room (see <a href="https://github.com/matrix-org/synapse-domain-rule-checker/blob/e7d092dd9f2a7f844928771dbfd9fd24c2332e48/synapse_domain_rule_checker/__init__.py#L56-L89">this function</a>
  340. as an example). Alternately, modules can also implement <a href="https://matrix-org.github.io/synapse/latest/modules/third_party_rules_callbacks.html#on_create_room"><code>on_create_room</code></a>.</p>
  341. <h1 id="upgrading-to-v1520"><a class="header" href="#upgrading-to-v1520">Upgrading to v1.52.0</a></h1>
  342. <h2 id="twisted-security-release"><a class="header" href="#twisted-security-release">Twisted security release</a></h2>
  343. <p>Note that <a href="https://github.com/twisted/twisted/releases/tag/twisted-22.1.0">Twisted 22.1.0</a>
  344. has recently been released, which fixes a <a href="https://github.com/twisted/twisted/security/advisories/GHSA-92x2-jw7w-xvvx">security issue</a>
  345. within the Twisted library. We do not believe Synapse is affected by this vulnerability,
  346. though we advise server administrators who installed Synapse via pip to upgrade Twisted
  347. with <code>pip install --upgrade Twisted treq</code> as a matter of good practice. The Docker image
  348. <code>matrixdotorg/synapse</code> and the Debian packages from <code>packages.matrix.org</code> are using the
  349. updated library.</p>
  350. <h1 id="upgrading-to-v1510"><a class="header" href="#upgrading-to-v1510">Upgrading to v1.51.0</a></h1>
  351. <h2 id="deprecation-of-webclient-listeners-and-non-https-web_client_location"><a class="header" href="#deprecation-of-webclient-listeners-and-non-https-web_client_location">Deprecation of <code>webclient</code> listeners and non-HTTP(S) <code>web_client_location</code></a></h2>
  352. <p>Listeners of type <code>webclient</code> are deprecated and scheduled to be removed in
  353. Synapse v1.53.0.</p>
  354. <p>Similarly, a non-HTTP(S) <code>web_client_location</code> configuration is deprecated and
  355. will become a configuration error in Synapse v1.53.0.</p>
  356. <h1 id="upgrading-to-v1500"><a class="header" href="#upgrading-to-v1500">Upgrading to v1.50.0</a></h1>
  357. <h2 id="dropping-support-for-old-python-and-postgres-versions"><a class="header" href="#dropping-support-for-old-python-and-postgres-versions">Dropping support for old Python and Postgres versions</a></h2>
  358. <p>In line with our <a href="deprecation_policy.html">deprecation policy</a>,
  359. we've dropped support for Python 3.6 and PostgreSQL 9.6, as they are no
  360. longer supported upstream.</p>
  361. <p>This release of Synapse requires Python 3.7+ and PostgreSQL 10+.</p>
  362. <h1 id="upgrading-to-v1470"><a class="header" href="#upgrading-to-v1470">Upgrading to v1.47.0</a></h1>
  363. <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>
  364. <p>The following admin APIs were deprecated in <a href="https://github.com/matrix-org/synapse/blob/v1.34.0/CHANGES.md#deprecations-and-removals">Synapse 1.34</a>
  365. (released on 2021-05-17) and have now been removed:</p>
  366. <ul>
  367. <li><code>POST /_synapse/admin/v1/&lt;room_id&gt;/delete</code></li>
  368. </ul>
  369. <p>Any scripts still using the above APIs should be converted to use the
  370. <a href="https://matrix-org.github.io/synapse/latest/admin_api/rooms.html#delete-room-api">Delete Room API</a>.</p>
  371. <h2 id="deprecation-of-the-user_may_create_room_with_invites-module-callback"><a class="header" href="#deprecation-of-the-user_may_create_room_with_invites-module-callback">Deprecation of the <code>user_may_create_room_with_invites</code> module callback</a></h2>
  372. <p>The <code>user_may_create_room_with_invites</code> is deprecated and will be removed in a future
  373. version of Synapse. Modules implementing this callback can instead implement
  374. <a href="https://matrix-org.github.io/synapse/latest/modules/spam_checker_callbacks.html#user_may_invite"><code>user_may_invite</code></a>
  375. and use the <a href="https://github.com/matrix-org/synapse/blob/872f23b95fa980a61b0866c1475e84491991fa20/synapse/module_api/__init__.py#L869-L876"><code>get_room_state</code></a>
  376. module API method to infer whether the invite is happening in the context of creating a
  377. room.</p>
  378. <p>We plan to remove this callback in January 2022.</p>
  379. <h1 id="upgrading-to-v1450"><a class="header" href="#upgrading-to-v1450">Upgrading to v1.45.0</a></h1>
  380. <h2 id="changes-required-to-media-storage-provider-modules-when-reading-from-the-synapse-configuration-object"><a class="header" href="#changes-required-to-media-storage-provider-modules-when-reading-from-the-synapse-configuration-object">Changes required to media storage provider modules when reading from the Synapse configuration object</a></h2>
  381. <p>Media storage provider modules that read from the Synapse configuration object (i.e. that
  382. read the value of <code>hs.config.[...]</code>) now need to specify the configuration section they're
  383. reading from. This means that if a module reads the value of e.g. <code>hs.config.media_store_path</code>,
  384. it needs to replace it with <code>hs.config.media.media_store_path</code>.</p>
  385. <h1 id="upgrading-to-v1440"><a class="header" href="#upgrading-to-v1440">Upgrading to v1.44.0</a></h1>
  386. <h2 id="the-url-preview-cache-is-no-longer-mirrored-to-storage-providers"><a class="header" href="#the-url-preview-cache-is-no-longer-mirrored-to-storage-providers">The URL preview cache is no longer mirrored to storage providers</a></h2>
  387. <p>The <code>url_cache/</code> and <code>url_cache_thumbnails/</code> directories in the media store are
  388. no longer mirrored to storage providers. These two directories can be safely
  389. deleted from any configured storage providers to reclaim space.</p>
  390. <h1 id="upgrading-to-v1430"><a class="header" href="#upgrading-to-v1430">Upgrading to v1.43.0</a></h1>
  391. <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>
  392. <p>The <a href="https://matrix-org.github.io/synapse/latest/workers.html#available-worker-applications">available worker applications documentation</a>
  393. has been updated to reflect that calls to the <code>/spaces</code>, <code>/hierarchy</code>, and
  394. <code>/summary</code> endpoints can now be routed to workers for both client API and
  395. federation requests.</p>
  396. <h1 id="upgrading-to-v1420"><a class="header" href="#upgrading-to-v1420">Upgrading to v1.42.0</a></h1>
  397. <h2 id="removal-of-old-room-admin-api-1"><a class="header" href="#removal-of-old-room-admin-api-1">Removal of old Room Admin API</a></h2>
  398. <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>
  399. (released on 2021-01-13) and have now been removed:</p>
  400. <ul>
  401. <li><code>POST /_synapse/admin/v1/purge_room</code></li>
  402. <li><code>POST /_synapse/admin/v1/shutdown_room/&lt;room_id&gt;</code></li>
  403. </ul>
  404. <p>Any scripts still using the above APIs should be converted to use the
  405. <a href="https://matrix-org.github.io/synapse/latest/admin_api/rooms.html#delete-room-api">Delete Room API</a>.</p>
  406. <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>
  407. <p>This may affect you if you make use of custom HTML templates for the
  408. <a href="../synapse/res/templates/recaptcha.html">reCAPTCHA</a> or
  409. <a href="../synapse/res/templates/terms.html">terms</a> fallback pages.</p>
  410. <p>The template is now provided an <code>error</code> variable if the authentication
  411. process failed. See the default templates linked above for an example.</p>
  412. <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>
  413. <p>Users will stop receiving message updates via email for addresses that were
  414. once, but not still, linked to their account.</p>
  415. <h1 id="upgrading-to-v1410"><a class="header" href="#upgrading-to-v1410">Upgrading to v1.41.0</a></h1>
  416. <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>
  417. <p>Since Synapse 1.6.0 (2019-11-26) you can set a proxy for outbound HTTP requests via
  418. http_proxy/https_proxy environment variables. This proxy was set for:</p>
  419. <ul>
  420. <li>push</li>
  421. <li>url previews</li>
  422. <li>phone-home stats</li>
  423. <li>recaptcha validation</li>
  424. <li>CAS auth validation</li>
  425. <li>OpenID Connect</li>
  426. <li>Federation (checking public key revocation)</li>
  427. </ul>
  428. <p>In this version we have added support for outbound requests for:</p>
  429. <ul>
  430. <li>Outbound federation</li>
  431. <li>Downloading remote media</li>
  432. <li>Fetching public keys of other servers</li>
  433. </ul>
  434. <p>These requests use the same proxy configuration. If you have a proxy configuration we
  435. recommend to verify the configuration. It may be necessary to adjust the <code>no_proxy</code>
  436. environment variable.</p>
  437. <p>See <a href="setup/forward_proxy.html">using a forward proxy with Synapse documentation</a> for
  438. details.</p>
  439. <h2 id="deprecation-of-template_dir"><a class="header" href="#deprecation-of-template_dir">Deprecation of <code>template_dir</code></a></h2>
  440. <p>The <code>template_dir</code> settings in the <code>sso</code>, <code>account_validity</code> and <code>email</code> sections of the
  441. configuration file are now deprecated. Server admins should use the new
  442. <code>templates.custom_template_directory</code> setting in the configuration file and use one single
  443. custom template directory for all aforementioned features. Template file names remain
  444. unchanged. See <a href="https://matrix-org.github.io/synapse/latest/templates.html">the related documentation</a>
  445. for more information and examples.</p>
  446. <p>We plan to remove support for these settings in October 2021.</p>
  447. <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>
  448. <p>The <a href="https://matrix-org.github.io/synapse/latest/workers.html#synapseappmedia_repository">media repository worker documentation</a>
  449. has been updated to reflect that calls to <code>/_synapse/admin/v1/users/{userId}/media</code>
  450. must now be handled by media repository workers. This is due to the new <code>DELETE</code> method
  451. of this endpoint modifying the media store.</p>
  452. <h1 id="upgrading-to-v1390"><a class="header" href="#upgrading-to-v1390">Upgrading to v1.39.0</a></h1>
  453. <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>
  454. <p>The current third-party rules module interface is deprecated in favour of the new generic
  455. modules system introduced in Synapse v1.37.0. Authors of third-party rules modules can refer
  456. to <a href="modules/porting_legacy_module.html">this documentation</a>
  457. to update their modules. Synapse administrators can refer to <a href="modules/index.html">this documentation</a>
  458. to update their configuration once the modules they are using have been updated.</p>
  459. <p>We plan to remove support for the current third-party rules interface in September 2021.</p>
  460. <h1 id="upgrading-to-v1380"><a class="header" href="#upgrading-to-v1380">Upgrading to v1.38.0</a></h1>
  461. <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>
  462. <p>This release includes a database schema update which requires re-indexing one of
  463. the larger tables in the database, <code>events</code>. This could result in increased
  464. disk I/O for several hours or days after upgrading while the migration
  465. completes. Furthermore, because we have to keep the old indexes until the new
  466. indexes are ready, it could result in a significant, temporary, increase in
  467. disk space.</p>
  468. <p>To get a rough idea of the disk space required, check the current size of one
  469. of the indexes. For example, from a <code>psql</code> shell, run the following sql:</p>
  470. <pre><code class="language-sql">SELECT pg_size_pretty(pg_relation_size('events_order_room'));
  471. </code></pre>
  472. <p>We need to rebuild <strong>four</strong> indexes, so you will need to multiply this result
  473. by four to give an estimate of the disk space required. For example, on one
  474. particular server:</p>
  475. <pre><code>synapse=# select pg_size_pretty(pg_relation_size('events_order_room'));
  476. pg_size_pretty
  477. ----------------
  478. 288 MB
  479. (1 row)
  480. </code></pre>
  481. <p>On this server, it would be wise to ensure that at least 1152MB are free.</p>
  482. <p>The additional disk space will be freed once the migration completes.</p>
  483. <p>SQLite databases are unaffected by this change.</p>
  484. <h1 id="upgrading-to-v1370"><a class="header" href="#upgrading-to-v1370">Upgrading to v1.37.0</a></h1>
  485. <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>
  486. <p>The current spam checker interface is deprecated in favour of a new generic modules system.
  487. Authors of spam checker modules can refer to [this
  488. documentation](modules/porting_legacy_module.md
  489. to update their modules. Synapse administrators can refer to <a href="modules/index.html">this
  490. documentation</a>
  491. to update their configuration once the modules they are using have been updated.</p>
  492. <p>We plan to remove support for the current spam checker interface in August 2021.</p>
  493. <p>More module interfaces will be ported over to this new generic system in future versions
  494. of Synapse.</p>
  495. <h1 id="upgrading-to-v1340"><a class="header" href="#upgrading-to-v1340">Upgrading to v1.34.0</a></h1>
  496. <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>
  497. <p>The <code>room_invite_state_types</code> configuration setting has been deprecated
  498. 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
  499. file</a>.</p>
  500. <p>If you have set <code>room_invite_state_types</code> to the default value you
  501. should simply remove it from your configuration file. The default value
  502. used to be:</p>
  503. <pre><code class="language-yaml">room_invite_state_types:
  504. - &quot;m.room.join_rules&quot;
  505. - &quot;m.room.canonical_alias&quot;
  506. - &quot;m.room.avatar&quot;
  507. - &quot;m.room.encryption&quot;
  508. - &quot;m.room.name&quot;
  509. </code></pre>
  510. <p>If you have customised this value, you should remove
  511. <code>room_invite_state_types</code> and configure <code>room_prejoin_state</code> instead.</p>
  512. <h1 id="upgrading-to-v1330"><a class="header" href="#upgrading-to-v1330">Upgrading to v1.33.0</a></h1>
  513. <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>
  514. <p>This may affect you if you have enabled the account validity feature,
  515. and have made use of a custom HTML template specified by the
  516. <code>account_validity.template_dir</code> or
  517. <code>account_validity.account_renewed_html_path</code> Synapse config options.</p>
  518. <p>The template can now accept an <code>expiration_ts</code> variable, which
  519. represents the unix timestamp in milliseconds for the future date of
  520. 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
  521. template</a>
  522. for an example of usage.</p>
  523. <p>ALso note that a new HTML template, <code>account_previously_renewed.html</code>,
  524. has been added. This is is shown to users when they attempt to renew
  525. their account with a valid renewal token that has already been used
  526. before. The default template contents can been found
  527. <a href="https://github.com/matrix-org/synapse/blob/release-v1.33.0/synapse/res/templates/account_previously_renewed.html">here</a>,
  528. and can also accept an <code>expiration_ts</code> variable. This template replaces
  529. the error message users would previously see upon attempting to use a
  530. valid renewal token more than once.</p>
  531. <h1 id="upgrading-to-v1320"><a class="header" href="#upgrading-to-v1320">Upgrading to v1.32.0</a></h1>
  532. <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>
  533. <p>This release introduces <a href="https://github.com/matrix-org/synapse/issues/9853">a
  534. regression</a> that can
  535. overwhelm connected Prometheus instances. This issue is not present in
  536. Synapse v1.32.0rc1.</p>
  537. <p>If you have been affected, please downgrade to 1.31.0. You then may need
  538. to remove excess writeahead logs in order for Prometheus to recover.
  539. Instructions for doing so are provided
  540. <a href="https://github.com/matrix-org/synapse/pull/9854#issuecomment-823472183">here</a>.</p>
  541. <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>
  542. <p>In line with our <a href="deprecation_policy.html">deprecation policy</a>,
  543. we've dropped support for Python 3.5 and PostgreSQL 9.5, as they are no
  544. longer supported upstream.</p>
  545. <p>This release of Synapse requires Python 3.6+ and PostgresSQL 9.6+ or
  546. SQLite 3.22+.</p>
  547. <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>
  548. <p>The deprecated v1 &quot;list accounts&quot; admin API
  549. (<code>GET /_synapse/admin/v1/users/&lt;user_id&gt;</code>) has been removed in this
  550. version.</p>
  551. <p>The <a href="admin_api/user_admin_api.html#list-accounts">v2 list accounts API</a>
  552. has been available since Synapse 1.7.0 (2019-12-13), and is accessible
  553. under <code>GET /_synapse/admin/v2/users</code>.</p>
  554. <p>The deprecation of the old endpoint was announced with Synapse 1.28.0
  555. (released on 2021-02-25).</p>
  556. <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>
  557. <p>In compliance with the <a href="https://matrix.org/docs/spec/application_service/r0.1.2#server-admin-style-permissions">Application Service
  558. spec</a>,
  559. Application Services are now required to use the
  560. <code>m.login.application_service</code> type when registering users via the
  561. <code>/_matrix/client/r0/register</code> endpoint. This behaviour was deprecated in
  562. Synapse v1.30.0.</p>
  563. <p>Please ensure your Application Services are up to date.</p>
  564. <h1 id="upgrading-to-v1290"><a class="header" href="#upgrading-to-v1290">Upgrading to v1.29.0</a></h1>
  565. <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>
  566. <p>When using Synapse with a reverse proxy (in particular, when using the
  567. <code>x_forwarded</code> option on an HTTP listener), Synapse now
  568. expects to receive an <code>X-Forwarded-Proto</code> header on incoming
  569. HTTP requests. If it is not set, Synapse will log a warning on each
  570. received request.</p>
  571. <p>To avoid the warning, administrators using a reverse proxy should ensure
  572. that the reverse proxy sets <code>X-Forwarded-Proto</code> header to
  573. <code>https</code> or <code>http</code> to indicate the protocol used
  574. by the client.</p>
  575. <p>Synapse also requires the <code>Host</code> header to be preserved.</p>
  576. <p>See the <a href="reverse_proxy.html">reverse proxy documentation</a>, where the
  577. example configurations have been updated to show how to set these
  578. headers.</p>
  579. <p>(Users of <a href="https://caddyserver.com/">Caddy</a> are unaffected, since we
  580. believe it sets <code>X-Forwarded-Proto</code> by default.)</p>
  581. <h1 id="upgrading-to-v1270"><a class="header" href="#upgrading-to-v1270">Upgrading to v1.27.0</a></h1>
  582. <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>
  583. <p>This version changes the URI used for callbacks from OAuth2 and SAML2
  584. identity providers:</p>
  585. <ul>
  586. <li>
  587. <p>If your server is configured for single sign-on via an OpenID
  588. Connect or OAuth2 identity provider, you will need to add
  589. <code>[synapse public baseurl]/_synapse/client/oidc/callback</code> to the list
  590. of permitted &quot;redirect URIs&quot; at the identity provider.</p>
  591. <p>See the <a href="openid.html">OpenID docs</a> for more information on setting
  592. up OpenID Connect.</p>
  593. </li>
  594. <li>
  595. <p>If your server is configured for single sign-on via a SAML2 identity
  596. provider, you will need to add
  597. <code>[synapse public baseurl]/_synapse/client/saml2/authn_response</code> as a
  598. permitted &quot;ACS location&quot; (also known as &quot;allowed callback URLs&quot;)
  599. at the identity provider.</p>
  600. <p>The &quot;Issuer&quot; in the &quot;AuthnRequest&quot; to the SAML2 identity
  601. provider is also updated to
  602. <code>[synapse public baseurl]/_synapse/client/saml2/metadata.xml</code>. If
  603. your SAML2 identity provider uses this property to validate or
  604. otherwise identify Synapse, its configuration will need to be
  605. updated to use the new URL. Alternatively you could create a new,
  606. separate &quot;EntityDescriptor&quot; in your SAML2 identity provider with
  607. the new URLs and leave the URLs in the existing &quot;EntityDescriptor&quot;
  608. as they were.</p>
  609. </li>
  610. </ul>
  611. <h2 id="changes-to-html-templates"><a class="header" href="#changes-to-html-templates">Changes to HTML templates</a></h2>
  612. <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
  613. autoescape</a>
  614. enabled for files ending in <code>.html</code>, <code>.htm</code>, and <code>.xml</code>. If you have
  615. customised these templates and see issues when viewing them you might
  616. need to update them. It is expected that most configurations will need
  617. no changes.</p>
  618. <p>If you have customised the templates <em>names</em> for these templates, it is
  619. recommended to verify they end in <code>.html</code> to ensure autoescape is
  620. enabled.</p>
  621. <p>The above applies to the following templates:</p>
  622. <ul>
  623. <li><code>add_threepid.html</code></li>
  624. <li><code>add_threepid_failure.html</code></li>
  625. <li><code>add_threepid_success.html</code></li>
  626. <li><code>notice_expiry.html</code></li>
  627. <li><code>notice_expiry.html</code></li>
  628. <li><code>notif_mail.html</code> (which, by default, includes <code>room.html</code> and
  629. <code>notif.html</code>)</li>
  630. <li><code>password_reset.html</code></li>
  631. <li><code>password_reset_confirmation.html</code></li>
  632. <li><code>password_reset_failure.html</code></li>
  633. <li><code>password_reset_success.html</code></li>
  634. <li><code>registration.html</code></li>
  635. <li><code>registration_failure.html</code></li>
  636. <li><code>registration_success.html</code></li>
  637. <li><code>sso_account_deactivated.html</code></li>
  638. <li><code>sso_auth_bad_user.html</code></li>
  639. <li><code>sso_auth_confirm.html</code></li>
  640. <li><code>sso_auth_success.html</code></li>
  641. <li><code>sso_error.html</code></li>
  642. <li><code>sso_login_idp_picker.html</code></li>
  643. <li><code>sso_redirect_confirm.html</code></li>
  644. </ul>
  645. <h1 id="upgrading-to-v1260"><a class="header" href="#upgrading-to-v1260">Upgrading to v1.26.0</a></h1>
  646. <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>
  647. <p>v1.26.0 includes a lot of large changes. If something problematic
  648. occurs, you may want to roll-back to a previous version of Synapse.
  649. Because v1.26.0 also includes a new database schema version, reverting
  650. that version is also required alongside the generic rollback
  651. instructions mentioned above. In short, to roll back to v1.25.0 you need
  652. to:</p>
  653. <ol>
  654. <li>
  655. <p>Stop the server</p>
  656. </li>
  657. <li>
  658. <p>Decrease the schema version in the database:</p>
  659. <pre><code class="language-sql">UPDATE schema_version SET version = 58;
  660. </code></pre>
  661. </li>
  662. <li>
  663. <p>Delete the ignored users &amp; chain cover data:</p>
  664. <pre><code class="language-sql">DROP TABLE IF EXISTS ignored_users;
  665. UPDATE rooms SET has_auth_chain_index = false;
  666. </code></pre>
  667. <p>For PostgreSQL run:</p>
  668. <pre><code class="language-sql">TRUNCATE event_auth_chain_links;
  669. TRUNCATE event_auth_chains;
  670. </code></pre>
  671. <p>For SQLite run:</p>
  672. <pre><code class="language-sql">DELETE FROM event_auth_chain_links;
  673. DELETE FROM event_auth_chains;
  674. </code></pre>
  675. </li>
  676. <li>
  677. <p>Mark the deltas as not run (so they will re-run on upgrade).</p>
  678. <pre><code class="language-sql">DELETE FROM applied_schema_deltas WHERE version = 59 AND file = &quot;59/01ignored_user.py&quot;;
  679. DELETE FROM applied_schema_deltas WHERE version = 59 AND file = &quot;59/06chain_cover_index.sql&quot;;
  680. </code></pre>
  681. </li>
  682. <li>
  683. <p>Downgrade Synapse by following the instructions for your
  684. installation method in the &quot;Rolling back to older versions&quot;
  685. section above.</p>
  686. </li>
  687. </ol>
  688. <h1 id="upgrading-to-v1250"><a class="header" href="#upgrading-to-v1250">Upgrading to v1.25.0</a></h1>
  689. <h2 id="last-release-supporting-python-35"><a class="header" href="#last-release-supporting-python-35">Last release supporting Python 3.5</a></h2>
  690. <p>This is the last release of Synapse which guarantees support with Python
  691. 3.5, which passed its upstream End of Life date several months ago.</p>
  692. <p>We will attempt to maintain support through March 2021, but without
  693. guarantees.</p>
  694. <p>In the future, Synapse will follow upstream schedules for ending support
  695. of older versions of Python and PostgreSQL. Please upgrade to at least
  696. Python 3.6 and PostgreSQL 9.6 as soon as possible.</p>
  697. <h2 id="blacklisting-ip-ranges"><a class="header" href="#blacklisting-ip-ranges">Blacklisting IP ranges</a></h2>
  698. <p>Synapse v1.25.0 includes new settings, <code>ip_range_blacklist</code> and
  699. <code>ip_range_whitelist</code>, for controlling outgoing requests from Synapse for
  700. federation, identity servers, push, and for checking key validity for
  701. third-party invite events. The previous setting,
  702. <code>federation_ip_range_blacklist</code>, is deprecated. The new
  703. <code>ip_range_blacklist</code> defaults to private IP ranges if it is not defined.</p>
  704. <p>If you have never customised <code>federation_ip_range_blacklist</code> it is
  705. recommended that you remove that setting.</p>
  706. <p>If you have customised <code>federation_ip_range_blacklist</code> you should update
  707. the setting name to <code>ip_range_blacklist</code>.</p>
  708. <p>If you have a custom push server that is reached via private IP space
  709. you may need to customise <code>ip_range_blacklist</code> or <code>ip_range_whitelist</code>.</p>
  710. <h1 id="upgrading-to-v1240"><a class="header" href="#upgrading-to-v1240">Upgrading to v1.24.0</a></h1>
  711. <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>
  712. <p>This release allows the OpenID Connect mapping provider to perform
  713. normalisation of the localpart of the Matrix ID. This allows for the
  714. mapping provider to specify different algorithms, instead of the
  715. <a href="https://matrix.org/docs/spec/appendices#mapping-from-other-character-sets">default
  716. way</a>.</p>
  717. <p>If your Synapse configuration uses a custom mapping provider
  718. (<code>oidc_config.user_mapping_provider.module</code> is specified and
  719. not equal to
  720. <code>synapse.handlers.oidc_handler.JinjaOidcMappingProvider</code>)
  721. then you <em>must</em> ensure that <code>map_user_attributes</code> of the
  722. mapping provider performs some normalisation of the
  723. <code>localpart</code> returned. To match previous behaviour you can
  724. use the <code>map_username_to_mxid_localpart</code> function provided
  725. by Synapse. An example is shown below:</p>
  726. <pre><code class="language-python">from synapse.types import map_username_to_mxid_localpart
  727. class MyMappingProvider:
  728. def map_user_attributes(self, userinfo, token):
  729. # ... your custom logic ...
  730. sso_user_id = ...
  731. localpart = map_username_to_mxid_localpart(sso_user_id)
  732. return {&quot;localpart&quot;: localpart}
  733. </code></pre>
  734. <h2 id="removal-historical-synapse-admin-api"><a class="header" href="#removal-historical-synapse-admin-api">Removal historical Synapse Admin API</a></h2>
  735. <p>Historically, the Synapse Admin API has been accessible under:</p>
  736. <ul>
  737. <li><code>/_matrix/client/api/v1/admin</code></li>
  738. <li><code>/_matrix/client/unstable/admin</code></li>
  739. <li><code>/_matrix/client/r0/admin</code></li>
  740. <li><code>/_synapse/admin/v1</code></li>
  741. </ul>
  742. <p>The endpoints with <code>/_matrix/client/*</code> prefixes have been removed as of
  743. v1.24.0. The Admin API is now only accessible under:</p>
  744. <ul>
  745. <li><code>/_synapse/admin/v1</code></li>
  746. </ul>
  747. <p>The only exception is the <code>/admin/whois</code> endpoint, which is
  748. <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
  749. API</a>.</p>
  750. <p>The deprecation of the old endpoints was announced with Synapse 1.20.0
  751. (released on 2020-09-22) and makes it easier for homeserver admins to
  752. lock down external access to the Admin API endpoints.</p>
  753. <h1 id="upgrading-to-v1230"><a class="header" href="#upgrading-to-v1230">Upgrading to v1.23.0</a></h1>
  754. <h2 id="structured-logging-configuration-breaking-changes"><a class="header" href="#structured-logging-configuration-breaking-changes">Structured logging configuration breaking changes</a></h2>
  755. <p>This release deprecates use of the <code>structured: true</code> logging
  756. configuration for structured logging. If your logging configuration
  757. contains <code>structured: true</code> then it should be modified based on the
  758. <a href="https://matrix-org.github.io/synapse/v1.56/structured_logging.html#upgrading-from-legacy-structured-logging-configuration">structured logging documentation</a>.</p>
  759. <p>The <code>structured</code> and <code>drains</code> logging options are now deprecated and
  760. should be replaced by standard logging configuration of <code>handlers</code> and
  761. <code>formatters</code>.</p>
  762. <p>A future will release of Synapse will make using <code>structured: true</code> an
  763. error.</p>
  764. <h1 id="upgrading-to-v1220"><a class="header" href="#upgrading-to-v1220">Upgrading to v1.22.0</a></h1>
  765. <h2 id="thirdpartyeventrules-breaking-changes"><a class="header" href="#thirdpartyeventrules-breaking-changes">ThirdPartyEventRules breaking changes</a></h2>
  766. <p>This release introduces a backwards-incompatible change to modules
  767. making use of <code>ThirdPartyEventRules</code> in Synapse. If you make use of a
  768. module defined under the <code>third_party_event_rules</code> config option, please
  769. make sure it is updated to handle the below change:</p>
  770. <p>The <code>http_client</code> argument is no longer passed to modules as they are
  771. initialised. Instead, modules are expected to make use of the
  772. <code>http_client</code> property on the <code>ModuleApi</code> class. Modules are now passed
  773. a <code>module_api</code> argument during initialisation, which is an instance of
  774. <code>ModuleApi</code>. <code>ModuleApi</code> instances have a <code>http_client</code> property which
  775. acts the same as the <code>http_client</code> argument previously passed to
  776. <code>ThirdPartyEventRules</code> modules.</p>
  777. <h1 id="upgrading-to-v1210"><a class="header" href="#upgrading-to-v1210">Upgrading to v1.21.0</a></h1>
  778. <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>
  779. <p>The <a href="reverse_proxy.html">reverse proxy documentation</a>
  780. has been updated to include reverse proxy directives for
  781. <code>/_synapse/client/*</code> endpoints. As the user password reset flow now uses
  782. endpoints under this prefix, <strong>you must update your reverse proxy
  783. configurations for user password reset to work</strong>.</p>
  784. <p>Additionally, note that the <a href="workers.html">Synapse worker documentation</a> has been updated to</p>
  785. <p>: state that the <code>/_synapse/client/password_reset/email/submit_token</code>
  786. endpoint can be handled</p>
  787. <p>by all workers. If you make use of Synapse's worker feature, please
  788. update your reverse proxy configuration to reflect this change.</p>
  789. <h2 id="new-html-templates"><a class="header" href="#new-html-templates">New HTML templates</a></h2>
  790. <p>A new HTML template,
  791. <a href="https://github.com/matrix-org/synapse/blob/develop/synapse/res/templates/password_reset_confirmation.html">password_reset_confirmation.html</a>,
  792. has been added to the <code>synapse/res/templates</code> directory. If you are
  793. using a custom template directory, you may want to copy the template
  794. over and modify it.</p>
  795. <p>Note that as of v1.20.0, templates do not need to be included in custom
  796. template directories for Synapse to start. The default templates will be
  797. used if a custom template cannot be found.</p>
  798. <p>This page will appear to the user after clicking a password reset link
  799. that has been emailed to them.</p>
  800. <p>To complete password reset, the page must include a way to make a
  801. <code>POST</code> request to
  802. <code>/_synapse/client/password_reset/{medium}/submit_token</code> with the query
  803. parameters from the original link, presented as a URL-encoded form. See
  804. the file itself for more details.</p>
  805. <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>
  806. <p>The <code>saml_error.html</code> template was removed from Synapse and replaced
  807. with the <code>sso_error.html</code> template. If your Synapse is configured to use
  808. SAML and a custom <code>sso_redirect_confirm_template_dir</code> configuration then
  809. any customisations of the <code>saml_error.html</code> template will need to be
  810. merged into the <code>sso_error.html</code> template. These templates are similar,
  811. but the parameters are slightly different:</p>
  812. <ul>
  813. <li>The <code>msg</code> parameter should be renamed to <code>error_description</code>.</li>
  814. <li>There is no longer a <code>code</code> parameter for the response code.</li>
  815. <li>A string <code>error</code> parameter is available that includes a short hint
  816. of why a user is seeing the error page.</li>
  817. </ul>
  818. <h1 id="upgrading-to-v1180"><a class="header" href="#upgrading-to-v1180">Upgrading to v1.18.0</a></h1>
  819. <h2 id="docker--py3-suffix-will-be-removed-in-future-versions"><a class="header" href="#docker--py3-suffix-will-be-removed-in-future-versions">Docker <code>-py3</code> suffix will be removed in future versions</a></h2>
  820. <p>From 10th August 2020, we will no longer publish Docker images with the
  821. <code>-py3</code> tag suffix. The images tagged with the
  822. <code>-py3</code> suffix have been identical to the non-suffixed tags
  823. since release 0.99.0, and the suffix is obsolete.</p>
  824. <p>On 10th August, we will remove the <code>latest-py3</code> tag.
  825. Existing per-release tags (such as <code>v1.18.0-py3</code> will not
  826. be removed, but no new <code>-py3</code> tags will be added.</p>
  827. <p>Scripts relying on the <code>-py3</code> suffix will need to be
  828. updated.</p>
  829. <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>
  830. <p>When setting up worker processes, we now recommend the use of a Redis
  831. server for replication. <strong>The old direct TCP connection method is
  832. deprecated and will be removed in a future release.</strong> See
  833. <a href="workers.html">workers</a> for more details.</p>
  834. <h1 id="upgrading-to-v1140"><a class="header" href="#upgrading-to-v1140">Upgrading to v1.14.0</a></h1>
  835. <p>This version includes a database update which is run as part of the
  836. upgrade, and which may take a couple of minutes in the case of a large
  837. server. Synapse will not respond to HTTP requests while this update is
  838. taking place.</p>
  839. <h1 id="upgrading-to-v1130"><a class="header" href="#upgrading-to-v1130">Upgrading to v1.13.0</a></h1>
  840. <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>
  841. <p>A bug was introduced in Synapse 1.4.0 which could cause the room
  842. directory to be incomplete or empty if Synapse was upgraded directly
  843. from v1.2.1 or earlier, to versions between v1.4.0 and v1.12.x.</p>
  844. <p>This will <em>not</em> be a problem for Synapse installations which were:</p>
  845. <p>: - created at v1.4.0 or later,
  846. - upgraded via v1.3.x, or
  847. - upgraded straight from v1.2.1 or earlier to v1.13.0 or later.</p>
  848. <p>If completeness of the room directory is a concern, installations which
  849. are affected can be repaired as follows:</p>
  850. <ol>
  851. <li>
  852. <p>Run the following sql from a <code>psql</code> or
  853. <code>sqlite3</code> console:</p>
  854. <pre><code class="language-sql">INSERT INTO background_updates (update_name, progress_json, depends_on) VALUES
  855. ('populate_stats_process_rooms', '{}', 'current_state_events_membership');
  856. INSERT INTO background_updates (update_name, progress_json, depends_on) VALUES
  857. ('populate_stats_process_users', '{}', 'populate_stats_process_rooms');
  858. </code></pre>
  859. </li>
  860. <li>
  861. <p>Restart synapse.</p>
  862. </li>
  863. </ol>
  864. <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>
  865. <p>New templates (<code>sso_auth_confirm.html</code>, <code>sso_auth_success.html</code>, and
  866. <code>sso_account_deactivated.html</code>) were added to Synapse. If your Synapse
  867. is configured to use SSO and a custom
  868. <code>sso_redirect_confirm_template_dir</code> configuration then these templates
  869. will need to be copied from
  870. <a href="synapse/res/templates">synapse/res/templates</a> into that directory.</p>
  871. <h2 id="synapse-sso-plugins-method-deprecation"><a class="header" href="#synapse-sso-plugins-method-deprecation">Synapse SSO Plugins Method Deprecation</a></h2>
  872. <p>Plugins using the <code>complete_sso_login</code> method of
  873. <code>synapse.module_api.ModuleApi</code> should update to using the async/await
  874. version <code>complete_sso_login_async</code> which includes additional checks. The
  875. non-async version is considered deprecated.</p>
  876. <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>
  877. <p>v1.13.0 includes a lot of large changes. If something problematic
  878. occurs, you may want to roll-back to a previous version of Synapse.
  879. Because v1.13.0 also includes a new database schema version, reverting
  880. that version is also required alongside the generic rollback
  881. instructions mentioned above. In short, to roll back to v1.12.4 you need
  882. to:</p>
  883. <ol>
  884. <li>
  885. <p>Stop the server</p>
  886. </li>
  887. <li>
  888. <p>Decrease the schema version in the database:</p>
  889. <pre><code class="language-sql">UPDATE schema_version SET version = 57;
  890. </code></pre>
  891. </li>
  892. <li>
  893. <p>Downgrade Synapse by following the instructions for your
  894. installation method in the &quot;Rolling back to older versions&quot;
  895. section above.</p>
  896. </li>
  897. </ol>
  898. <h1 id="upgrading-to-v1120"><a class="header" href="#upgrading-to-v1120">Upgrading to v1.12.0</a></h1>
  899. <p>This version includes a database update which is run as part of the
  900. upgrade, and which may take some time (several hours in the case of a
  901. large server). Synapse will not respond to HTTP requests while this
  902. update is taking place.</p>
  903. <p>This is only likely to be a problem in the case of a server which is
  904. participating in many rooms.</p>
  905. <ol start="0">
  906. <li>
  907. <p>As with all upgrades, it is recommended that you have a recent
  908. backup of your database which can be used for recovery in the event
  909. of any problems.</p>
  910. </li>
  911. <li>
  912. <p>As an initial check to see if you will be affected, you can try
  913. running the following query from the <code>psql</code> or
  914. <code>sqlite3</code> console. It is safe to run it while Synapse is
  915. still running.</p>
  916. <pre><code class="language-sql">SELECT MAX(q.v) FROM (
  917. SELECT (
  918. SELECT ej.json AS v
  919. FROM state_events se INNER JOIN event_json ej USING (event_id)
  920. WHERE se.room_id=rooms.room_id AND se.type='m.room.create' AND se.state_key=''
  921. LIMIT 1
  922. ) FROM rooms WHERE rooms.room_version IS NULL
  923. ) q;
  924. </code></pre>
  925. <p>This query will take about the same amount of time as the upgrade
  926. process: ie, if it takes 5 minutes, then it is likely that Synapse
  927. will be unresponsive for 5 minutes during the upgrade.</p>
  928. <p>If you consider an outage of this duration to be acceptable, no
  929. further action is necessary and you can simply start Synapse 1.12.0.</p>
  930. <p>If you would prefer to reduce the downtime, continue with the steps
  931. below.</p>
  932. </li>
  933. <li>
  934. <p>The easiest workaround for this issue is to manually create a new
  935. index before upgrading. On PostgreSQL, his can be done as follows:</p>
  936. <pre><code class="language-sql">CREATE INDEX CONCURRENTLY tmp_upgrade_1_12_0_index
  937. ON state_events(room_id) WHERE type = 'm.room.create';
  938. </code></pre>
  939. <p>The above query may take some time, but is also safe to run while
  940. Synapse is running.</p>
  941. <p>We assume that no SQLite users have databases large enough to be
  942. affected. If you <em>are</em> affected, you can run a similar query,
  943. omitting the <code>CONCURRENTLY</code> keyword. Note however that this
  944. operation may in itself cause Synapse to stop running for some time.
  945. Synapse admins are reminded that <a href="postgres.html">SQLite is not recommended for use
  946. outside a test environment</a>.</p>
  947. </li>
  948. <li>
  949. <p>Once the index has been created, the <code>SELECT</code> query in step 1 above
  950. should complete quickly. It is therefore safe to upgrade to Synapse
  951. 1.12.0.</p>
  952. </li>
  953. <li>
  954. <p>Once Synapse 1.12.0 has successfully started and is responding to
  955. HTTP requests, the temporary index can be removed:</p>
  956. <pre><code class="language-sql">DROP INDEX tmp_upgrade_1_12_0_index;
  957. </code></pre>
  958. </li>
  959. </ol>
  960. <h1 id="upgrading-to-v1100"><a class="header" href="#upgrading-to-v1100">Upgrading to v1.10.0</a></h1>
  961. <p>Synapse will now log a warning on start up if used with a PostgreSQL
  962. database that has a non-recommended locale set.</p>
  963. <p>See <a href="postgres.html">Postgres</a> for details.</p>
  964. <h1 id="upgrading-to-v180"><a class="header" href="#upgrading-to-v180">Upgrading to v1.8.0</a></h1>
  965. <p>Specifying a <code>log_file</code> config option will now cause Synapse to refuse
  966. to start, and should be replaced by with the <code>log_config</code> option.
  967. Support for the <code>log_file</code> option was removed in v1.3.0 and has since
  968. had no effect.</p>
  969. <h1 id="upgrading-to-v170"><a class="header" href="#upgrading-to-v170">Upgrading to v1.7.0</a></h1>
  970. <p>In an attempt to configure Synapse in a privacy preserving way, the
  971. default behaviours of <code>allow_public_rooms_without_auth</code> and
  972. <code>allow_public_rooms_over_federation</code> have been inverted. This means that
  973. by default, only authenticated users querying the Client/Server API will
  974. be able to query the room directory, and relatedly that the server will
  975. not share room directory information with other servers over federation.</p>
  976. <p>If your installation does not explicitly set these settings one way or
  977. the other and you want either setting to be <code>true</code> then it will
  978. necessary to update your homeserver configuration file accordingly.</p>
  979. <p>For more details on the surrounding context see our
  980. <a href="https://matrix.org/blog/2019/11/09/avoiding-unwelcome-visitors-on-private-matrix-servers">explainer</a>.</p>
  981. <h1 id="upgrading-to-v150"><a class="header" href="#upgrading-to-v150">Upgrading to v1.5.0</a></h1>
  982. <p>This release includes a database migration which may take several
  983. minutes to complete if there are a large number (more than a million or
  984. so) of entries in the <code>devices</code> table. This is only likely to a be a
  985. problem on very large installations.</p>
  986. <h1 id="upgrading-to-v140"><a class="header" href="#upgrading-to-v140">Upgrading to v1.4.0</a></h1>
  987. <h2 id="new-custom-templates"><a class="header" href="#new-custom-templates">New custom templates</a></h2>
  988. <p>If you have configured a custom template directory with the
  989. <code>email.template_dir</code> option, be aware that there are new templates
  990. regarding registration and threepid management (see below) that must be
  991. included.</p>
  992. <ul>
  993. <li><code>registration.html</code> and <code>registration.txt</code></li>
  994. <li><code>registration_success.html</code> and <code>registration_failure.html</code></li>
  995. <li><code>add_threepid.html</code> and <code>add_threepid.txt</code></li>
  996. <li><code>add_threepid_failure.html</code> and <code>add_threepid_success.html</code></li>
  997. </ul>
  998. <p>Synapse will expect these files to exist inside the configured template
  999. directory, and <strong>will fail to start</strong> if they are absent. To view the
  1000. default templates, see
  1001. <a href="https://github.com/matrix-org/synapse/tree/master/synapse/res/templates">synapse/res/templates</a>.</p>
  1002. <h2 id="3pid-verification-changes"><a class="header" href="#3pid-verification-changes">3pid verification changes</a></h2>
  1003. <p><strong>Note: As of this release, users will be unable to add phone numbers or
  1004. email addresses to their accounts, without changes to the Synapse
  1005. configuration. This includes adding an email address during
  1006. registration.</strong></p>
  1007. <p>It is possible for a user to associate an email address or phone number
  1008. with their account, for a number of reasons:</p>
  1009. <ul>
  1010. <li>for use when logging in, as an alternative to the user id.</li>
  1011. <li>in the case of email, as an alternative contact to help with account
  1012. recovery.</li>
  1013. <li>in the case of email, to receive notifications of missed messages.</li>
  1014. </ul>
  1015. <p>Before an email address or phone number can be added to a user's
  1016. account, or before such an address is used to carry out a
  1017. password-reset, Synapse must confirm the operation with the owner of the
  1018. email address or phone number. It does this by sending an email or text
  1019. giving the user a link or token to confirm receipt. This process is
  1020. known as '3pid verification'. ('3pid', or 'threepid', stands for
  1021. third-party identifier, and we use it to refer to external identifiers
  1022. such as email addresses and phone numbers.)</p>
  1023. <p>Previous versions of Synapse delegated the task of 3pid verification to
  1024. an identity server by default. In most cases this server is <code>vector.im</code>
  1025. or <code>matrix.org</code>.</p>
  1026. <p>In Synapse 1.4.0, for security and privacy reasons, the homeserver will
  1027. no longer delegate this task to an identity server by default. Instead,
  1028. the server administrator will need to explicitly decide how they would
  1029. like the verification messages to be sent.</p>
  1030. <p>In the medium term, the <code>vector.im</code> and <code>matrix.org</code> identity servers
  1031. will disable support for delegated 3pid verification entirely. However,
  1032. in order to ease the transition, they will retain the capability for a
  1033. limited period. Delegated email verification will be disabled on Monday
  1034. 2nd December 2019 (giving roughly 2 months notice). Disabling delegated
  1035. SMS verification will follow some time after that once SMS verification
  1036. support lands in Synapse.</p>
  1037. <p>Once delegated 3pid verification support has been disabled in the
  1038. <code>vector.im</code> and <code>matrix.org</code> identity servers, all Synapse versions that
  1039. depend on those instances will be unable to verify email and phone
  1040. numbers through them. There are no imminent plans to remove delegated
  1041. 3pid verification from Sydent generally. (Sydent is the identity server
  1042. project that backs the <code>vector.im</code> and <code>matrix.org</code> instances).</p>
  1043. <h3 id="email"><a class="header" href="#email">Email</a></h3>
  1044. <p>Following upgrade, to continue verifying email (e.g. as part of the
  1045. registration process), admins can either:-</p>
  1046. <ul>
  1047. <li>Configure Synapse to use an email server.</li>
  1048. <li>Run or choose an identity server which allows delegated email
  1049. verification and delegate to it.</li>
  1050. </ul>
  1051. <h4 id="configure-smtp-in-synapse"><a class="header" href="#configure-smtp-in-synapse">Configure SMTP in Synapse</a></h4>
  1052. <p>To configure an SMTP server for Synapse, modify the configuration
  1053. section headed <code>email</code>, and be sure to have at least the
  1054. <code>smtp_host, smtp_port</code> and <code>notif_from</code> fields filled out.</p>
  1055. <p>You may also need to set <code>smtp_user</code>, <code>smtp_pass</code>, and
  1056. <code>require_transport_security</code>.</p>
  1057. <p>See the <a href="usage/configuration/homeserver_sample_config.html">sample configuration file</a>
  1058. for more details on these settings.</p>
  1059. <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>
  1060. <p>Some admins will wish to continue using email verification as part of
  1061. the registration process, but will not immediately have an appropriate
  1062. SMTP server at hand.</p>
  1063. <p>To this end, we will continue to support email verification delegation
  1064. via the <code>vector.im</code> and <code>matrix.org</code> identity servers for two months.
  1065. Support for delegated email verification will be disabled on Monday 2nd
  1066. December.</p>
  1067. <p>The <code>account_threepid_delegates</code> dictionary defines whether the
  1068. homeserver should delegate an external server (typically an <a href="https://matrix.org/docs/spec/identity_service/r0.2.1">identity
  1069. server</a>) to handle
  1070. sending confirmation messages via email and SMS.</p>
  1071. <p>So to delegate email verification, in <code>homeserver.yaml</code>, set
  1072. <code>account_threepid_delegates.email</code> to the base URL of an identity
  1073. server. For example:</p>
  1074. <pre><code class="language-yaml">account_threepid_delegates:
  1075. email: https://example.com # Delegate email sending to example.com
  1076. </code></pre>
  1077. <p>Note that <code>account_threepid_delegates.email</code> replaces the deprecated
  1078. <code>email.trust_identity_server_for_password_resets</code>: if
  1079. <code>email.trust_identity_server_for_password_resets</code> is set to <code>true</code>, and
  1080. <code>account_threepid_delegates.email</code> is not set, then the first entry in
  1081. <code>trusted_third_party_id_servers</code> will be used as the
  1082. <code>account_threepid_delegate</code> for email. This is to ensure compatibility
  1083. with existing Synapse installs that set up external server handling for
  1084. these tasks before v1.4.0. If
  1085. <code>email.trust_identity_server_for_password_resets</code> is <code>true</code> and no
  1086. trusted identity server domains are configured, Synapse will report an
  1087. error and refuse to start.</p>
  1088. <p>If <code>email.trust_identity_server_for_password_resets</code> is <code>false</code> or
  1089. absent and no <code>email</code> delegate is configured in
  1090. <code>account_threepid_delegates</code>, then Synapse will send email verification
  1091. messages itself, using the configured SMTP server (see above). that
  1092. type.</p>
  1093. <h3 id="phone-numbers"><a class="header" href="#phone-numbers">Phone numbers</a></h3>
  1094. <p>Synapse does not support phone-number verification itself, so the only
  1095. way to maintain the ability for users to add phone numbers to their
  1096. accounts will be by continuing to delegate phone number verification to
  1097. the <code>matrix.org</code> and <code>vector.im</code> identity servers (or another identity
  1098. server that supports SMS sending).</p>
  1099. <p>The <code>account_threepid_delegates</code> dictionary defines whether the
  1100. homeserver should delegate an external server (typically an <a href="https://matrix.org/docs/spec/identity_service/r0.2.1">identity
  1101. server</a>) to handle
  1102. sending confirmation messages via email and SMS.</p>
  1103. <p>So to delegate phone number verification, in <code>homeserver.yaml</code>, set
  1104. <code>account_threepid_delegates.msisdn</code> to the base URL of an identity
  1105. server. For example:</p>
  1106. <pre><code class="language-yaml">account_threepid_delegates:
  1107. msisdn: https://example.com # Delegate sms sending to example.com
  1108. </code></pre>
  1109. <p>The <code>matrix.org</code> and <code>vector.im</code> identity servers will continue to
  1110. support delegated phone number verification via SMS until such time as
  1111. it is possible for admins to configure their servers to perform phone
  1112. number verification directly. More details will follow in a future
  1113. release.</p>
  1114. <h2 id="rolling-back-to-v131"><a class="header" href="#rolling-back-to-v131">Rolling back to v1.3.1</a></h2>
  1115. <p>If you encounter problems with v1.4.0, it should be possible to roll
  1116. back to v1.3.1, subject to the following:</p>
  1117. <ul>
  1118. <li>
  1119. <p>The 'room statistics' engine was heavily reworked in this release
  1120. (see <a href="https://github.com/matrix-org/synapse/pull/5971">#5971</a>),
  1121. including significant changes to the database schema, which are not
  1122. easily reverted. This will cause the room statistics engine to stop
  1123. updating when you downgrade.</p>
  1124. <p>The room statistics are essentially unused in v1.3.1 (in future
  1125. versions of Synapse, they will be used to populate the room
  1126. directory), so there should be no loss of functionality. However,
  1127. the statistics engine will write errors to the logs, which can be
  1128. avoided by setting the following in <code>homeserver.yaml</code>:</p>
  1129. <pre><code class="language-yaml">stats:
  1130. enabled: false
  1131. </code></pre>
  1132. <p>Don't forget to re-enable it when you upgrade again, in preparation
  1133. for its use in the room directory!</p>
  1134. </li>
  1135. </ul>
  1136. <h1 id="upgrading-to-v120"><a class="header" href="#upgrading-to-v120">Upgrading to v1.2.0</a></h1>
  1137. <p>Some counter metrics have been renamed, with the old names deprecated.
  1138. See <a href="metrics-howto.html#renaming-of-metrics--deprecation-of-old-names-in-12">the metrics
  1139. documentation</a>
  1140. for details.</p>
  1141. <h1 id="upgrading-to-v110"><a class="header" href="#upgrading-to-v110">Upgrading to v1.1.0</a></h1>
  1142. <p>Synapse v1.1.0 removes support for older Python and PostgreSQL versions,
  1143. as outlined in <a href="https://matrix.org/blog/2019/04/08/synapse-deprecating-postgres-9-4-and-python-2-x">our deprecation
  1144. notice</a>.</p>
  1145. <h2 id="minimum-python-version"><a class="header" href="#minimum-python-version">Minimum Python Version</a></h2>
  1146. <p>Synapse v1.1.0 has a minimum Python requirement of Python 3.5. Python
  1147. 3.6 or Python 3.7 are recommended as they have improved internal string
  1148. handling, significantly reducing memory usage.</p>
  1149. <p>If you use current versions of the Matrix.org-distributed Debian
  1150. packages or Docker images, action is not required.</p>
  1151. <p>If you install Synapse in a Python virtual environment, please see
  1152. &quot;Upgrading to v0.34.0&quot; for notes on setting up a new virtualenv under
  1153. Python 3.</p>
  1154. <h2 id="minimum-postgresql-version"><a class="header" href="#minimum-postgresql-version">Minimum PostgreSQL Version</a></h2>
  1155. <p>If using PostgreSQL under Synapse, you will need to use PostgreSQL 9.5
  1156. or above. Please see the <a href="https://www.postgresql.org/docs/11/upgrading.html">PostgreSQL
  1157. documentation</a> for
  1158. more details on upgrading your database.</p>
  1159. <h1 id="upgrading-to-v10"><a class="header" href="#upgrading-to-v10">Upgrading to v1.0</a></h1>
  1160. <h2 id="validation-of-tls-certificates"><a class="header" href="#validation-of-tls-certificates">Validation of TLS certificates</a></h2>
  1161. <p>Synapse v1.0 is the first release to enforce validation of TLS
  1162. certificates for the federation API. It is therefore essential that your
  1163. certificates are correctly configured.</p>
  1164. <p>Note, v1.0 installations will also no longer be able to federate with
  1165. servers that have not correctly configured their certificates.</p>
  1166. <p>In rare cases, it may be desirable to disable certificate checking: for
  1167. example, it might be essential to be able to federate with a given
  1168. legacy server in a closed federation. This can be done in one of two
  1169. ways:-</p>
  1170. <ul>
  1171. <li>Configure the global switch <code>federation_verify_certificates</code> to
  1172. <code>false</code>.</li>
  1173. <li>Configure a whitelist of server domains to trust via
  1174. <code>federation_certificate_verification_whitelist</code>.</li>
  1175. </ul>
  1176. <p>See the <a href="usage/configuration/homeserver_sample_config.html">sample configuration file</a>
  1177. for more details on these settings.</p>
  1178. <h2 id="email-1"><a class="header" href="#email-1">Email</a></h2>
  1179. <p>When a user requests a password reset, Synapse will send an email to the
  1180. user to confirm the request.</p>
  1181. <p>Previous versions of Synapse delegated the job of sending this email to
  1182. an identity server. If the identity server was somehow malicious or
  1183. became compromised, it would be theoretically possible to hijack an
  1184. account through this means.</p>
  1185. <p>Therefore, by default, Synapse v1.0 will send the confirmation email
  1186. itself. If Synapse is not configured with an SMTP server, password reset
  1187. via email will be disabled.</p>
  1188. <p>To configure an SMTP server for Synapse, modify the configuration
  1189. section headed <code>email</code>, and be sure to have at least the <code>smtp_host</code>,
  1190. <code>smtp_port</code> and <code>notif_from</code> fields filled out. You may also need to set
  1191. <code>smtp_user</code>, <code>smtp_pass</code>, and <code>require_transport_security</code>.</p>
  1192. <p>If you are absolutely certain that you wish to continue using an
  1193. identity server for password resets, set
  1194. <code>trust_identity_server_for_password_resets</code> to <code>true</code>.</p>
  1195. <p>See the <a href="usage/configuration/homeserver_sample_config.html">sample configuration file</a>
  1196. for more details on these settings.</p>
  1197. <h2 id="new-email-templates"><a class="header" href="#new-email-templates">New email templates</a></h2>
  1198. <p>Some new templates have been added to the default template directory for the purpose of
  1199. the homeserver sending its own password reset emails. If you have configured a
  1200. custom <code>template_dir</code> in your Synapse config, these files will need to be added.</p>
  1201. <p><code>password_reset.html</code> and <code>password_reset.txt</code> are HTML and plain text
  1202. templates respectively that contain the contents of what will be emailed
  1203. to the user upon attempting to reset their password via email.
  1204. <code>password_reset_success.html</code> and <code>password_reset_failure.html</code> are HTML
  1205. files that the content of which (assuming no redirect URL is set) will
  1206. be shown to the user after they attempt to click the link in the email
  1207. sent to them.</p>
  1208. <h1 id="upgrading-to-v0990"><a class="header" href="#upgrading-to-v0990">Upgrading to v0.99.0</a></h1>
  1209. <p>Please be aware that, before Synapse v1.0 is released around March 2019,
  1210. you will need to replace any self-signed certificates with those
  1211. verified by a root CA. Information on how to do so can be found at the
  1212. ACME docs.</p>
  1213. <h1 id="upgrading-to-v0340"><a class="header" href="#upgrading-to-v0340">Upgrading to v0.34.0</a></h1>
  1214. <ol>
  1215. <li>
  1216. <p>This release is the first to fully support Python 3. Synapse will
  1217. now run on Python versions 3.5, or 3.6 (as well as 2.7). We
  1218. recommend switching to Python 3, as it has been shown to give
  1219. performance improvements.</p>
  1220. <p>For users who have installed Synapse into a virtualenv, we recommend
  1221. doing this by creating a new virtualenv. For example:</p>
  1222. <pre><code class="language-sh">virtualenv -p python3 ~/synapse/env3
  1223. source ~/synapse/env3/bin/activate
  1224. pip install matrix-synapse
  1225. </code></pre>
  1226. <p>You can then start synapse as normal, having activated the new
  1227. virtualenv:</p>
  1228. <pre><code class="language-sh">cd ~/synapse
  1229. source env3/bin/activate
  1230. synctl start
  1231. </code></pre>
  1232. <p>Users who have installed from distribution packages should see the
  1233. relevant package documentation. See below for notes on Debian
  1234. packages.</p>
  1235. <ul>
  1236. <li>
  1237. <p>When upgrading to Python 3, you <strong>must</strong> make sure that your log
  1238. files are configured as UTF-8, by adding <code>encoding: utf8</code> to the
  1239. <code>RotatingFileHandler</code> configuration (if you have one) in your
  1240. <code>&lt;server&gt;.log.config</code> file. For example, if your <code>log.config</code>
  1241. file contains:</p>
  1242. <pre><code class="language-yaml">handlers:
  1243. file:
  1244. class: logging.handlers.RotatingFileHandler
  1245. formatter: precise
  1246. filename: homeserver.log
  1247. maxBytes: 104857600
  1248. backupCount: 10
  1249. filters: [context]
  1250. console:
  1251. class: logging.StreamHandler
  1252. formatter: precise
  1253. filters: [context]
  1254. </code></pre>
  1255. <p>Then you should update this to be:</p>
  1256. <pre><code class="language-yaml">handlers:
  1257. file:
  1258. class: logging.handlers.RotatingFileHandler
  1259. formatter: precise
  1260. filename: homeserver.log
  1261. maxBytes: 104857600
  1262. backupCount: 10
  1263. filters: [context]
  1264. encoding: utf8
  1265. console:
  1266. class: logging.StreamHandler
  1267. formatter: precise
  1268. filters: [context]
  1269. </code></pre>
  1270. <p>There is no need to revert this change if downgrading to
  1271. Python 2.</p>
  1272. </li>
  1273. </ul>
  1274. <p>We are also making available Debian packages which will run Synapse
  1275. on Python 3. You can switch to these packages with
  1276. <code>apt-get install matrix-synapse-py3</code>, however, please read
  1277. <a href="https://github.com/matrix-org/synapse/blob/release-v0.34.0/debian/NEWS">debian/NEWS</a>
  1278. before doing so. The existing <code>matrix-synapse</code> packages will
  1279. continue to use Python 2 for the time being.</p>
  1280. </li>
  1281. <li>
  1282. <p>This release removes the <code>riot.im</code> from the default list of trusted
  1283. identity servers.</p>
  1284. <p>If <code>riot.im</code> is in your homeserver's list of
  1285. <code>trusted_third_party_id_servers</code>, you should remove it. It was added
  1286. in case a hypothetical future identity server was put there. If you
  1287. don't remove it, users may be unable to deactivate their accounts.</p>
  1288. </li>
  1289. <li>
  1290. <p>This release no longer installs the (unmaintained) Matrix Console
  1291. web client as part of the default installation. It is possible to
  1292. re-enable it by installing it separately and setting the
  1293. <code>web_client_location</code> config option, but please consider switching
  1294. to another client.</p>
  1295. </li>
  1296. </ol>
  1297. <h1 id="upgrading-to-v0337"><a class="header" href="#upgrading-to-v0337">Upgrading to v0.33.7</a></h1>
  1298. <p>This release removes the example email notification templates from
  1299. <code>res/templates</code> (they are now internal to the python package). This
  1300. should only affect you if you (a) deploy your Synapse instance from a
  1301. git checkout or a github snapshot URL, and (b) have email notifications
  1302. enabled.</p>
  1303. <p>If you have email notifications enabled, you should ensure that
  1304. <code>email.template_dir</code> is either configured to point at a directory where
  1305. you have installed customised templates, or leave it unset to use the
  1306. default templates.</p>
  1307. <h1 id="upgrading-to-v0273"><a class="header" href="#upgrading-to-v0273">Upgrading to v0.27.3</a></h1>
  1308. <p>This release expands the anonymous usage stats sent if the opt-in
  1309. <code>report_stats</code> configuration is set to <code>true</code>. We now capture RSS memory
  1310. and cpu use at a very coarse level. This requires administrators to
  1311. install the optional <code>psutil</code> python module.</p>
  1312. <p>We would appreciate it if you could assist by ensuring this module is
  1313. available and <code>report_stats</code> is enabled. This will let us see if
  1314. performance changes to synapse are having an impact to the general
  1315. community.</p>
  1316. <h1 id="upgrading-to-v0150"><a class="header" href="#upgrading-to-v0150">Upgrading to v0.15.0</a></h1>
  1317. <p>If you want to use the new URL previewing API
  1318. (<code>/_matrix/media/r0/preview_url</code>) then you have to explicitly enable it
  1319. in the config and update your dependencies dependencies. See README.rst
  1320. for details.</p>
  1321. <h1 id="upgrading-to-v0110"><a class="header" href="#upgrading-to-v0110">Upgrading to v0.11.0</a></h1>
  1322. <p>This release includes the option to send anonymous usage stats to
  1323. matrix.org, and requires that administrators explictly opt in or out by
  1324. setting the <code>report_stats</code> option to either <code>true</code> or <code>false</code>.</p>
  1325. <p>We would really appreciate it if you could help our project out by
  1326. reporting anonymized usage statistics from your homeserver. Only very
  1327. basic aggregate data (e.g. number of users) will be reported, but it
  1328. helps us to track the growth of the Matrix community, and helps us to
  1329. make Matrix a success, as well as to convince other networks that they
  1330. should peer with us.</p>
  1331. <h1 id="upgrading-to-v090"><a class="header" href="#upgrading-to-v090">Upgrading to v0.9.0</a></h1>
  1332. <p>Application services have had a breaking API change in this version.</p>
  1333. <p>They can no longer register themselves with a home server using the AS
  1334. HTTP API. This decision was made because a compromised application
  1335. service with free reign to register any regex in effect grants full
  1336. read/write access to the home server if a regex of <code>.*</code> is used. An
  1337. attack where a compromised AS re-registers itself with <code>.*</code> was deemed
  1338. too big of a security risk to ignore, and so the ability to register
  1339. with the HS remotely has been removed.</p>
  1340. <p>It has been replaced by specifying a list of application service
  1341. registrations in <code>homeserver.yaml</code>:</p>
  1342. <pre><code class="language-yaml">app_service_config_files: [&quot;registration-01.yaml&quot;, &quot;registration-02.yaml&quot;]
  1343. </code></pre>
  1344. <p>Where <code>registration-01.yaml</code> looks like:</p>
  1345. <pre><code class="language-yaml">url: &lt;String&gt; # e.g. &quot;https://my.application.service.com&quot;
  1346. as_token: &lt;String&gt;
  1347. hs_token: &lt;String&gt;
  1348. sender_localpart: &lt;String&gt; # This is a new field which denotes the user_id localpart when using the AS token
  1349. namespaces:
  1350. users:
  1351. - exclusive: &lt;Boolean&gt;
  1352. regex: &lt;String&gt; # e.g. &quot;@prefix_.*&quot;
  1353. aliases:
  1354. - exclusive: &lt;Boolean&gt;
  1355. regex: &lt;String&gt;
  1356. rooms:
  1357. - exclusive: &lt;Boolean&gt;
  1358. regex: &lt;String&gt;
  1359. </code></pre>
  1360. <h1 id="upgrading-to-v080"><a class="header" href="#upgrading-to-v080">Upgrading to v0.8.0</a></h1>
  1361. <p>Servers which use captchas will need to add their public key to:</p>
  1362. <pre><code>static/client/register/register_config.js
  1363. window.matrixRegistrationConfig = {
  1364. recaptcha_public_key: &quot;YOUR_PUBLIC_KEY&quot;
  1365. };
  1366. </code></pre>
  1367. <p>This is required in order to support registration fallback (typically
  1368. used on mobile devices).</p>
  1369. <h1 id="upgrading-to-v070"><a class="header" href="#upgrading-to-v070">Upgrading to v0.7.0</a></h1>
  1370. <p>New dependencies are:</p>
  1371. <ul>
  1372. <li>pydenticon</li>
  1373. <li>simplejson</li>
  1374. <li>syutil</li>
  1375. <li>matrix-angular-sdk</li>
  1376. </ul>
  1377. <p>To pull in these dependencies in a virtual env, run:</p>
  1378. <pre><code>python synapse/python_dependencies.py | xargs -n 1 pip install
  1379. </code></pre>
  1380. <h1 id="upgrading-to-v060"><a class="header" href="#upgrading-to-v060">Upgrading to v0.6.0</a></h1>
  1381. <p>To pull in new dependencies, run:</p>
  1382. <pre><code>python setup.py develop --user
  1383. </code></pre>
  1384. <p>This update includes a change to the database schema. To upgrade you
  1385. first need to upgrade the database by running:</p>
  1386. <pre><code>python scripts/upgrade_db_to_v0.6.0.py &lt;db&gt; &lt;server_name&gt; &lt;signing_key&gt;
  1387. </code></pre>
  1388. <p>Where <code>&lt;db&gt;</code> is the location of the database,
  1389. <code>&lt;server_name&gt;</code> is the server name as specified in the
  1390. synapse configuration, and <code>&lt;signing_key&gt;</code> is the location
  1391. of the signing key as specified in the synapse configuration.</p>
  1392. <p>This may take some time to complete. Failures of signatures and content
  1393. hashes can safely be ignored.</p>
  1394. <h1 id="upgrading-to-v051"><a class="header" href="#upgrading-to-v051">Upgrading to v0.5.1</a></h1>
  1395. <p>Depending on precisely when you installed v0.5.0 you may have ended up
  1396. with a stale release of the reference matrix webclient installed as a
  1397. python module. To uninstall it and ensure you are depending on the
  1398. latest module, please run:</p>
  1399. <pre><code>$ pip uninstall syweb
  1400. </code></pre>
  1401. <h1 id="upgrading-to-v050"><a class="header" href="#upgrading-to-v050">Upgrading to v0.5.0</a></h1>
  1402. <p>The webclient has been split out into a seperate repository/pacakage in
  1403. this release. Before you restart your homeserver you will need to pull
  1404. in the webclient package by running:</p>
  1405. <pre><code>python setup.py develop --user
  1406. </code></pre>
  1407. <p>This release completely changes the database schema and so requires
  1408. upgrading it before starting the new version of the homeserver.</p>
  1409. <p>The script &quot;database-prepare-for-0.5.0.sh&quot; should be used to upgrade
  1410. the database. This will save all user information, such as logins and
  1411. profiles, but will otherwise purge the database. This includes messages,
  1412. which rooms the home server was a member of and room alias mappings.</p>
  1413. <p>If you would like to keep your history, please take a copy of your
  1414. database file and ask for help in #matrix:matrix.org. The upgrade
  1415. process is, unfortunately, non trivial and requires human intervention
  1416. to resolve any resulting conflicts during the upgrade process.</p>
  1417. <p>Before running the command the homeserver should be first completely
  1418. shutdown. To run it, simply specify the location of the database, e.g.:</p>
  1419. <blockquote>
  1420. <p>./scripts/database-prepare-for-0.5.0.sh &quot;homeserver.db&quot;</p>
  1421. </blockquote>
  1422. <p>Once this has successfully completed it will be safe to restart the
  1423. homeserver. You may notice that the homeserver takes a few seconds
  1424. longer to restart than usual as it reinitializes the database.</p>
  1425. <p>On startup of the new version, users can either rejoin remote rooms
  1426. using room aliases or by being reinvited. Alternatively, if any other
  1427. homeserver sends a message to a room that the homeserver was previously
  1428. in the local HS will automatically rejoin the room.</p>
  1429. <h1 id="upgrading-to-v040"><a class="header" href="#upgrading-to-v040">Upgrading to v0.4.0</a></h1>
  1430. <p>This release needs an updated syutil version. Run:</p>
  1431. <pre><code>python setup.py develop
  1432. </code></pre>
  1433. <p>You will also need to upgrade your configuration as the signing key
  1434. format has changed. Run:</p>
  1435. <pre><code>python -m synapse.app.homeserver --config-path &lt;CONFIG&gt; --generate-config
  1436. </code></pre>
  1437. <h1 id="upgrading-to-v030"><a class="header" href="#upgrading-to-v030">Upgrading to v0.3.0</a></h1>
  1438. <p>This registration API now closely matches the login API. This introduces
  1439. a bit more backwards and forwards between the HS and the client, but
  1440. this improves the overall flexibility of the API. You can now GET on
  1441. /register to retrieve a list of valid registration flows. Upon choosing
  1442. one, they are submitted in the same way as login, e.g:</p>
  1443. <pre><code>{
  1444. type: m.login.password,
  1445. user: foo,
  1446. password: bar
  1447. }
  1448. </code></pre>
  1449. <p>The default HS supports 2 flows, with and without Identity Server email
  1450. authentication. Enabling captcha on the HS will add in an extra step to
  1451. all flows: <code>m.login.recaptcha</code> which must be completed before you can
  1452. transition to the next stage. There is a new login type:
  1453. <code>m.login.email.identity</code> which contains the <code>threepidCreds</code> key which
  1454. were previously sent in the original register request. For more
  1455. information on this, see the specification.</p>
  1456. <h2 id="web-client"><a class="header" href="#web-client">Web Client</a></h2>
  1457. <p>The VoIP specification has changed between v0.2.0 and v0.3.0. Users
  1458. should refresh any browser tabs to get the latest web client code. Users
  1459. on v0.2.0 of the web client will not be able to call those on v0.3.0 and
  1460. vice versa.</p>
  1461. <h1 id="upgrading-to-v020"><a class="header" href="#upgrading-to-v020">Upgrading to v0.2.0</a></h1>
  1462. <p>The home server now requires setting up of SSL config before it can run.
  1463. To automatically generate default config use:</p>
  1464. <pre><code>$ python synapse/app/homeserver.py \
  1465. --server-name machine.my.domain.name \
  1466. --bind-port 8448 \
  1467. --config-path homeserver.config \
  1468. --generate-config
  1469. </code></pre>
  1470. <p>This config can be edited if desired, for example to specify a different
  1471. SSL certificate to use. Once done you can run the home server using:</p>
  1472. <pre><code>$ python synapse/app/homeserver.py --config-path homeserver.config
  1473. </code></pre>
  1474. <p>See the README.rst for more information.</p>
  1475. <p>Also note that some config options have been renamed, including:</p>
  1476. <ul>
  1477. <li>&quot;host&quot; to &quot;server-name&quot;</li>
  1478. <li>&quot;database&quot; to &quot;database-path&quot;</li>
  1479. <li>&quot;port&quot; to &quot;bind-port&quot; and &quot;unsecure-port&quot;</li>
  1480. </ul>
  1481. <h1 id="upgrading-to-v001"><a class="header" href="#upgrading-to-v001">Upgrading to v0.0.1</a></h1>
  1482. <p>This release completely changes the database schema and so requires
  1483. upgrading it before starting the new version of the homeserver.</p>
  1484. <p>The script &quot;database-prepare-for-0.0.1.sh&quot; should be used to upgrade
  1485. the database. This will save all user information, such as logins and
  1486. profiles, but will otherwise purge the database. This includes messages,
  1487. which rooms the home server was a member of and room alias mappings.</p>
  1488. <p>Before running the command the homeserver should be first completely
  1489. shutdown. To run it, simply specify the location of the database, e.g.:</p>
  1490. <blockquote>
  1491. <p>./scripts/database-prepare-for-0.0.1.sh &quot;homeserver.db&quot;</p>
  1492. </blockquote>
  1493. <p>Once this has successfully completed it will be safe to restart the
  1494. homeserver. You may notice that the homeserver takes a few seconds
  1495. longer to restart than usual as it reinitializes the database.</p>
  1496. <p>On startup of the new version, users can either rejoin remote rooms
  1497. using room aliases or by being reinvited. Alternatively, if any other
  1498. homeserver sends a message to a room that the homeserver was previously
  1499. in the local HS will automatically rejoin the room.</p>
  1500. </main>
  1501. <nav class="nav-wrapper" aria-label="Page navigation">
  1502. <!-- Mobile navigation buttons -->
  1503. <a rel="prev" href="delegate.html" class="mobile-nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
  1504. <i class="fa fa-angle-left"></i>
  1505. </a>
  1506. <a rel="next" href="federate.html" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
  1507. <i class="fa fa-angle-right"></i>
  1508. </a>
  1509. <div style="clear: both"></div>
  1510. </nav>
  1511. </div>
  1512. </div>
  1513. <nav class="nav-wide-wrapper" aria-label="Page navigation">
  1514. <a rel="prev" href="delegate.html" class="nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
  1515. <i class="fa fa-angle-left"></i>
  1516. </a>
  1517. <a rel="next" href="federate.html" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
  1518. <i class="fa fa-angle-right"></i>
  1519. </a>
  1520. </nav>
  1521. </div>
  1522. <script type="text/javascript">
  1523. window.playground_copyable = true;
  1524. </script>
  1525. <script src="elasticlunr.min.js" type="text/javascript" charset="utf-8"></script>
  1526. <script src="mark.min.js" type="text/javascript" charset="utf-8"></script>
  1527. <script src="searcher.js" type="text/javascript" charset="utf-8"></script>
  1528. <script src="clipboard.min.js" type="text/javascript" charset="utf-8"></script>
  1529. <script src="highlight.js" type="text/javascript" charset="utf-8"></script>
  1530. <script src="book.js" type="text/javascript" charset="utf-8"></script>
  1531. <!-- Custom JS scripts -->
  1532. <script type="text/javascript" src="docs/website_files/table-of-contents.js"></script>
  1533. </body>
  1534. </html>