Author: Ho229v3
Dendrite is the second generation Matrix homeserver written in Go. Today, let's dive into it.
The entire deployment process is based on the official Get started guide.
Friendly Reminder: If you are not really eager to become a Matrix guru or a fanatical decentralization advocate, this article will only waste your time. I do not recommend anyone to deploy Dendrite on their own unless you have nothing better to do.
Compilation and Key Generation#
There were no issues during compilation and key generation.
I used an AWS 1g1c instance with Ubuntu 22.04-amd64 as the operating system and Go version 1.18.1 linux/amd64.
Configuration File#
Configuring the Database#
After compilation and key generation, running dendrite-monolith-server
resulted in the following error (Get started == Get new shit):
PANIC[2022-11-02T05:02:46.231645575Z] Failed to set up global database connections error="failed to find maximum connections: dial tcp: lookup hostname: no such host"
panic: (*logrus.Entry) 0xc0002a5c70
...
Since this error message was vague and could also be due to my inexperience, I couldn't find anything useful online. After reading its source code, I discovered that it panicked during the execution of the config, which means the provided dendrite-sample.monolith.yaml
cannot be used directly (Filtering target users).
Upon opening the YAML file, I found that it directly used PostgreSQL in global.database
, but I don't intend to deploy using PostgreSQL. After studying the comments, I found that global.database
is exclusive to PostgreSQL, and SQLite cannot be used for global.database
(which is the Dendrite Global database connection pool). Additionally, each component must be manually assigned a database, which means adding the following under each component (Why can't the user be helped with such a simple task? Why can't SQLite's connection pool be used?):
database:
connection_string: file:dendrite_<component>.db
max_open_conns: 10
max_idle_conns: 2
conn_max_lifetime: -1
It is important to note that each component cannot use the same .db file, and global.database
should also be commented out.
Adding Missing Component Configurations#
Running dendrite-monolith-server
again resulted in the following error:
INFO[2022-11-02T05:25:53.722317580Z] Dendrite version 0.10.5+8c7b274e
PANIC[2022-11-02T05:25:53.756013624Z] failed to connect to room server db error="sqlutil.Open: no database connections configured"
...
However, there was no configuration for the room server in my YAML file, indicating that the example was missing some fields. So, I found another Dendrite configuration file online, which also used SQLite. After comparing the two files, I found that the example was missing the configurations for the room_server
and key_server
components, as well as user_api.account_database
and user_api.device_database
(If you can't write a proper sample, then don't write one).
The solution was to add the missing configurations based on the online configuration file, and remember to modify the database.connection_string
path.
After running dendrite-monolith-server
again, the server started successfully. The address is http://localhost:8008.
Account Creation#
Following the last step of the Get started guide to create an account resulted in the following error:
FATAL[0000] Shared secret registration is not enabled, enable it by setting a shared secret in the config: 'client_api.registration_shared_secret'
This error message is self-explanatory. It occurred because client_api.registration_shared_secret
was not set in the YAML file. The solution is to generate a random string as the shared secret.
Public Account Registration#
If you want to allow account registration on the client side instead of the server side, you need to enable public account registration.
There are two methods for public account registration:
- (Not secure) Set
client_api.registration_disabled
tofalse
in the YAML file, and add-really-enable-open-registration
as a startup parameter fordendrite-monolith-server
. - Enable reCAPTCHA verification registration (Let Google exploit your brain's computing power for free).
Deployment#
Before deployment, remember to change global.server_name
, global.well_known_server_name
, and global.well_known_client_name
to your own server's domain.
The HTTP(S) ports can be changed using -http(s)-bind-address
, with the default HTTP port being 8008 and the default HTTPS port being 8448.
Integration Manager#
Currently, the mainstream integration manager for Matrix is Dimension.
To deploy the integration manager, you need to use Nginx reverse proxy to map Dimension's port to 443 (or 80). For specific instructions, refer to Installing Dimension (Hope you're too lazy to read it. Even if you manage to deploy it after a lot of effort, it only has a few bridges and stickers generated by certain open-source communities).
Usage#
The tested clients were the Android and Desktop versions of Element.
It was found that the phone and video icons on the Android client initiated phone conferences and video conferences, while on the Desktop client, they initiated voice and video calls. However, the video calls initiated on the Desktop client could not be connected and remained in the connecting state (What a split personality scene).
If you are just an ordinary user looking for an alternative to IM, Matrix may not be suitable for you. Firstly, you need to manually manage your keys, and if you lose your keys, it will look like this:
If you are a fashionable geek, the above situations may not be a problem for you. However, its UI might disappoint you. For example:
If you are a heavy IM user, stickers are probably a frequently used feature for you. Leaving aside the sticker ecosystem, if you want to send a sticker, you have to click the plus icon next to the input box, then click the second "Send Sticker" option, and wait for the page to load before you can send a sticker.
EOF#
Cherish life, stay away from Matrix.