From 7cc668489b86ff48c56f5260ac882a8ec75352cc Mon Sep 17 00:00:00 2001 From: Array in a Matrix Date: Sun, 20 Nov 2022 00:11:21 -0800 Subject: [PATCH] add auto join option to dendrite config (#2255) * add auto join option to dendrite config * added auto_join_rooms: variable * added "configuring dendrite" entry * created dendite configuration documentation * fixed config path * Update docs/configuring-playbook-dendrite.md Co-authored-by: Slavi Pantaleev * Update docs/configuring-playbook-dendrite.md Co-authored-by: Slavi Pantaleev * Update docs/configuring-playbook-dendrite.md Co-authored-by: Slavi Pantaleev * Update docs/configuring-playbook-dendrite.md Co-authored-by: Slavi Pantaleev * Update docs/configuring-playbook-dendrite.md Co-authored-by: Slavi Pantaleev * Update roles/custom/matrix-dendrite/defaults/main.yml Co-authored-by: Slavi Pantaleev * correction Co-authored-by: Slavi Pantaleev --- docs/configuring-playbook-dendrite.md | 32 +++++++++++++++++++ docs/configuring-playbook.md | 2 ++ .../custom/matrix-dendrite/defaults/main.yml | 2 ++ .../templates/dendrite/dendrite.yaml.j2 | 2 ++ 4 files changed, 38 insertions(+) create mode 100644 docs/configuring-playbook-dendrite.md diff --git a/docs/configuring-playbook-dendrite.md b/docs/configuring-playbook-dendrite.md new file mode 100644 index 000000000..fcd5693de --- /dev/null +++ b/docs/configuring-playbook-dendrite.md @@ -0,0 +1,32 @@ +# Configuring Dendrite (optional) + +By default, this playbook configures the [Synapse](https://github.com/matrix-org/synapse) Matrix server, but you can also use [Dendrite](https://github.com/matrix-org/dendrite). + +**NOTES**: + +- **You can't switch an existing Matrix server's implementation** (e.g. Synapse -> Dendrite). Proceed below only if you're OK with losing data or you're dealing with a server on a new domain name, which hasn't participated in the Matrix federation yet. + +- **homeserver implementations other than Synapse may not be fully functional**. The playbook may also not assist you in an optimal way (like it does with Synapse). Make yourself familiar with the downsides before proceeding + +The playbook provided settings for Dendrite are defined in [`roles/custom/matrix-dendrite/defaults/main.yml`](../roles/custom/matrix-dendrite/defaults/main.yml) and they ultimately end up in the generated `/matrix/dendrite/config/dendrite.yaml` file (on the server). This file is generated from the [`roles/custom/matrix-dendrite/templates/dendrite/dendrite.yaml.j2`](../roles/custom/matrix-dendrite/templates/dendrite/dendrite.yaml.j2) template. + +**If there's an existing variable** which controls a setting you wish to change, you can simply define that variable in your configuration file (`inventory/host_vars/matrix./vars.yml`) and [re-run the playbook](installing.md) to apply the changes. + +Alternatively, **if there is no pre-defined variable** for a Dendrite setting you wish to change: + +- you can either **request a variable to be created** (or you can submit such a contribution yourself). Keep in mind that it's **probably not a good idea** to create variables for each one of Dendrite's various settings that rarely get used. + +- or, you can **extend and override the default configuration** ([`dendrite.yaml.j2`](../roles/custom/matrix-dendrite/templates/dendrite/dendrite.yaml.j2)) by making use of the `matrix_dendrite_configuration_extension_yaml` variable. You can find information about this in [`roles/custom/matrix-dendrite/defaults/main.yml`](../roles/custom/matrix-dendrite/defaults/main.yml). + +- or, if extending the configuration is still not powerful enough for your needs, you can **override the configuration completely** using `matrix_dendrite_configuration` (or `matrix_dendrite_configuration_yaml`). You can find information about this in [`roles/custom/matrix-dendrite/defaults/main.yml`](../roles/custom/matrix-dendrite/defaults/main.yml). + + + +## Installation + +To use Dendrite, you **generally** need the following additional `vars.yml` configuration: + +```yaml +matrix_homeserver_implementation: dendrite +``` + diff --git a/docs/configuring-playbook.md b/docs/configuring-playbook.md index 127ab47da..fa00c858d 100644 --- a/docs/configuring-playbook.md +++ b/docs/configuring-playbook.md @@ -47,6 +47,8 @@ When you're done with all the configuration you'd like to do, continue with [Ins - [Configuring Conduit](configuring-playbook-conduit.md), if you've switched to the [Conduit](https://conduit.rs) homeserver implementation (optional) + - [Configuring Dendrite](configuring-playbook-dendrite.md), if you've switched to the [Dendrite](https://matrix-org.github.io/dendrite) homeserver implementation (optional) + - [Configuring Element](configuring-playbook-client-element.md) (optional) - [Storing Matrix media files on Amazon S3](configuring-playbook-s3.md) (optional) diff --git a/roles/custom/matrix-dendrite/defaults/main.yml b/roles/custom/matrix-dendrite/defaults/main.yml index b9dddfe9b..698a1f48d 100644 --- a/roles/custom/matrix-dendrite/defaults/main.yml +++ b/roles/custom/matrix-dendrite/defaults/main.yml @@ -194,3 +194,5 @@ matrix_dendrite_configuration_extension: "{{ matrix_dendrite_configuration_exten # Holds the final Dendrite configuration (a combination of the default and its extension). # You most likely don't need to touch this variable. Instead, see `matrix_dendrite_configuration_yaml`. matrix_dendrite_configuration: "{{ matrix_dendrite_configuration_yaml | from_yaml | combine(matrix_dendrite_configuration_extension, recursive=True) }}" + +matrix_dendrite_userapi_auto_join_rooms: [] diff --git a/roles/custom/matrix-dendrite/templates/dendrite/dendrite.yaml.j2 b/roles/custom/matrix-dendrite/templates/dendrite/dendrite.yaml.j2 index 86a12d7c2..7d99aee55 100644 --- a/roles/custom/matrix-dendrite/templates/dendrite/dendrite.yaml.j2 +++ b/roles/custom/matrix-dendrite/templates/dendrite/dendrite.yaml.j2 @@ -382,6 +382,7 @@ user_api: # is considered to be valid in milliseconds. # The default lifetime is 3600000ms (60 minutes). # openid_token_lifetime_ms: 3600000 + auto_join_rooms: {{ matrix_dendrite_userapi_auto_join_rooms | to_json }} # Not in dendrite-config.yaml, but is in build/docker/config/dendrite.yaml # Configuration for the Push Server API. @@ -414,3 +415,4 @@ tracing: # Logging configuration, in addition to the standard logging that is sent to # stdout by Dendrite. logging: [] +