Matrix: Difference between revisions

From Alpine Linux
(Added upstream link to reverse proxy configuration examples)
 
(3 intermediate revisions by one other user not shown)
Line 33: Line 33:


You will want to refer to the [https://element-hq.github.io/synapse/latest/usage/configuration/config_documentation.html Matrix Synapse Configuration Manual] to configure the various options.
You will want to refer to the [https://element-hq.github.io/synapse/latest/usage/configuration/config_documentation.html Matrix Synapse Configuration Manual] to configure the various options.
Make sure the synapse user can read/edit the configuration directory:
{{Cmd| chown -R synapse:synapse/etc/synapse}}


If you want your Matrix Synapse server to be accessed over the internet, then it is highly recommended to configure a [https://element-hq.github.io/synapse/latest/reverse_proxy.html reverse proxy] to do that. You are free to choose your reverse proxy of choice, as [https://element-hq.github.io/synapse/latest/reverse_proxy.html#reverse-proxy-configuration-examples the Matrix Synapse documentation has examples] for each one. I prefer [[nginx]], as I am familiar with it. Please make the best reverse proxy choice of one that you are familiar with, or that you want to learn more about.
Add synapse to the default runlevel to have it started at boot:
{{Cmd| rc-update add synapse}}
 
=== Reverse Proxy ===
 
If you want your Matrix Synapse server to be accessed over the internet, then it is highly recommended to configure a [https://element-hq.github.io/synapse/latest/reverse_proxy.html reverse proxy] to do that. One advantage of doing this is that you can expose the default HTTPS port (443) to Matrix clients [https://github.com/element-hq/synapse?tab=readme-ov-file#using-a-reverse-proxy-with-synapse without needing to run Synapse with root privileges].
 
The Matrix developers have provided [https://element-hq.github.io/synapse/latest/reverse_proxy.html#reverse-proxy-configuration-examples very good documentation with reverse proxy examples]. I prefer [[Nginx]], as I am most familiar with it, but you can also choose [[Apache]], [[Caddy]], or [[HAProxy]] to have in front of Synapse.


=== Database ===
=== Database ===


Once synapse is installed, you will need to select which database to use with it. By default, Synapse uses a SQLite database, which is only acceptable for testing purposes & should not be used a production environment.
Once synapse is installed, you will need to select which database to use with it. By default, Synapse uses a SQLite database, which is only acceptable for testing purposes & should not be used in a production environment.


The Matrix Synapse developers recommend using PostgresSQL as your database backend. For more details on installing PostgresSQL, refer to the [[Postgresql|PostgreSQL article]]. It is recommended that you install the latest PostgreSQL release available, which at this time is PostgreSQL 16.
The Matrix Synapse developers recommend using PostgresSQL as your database backend. For more details on installing PostgresSQL, refer to the [[Postgresql|PostgreSQL article]]. It is recommended that you install the latest PostgreSQL release available, which at this time is PostgreSQL 16.


== See also ==
== See also ==

Latest revision as of 18:09, 3 October 2024

Matrix is an ambitious new ecosystem and protocol for open federated instant messaging and VoIP. It consists of servers, various clients and bridge software to connect to existing messaging solutions such as IRC (Internet Relay Chat).

The Alpine Linux IRC chatrooms are bridged to Matrix. The General Alpine Linux room can be found on Matrix here #_oftc_#alpine-linux:matrix.org. If you want to access any of the other Alpine Linux chats from Matrix, then substitute the IRC channel name accordingly.

Installation

The Matrix Protocol has multiple server implementations which are available on Alpine Linux.

The reference server implementation Synapse, which is the most commonly used server, is available as the synapse package. It has been available since Alpine 3.11.

There is also a second-generation Matrix homeserver written in Go, which is available as the dendrite package. It intends to provide an efficient, reliable and scalable alternative to Synapse, but it is not as feature complete as Synapse is at this time. It has been available since Alpine 3.15.

There is also another Matrix homeserver, written in Rust, which is available as the conduit package and is only currently available in the Alpine Edge at this time.

Before you start installing anything, make sure you have the latest packages available.

Tip: Detailed information is found in this doc.

Matrix Synapse server

This Wiki will cover the installation, configuration, and setup of the Matrix Synapse server, as this is the most commonly used and feature complete Matrix Protocol server at this time.

Install Matrix Synapse server

Synapse package is available in the Alpine Linux repositories. To install it run:

apk update apk add synapse

When installing the Alpine Linux synapse package, it will create a user called synapse.

Configuration and Setup

During installation, the Alpine Linux synapse package will create a default synapse configuration file which will be located at /etc/synapse/homeserver.conf.

You will want to refer to the Matrix Synapse Configuration Manual to configure the various options. Make sure the synapse user can read/edit the configuration directory:

chown -R synapse:synapse/etc/synapse

Add synapse to the default runlevel to have it started at boot:

rc-update add synapse

Reverse Proxy

If you want your Matrix Synapse server to be accessed over the internet, then it is highly recommended to configure a reverse proxy to do that. One advantage of doing this is that you can expose the default HTTPS port (443) to Matrix clients without needing to run Synapse with root privileges.

The Matrix developers have provided very good documentation with reverse proxy examples. I prefer Nginx, as I am most familiar with it, but you can also choose Apache, Caddy, or HAProxy to have in front of Synapse.

Database

Once synapse is installed, you will need to select which database to use with it. By default, Synapse uses a SQLite database, which is only acceptable for testing purposes & should not be used in a production environment.

The Matrix Synapse developers recommend using PostgresSQL as your database backend. For more details on installing PostgresSQL, refer to the PostgreSQL article. It is recommended that you install the latest PostgreSQL release available, which at this time is PostgreSQL 16.

See also