File README.SUSE of Package matrix-synapse
Before you can start matrix-synapse you must generate and the config homeserver.yaml.
After that you must review this file and customise it to your needs.
You can do this by the commands below
or you can do most of it through the script matrix-synapse-init.
The script will generate config, fix some paths in it and let you
insert the first user.
Then you can change some things in homeserver.yaml to connect to federation.
To join federation do following things:
a) Comment out the bind listeners:
- port: 8448
type: http
tls: true
resources:
- name: [client, federation]
Attention: It can rise up parse errors on restart.
Best you delete all blanks in front of.
b) Comment out and insert your certs and path.
i) In /etc/matrix-synapse/homeserver.yaml:
tls_certificate_path: "/etc/certbot/live/matrix.example.com/fullchain.pem"
tls_private_key_path: "/etc/certbot/live/matrix.example.com/privkey.pem"
or use internal acme tls from synapse.
Attention: If you use certbot, ensure that synapse user can read the certs.
- Generate group certbot
- Change group for /etc/certbot/live/matrix.example.com/*.pem
to certbot.
- Change rights for group to rw.
- Add sysnapse to group certbot.
ii) in /etc/apache2/vhost.d/matrix-synapse.conf
SSLCertificateFile
SSLCertificateKeyFile
SSLCertificateChainFile
iii) in /srv/www/htdocs/.well-known/matrix/server
You must change your server name
Then restart apache2 with systemctl restart apache2.
Now you can check federation with federation-tester:
https://matrix.org/federationtester
Generate config
---------------
cd /var/lib/matrix-synapse
sudo -u synapse python<2|3> -m synapse.app.homeserver --server-name <my.domain.name> --config-path /etc/matrix-synapse/homeserver.yaml --generate-config --report-stats=<yes|no>
Register new user
-----------------
without federation:
sudo -u synapse register_new_matrix_user -c /etc/matrix-synapse/homeserver.yaml http://127.0.0.1:8008
with federation:
sudo -u synapse register_new_matrix_user -c /etc/matrix-synapse/homeserver.yaml https://matrix.example.com
Use own turnserver
------------------
Install corturn and read README.SUSE under /usr/share/doc/packages/coturn.
Information
===========
If you had migrated to postgresql and have now errors with device_list in logfile,
then you can execute following on DB (See: https://github.com/matrix-org/synapse/issues/4877):
CREATE INDEX access_tokens_device_id ON public.access_tokens USING btree (user_id, device_id);
CREATE INDEX current_state_events_member_index ON public.current_state_events USING btree (state_key) WHERE (type = 'm.room.member'::text);
DROP INDEX device_inbox_stream_id;
CREATE INDEX device_inbox_stream_id_user_id ON public.device_inbox USING btree (stream_id, user_id);
CREATE UNIQUE INDEX device_lists_remote_cache_unique_id ON public.device_lists_remote_cache USING btree (user_id, device_id);
CREATE UNIQUE INDEX device_lists_remote_extremeties_unique_idx ON public.device_lists_remote_extremeties USING btree (user_id);
CREATE INDEX device_lists_stream_user_id ON public.device_lists_stream USING btree (user_id, device_id);
CREATE INDEX event_contains_url_index ON public.events USING btree (room_id, topological_ordering, stream_ordering) WHERE ((contains_url = true) AND (outlier = false));
CREATE INDEX event_push_actions_highlights_index ON public.event_push_actions USING btree (user_id, room_id, topological_ordering, stream_ordering) WHERE (highlight = 1);
CREATE INDEX event_push_actions_u_highlight ON public.event_push_actions USING btree (user_id, stream_ordering);
CREATE UNIQUE INDEX event_search_event_id_idx ON public.event_search USING btree (event_id);
CREATE INDEX event_to_state_groups_sg_index ON public.event_to_state_groups USING btree (state_group);
CREATE INDEX local_media_repository_url_idx ON public.local_media_repository USING btree (created_ts) WHERE (url_cache IS NOT NULL);
DROP INDEX state_groups_state_id;
CREATE INDEX state_groups_state_type_idx ON public.state_groups_state USING btree (state_group, type, state_key);
CREATE INDEX user_ips_device_id ON public.user_ips USING btree (user_id, device_id, last_seen);
CREATE INDEX user_ips_last_seen ON public.user_ips USING btree (user_id, last_seen);
CREATE INDEX user_ips_last_seen_only ON public.user_ips USING btree (last_seen);
DROP INDEX user_ips_user_ip;
CREATE UNIQUE INDEX user_ips_user_token_ip_unique_index ON public.user_ips USING btree (user_id, access_token, ip);
CREATE INDEX users_creation_ts ON public.users USING btree (creation_ts);
Help!! Synapse eats all my RAM!
-------------------------------
Synapse's architecture is quite RAM hungry currently - we deliberately cache a lot of recent room data and metadata in RAM
in order to speed up common requests. We'll improve this in the future, but for now the easiest way to either reduce the RAM
usage (at the risk of slowing things down) is to set the almost-undocumented SYNAPSE_CACHE_FACTOR environment variable.
The default is 0.1, which can be decreased to reduce RAM usage in memory constrained enviroments,
or increased if performance starts to degrade.
Using libjemalloc can also yield a significant improvement in overall amount, and especially in terms of giving back RAM
to the OS. To use it, the library must simply be put in the LD_PRELOAD environment variable when launching Synapse.
Uncomment the line LD_PRELOAD=/usr/lib64/libjemalloc.so.2 in /etc/default/matrix-synapse.