README.rst 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635
  1. .. contents::
  2. Introduction
  3. ============
  4. Matrix is an ambitious new ecosystem for open federated Instant Messaging and
  5. VoIP. The basics you need to know to get up and running are:
  6. - Everything in Matrix happens in a room. Rooms are distributed and do not
  7. exist on any single server. Rooms can be located using convenience aliases
  8. like ``#matrix:matrix.org`` or ``#test:localhost:8448``.
  9. - Matrix user IDs look like ``@matthew:matrix.org`` (although in the future
  10. you will normally refer to yourself and others using a 3PID: email
  11. address, phone number, etc rather than manipulating Matrix user IDs)
  12. The overall architecture is::
  13. client <----> homeserver <=====================> homeserver <----> client
  14. https://somewhere.org/_matrix https://elsewhere.net/_matrix
  15. ``#matrix:matrix.org`` is the official support room for Matrix, and can be
  16. accessed by any client from https://matrix.org/blog/try-matrix-now or via IRC
  17. bridge at irc://irc.freenode.net/matrix.
  18. Synapse is currently in rapid development, but as of version 0.5 we believe it
  19. is sufficiently stable to be run as an internet-facing service for real usage!
  20. About Matrix
  21. ============
  22. Matrix specifies a set of pragmatic RESTful HTTP JSON APIs as an open standard,
  23. which handle:
  24. - Creating and managing fully distributed chat rooms with no
  25. single points of control or failure
  26. - Eventually-consistent cryptographically secure synchronisation of room
  27. state across a global open network of federated servers and services
  28. - Sending and receiving extensible messages in a room with (optional)
  29. end-to-end encryption[1]
  30. - Inviting, joining, leaving, kicking, banning room members
  31. - Managing user accounts (registration, login, logout)
  32. - Using 3rd Party IDs (3PIDs) such as email addresses, phone numbers,
  33. Facebook accounts to authenticate, identify and discover users on Matrix.
  34. - Placing 1:1 VoIP and Video calls
  35. These APIs are intended to be implemented on a wide range of servers, services
  36. and clients, letting developers build messaging and VoIP functionality on top
  37. of the entirely open Matrix ecosystem rather than using closed or proprietary
  38. solutions. The hope is for Matrix to act as the building blocks for a new
  39. generation of fully open and interoperable messaging and VoIP apps for the
  40. internet.
  41. Synapse is a reference "homeserver" implementation of Matrix from the core
  42. development team at matrix.org, written in Python/Twisted for clarity and
  43. simplicity. It is intended to showcase the concept of Matrix and let folks see
  44. the spec in the context of a codebase and let you run your own homeserver and
  45. generally help bootstrap the ecosystem.
  46. In Matrix, every user runs one or more Matrix clients, which connect through to
  47. a Matrix homeserver. The homeserver stores all their personal chat history and
  48. user account information - much as a mail client connects through to an
  49. IMAP/SMTP server. Just like email, you can either run your own Matrix
  50. homeserver and control and own your own communications and history or use one
  51. hosted by someone else (e.g. matrix.org) - there is no single point of control
  52. or mandatory service provider in Matrix, unlike WhatsApp, Facebook, Hangouts,
  53. etc.
  54. Synapse ships with two basic demo Matrix clients: webclient (a basic group chat
  55. web client demo implemented in AngularJS) and cmdclient (a basic Python
  56. command line utility which lets you easily see what the JSON APIs are up to).
  57. Meanwhile, iOS and Android SDKs and clients are available from:
  58. - https://github.com/matrix-org/matrix-ios-sdk
  59. - https://github.com/matrix-org/matrix-ios-kit
  60. - https://github.com/matrix-org/matrix-ios-console
  61. - https://github.com/matrix-org/matrix-android-sdk
  62. We'd like to invite you to join #matrix:matrix.org (via
  63. https://matrix.org/blog/try-matrix-now), run a homeserver, take a look at the
  64. Matrix spec at https://matrix.org/docs/spec and API docs at
  65. https://matrix.org/docs/api, experiment with the APIs and the demo clients, and
  66. report any bugs via https://matrix.org/jira.
  67. Thanks for using Matrix!
  68. [1] End-to-end encryption is currently in development - see https://matrix.org/git/olm
  69. Synapse Installation
  70. ====================
  71. Synapse is the reference python/twisted Matrix homeserver implementation.
  72. System requirements:
  73. - POSIX-compliant system (tested on Linux & OS X)
  74. - Python 2.7
  75. - At least 512 MB RAM.
  76. Synapse is written in python but some of the libraries is uses are written in
  77. C. So before we can install synapse itself we need a working C compiler and the
  78. header files for python C extensions.
  79. Installing prerequisites on Ubuntu or Debian::
  80. sudo apt-get install build-essential python2.7-dev libffi-dev \
  81. python-pip python-setuptools sqlite3 \
  82. libssl-dev python-virtualenv libjpeg-dev libxslt1-dev
  83. Installing prerequisites on ArchLinux::
  84. sudo pacman -S base-devel python2 python-pip \
  85. python-setuptools python-virtualenv sqlite3
  86. Installing prerequisites on CentOS 7::
  87. sudo yum install libtiff-devel libjpeg-devel libzip-devel freetype-devel \
  88. lcms2-devel libwebp-devel tcl-devel tk-devel \
  89. python-virtualenv libffi-devel openssl-devel
  90. sudo yum groupinstall "Development Tools"
  91. Installing prerequisites on Mac OS X::
  92. xcode-select --install
  93. sudo easy_install pip
  94. sudo pip install virtualenv
  95. Installing prerequisites on Raspbian::
  96. sudo apt-get install build-essential python2.7-dev libffi-dev \
  97. python-pip python-setuptools sqlite3 \
  98. libssl-dev python-virtualenv libjpeg-dev
  99. sudo pip install --upgrade pip
  100. sudo pip install --upgrade ndg-httpsclient
  101. sudo pip install --upgrade virtualenv
  102. To install the synapse homeserver run::
  103. virtualenv -p python2.7 ~/.synapse
  104. source ~/.synapse/bin/activate
  105. pip install --upgrade setuptools
  106. pip install https://github.com/matrix-org/synapse/tarball/master
  107. This installs synapse, along with the libraries it uses, into a virtual
  108. environment under ``~/.synapse``. Feel free to pick a different directory
  109. if you prefer.
  110. In case of problems, please see the _Troubleshooting section below.
  111. Alternatively, Silvio Fricke has contributed a Dockerfile to automate the
  112. above in Docker at https://registry.hub.docker.com/u/silviof/docker-matrix/.
  113. Also, Martin Giess has created an auto-deployment process with vagrant/ansible,
  114. tested with VirtualBox/AWS/DigitalOcean - see https://github.com/EMnify/matrix-synapse-auto-deploy
  115. for details.
  116. To set up your homeserver, run (in your virtualenv, as before)::
  117. cd ~/.synapse
  118. python -m synapse.app.homeserver \
  119. --server-name machine.my.domain.name \
  120. --config-path homeserver.yaml \
  121. --generate-config \
  122. --report-stats=[yes|no]
  123. ...substituting your host and domain name as appropriate.
  124. This will generate you a config file that you can then customise, but it will
  125. also generate a set of keys for you. These keys will allow your Home Server to
  126. identify itself to other Home Servers, so don't lose or delete them. It would be
  127. wise to back them up somewhere safe. If, for whatever reason, you do need to
  128. change your Home Server's keys, you may find that other Home Servers have the
  129. old key cached. If you update the signing key, you should change the name of the
  130. key in the <server name>.signing.key file (the second word) to something different.
  131. By default, registration of new users is disabled. You can either enable
  132. registration in the config by specifying ``enable_registration: true``
  133. (it is then recommended to also set up CAPTCHA - see docs/CAPTCHA_SETUP), or
  134. you can use the command line to register new users::
  135. $ source ~/.synapse/bin/activate
  136. $ synctl start # if not already running
  137. $ register_new_matrix_user -c homeserver.yaml https://localhost:8448
  138. New user localpart: erikj
  139. Password:
  140. Confirm password:
  141. Success!
  142. For reliable VoIP calls to be routed via this homeserver, you MUST configure
  143. a TURN server. See docs/turn-howto.rst for details.
  144. Running Synapse
  145. ===============
  146. To actually run your new homeserver, pick a working directory for Synapse to
  147. run (e.g. ``~/.synapse``), and::
  148. cd ~/.synapse
  149. source ./bin/activate
  150. synctl start
  151. Using PostgreSQL
  152. ================
  153. As of Synapse 0.9, `PostgreSQL <http://www.postgresql.org>`_ is supported as an
  154. alternative to the `SQLite <http://sqlite.org/>`_ database that Synapse has
  155. traditionally used for convenience and simplicity.
  156. The advantages of Postgres include:
  157. * significant performance improvements due to the superior threading and
  158. caching model, smarter query optimiser
  159. * allowing the DB to be run on separate hardware
  160. * allowing basic active/backup high-availability with a "hot spare" synapse
  161. pointing at the same DB master, as well as enabling DB replication in
  162. synapse itself.
  163. The only disadvantage is that the code is relatively new as of April 2015 and
  164. may have a few regressions relative to SQLite.
  165. For information on how to install and use PostgreSQL, please see
  166. `docs/postgres.rst <docs/postgres.rst>`_.
  167. Platform Specific Instructions
  168. ==============================
  169. Debian
  170. ------
  171. Matrix provides official Debian packages via apt from http://matrix.org/packages/debian/.
  172. Note that these packages do not include a client - choose one from
  173. https://matrix.org/blog/try-matrix-now/ (or build your own with one of our SDKs :)
  174. Fedora
  175. ------
  176. Oleg Girko provides Fedora RPMs at
  177. https://obs.infoserver.lv/project/monitor/matrix-synapse
  178. ArchLinux
  179. ---------
  180. The quickest way to get up and running with ArchLinux is probably with Ivan
  181. Shapovalov's AUR package from
  182. https://aur.archlinux.org/packages/matrix-synapse/, which should pull in all
  183. the necessary dependencies.
  184. Alternatively, to install using pip a few changes may be needed as ArchLinux
  185. defaults to python 3, but synapse currently assumes python 2.7 by default:
  186. pip may be outdated (6.0.7-1 and needs to be upgraded to 6.0.8-1 )::
  187. sudo pip2.7 install --upgrade pip
  188. You also may need to explicitly specify python 2.7 again during the install
  189. request::
  190. pip2.7 install https://github.com/matrix-org/synapse/tarball/master
  191. If you encounter an error with lib bcrypt causing an Wrong ELF Class:
  192. ELFCLASS32 (x64 Systems), you may need to reinstall py-bcrypt to correctly
  193. compile it under the right architecture. (This should not be needed if
  194. installing under virtualenv)::
  195. sudo pip2.7 uninstall py-bcrypt
  196. sudo pip2.7 install py-bcrypt
  197. During setup of Synapse you need to call python2.7 directly again::
  198. cd ~/.synapse
  199. python2.7 -m synapse.app.homeserver \
  200. --server-name machine.my.domain.name \
  201. --config-path homeserver.yaml \
  202. --generate-config
  203. ...substituting your host and domain name as appropriate.
  204. FreeBSD
  205. -------
  206. Synapse can be installed via FreeBSD Ports or Packages contributed by Brendan Molloy from:
  207. - Ports: ``cd /usr/ports/net/py-matrix-synapse && make install clean``
  208. - Packages: ``pkg install py27-matrix-synapse``
  209. NixOS
  210. -----
  211. Robin Lambertz has packaged Synapse for NixOS at:
  212. https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/misc/matrix-synapse.nix
  213. Windows Install
  214. ---------------
  215. Synapse can be installed on Cygwin. It requires the following Cygwin packages:
  216. - gcc
  217. - git
  218. - libffi-devel
  219. - openssl (and openssl-devel, python-openssl)
  220. - python
  221. - python-setuptools
  222. The content repository requires additional packages and will be unable to process
  223. uploads without them:
  224. - libjpeg8
  225. - libjpeg8-devel
  226. - zlib
  227. If you choose to install Synapse without these packages, you will need to reinstall
  228. ``pillow`` for changes to be applied, e.g. ``pip uninstall pillow`` ``pip install
  229. pillow --user``
  230. Troubleshooting:
  231. - You may need to upgrade ``setuptools`` to get this to work correctly:
  232. ``pip install setuptools --upgrade``.
  233. - You may encounter errors indicating that ``ffi.h`` is missing, even with
  234. ``libffi-devel`` installed. If you do, copy the ``.h`` files:
  235. ``cp /usr/lib/libffi-3.0.13/include/*.h /usr/include``
  236. - You may need to install libsodium from source in order to install PyNacl. If
  237. you do, you may need to create a symlink to ``libsodium.a`` so ``ld`` can find
  238. it: ``ln -s /usr/local/lib/libsodium.a /usr/lib/libsodium.a``
  239. Troubleshooting
  240. ===============
  241. Troubleshooting Installation
  242. ----------------------------
  243. Synapse requires pip 1.7 or later, so if your OS provides too old a version you
  244. may need to manually upgrade it::
  245. sudo pip install --upgrade pip
  246. Installing may fail with ``Could not find any downloads that satisfy the requirement pymacaroons-pynacl (from matrix-synapse==0.12.0)``.
  247. You can fix this by manually upgrading pip and virtualenv::
  248. sudo pip install --upgrade virtualenv
  249. You can next rerun ``virtualenv -p python2.7 synapse`` to update the virtual env.
  250. Installing may fail during installing virtualenv with ``InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.``
  251. You can fix this by manually installing ndg-httpsclient::
  252. pip install --upgrade ndg-httpsclient
  253. Installing may fail with ``mock requires setuptools>=17.1. Aborting installation``.
  254. You can fix this by upgrading setuptools::
  255. pip install --upgrade setuptools
  256. If pip crashes mid-installation for reason (e.g. lost terminal), pip may
  257. refuse to run until you remove the temporary installation directory it
  258. created. To reset the installation::
  259. rm -rf /tmp/pip_install_matrix
  260. pip seems to leak *lots* of memory during installation. For instance, a Linux
  261. host with 512MB of RAM may run out of memory whilst installing Twisted. If this
  262. happens, you will have to individually install the dependencies which are
  263. failing, e.g.::
  264. pip install twisted
  265. On OS X, if you encounter clang: error: unknown argument: '-mno-fused-madd' you
  266. will need to export CFLAGS=-Qunused-arguments.
  267. Troubleshooting Running
  268. -----------------------
  269. If synapse fails with ``missing "sodium.h"`` crypto errors, you may need
  270. to manually upgrade PyNaCL, as synapse uses NaCl (http://nacl.cr.yp.to/) for
  271. encryption and digital signatures.
  272. Unfortunately PyNACL currently has a few issues
  273. (https://github.com/pyca/pynacl/issues/53) and
  274. (https://github.com/pyca/pynacl/issues/79) that mean it may not install
  275. correctly, causing all tests to fail with errors about missing "sodium.h". To
  276. fix try re-installing from PyPI or directly from
  277. (https://github.com/pyca/pynacl)::
  278. # Install from PyPI
  279. pip install --user --upgrade --force pynacl
  280. # Install from github
  281. pip install --user https://github.com/pyca/pynacl/tarball/master
  282. ArchLinux
  283. ~~~~~~~~~
  284. If running `$ synctl start` fails with 'returned non-zero exit status 1',
  285. you will need to explicitly call Python2.7 - either running as::
  286. python2.7 -m synapse.app.homeserver --daemonize -c homeserver.yaml
  287. ...or by editing synctl with the correct python executable.
  288. Synapse Development
  289. ===================
  290. To check out a synapse for development, clone the git repo into a working
  291. directory of your choice::
  292. git clone https://github.com/matrix-org/synapse.git
  293. cd synapse
  294. Synapse has a number of external dependencies, that are easiest
  295. to install using pip and a virtualenv::
  296. virtualenv env
  297. source env/bin/activate
  298. python synapse/python_dependencies.py | xargs -n1 pip install
  299. pip install setuptools_trial mock
  300. This will run a process of downloading and installing all the needed
  301. dependencies into a virtual env.
  302. Once this is done, you may wish to run Synapse's unit tests, to
  303. check that everything is installed as it should be::
  304. python setup.py test
  305. This should end with a 'PASSED' result::
  306. Ran 143 tests in 0.601s
  307. PASSED (successes=143)
  308. Upgrading an existing Synapse
  309. =============================
  310. The instructions for upgrading synapse are in `UPGRADE.rst`_.
  311. Please check these instructions as upgrading may require extra steps for some
  312. versions of synapse.
  313. .. _UPGRADE.rst: UPGRADE.rst
  314. Setting up Federation
  315. =====================
  316. In order for other homeservers to send messages to your server, it will need to
  317. be publicly visible on the internet, and they will need to know its host name.
  318. You have two choices here, which will influence the form of your Matrix user
  319. IDs:
  320. 1) Use the machine's own hostname as available on public DNS in the form of
  321. its A or AAAA records. This is easier to set up initially, perhaps for
  322. testing, but lacks the flexibility of SRV.
  323. 2) Set up a SRV record for your domain name. This requires you create a SRV
  324. record in DNS, but gives the flexibility to run the server on your own
  325. choice of TCP port, on a machine that might not be the same name as the
  326. domain name.
  327. For the first form, simply pass the required hostname (of the machine) as the
  328. --server-name parameter::
  329. python -m synapse.app.homeserver \
  330. --server-name machine.my.domain.name \
  331. --config-path homeserver.yaml \
  332. --generate-config
  333. python -m synapse.app.homeserver --config-path homeserver.yaml
  334. Alternatively, you can run ``synctl start`` to guide you through the process.
  335. For the second form, first create your SRV record and publish it in DNS. This
  336. needs to be named _matrix._tcp.YOURDOMAIN, and point at at least one hostname
  337. and port where the server is running. (At the current time synapse does not
  338. support clustering multiple servers into a single logical homeserver). The DNS
  339. record would then look something like::
  340. $ dig -t srv _matrix._tcp.machine.my.domain.name
  341. _matrix._tcp IN SRV 10 0 8448 machine.my.domain.name.
  342. At this point, you should then run the homeserver with the hostname of this
  343. SRV record, as that is the name other machines will expect it to have::
  344. python -m synapse.app.homeserver \
  345. --server-name YOURDOMAIN \
  346. --config-path homeserver.yaml \
  347. --generate-config
  348. python -m synapse.app.homeserver --config-path homeserver.yaml
  349. If you've already generated the config file, you need to edit the "server_name"
  350. in you ```homeserver.yaml``` file. If you've already started Synapse and a
  351. database has been created, you will have to recreate the database.
  352. You may additionally want to pass one or more "-v" options, in order to
  353. increase the verbosity of logging output; at least for initial testing.
  354. Running a Demo Federation of Synapses
  355. -------------------------------------
  356. If you want to get up and running quickly with a trio of homeservers in a
  357. private federation (``localhost:8080``, ``localhost:8081`` and
  358. ``localhost:8082``) which you can then access through the webclient running at
  359. http://localhost:8080. Simply run::
  360. demo/start.sh
  361. This is mainly useful just for development purposes.
  362. Running The Demo Web Client
  363. ===========================
  364. The homeserver runs a web client by default at https://localhost:8448/.
  365. If this is the first time you have used the client from that browser (it uses
  366. HTML5 local storage to remember its config), you will need to log in to your
  367. account. If you don't yet have an account, because you've just started the
  368. homeserver for the first time, then you'll need to register one.
  369. Registering A New Account
  370. -------------------------
  371. Your new user name will be formed partly from the hostname your server is
  372. running as, and partly from a localpart you specify when you create the
  373. account. Your name will take the form of::
  374. @localpart:my.domain.here
  375. (pronounced "at localpart on my dot domain dot here")
  376. Specify your desired localpart in the topmost box of the "Register for an
  377. account" form, and click the "Register" button. Hostnames can contain ports if
  378. required due to lack of SRV records (e.g. @matthew:localhost:8448 on an
  379. internal synapse sandbox running on localhost).
  380. If registration fails, you may need to enable it in the homeserver (see
  381. `Synapse Installation`_ above)
  382. Logging In To An Existing Account
  383. ---------------------------------
  384. Just enter the ``@localpart:my.domain.here`` Matrix user ID and password into
  385. the form and click the Login button.
  386. Identity Servers
  387. ================
  388. The job of authenticating 3PIDs and tracking which 3PIDs are associated with a
  389. given Matrix user is very security-sensitive, as there is obvious risk of spam
  390. if it is too easy to sign up for Matrix accounts or harvest 3PID data.
  391. Meanwhile the job of publishing the end-to-end encryption public keys for
  392. Matrix users is also very security-sensitive for similar reasons.
  393. Therefore the role of managing trusted identity in the Matrix ecosystem is
  394. farmed out to a cluster of known trusted ecosystem partners, who run 'Matrix
  395. Identity Servers' such as ``sydent``, whose role is purely to authenticate and
  396. track 3PID logins and publish end-user public keys.
  397. It's currently early days for identity servers as Matrix is not yet using 3PIDs
  398. as the primary means of identity and E2E encryption is not complete. As such,
  399. we are running a single identity server (https://matrix.org) at the current
  400. time.
  401. URL Previews
  402. ============
  403. Synapse 0.15.0 introduces an experimental new API for previewing URLs at
  404. /_matrix/media/r0/preview_url. This is disabled by default. To turn it on
  405. you must enable the `url_preview_enabled: True` config parameter and explicitly
  406. specify the IP ranges that Synapse is not allowed to spider for previewing in
  407. the `url_preview_ip_range_blacklist` configuration parameter. This is critical
  408. from a security perspective to stop arbitrary Matrix users spidering 'internal'
  409. URLs on your network. At the very least we recommend that your loopback and
  410. RFC1918 IP addresses are blacklisted.
  411. This also requires the optional lxml and netaddr python dependencies to be
  412. installed.
  413. Password reset
  414. ==============
  415. If a user has registered an email address to their account using an identity
  416. server, they can request a password-reset token via clients such as Vector.
  417. A manual password reset can be done via direct database access as follows.
  418. First calculate the hash of the new password:
  419. $ source ~/.synapse/bin/activate
  420. $ ./scripts/hash_password
  421. Password:
  422. Confirm password:
  423. $2a$12$xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  424. Then update the `users` table in the database:
  425. UPDATE users SET password_hash='$2a$12$xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
  426. WHERE name='@test:test.com';
  427. Where's the spec?!
  428. ==================
  429. The source of the matrix spec lives at https://github.com/matrix-org/matrix-doc.
  430. A recent HTML snapshot of this lives at http://matrix.org/docs/spec
  431. Building Internal API Documentation
  432. ===================================
  433. Before building internal API documentation install sphinx and
  434. sphinxcontrib-napoleon::
  435. pip install sphinx
  436. pip install sphinxcontrib-napoleon
  437. Building internal API documentation::
  438. python setup.py build_sphinx
  439. Help!! Synapse eats all my RAM!
  440. ===============================
  441. Synapse's architecture is quite RAM hungry currently - we deliberately
  442. cache a lot of recent room data and metadata in RAM in order to speed up
  443. common requests. We'll improve this in future, but for now the easiest
  444. way to either reduce the RAM usage (at the risk of slowing things down)
  445. is to set the almost-undocumented ``SYNAPSE_CACHE_FACTOR`` environment
  446. variable. Roughly speaking, a SYNAPSE_CACHE_FACTOR of 1.0 will max out
  447. at around 3-4GB of resident memory - this is what we currently run the
  448. matrix.org on. The default setting is currently 0.1, which is probably
  449. around a ~700MB footprint. You can dial it down further to 0.02 if
  450. desired, which targets roughly ~512MB. Conversely you can dial it up if
  451. you need performance for lots of users and have a box with a lot of RAM.