contributing_guide.html 55 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657
  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>Contributing Guide - 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. <link rel="stylesheet" href="../docs/website_files/version-picker.css">
  30. </head>
  31. <body>
  32. <!-- Provide site root to javascript -->
  33. <script type="text/javascript">
  34. var path_to_root = "../";
  35. var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "navy" : "light";
  36. </script>
  37. <!-- Work around some values being stored in localStorage wrapped in quotes -->
  38. <script type="text/javascript">
  39. try {
  40. var theme = localStorage.getItem('mdbook-theme');
  41. var sidebar = localStorage.getItem('mdbook-sidebar');
  42. if (theme.startsWith('"') && theme.endsWith('"')) {
  43. localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1));
  44. }
  45. if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
  46. localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1));
  47. }
  48. } catch (e) { }
  49. </script>
  50. <!-- Set the theme before any content is loaded, prevents flash -->
  51. <script type="text/javascript">
  52. var theme;
  53. try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { }
  54. if (theme === null || theme === undefined) { theme = default_theme; }
  55. var html = document.querySelector('html');
  56. html.classList.remove('no-js')
  57. html.classList.remove('light')
  58. html.classList.add(theme);
  59. html.classList.add('js');
  60. </script>
  61. <!-- Hide / unhide sidebar before it is displayed -->
  62. <script type="text/javascript">
  63. var html = document.querySelector('html');
  64. var sidebar = 'hidden';
  65. if (document.body.clientWidth >= 1080) {
  66. try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { }
  67. sidebar = sidebar || 'visible';
  68. }
  69. html.classList.remove('sidebar-visible');
  70. html.classList.add("sidebar-" + sidebar);
  71. </script>
  72. <nav id="sidebar" class="sidebar" aria-label="Table of contents">
  73. <div class="sidebar-scrollbox">
  74. <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><ol class="section"><li class="chapter-item expanded "><a href="../setup/turn/coturn.html">coturn TURN server</a></li><li class="chapter-item expanded "><a href="../setup/turn/eturnal.html">eturnal TURN server</a></li></ol></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">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/config_documentation.html">Configuration Manual</a></li><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="../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/add_extra_fields_to_client_events_unsigned.html">Add extra fields to client events unsigned section 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/event_reports.html">Event Reports</a></li><li class="chapter-item expanded "><a href="../admin_api/experimental_features.html">Experimental Features</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><ol class="section"><li class="chapter-item expanded "><a href="../usage/administration/monitoring/reporting_homeserver_usage_statistics.html">Reporting Homeserver Usage Statistics</a></li></ol></li><li class="chapter-item expanded "><a href="../usage/administration/monthly_active_users.html">Monthly Active Users</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" class="active">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/reviews.html">Reviewing Code</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 "><a href="../development/dependencies.html">Dependency management</a></li><li class="chapter-item expanded "><div>Synapse Architecture</div></li><li><ol class="section"><li class="chapter-item expanded "><a href="../development/synapse_architecture/cancellation.html">Cancellation</a></li><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="../development/synapse_architecture/streams.html">Streams</a></li><li class="chapter-item expanded "><a href="../tcp_replication.html">TCP Replication</a></li><li class="chapter-item expanded "><a href="../development/synapse_architecture/faster_joins.html">Faster remote joins</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>
  75. </div>
  76. <div id="sidebar-resize-handle" class="sidebar-resize-handle"></div>
  77. </nav>
  78. <div id="page-wrapper" class="page-wrapper">
  79. <div class="page">
  80. <div id="menu-bar-hover-placeholder"></div>
  81. <div id="menu-bar" class="menu-bar sticky bordered">
  82. <div class="left-buttons">
  83. <button id="sidebar-toggle" class="icon-button" type="button" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
  84. <i class="fa fa-bars"></i>
  85. </button>
  86. <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">
  87. <i class="fa fa-paint-brush"></i>
  88. </button>
  89. <ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu">
  90. <li role="none"><button role="menuitem" class="theme" id="light">Light (default)</button></li>
  91. <li role="none"><button role="menuitem" class="theme" id="rust">Rust</button></li>
  92. <li role="none"><button role="menuitem" class="theme" id="coal">Coal</button></li>
  93. <li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li>
  94. <li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li>
  95. </ul>
  96. <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">
  97. <i class="fa fa-search"></i>
  98. </button>
  99. <div class="version-picker">
  100. <div class="dropdown">
  101. <div class="select">
  102. <span></span>
  103. <i class="fa fa-chevron-down"></i>
  104. </div>
  105. <input type="hidden" name="version">
  106. <ul class="dropdown-menu">
  107. <!-- Versions will be added dynamically in version-picker.js -->
  108. </ul>
  109. </div>
  110. </div>
  111. </div>
  112. <h1 class="menu-title">Synapse</h1>
  113. <div class="right-buttons">
  114. <a href="../print.html" title="Print this book" aria-label="Print this book">
  115. <i id="print-button" class="fa fa-print"></i>
  116. </a>
  117. <a href="https://github.com/matrix-org/synapse" title="Git repository" aria-label="Git repository">
  118. <i id="git-repository-button" class="fa fa-github"></i>
  119. </a>
  120. <a href="https://github.com/matrix-org/synapse/edit/develop/docs/development/contributing_guide.md" title="Suggest an edit" aria-label="Suggest an edit">
  121. <i id="git-edit-button" class="fa fa-edit"></i>
  122. </a>
  123. </div>
  124. </div>
  125. <div id="search-wrapper" class="hidden">
  126. <form id="searchbar-outer" class="searchbar-outer">
  127. <input type="search" id="searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="searchresults-outer" aria-describedby="searchresults-header">
  128. </form>
  129. <div id="searchresults-outer" class="searchresults-outer hidden">
  130. <div id="searchresults-header" class="searchresults-header"></div>
  131. <ul id="searchresults">
  132. </ul>
  133. </div>
  134. </div>
  135. <!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM -->
  136. <script type="text/javascript">
  137. document.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible');
  138. document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible');
  139. Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) {
  140. link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1);
  141. });
  142. </script>
  143. <div id="content" class="content">
  144. <main>
  145. <!-- Page table of contents -->
  146. <div class="sidetoc">
  147. <nav class="pagetoc"></nav>
  148. </div>
  149. <h1 id="contributing"><a class="header" href="#contributing">Contributing</a></h1>
  150. <p>This document aims to get you started with contributing to Synapse!</p>
  151. <h1 id="1-who-can-contribute-to-synapse"><a class="header" href="#1-who-can-contribute-to-synapse">1. Who can contribute to Synapse?</a></h1>
  152. <p>Everyone is welcome to contribute code to <a href="https://github.com/matrix-org">matrix.org
  153. projects</a>, provided that they are willing to
  154. license their contributions under the same license as the project itself. We
  155. follow a simple 'inbound=outbound' model for contributions: the act of
  156. submitting an 'inbound' contribution means that the contributor agrees to
  157. license the code under the same terms as the project's overall 'outbound'
  158. license - in our case, this is almost always Apache Software License v2 (see
  159. <a href="https://github.com/matrix-org/synapse/blob/develop/LICENSE">LICENSE</a>).</p>
  160. <h1 id="2-what-do-i-need"><a class="header" href="#2-what-do-i-need">2. What do I need?</a></h1>
  161. <p>If you are running Windows, the Windows Subsystem for Linux (WSL) is strongly
  162. recommended for development. More information about WSL can be found at
  163. <a href="https://docs.microsoft.com/en-us/windows/wsl/install">https://docs.microsoft.com/en-us/windows/wsl/install</a>. Running Synapse natively
  164. on Windows is not officially supported.</p>
  165. <p>The code of Synapse is written in Python 3. To do pretty much anything, you'll need <a href="https://www.python.org/downloads/">a recent version of Python 3</a>. Your Python also needs support for <a href="https://docs.python.org/3/library/venv.html">virtual environments</a>. This is usually built-in, but some Linux distributions like Debian and Ubuntu split it out into its own package. Running <code>sudo apt install python3-venv</code> should be enough.</p>
  166. <p>A recent version of the Rust compiler is needed to build the native modules. The
  167. easiest way of installing the latest version is to use <a href="https://rustup.rs/">rustup</a>.</p>
  168. <p>Synapse can connect to PostgreSQL via the <a href="https://pypi.org/project/psycopg2/">psycopg2</a> Python library. Building this library from source requires access to PostgreSQL's C header files. On Debian or Ubuntu Linux, these can be installed with <code>sudo apt install libpq-dev</code>.</p>
  169. <p>Synapse has an optional, improved user search with better Unicode support. For that you need the development package of <code>libicu</code>. On Debian or Ubuntu Linux, this can be installed with <code>sudo apt install libicu-dev</code>.</p>
  170. <p>The source code of Synapse is hosted on GitHub. You will also need <a href="https://github.com/git-guides/install-git">a recent version of git</a>.</p>
  171. <p>For some tests, you will need <a href="https://docs.docker.com/get-docker/">a recent version of Docker</a>.</p>
  172. <h1 id="3-get-the-source"><a class="header" href="#3-get-the-source">3. Get the source.</a></h1>
  173. <p>The preferred and easiest way to contribute changes is to fork the relevant
  174. project on GitHub, and then <a href="https://help.github.com/articles/using-pull-requests/">create a pull request</a> to ask us to pull your
  175. changes into our repo.</p>
  176. <p>Please base your changes on the <code>develop</code> branch.</p>
  177. <pre><code class="language-sh">git clone git@github.com:YOUR_GITHUB_USER_NAME/synapse.git
  178. git checkout develop
  179. </code></pre>
  180. <p>If you need help getting started with git, this is beyond the scope of the document, but you
  181. can find many good git tutorials on the web.</p>
  182. <h1 id="4-install-the-dependencies"><a class="header" href="#4-install-the-dependencies">4. Install the dependencies</a></h1>
  183. <p>Before installing the Python dependencies, make sure you have installed a recent version
  184. of Rust (see the &quot;What do I need?&quot; section above). The easiest way of installing the
  185. latest version is to use <a href="https://rustup.rs/">rustup</a>.</p>
  186. <p>Synapse uses the <a href="https://python-poetry.org/">poetry</a> project to manage its dependencies
  187. and development environment. Once you have installed Python 3 and added the
  188. source, you should install <code>poetry</code>.
  189. Of their installation methods, we recommend
  190. <a href="https://python-poetry.org/docs/#installing-with-pipx">installing <code>poetry</code> using <code>pipx</code></a>,</p>
  191. <pre><code class="language-shell">pip install --user pipx
  192. pipx install poetry==1.5.1 # Problems with Poetry 1.6, see https://github.com/matrix-org/synapse/issues/16147
  193. </code></pre>
  194. <p>but see poetry's <a href="https://python-poetry.org/docs/#installation">installation instructions</a>
  195. for other installation methods.</p>
  196. <p>Developing Synapse requires Poetry version 1.3.2 or later.</p>
  197. <p>Next, open a terminal and install dependencies as follows:</p>
  198. <pre><code class="language-sh">cd path/where/you/have/cloned/the/repository
  199. poetry install --extras all
  200. </code></pre>
  201. <p>This will install the runtime and developer dependencies for the project. Be sure to check
  202. that the <code>poetry install</code> step completed cleanly.</p>
  203. <h2 id="running-synapse-via-poetry"><a class="header" href="#running-synapse-via-poetry">Running Synapse via poetry</a></h2>
  204. <p>To start a local instance of Synapse in the locked poetry environment, create a config file:</p>
  205. <pre><code class="language-sh">cp docs/sample_config.yaml homeserver.yaml
  206. cp docs/sample_log_config.yaml log_config.yaml
  207. </code></pre>
  208. <p>Now edit <code>homeserver.yaml</code>, things you might want to change include:</p>
  209. <ul>
  210. <li>Set a <code>server_name</code></li>
  211. <li>Adjusting paths to be correct for your system like the <code>log_config</code> to point to the log config you just copied</li>
  212. <li>Using a <a href="https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#database">PostgreSQL database instead of SQLite</a></li>
  213. <li>Adding a <a href="https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#registration_shared_secret"><code>registration_shared_secret</code></a> so you can use <a href="https://matrix-org.github.io/synapse/latest/setup/installation.html#registering-a-user"><code>register_new_matrix_user</code> command</a>.</li>
  214. </ul>
  215. <p>And then run Synapse with the following command:</p>
  216. <pre><code class="language-sh">poetry run python -m synapse.app.homeserver -c homeserver.yaml
  217. </code></pre>
  218. <p>If you get an error like the following:</p>
  219. <pre><code>importlib.metadata.PackageNotFoundError: matrix-synapse
  220. </code></pre>
  221. <p>this probably indicates that the <code>poetry install</code> step did not complete cleanly - go back and
  222. resolve any issues and re-run until successful.</p>
  223. <h1 id="5-get-in-touch"><a class="header" href="#5-get-in-touch">5. Get in touch.</a></h1>
  224. <p>Join our developer community on Matrix: <a href="https://matrix.to/#/#synapse-dev:matrix.org">#synapse-dev:matrix.org</a>!</p>
  225. <h1 id="6-pick-an-issue"><a class="header" href="#6-pick-an-issue">6. Pick an issue.</a></h1>
  226. <p>Fix your favorite problem or perhaps find a <a href="https://github.com/matrix-org/synapse/issues?q=is%3Aopen+is%3Aissue+label%3A%22Good+First+Issue%22">Good First Issue</a>
  227. to work on.</p>
  228. <h1 id="7-turn-coffee-into-code-and-documentation"><a class="header" href="#7-turn-coffee-into-code-and-documentation">7. Turn coffee into code and documentation!</a></h1>
  229. <p>There is a growing amount of documentation located in the
  230. <a href="https://github.com/matrix-org/synapse/tree/develop/docs"><code>docs</code></a>
  231. directory, with a rendered version <a href="https://matrix-org.github.io/synapse">available online</a>.
  232. This documentation is intended primarily for sysadmins running their
  233. own Synapse instance, as well as developers interacting externally with
  234. Synapse.
  235. <a href="https://github.com/matrix-org/synapse/tree/develop/docs/development"><code>docs/development</code></a>
  236. exists primarily to house documentation for
  237. Synapse developers.
  238. <a href="https://github.com/matrix-org/synapse/tree/develop/docs/admin_api"><code>docs/admin_api</code></a> houses documentation
  239. regarding Synapse's Admin API, which is used mostly by sysadmins and external
  240. service developers.</p>
  241. <p>Synapse's code style is documented <a href="../code_style.html">here</a>. Please follow
  242. it, including the conventions for <a href="../code_style.html#configuration-code-and-documentation-format">configuration
  243. options and documentation</a>.</p>
  244. <p>We welcome improvements and additions to our documentation itself! When
  245. writing new pages, please
  246. <a href="https://github.com/matrix-org/synapse/tree/develop/docs#adding-to-the-documentation">build <code>docs</code> to a book</a>
  247. to check that your contributions render correctly. The docs are written in
  248. <a href="https://guides.github.com/features/mastering-markdown/">GitHub-Flavoured Markdown</a>.</p>
  249. <p>Some documentation also exists in <a href="https://github.com/matrix-org/synapse/wiki">Synapse's GitHub
  250. Wiki</a>, although this is primarily
  251. contributed to by community authors.</p>
  252. <p>When changes are made to any Rust code then you must call either <code>poetry install</code>
  253. or <code>maturin develop</code> (if installed) to rebuild the Rust code. Using <a href="https://github.com/PyO3/maturin"><code>maturin</code></a>
  254. is quicker than <code>poetry install</code>, so is recommended when making frequent
  255. changes to the Rust code.</p>
  256. <h1 id="8-test-test-test"><a class="header" href="#8-test-test-test">8. Test, test, test!</a></h1>
  257. <p><a name="test-test-test" id="test-test-test"></a></p>
  258. <p>While you're developing and before submitting a patch, you'll
  259. want to test your code.</p>
  260. <h2 id="run-the-linters"><a class="header" href="#run-the-linters">Run the linters.</a></h2>
  261. <p>The linters look at your code and do two things:</p>
  262. <ul>
  263. <li>ensure that your code follows the coding style adopted by the project;</li>
  264. <li>catch a number of errors in your code.</li>
  265. </ul>
  266. <p>The linter takes no time at all to run as soon as you've <a href="#4-install-the-dependencies">downloaded the dependencies</a>.</p>
  267. <pre><code class="language-sh">poetry run ./scripts-dev/lint.sh
  268. </code></pre>
  269. <p>Note that this script <em>will modify your files</em> to fix styling errors.
  270. Make sure that you have saved all your files.</p>
  271. <p>If you wish to restrict the linters to only the files changed since the last commit
  272. (much faster!), you can instead run:</p>
  273. <pre><code class="language-sh">poetry run ./scripts-dev/lint.sh -d
  274. </code></pre>
  275. <p>Or if you know exactly which files you wish to lint, you can instead run:</p>
  276. <pre><code class="language-sh">poetry run ./scripts-dev/lint.sh path/to/file1.py path/to/file2.py path/to/folder
  277. </code></pre>
  278. <h2 id="run-the-unit-tests-twisted-trial"><a class="header" href="#run-the-unit-tests-twisted-trial">Run the unit tests (Twisted trial).</a></h2>
  279. <p>The unit tests run parts of Synapse, including your changes, to see if anything
  280. was broken. They are slower than the linters but will typically catch more errors.</p>
  281. <pre><code class="language-sh">poetry run trial tests
  282. </code></pre>
  283. <p>You can run unit tests in parallel by specifying <code>-jX</code> argument to <code>trial</code> where <code>X</code> is the number of parallel runners you want. To use 4 cpu cores, you would run them like:</p>
  284. <pre><code class="language-sh">poetry run trial -j4 tests
  285. </code></pre>
  286. <p>If you wish to only run <em>some</em> unit tests, you may specify
  287. another module instead of <code>tests</code> - or a test class or a method:</p>
  288. <pre><code class="language-sh">poetry run trial tests.rest.admin.test_room tests.handlers.test_admin.ExfiltrateData.test_invite
  289. </code></pre>
  290. <p>If your tests fail, you may wish to look at the logs (the default log level is <code>ERROR</code>):</p>
  291. <pre><code class="language-sh">less _trial_temp/test.log
  292. </code></pre>
  293. <p>To increase the log level for the tests, set <code>SYNAPSE_TEST_LOG_LEVEL</code>:</p>
  294. <pre><code class="language-sh">SYNAPSE_TEST_LOG_LEVEL=DEBUG poetry run trial tests
  295. </code></pre>
  296. <p>By default, tests will use an in-memory SQLite database for test data. For additional
  297. help with debugging, one can use an on-disk SQLite database file instead, in order to
  298. review database state during and after running tests. This can be done by setting
  299. the <code>SYNAPSE_TEST_PERSIST_SQLITE_DB</code> environment variable. Doing so will cause the
  300. database state to be stored in a file named <code>test.db</code> under the trial process'
  301. working directory. Typically, this ends up being <code>_trial_temp/test.db</code>. For example:</p>
  302. <pre><code class="language-sh">SYNAPSE_TEST_PERSIST_SQLITE_DB=1 poetry run trial tests
  303. </code></pre>
  304. <p>The database file can then be inspected with:</p>
  305. <pre><code class="language-sh">sqlite3 _trial_temp/test.db
  306. </code></pre>
  307. <p>Note that the database file is cleared at the beginning of each test run. Thus it
  308. will always only contain the data generated by the <em>last run test</em>. Though generally
  309. when debugging, one is only running a single test anyway.</p>
  310. <h3 id="running-tests-under-postgresql"><a class="header" href="#running-tests-under-postgresql">Running tests under PostgreSQL</a></h3>
  311. <p>Invoking <code>trial</code> as above will use an in-memory SQLite database. This is great for
  312. quick development and testing. However, we recommend using a PostgreSQL database
  313. in production (and indeed, we have some code paths specific to each database).
  314. This means that we need to run our unit tests against PostgreSQL too. Our CI does
  315. this automatically for pull requests and release candidates, but it's sometimes
  316. useful to reproduce this locally.</p>
  317. <h4 id="using-docker"><a class="header" href="#using-docker">Using Docker</a></h4>
  318. <p>The easiest way to do so is to run Postgres via a docker container. In one
  319. terminal:</p>
  320. <pre><code class="language-shell">docker run --rm -e POSTGRES_PASSWORD=mysecretpassword -e POSTGRES_USER=postgres -e POSTGRES_DB=postgres -p 5432:5432 postgres:14
  321. </code></pre>
  322. <p>If you see an error like</p>
  323. <pre><code>docker: Error response from daemon: driver failed programming external connectivity on endpoint nice_ride (b57bbe2e251b70015518d00c9981e8cb8346b5c785250341a6c53e3c899875f1): Error starting userland proxy: listen tcp4 0.0.0.0:5432: bind: address already in use.
  324. </code></pre>
  325. <p>then something is already bound to port 5432. You're probably already running postgres locally.</p>
  326. <p>Once you have a postgres server running, invoke <code>trial</code> in a second terminal:</p>
  327. <pre><code class="language-shell">SYNAPSE_POSTGRES=1 SYNAPSE_POSTGRES_HOST=127.0.0.1 SYNAPSE_POSTGRES_USER=postgres SYNAPSE_POSTGRES_PASSWORD=mysecretpassword poetry run trial tests
  328. </code></pre>
  329. <h4 id="using-an-existing-postgres-installation"><a class="header" href="#using-an-existing-postgres-installation">Using an existing Postgres installation</a></h4>
  330. <p>If you have postgres already installed on your system, you can run <code>trial</code> with the
  331. following environment variables matching your configuration:</p>
  332. <ul>
  333. <li><code>SYNAPSE_POSTGRES</code> to anything nonempty</li>
  334. <li><code>SYNAPSE_POSTGRES_HOST</code> (optional if it's the default: UNIX socket)</li>
  335. <li><code>SYNAPSE_POSTGRES_PORT</code> (optional if it's the default: 5432)</li>
  336. <li><code>SYNAPSE_POSTGRES_USER</code> (optional if using a UNIX socket)</li>
  337. <li><code>SYNAPSE_POSTGRES_PASSWORD</code> (optional if using a UNIX socket)</li>
  338. </ul>
  339. <p>For example:</p>
  340. <pre><code class="language-shell">export SYNAPSE_POSTGRES=1
  341. export SYNAPSE_POSTGRES_HOST=localhost
  342. export SYNAPSE_POSTGRES_USER=postgres
  343. export SYNAPSE_POSTGRES_PASSWORD=mydevenvpassword
  344. trial
  345. </code></pre>
  346. <p>You don't need to specify the host, user, port or password if your Postgres
  347. server is set to authenticate you over the UNIX socket (i.e. if the <code>psql</code> command
  348. works without further arguments).</p>
  349. <p>Your Postgres account needs to be able to create databases; see the postgres
  350. docs for <a href="https://www.postgresql.org/docs/current/sql-alterrole.html"><code>ALTER ROLE</code></a>.</p>
  351. <h2 id="run-the-integration-tests-sytest"><a class="header" href="#run-the-integration-tests-sytest">Run the integration tests (<a href="https://github.com/matrix-org/sytest">Sytest</a>).</a></h2>
  352. <p>The integration tests are a more comprehensive suite of tests. They
  353. run a full version of Synapse, including your changes, to check if
  354. anything was broken. They are slower than the unit tests but will
  355. typically catch more errors.</p>
  356. <p>The following command will let you run the integration test with the most common
  357. configuration:</p>
  358. <pre><code class="language-sh">$ docker run --rm -it -v /path/where/you/have/cloned/the/repository\:/src:ro -v /path/to/where/you/want/logs\:/logs matrixdotorg/sytest-synapse:focal
  359. </code></pre>
  360. <p>(Note that the paths must be full paths! You could also write <code>$(realpath relative/path)</code> if needed.)</p>
  361. <p>This configuration should generally cover your needs.</p>
  362. <ul>
  363. <li>To run with Postgres, supply the <code>-e POSTGRES=1 -e MULTI_POSTGRES=1</code> environment flags.</li>
  364. <li>To run with Synapse in worker mode, supply the <code>-e WORKERS=1 -e REDIS=1</code> environment flags (in addition to the Postgres flags).</li>
  365. </ul>
  366. <p>For more details about other configurations, see the <a href="https://github.com/matrix-org/sytest/blob/develop/docker/README.md">Docker-specific documentation in the SyTest repo</a>.</p>
  367. <h2 id="run-the-integration-tests-complement"><a class="header" href="#run-the-integration-tests-complement">Run the integration tests (<a href="https://github.com/matrix-org/complement">Complement</a>).</a></h2>
  368. <p><a href="https://github.com/matrix-org/complement">Complement</a> is a suite of black box tests that can be run on any homeserver implementation. It can also be thought of as end-to-end (e2e) tests.</p>
  369. <p>It's often nice to develop on Synapse and write Complement tests at the same time.
  370. Here is how to run your local Synapse checkout against your local Complement checkout.</p>
  371. <p>(checkout <a href="https://github.com/matrix-org/complement"><code>complement</code></a> alongside your <code>synapse</code> checkout)</p>
  372. <pre><code class="language-sh">COMPLEMENT_DIR=../complement ./scripts-dev/complement.sh
  373. </code></pre>
  374. <p>To run a specific test file, you can pass the test name at the end of the command. The name passed comes from the naming structure in your Complement tests. If you're unsure of the name, you can do a full run and copy it from the test output:</p>
  375. <pre><code class="language-sh">COMPLEMENT_DIR=../complement ./scripts-dev/complement.sh -run TestImportHistoricalMessages
  376. </code></pre>
  377. <p>To run a specific test, you can specify the whole name structure:</p>
  378. <pre><code class="language-sh">COMPLEMENT_DIR=../complement ./scripts-dev/complement.sh -run TestImportHistoricalMessages/parallel/Historical_events_resolve_in_the_correct_order
  379. </code></pre>
  380. <p>The above will run a monolithic (single-process) Synapse with SQLite as the database. For other configurations, try:</p>
  381. <ul>
  382. <li>Passing <code>POSTGRES=1</code> as an environment variable to use the Postgres database instead.</li>
  383. <li>Passing <code>WORKERS=1</code> as an environment variable to use a workerised setup instead. This option implies the use of Postgres.
  384. <ul>
  385. <li>If setting <code>WORKERS=1</code>, optionally set <code>WORKER_TYPES=</code> to declare which worker
  386. types you wish to test. A simple comma-delimited string containing the worker types
  387. defined from the <code>WORKERS_CONFIG</code> template in
  388. <a href="https://github.com/matrix-org/synapse/blob/develop/docker/configure_workers_and_start.py#L54">here</a>.
  389. A safe example would be <code>WORKER_TYPES=&quot;federation_inbound, federation_sender, synchrotron&quot;</code>.
  390. See the <a href="../workers.html">worker documentation</a> for additional information on workers.</li>
  391. </ul>
  392. </li>
  393. <li>Passing <code>ASYNCIO_REACTOR=1</code> as an environment variable to use the Twisted asyncio reactor instead of the default one.</li>
  394. <li>Passing <code>PODMAN=1</code> will use the <a href="https://podman.io/">podman</a> container runtime, instead of docker.</li>
  395. <li>Passing <code>UNIX_SOCKETS=1</code> will utilise Unix socket functionality for Synapse, Redis, and Postgres(when applicable).</li>
  396. </ul>
  397. <p>To increase the log level for the tests, set <code>SYNAPSE_TEST_LOG_LEVEL</code>, e.g:</p>
  398. <pre><code class="language-sh">SYNAPSE_TEST_LOG_LEVEL=DEBUG COMPLEMENT_DIR=../complement ./scripts-dev/complement.sh -run TestImportHistoricalMessages
  399. </code></pre>
  400. <h3 id="prettier-formatting-with-gotestfmt"><a class="header" href="#prettier-formatting-with-gotestfmt">Prettier formatting with <code>gotestfmt</code></a></h3>
  401. <p>If you want to format the output of the tests the same way as it looks in CI,
  402. install <a href="https://github.com/GoTestTools/gotestfmt">gotestfmt</a>.</p>
  403. <p>You can then use this incantation to format the tests appropriately:</p>
  404. <pre><code class="language-sh">COMPLEMENT_DIR=../complement ./scripts-dev/complement.sh -json | gotestfmt -hide successful-tests
  405. </code></pre>
  406. <p>(Remove <code>-hide successful-tests</code> if you don't want to hide successful tests.)</p>
  407. <h3 id="access-database-for-homeserver-after-complement-test-runs"><a class="header" href="#access-database-for-homeserver-after-complement-test-runs">Access database for homeserver after Complement test runs.</a></h3>
  408. <p>If you're curious what the database looks like after you run some tests, here are some steps to get you going in Synapse:</p>
  409. <ol>
  410. <li>In your Complement test comment out <code>defer deployment.Destroy(t)</code> and replace with <code>defer time.Sleep(2 * time.Hour)</code> to keep the homeserver running after the tests complete</li>
  411. <li>Start the Complement tests</li>
  412. <li>Find the name of the container, <code>docker ps -f name=complement_</code> (this will filter for just the Compelement related Docker containers)</li>
  413. <li>Access the container replacing the name with what you found in the previous step: <code>docker exec -it complement_1_hs_with_application_service.hs1_2 /bin/bash</code></li>
  414. <li>Install sqlite (database driver), <code>apt-get update &amp;&amp; apt-get install -y sqlite3</code></li>
  415. <li>Then run <code>sqlite3</code> and open the database <code>.open /conf/homeserver.db</code> (this db path comes from the Synapse homeserver.yaml)</li>
  416. </ol>
  417. <h1 id="9-submit-your-patch"><a class="header" href="#9-submit-your-patch">9. Submit your patch.</a></h1>
  418. <p>Once you're happy with your patch, it's time to prepare a Pull Request.</p>
  419. <p>To prepare a Pull Request, please:</p>
  420. <ol>
  421. <li>verify that <a href="#test-test-test">all the tests pass</a>, including the coding style;</li>
  422. <li><a href="#sign-off">sign off</a> your contribution;</li>
  423. <li><code>git push</code> your commit to your fork of Synapse;</li>
  424. <li>on GitHub, <a href="https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request">create the Pull Request</a>;</li>
  425. <li>add a <a href="#changelog">changelog entry</a> and push it to your Pull Request;</li>
  426. <li>that's it for now, a non-draft pull request will automatically request review from the team;</li>
  427. <li>if you need to update your PR, please avoid rebasing and just add new commits to your branch.</li>
  428. </ol>
  429. <h2 id="changelog"><a class="header" href="#changelog">Changelog</a></h2>
  430. <p>All changes, even minor ones, need a corresponding changelog / newsfragment
  431. entry. These are managed by <a href="https://github.com/twisted/towncrier">Towncrier</a>.</p>
  432. <p>To create a changelog entry, make a new file in the <code>changelog.d</code> directory named
  433. in the format of <code>PRnumber.type</code>. The type can be one of the following:</p>
  434. <ul>
  435. <li><code>feature</code></li>
  436. <li><code>bugfix</code></li>
  437. <li><code>docker</code> (for updates to the Docker image)</li>
  438. <li><code>doc</code> (for updates to the documentation)</li>
  439. <li><code>removal</code> (also used for deprecations)</li>
  440. <li><code>misc</code> (for internal-only changes)</li>
  441. </ul>
  442. <p>This file will become part of our <a href="https://github.com/matrix-org/synapse/blob/master/CHANGES.md">changelog</a> at the next
  443. release, so the content of the file should be a short description of your
  444. change in the same style as the rest of the changelog. The file can contain Markdown
  445. formatting, and must end with a full stop (.) or an exclamation mark (!) for
  446. consistency.</p>
  447. <p>Adding credits to the changelog is encouraged, we value your
  448. contributions and would like to have you shouted out in the release notes!</p>
  449. <p>For example, a fix in PR #1234 would have its changelog entry in
  450. <code>changelog.d/1234.bugfix</code>, and contain content like:</p>
  451. <blockquote>
  452. <p>The security levels of Florbs are now validated when received
  453. via the <code>/federation/florb</code> endpoint. Contributed by Jane Matrix.</p>
  454. </blockquote>
  455. <p>If there are multiple pull requests involved in a single bugfix/feature/etc,
  456. then the content for each <code>changelog.d</code> file should be the same. Towncrier will
  457. merge the matching files together into a single changelog entry when we come to
  458. release.</p>
  459. <h3 id="how-do-i-know-what-to-call-the-changelog-file-before-i-create-the-pr"><a class="header" href="#how-do-i-know-what-to-call-the-changelog-file-before-i-create-the-pr">How do I know what to call the changelog file before I create the PR?</a></h3>
  460. <p>Obviously, you don't know if you should call your newsfile
  461. <code>1234.bugfix</code> or <code>5678.bugfix</code> until you create the PR, which leads to a
  462. chicken-and-egg problem.</p>
  463. <p>There are two options for solving this:</p>
  464. <ol>
  465. <li>
  466. <p>Open the PR without a changelog file, see what number you got, and <em>then</em>
  467. add the changelog file to your branch, or:</p>
  468. </li>
  469. <li>
  470. <p>Look at the <a href="https://github.com/matrix-org/synapse/issues?q=">list of all
  471. issues/PRs</a>, add one to the
  472. highest number you see, and quickly open the PR before somebody else claims
  473. your number.</p>
  474. <p><a href="https://github.com/richvdh/scripts/blob/master/next_github_number.sh">This
  475. script</a>
  476. might be helpful if you find yourself doing this a lot.</p>
  477. </li>
  478. </ol>
  479. <p>Sorry, we know it's a bit fiddly, but it's <em>really</em> helpful for us when we come
  480. to put together a release!</p>
  481. <h3 id="debian-changelog"><a class="header" href="#debian-changelog">Debian changelog</a></h3>
  482. <p>Changes which affect the debian packaging files (in <code>debian</code>) are an
  483. exception to the rule that all changes require a <code>changelog.d</code> file.</p>
  484. <p>In this case, you will need to add an entry to the debian changelog for the
  485. next release. For this, run the following command:</p>
  486. <pre><code>dch
  487. </code></pre>
  488. <p>This will make up a new version number (if there isn't already an unreleased
  489. version in flight), and open an editor where you can add a new changelog entry.
  490. (Our release process will ensure that the version number and maintainer name is
  491. corrected for the release.)</p>
  492. <p>If your change affects both the debian packaging <em>and</em> files outside the debian
  493. directory, you will need both a regular newsfragment <em>and</em> an entry in the
  494. debian changelog. (Though typically such changes should be submitted as two
  495. separate pull requests.)</p>
  496. <h2 id="sign-off"><a class="header" href="#sign-off">Sign off</a></h2>
  497. <p>In order to have a concrete record that your contribution is intentional
  498. and you agree to license it under the same terms as the project's license, we've adopted the
  499. same lightweight approach that the Linux Kernel
  500. <a href="https://www.kernel.org/doc/html/latest/process/submitting-patches.html#sign-your-work-the-developer-s-certificate-of-origin%3E">submitting patches process</a>,
  501. <a href="https://github.com/docker/docker/blob/master/CONTRIBUTING.md">Docker</a>, and many other
  502. projects use: the DCO (<a href="http://developercertificate.org/">Developer Certificate of Origin</a>).
  503. This is a simple declaration that you wrote
  504. the contribution or otherwise have the right to contribute it to Matrix:</p>
  505. <pre><code>Developer Certificate of Origin
  506. Version 1.1
  507. Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
  508. 660 York Street, Suite 102,
  509. San Francisco, CA 94110 USA
  510. Everyone is permitted to copy and distribute verbatim copies of this
  511. license document, but changing it is not allowed.
  512. Developer's Certificate of Origin 1.1
  513. By making a contribution to this project, I certify that:
  514. (a) The contribution was created in whole or in part by me and I
  515. have the right to submit it under the open source license
  516. indicated in the file; or
  517. (b) The contribution is based upon previous work that, to the best
  518. of my knowledge, is covered under an appropriate open source
  519. license and I have the right under that license to submit that
  520. work with modifications, whether created in whole or in part
  521. by me, under the same open source license (unless I am
  522. permitted to submit under a different license), as indicated
  523. in the file; or
  524. (c) The contribution was provided directly to me by some other
  525. person who certified (a), (b) or (c) and I have not modified
  526. it.
  527. (d) I understand and agree that this project and the contribution
  528. are public and that a record of the contribution (including all
  529. personal information I submit with it, including my sign-off) is
  530. maintained indefinitely and may be redistributed consistent with
  531. this project or the open source license(s) involved.
  532. </code></pre>
  533. <p>If you agree to this for your contribution, then all that's needed is to
  534. include the line in your commit or pull request comment:</p>
  535. <pre><code>Signed-off-by: Your Name &lt;your@email.example.org&gt;
  536. </code></pre>
  537. <p>We accept contributions under a legally identifiable name, such as
  538. your name on government documentation or common-law names (names
  539. claimed by legitimate usage or repute). Unfortunately, we cannot
  540. accept anonymous contributions at this time.</p>
  541. <p>Git allows you to add this signoff automatically when using the <code>-s</code>
  542. flag to <code>git commit</code>, which uses the name and email set in your
  543. <code>user.name</code> and <code>user.email</code> git configs.</p>
  544. <h3 id="private-sign-off"><a class="header" href="#private-sign-off">Private Sign off</a></h3>
  545. <p>If you would like to provide your legal name privately to the Matrix.org
  546. Foundation (instead of in a public commit or comment), you can do so
  547. by emailing your legal name and a link to the pull request to
  548. <a href="mailto:dco@matrix.org?subject=Private%20sign%20off">dco@matrix.org</a>.
  549. It helps to include &quot;sign off&quot; or similar in the subject line. You will then
  550. be instructed further.</p>
  551. <p>Once private sign off is complete, doing so for future contributions will not
  552. be required.</p>
  553. <h1 id="10-turn-feedback-into-better-code"><a class="header" href="#10-turn-feedback-into-better-code">10. Turn feedback into better code.</a></h1>
  554. <p>Once the Pull Request is opened, you will see a few things:</p>
  555. <ol>
  556. <li>our automated CI (Continuous Integration) pipeline will run (again) the linters, the unit tests, the integration tests and more;</li>
  557. <li>one or more of the developers will take a look at your Pull Request and offer feedback.</li>
  558. </ol>
  559. <p>From this point, you should:</p>
  560. <ol>
  561. <li>Look at the results of the CI pipeline.
  562. <ul>
  563. <li>If there is any error, fix the error.</li>
  564. </ul>
  565. </li>
  566. <li>If a developer has requested changes, make these changes and let us know if it is ready for a developer to review again.
  567. <ul>
  568. <li>A pull request is a conversation, if you disagree with the suggestions, please respond and discuss it.</li>
  569. </ul>
  570. </li>
  571. <li>Create a new commit with the changes.
  572. <ul>
  573. <li>Please do NOT overwrite the history. New commits make the reviewer's life easier.</li>
  574. <li>Push this commits to your Pull Request.</li>
  575. </ul>
  576. </li>
  577. <li>Back to 1.</li>
  578. <li>Once the pull request is ready for review again please re-request review from whichever developer did your initial
  579. review (or leave a comment in the pull request that you believe all required changes have been done).</li>
  580. </ol>
  581. <p>Once both the CI and the developers are happy, the patch will be merged into Synapse and released shortly!</p>
  582. <h1 id="11-find-a-new-issue"><a class="header" href="#11-find-a-new-issue">11. Find a new issue.</a></h1>
  583. <p>By now, you know the drill!</p>
  584. <h1 id="notes-for-maintainers-on-merging-prs-etc"><a class="header" href="#notes-for-maintainers-on-merging-prs-etc">Notes for maintainers on merging PRs etc</a></h1>
  585. <p>There are some notes for those with commit access to the project on how we
  586. manage git <a href="git.html">here</a>.</p>
  587. <h1 id="conclusion"><a class="header" href="#conclusion">Conclusion</a></h1>
  588. <p>That's it! Matrix is a very open and collaborative project as you might expect
  589. given our obsession with open communication. If we're going to successfully
  590. matrix together all the fragmented communication technologies out there we are
  591. reliant on contributions and collaboration from the community to do so. So
  592. please get involved - and we hope you have as much fun hacking on Matrix as we
  593. do!</p>
  594. </main>
  595. <nav class="nav-wrapper" aria-label="Page navigation">
  596. <!-- Mobile navigation buttons -->
  597. <a rel="prev" href="../usage/administration/admin_faq.html" class="mobile-nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
  598. <i class="fa fa-angle-left"></i>
  599. </a>
  600. <a rel="next" href="../code_style.html" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
  601. <i class="fa fa-angle-right"></i>
  602. </a>
  603. <div style="clear: both"></div>
  604. </nav>
  605. </div>
  606. </div>
  607. <nav class="nav-wide-wrapper" aria-label="Page navigation">
  608. <a rel="prev" href="../usage/administration/admin_faq.html" class="nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
  609. <i class="fa fa-angle-left"></i>
  610. </a>
  611. <a rel="next" href="../code_style.html" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
  612. <i class="fa fa-angle-right"></i>
  613. </a>
  614. </nav>
  615. </div>
  616. <script type="text/javascript">
  617. window.playground_copyable = true;
  618. </script>
  619. <script src="../elasticlunr.min.js" type="text/javascript" charset="utf-8"></script>
  620. <script src="../mark.min.js" type="text/javascript" charset="utf-8"></script>
  621. <script src="../searcher.js" type="text/javascript" charset="utf-8"></script>
  622. <script src="../clipboard.min.js" type="text/javascript" charset="utf-8"></script>
  623. <script src="../highlight.js" type="text/javascript" charset="utf-8"></script>
  624. <script src="../book.js" type="text/javascript" charset="utf-8"></script>
  625. <!-- Custom JS scripts -->
  626. <script type="text/javascript" src="../docs/website_files/table-of-contents.js"></script>
  627. <script type="text/javascript" src="../docs/website_files/version-picker.js"></script>
  628. <script type="text/javascript" src="../docs/website_files/version.js"></script>
  629. </body>
  630. </html>