User:Maffblaster/Projects/Matrix

From Gentoo Wiki
Jump to:navigation Jump to:search

maff's landing page for setting up a Matrix server on Gentoo.

Todo

  • Finish writing ebuild for www-servers/synapse.
    • Ebuild will need a user account.
    • Research and add relevant USE flags.
    • Tests? Should they be included? They don't seem necessary, but would conclude a 'perfect' ebuild.

Done

Project links

Dendrite

Prerequisites

dev-lang/go

Setup

Instructions for getting a basic Dendrite test server setup:

user $git clone https://github.com/matrix-org/dendrite
user $cd dendrite
user $git checkout v0.3.9 # Checkout the latest tagged release
user $./build.sh
user $./bin/generate-keys --private-key matrix_key.pem
user $./bin/generate-keys --tls-cert server.crt --tls-key server.key
user $cp dendrite-config.yaml dendrite.yaml

Edit the dendrite.yaml configuration file to include the domain name of the hosting server:

FILE dendrite.yamlModify the dendrite configuration file
# Global Matrix configuration. This configuration applies to all components.
global:
 # The domain name of this homeserver.
 server_name: dendrite.gentoo.test

The rest of the defaults in the file should work for this setup. Save and exit the file, then start the server:

user $./bin/dendrite-monolith-server --tls-cert server.crt --tls-key server.key --config dendrite.yaml

Insecure and secure connections for the server should run respectively on port 8008 (HTTP) and 8448 (HTTPS) by default.

Now with the server running, open a new terminal console to the current working directory and create some test users:

user $ ./bin/create-account --config dendrite.yaml --username <YourUsername1> --password <SecretPassword1>
user $ ./bin/create-account --config dendrite.yaml --username <YourUsername2> --password <SecretPassword2>
Note
Including a white space before the command as shown in the example above will prevent the line from being recorded in bash's history file (~/.bash_history, which will help the passwords stay private.

Testing

curl (net-misc/curl) can be used to test the API from the command line for both self-signed and signed certificates. For example, to verify the

user $curl --insecure https://dendrite.gentoo.test:8448/_matrix/federation/v1/version
{"server":{"version":"0.3.9+397b158c","name":"Dendrite"}}

Clients

Some clients are being maintained in the matrix overlay.

Prerequisite: app-eselect/eselect-repository

Install the overlay:

root #eselect repository add matrix git https://anongit.gentoo.org/git/repo/proj/matrix.git
root #emaint sync -r matrix
root #eix-update # Regenerate eix database cache (optional)

weechat-matrix

Emerge dev-libs/olm (requires matrix overlay above):

root #emerge --ask dev-libs/olm

Manual installation (Python implementation)

Getting the weechat-matrix client (Python implementation) manually installed on Gentoo:

Prerequisites: dev-python/pip

user $git clone https://github.com/poljar/weechat-matrix.git
user $cd weechat-matrix
user $pip install --user -r requirements.txt
user $make install

The plugin should install to the current user's ~/.weechat/python directory as matrix.py.

On the weechat buffer, it is wise to restart weechat (using the /upgrade command works nicely), then attempt to load the plugin:

weechat/upgrade
weechat/script load matrix.py
python: loading script "/home/larry/.weechat/python/matrix.py"
python: registered script "matrix", version 0.2.0 (matrix chat plugin)
New key binding (context "cursor"): @chat(python.matrix.*):r => hsignal:matrix_cursor_reply

After the plugin has been successfully loaded, help can be obtained via:

weechat/matrix help

Add custom server:

weechat/matrix server add testservername testserver.org
weechat/set matrix.server.testservername.username larry
weechat/set matrix.server.testservername.password SeCrEtP@SsWoRd
weechat/matrix connect testservername

Manual installation (Rust implementation)

Getting the weechat-matrix client (Rust implementation) manually installed on Gentoo:

Prerequisites: dev-lang/rust

user $git clone https://github.com/poljar/weechat-matrix-rs.git
user $cd weechat-matrix-rs
user $cargo build
user $make install

External references