Telodendria

From IM Wiki
Revision as of 12:24, 20 January 2024 by Matrix>LDA (start adminwerk)
Jump to navigation Jump to search

Telodendria (also known as Telo) is a Matrix homeserver in alpha written in C99 (previously C89)[1], that aims to extremely powerful yet lightweight, while all being as POSIX-compliant as possible.

Telodendria is still in heavy development and isn't excepting a non-federating release until January 2025[2].

Configuring Telodendria

Telodendria essentially uses the filesystem as a database, and as such, you need to point it to an existing directory with the -d [dir] flag, like telodendria -d data. From that directory, several things are stored, including the actual data Telodendria has to save in order to act as a Matrix homeserver, log files, and the configuration, as [dir]/config.json.

Modifying the configuration

Note: More information is available at Telodendria's wiki page on configuration

The configuration is stored in a JSON file called [dir]/config.json, which contains the following properties:

  • listen: A required object list (Telodendria supports multiple listeners) storing where Telodendria should listen for requests:
    • port: A required integer (between 1 and 65535) representing what port Telodendria listens to.
    • maxConnections: An optional integer, defining the maximal amount of connections the listener should accept, which is 32 by default. You should play around, and see what values work the best for your loads.
    • threads: An optional integer, defining the amount of threads the listener sets up, which is 4 by default. You should play around, and see what values work the best for your loads.
    • tls: An optional object, containing both cert and key, which are both required paths to your certificate and key, in the format excepted by your TLS library.
  • log: A required object storing how Telodendria should log:
    • output: An enum, storing where Telodendria should log:
      • "stdout": Write to the standard output.
      • "syslog": Write to the system logger.
      • "file": Write to the [dir]/telodendria.log file.
    • level: An enum, storing the minimum level of severity for Telodendria to log an event:
      • "message"
      • "debug"
      • "notice"
      • "warning"
      • "error"
    • timestampFormat: Represents the format Telodendria uses to write time information (see strftime for more).
    • color: A boolean, determining whenever color should be enabled, whenever possible (if on an ANSI terminal)
  • runAs: An object, that determines what user (uid as username) and role (gid as rolename) to run as if running as UID 0 (root in most systems)
  • serverName: A required string, representing the server's name to the federation (see Delegation)
  • baseUrl: The URL used to prefix Matrix requests, when delegated
  • pid: An optional PID file Telodendria creates and writes it's PID to when running.
  • federation: A required boolean, used to determing whenever the server handles federation.
  • registration: A required boolean, used to determing whenever the server supports open registration. Please note registration tokens do bypass this.
  • maxCache: An optional integer, denoting how much cache to setup for the database in bytes, set to 0 by default.
  • identityServer: An optional identity server to advertise.

Compiling Telodendria from Git

Telodendria only needs a few dependencies: Cytoplasm (which can be built at the same time), a POSIX-compliant libc (with pthread support), and an optional TLS library (OpenSSL/LibreSSL).

To build it, you can first install Cytoplasm if your distribution supports it. On Arch, you can use the AUR to install cytoplasm-git.

Then, clone and setup Telodendria with the following

$ git clone https://git.telodendria.io/Telodendria/Telodendria # use --recurse-submodules if Cytoplasm wasn't already installed
$ cd Telodendria

# If Cytoplasm wasn't already installed
$ cd Cytoplasm
$ ./configure # --disable-tls if you do not have OpenSSL or LibreSSL
$ make # You can use -j[jobs] there
$ cd ..

Now, build it with

$ ./configure # in the Telodendria directory
$ make # You can use -j[jobs] here

If you didn't already install Cytoplasm, make sure to either move the generated shared library (Cytoplasm/out/lib/libCytoplasm.so) to a standard search path by using make install, or add its directory to LD_LIBRARY_PATH for testing.

Then, to test that Telodendria works, one can run on its directory

$ ./out/bin/telodendria

It should log No database directory specified. before shutting down.

Administration API

Note: More information is available at Telodendria's wiki page on its admin API

Telodendria uses a custom admin API, accessible from /_telodendria/admin/v1 (note that endpoints here will use this as a base, so /_telodendria/admin/v1/foo will just be /foo). Unlike Synapse, there are multiple "privileges", allowing fine-grained control over what admins can do[3]:

  • DEACTIVATE: Allows an user to deactivate other users with POST /deactivate/[local]
  • ISSUE_TOKENS: Allows an user to issue registration tokens to other users (which can be used to give users specific privileges).
  • GRANT_PRIVILEGES: Allows an user to change other users' privileges with GET|POST|PUT|DELETE /privileges/[local][3].
  • CONFIG: Allows an user to change Telodendria's configuration without touching the database directly with GET|POST|PUT /config.
  • ALIAS: Allows an user to manage the server's room aliases.
  • PROC_CONTROL: Allows an user to manage Telodendria's process (by "soft-restarting" or stopping it) and view statistics.
  • ALL: Allows an user to do any admin actions, which is equivalent to giving a user admin access in Synapse.

References