meta data for this page
  •  
Translations of this page:
  • en

**This is an old revision of the document!**

Matrix Synapse Miscellaneous

Different things, sometimes advanced and some things that just did not fit in the regular guide.

.well-known section

Mathijs
it's a little early, but you could also add a section about .well-known which just means you have nginx serve a json file on example.com/.well-known/matrix/client I did it for apache, but it's probably fairly easy for nginx as well

Mathijs
https://matrix.org/docs/spec/client_server/r0.4.0.html#server-discovery if you like reading spec :)

Add an SRV Record

To use the domain matrix.example.com and still just use @user:example.com instead of @user:matrix.example.com we need to set up an SRV record. At first an A (possibly AAAA) record is needed for matrix.example.com.

After the A record is set up, create a SRV Record that looks like

_matrix._tcp.<yourdomain.com> <ttl> IN SRV 10 0 <port> <synapse.server.name>

So, for example use

_matrix._tcp.example.com. 3600 IN SRV 10 0 8448 synapse.example.com.

and when creating the Synapse server use example.com for the servername.

Stefan

So, when I'm using the domain matrix.example.com and want to use exmpale.com for the registration and so on, i should use SRV. If i'm using example.com and making the redirect with nginx, there is no need for a SRV record?

kythyria

The SRV record is how other servers find your server (and putting matrix federation behind a reverse proxy is a bit fragile)

Mathijs the relevant url is where the federated servers can connect to you

kythyria

It's so your server_name (what's in MXIDs) doesn't have to be the hostname of the machine synapse is running on.

Optional Adminshell

If you forgot to write sudo and don't want to rewrite the whole command, just type sudo !! to execute the last command with sudo rights.

There is another way but you should not work like that all the time because its not secure. There is a reason you have to write sudo for a lot of commands. For an initial server setup you may have to type a lot of commands, to avoid typing sudo * all the time, it is possible to type in sudo su. This opens a admin-shell and you should be able to work without typing sudo in. Keep in mind, exit after step 8 and don't use sudo su when you just have to type in some commands.

Synpase maintenance tools

Change listener port

Now check if the HTTP and HTTPS listener port '8008' and '8448' are bound to the local IP address 0.0.0.0 (and not to 127.0.0.1.

sudo nano /etc/matrix-synapse/homeserver.yaml
    port: 8448
    bind_addresses:
      - '0.0.0.0'

    - port: 8008
    bind_addresses: ['127.0.0.1']

Installing Bots

Matrix Synapse currently does not have a concept of bots, a bot is just a normal user. Usally there is a config and a .py file, download the files, unpack them and run the .py file. Running and downloading things via pip is not recommended.

Install python3

sudo apt install python3

then install pip

sudo apt install python3-pip

then matrix-bot-api from pyp

pip3 install matrix-bot-api

and finally fill out the config and start it

python3 pollbot.py