From e2ab3396348e431cbd2421d3e6cf36773f230510 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 11 Feb 2024 00:58:31 +0000 Subject: [PATCH 01/22] Update joseluisq/static-web-server Docker tag to v2.26.0 --- roles/custom/matrix-cactus-comments-client/defaults/main.yml | 2 +- roles/custom/matrix-static-files/defaults/main.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/custom/matrix-cactus-comments-client/defaults/main.yml b/roles/custom/matrix-cactus-comments-client/defaults/main.yml index 66662aad6..20532c8db 100644 --- a/roles/custom/matrix-cactus-comments-client/defaults/main.yml +++ b/roles/custom/matrix-cactus-comments-client/defaults/main.yml @@ -13,7 +13,7 @@ matrix_cactus_comments_client_public_path: "{{ matrix_cactus_comments_client_bas matrix_cactus_comments_client_public_path_file_permissions: "0644" # renovate: datasource=docker depName=joseluisq/static-web-server -matrix_cactus_comments_client_version: 2.25.0 +matrix_cactus_comments_client_version: 2.26.0 matrix_cactus_comments_client_container_image: "{{ matrix_container_global_registry_prefix }}joseluisq/static-web-server:{{ matrix_cactus_comments_client_container_image_tag }}" matrix_cactus_comments_client_container_image_tag: "{{ 'latest' if matrix_cactus_comments_client_version == 'latest' else (matrix_cactus_comments_client_version + '-alpine') }}" diff --git a/roles/custom/matrix-static-files/defaults/main.yml b/roles/custom/matrix-static-files/defaults/main.yml index 045004f46..9b3864d78 100644 --- a/roles/custom/matrix-static-files/defaults/main.yml +++ b/roles/custom/matrix-static-files/defaults/main.yml @@ -8,7 +8,7 @@ matrix_static_files_enabled: true matrix_static_files_identifier: matrix-static-files # renovate: datasource=docker depName=joseluisq/static-web-server -matrix_static_files_version: 2.25.0 +matrix_static_files_version: 2.26.0 matrix_static_files_base_path: "{{ matrix_base_data_path }}/{{ 'static-files' if matrix_static_files_identifier == 'matrix-static-files' else matrix_static_files_identifier }}" matrix_static_files_config_path: "{{ matrix_static_files_base_path }}/config" From cf9388c546dacfc322c28791c62312bc27f2911d Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Sun, 11 Feb 2024 09:03:48 +0200 Subject: [PATCH 02/22] Make base domain root path redirect regex configurable --- roles/custom/matrix-static-files/defaults/main.yml | 1 + roles/custom/matrix-static-files/templates/labels.j2 | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/roles/custom/matrix-static-files/defaults/main.yml b/roles/custom/matrix-static-files/defaults/main.yml index 9b3864d78..39fd06750 100644 --- a/roles/custom/matrix-static-files/defaults/main.yml +++ b/roles/custom/matrix-static-files/defaults/main.yml @@ -83,6 +83,7 @@ matrix_static_files_container_labels_base_domain_traefik_tls: "{{ matrix_static_ matrix_static_files_container_labels_base_domain_traefik_tls_certResolver: "{{ matrix_static_files_container_labels_traefik_tls_certResolver }}" # noqa var-naming # Controls whether the root path (/) at the base domain would respond with a redirect to some URL. matrix_static_files_container_labels_base_domain_root_path_redirection_enabled: false +matrix_static_files_container_labels_base_domain_root_path_redirection_regex: "^https://{{ matrix_static_files_container_labels_base_domain_traefik_hostname }}{{ matrix_static_files_container_labels_base_domain_traefik_path_prefix }}$" matrix_static_files_container_labels_base_domain_root_path_redirection_url: "" # matrix_static_files_container_labels_additional_labels contains a multiline string with additional labels to add to the container label file. diff --git a/roles/custom/matrix-static-files/templates/labels.j2 b/roles/custom/matrix-static-files/templates/labels.j2 index 46fc49490..dd3cad544 100644 --- a/roles/custom/matrix-static-files/templates/labels.j2 +++ b/roles/custom/matrix-static-files/templates/labels.j2 @@ -59,7 +59,7 @@ traefik.http.routers.{{ matrix_static_files_identifier }}-well-known.tls.certRes {% set middlewares = [] %} {% if matrix_static_files_container_labels_base_domain_root_path_redirection_enabled %} -traefik.http.middlewares.{{ matrix_static_files_identifier }}-root-path-redirect.redirectregex.regex=^https://{{ matrix_static_files_container_labels_base_domain_traefik_hostname }}{{ matrix_static_files_container_labels_base_domain_traefik_path_prefix }}$ +traefik.http.middlewares.{{ matrix_static_files_identifier }}-root-path-redirect.redirectregex.regex={{ matrix_static_files_container_labels_base_domain_root_path_redirection_regex }} traefik.http.middlewares.{{ matrix_static_files_identifier }}-root-path-redirect.redirectregex.replacement={{ matrix_static_files_container_labels_base_domain_root_path_redirection_url }} {% set middlewares = middlewares + [matrix_static_files_identifier + '-root-path-redirect'] %} {% endif %} From ce9a8d3a2c00cd3307fa07516ca024c34423141d Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Sun, 11 Feb 2024 09:07:32 +0200 Subject: [PATCH 03/22] Rename base domain root path redirect middleware to improve consistency --- roles/custom/matrix-static-files/templates/labels.j2 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/custom/matrix-static-files/templates/labels.j2 b/roles/custom/matrix-static-files/templates/labels.j2 index dd3cad544..e9fcf1945 100644 --- a/roles/custom/matrix-static-files/templates/labels.j2 +++ b/roles/custom/matrix-static-files/templates/labels.j2 @@ -59,9 +59,9 @@ traefik.http.routers.{{ matrix_static_files_identifier }}-well-known.tls.certRes {% set middlewares = [] %} {% if matrix_static_files_container_labels_base_domain_root_path_redirection_enabled %} -traefik.http.middlewares.{{ matrix_static_files_identifier }}-root-path-redirect.redirectregex.regex={{ matrix_static_files_container_labels_base_domain_root_path_redirection_regex }} -traefik.http.middlewares.{{ matrix_static_files_identifier }}-root-path-redirect.redirectregex.replacement={{ matrix_static_files_container_labels_base_domain_root_path_redirection_url }} -{% set middlewares = middlewares + [matrix_static_files_identifier + '-root-path-redirect'] %} +traefik.http.middlewares.{{ matrix_static_files_identifier }}-base-domain-root-path-redirect.redirectregex.regex={{ matrix_static_files_container_labels_base_domain_root_path_redirection_regex }} +traefik.http.middlewares.{{ matrix_static_files_identifier }}-base-domain-root-path-redirect.redirectregex.replacement={{ matrix_static_files_container_labels_base_domain_root_path_redirection_url }} +{% set middlewares = middlewares + [matrix_static_files_identifier + '-base-domain-root-path-redirect'] %} {% endif %} traefik.http.routers.{{ matrix_static_files_identifier }}-base-domain.rule={{ matrix_static_files_container_labels_base_domain_traefik_rule }} From cf9ca9e602afaf05e4dc2ea38db59ade333d1c85 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 11 Feb 2024 19:45:35 +0000 Subject: [PATCH 04/22] Update registry.gitlab.com/etke.cc/postmoogle Docker tag to v0.9.17 --- roles/custom/matrix-bot-postmoogle/defaults/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/custom/matrix-bot-postmoogle/defaults/main.yml b/roles/custom/matrix-bot-postmoogle/defaults/main.yml index fc7d9749a..9d3556a0c 100644 --- a/roles/custom/matrix-bot-postmoogle/defaults/main.yml +++ b/roles/custom/matrix-bot-postmoogle/defaults/main.yml @@ -10,7 +10,7 @@ matrix_bot_postmoogle_docker_repo_version: "{{ 'main' if matrix_bot_postmoogle_v matrix_bot_postmoogle_docker_src_files_path: "{{ matrix_base_data_path }}/postmoogle/docker-src" # renovate: datasource=docker depName=registry.gitlab.com/etke.cc/postmoogle -matrix_bot_postmoogle_version: v0.9.16 +matrix_bot_postmoogle_version: v0.9.17 matrix_bot_postmoogle_docker_image: "{{ matrix_bot_postmoogle_docker_image_name_prefix }}etke.cc/postmoogle:{{ matrix_bot_postmoogle_version }}" matrix_bot_postmoogle_docker_image_name_prefix: "{{ 'localhost/' if matrix_bot_postmoogle_container_image_self_build else 'registry.gitlab.com/' }}" matrix_bot_postmoogle_docker_image_force_pull: "{{ matrix_bot_postmoogle_docker_image.endswith(':latest') }}" From 1aafb58d00410ea482fee0273aa1005b7db2f383 Mon Sep 17 00:00:00 2001 From: Catalan Lover <48515417+FSG-Cat@users.noreply.github.com> Date: Sun, 11 Feb 2024 23:28:45 +0100 Subject: [PATCH 05/22] Update container-images.md to mention Draupnir Adds a Draupnir mention to the list and as for why we pull from Gnuxie its because that is the official source of docker images as Draupnir used to be Gnuxie/Draupnir before it moved to The Draupnir Project. --- docs/container-images.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/container-images.md b/docs/container-images.md index 6a0157ad7..787a10506 100644 --- a/docs/container-images.md +++ b/docs/container-images.md @@ -108,6 +108,8 @@ These services are not part of our default installation, but can be enabled by [ - [matrixdotorg/mjolnir](https://hub.docker.com/r/matrixdotorg/mjolnir) - the [mjolnir](https://github.com/matrix-org/mjolnir) moderation bot (optional) +- [gnuxie/draupnir](https://hub.docker.com/r/gnuxie/draupnir) - the [Draupnir](https://github.com/the-draupnir-project/Draupnir/) moderation bot (optional) + - [awesometechnologies/synapse-admin](https://hub.docker.com/r/awesometechnologies/synapse-admin) - the [synapse-admin](https://github.com/Awesome-Technologies/synapse-admin) web UI tool for administrating users and rooms on your Matrix server (optional) - [prom/prometheus](https://hub.docker.com/r/prom/prometheus/) - [Prometheus](https://github.com/prometheus/prometheus/) is a systems and service monitoring system From a27464a5469d34058b23f16cb13bd0b67fbac56a Mon Sep 17 00:00:00 2001 From: chagai95 <31655082+chagai95@users.noreply.github.com> Date: Mon, 12 Feb 2024 16:35:48 +0100 Subject: [PATCH 06/22] Update CHANGELOG.md (#3181) * Update CHANGELOG.md * Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d96326a17..d8ebdd0ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -207,7 +207,7 @@ As mentioned above, static files like `/.well-known/matrix/*` or your base domai All of this has been extracted into a new `matrix-static-files` Ansible role that's part of the playbook. The static files generated by this new role still live at roughly the same place (`/matrix/static-files/public` directory, instead of `/matrix/static-files`). -The playbook will migrate and update the files automatically. It will also warn you about usage of old variable names, so you can adapt to the new names. +The playbook will migrate and update the `/.well-known/matrix/*` files automatically but not your own files in `nginx-proxy/data/matrix-domain/` you will need to back these up yourself otherwise they will be lost. It will also warn you about usage of old variable names, so you can adapt to the new names. ### A note on performance From 2bc6dcf4f3cfad75315aef8fc085c5b3bf3cc6f2 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 12 Feb 2024 18:56:15 +0000 Subject: [PATCH 07/22] Update dependency traefik to v2.11.0-0 --- requirements.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.yml b/requirements.yml index 3c51ab86e..2ed436791 100644 --- a/requirements.yml +++ b/requirements.yml @@ -67,7 +67,7 @@ version: v1.0.0-0 name: timesync - src: git+https://github.com/devture/com.devture.ansible.role.traefik.git - version: v2.10.7-0 + version: v2.11.0-0 name: traefik - src: git+https://github.com/devture/com.devture.ansible.role.traefik_certs_dumper.git version: v2.8.3-1 From 4242f4f7cd4aa4b6684cde220130a8f6040f5962 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 13 Feb 2024 03:02:42 +0000 Subject: [PATCH 08/22] Update joseluisq/static-web-server Docker tag to v2.27.0 --- roles/custom/matrix-cactus-comments-client/defaults/main.yml | 2 +- roles/custom/matrix-static-files/defaults/main.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/custom/matrix-cactus-comments-client/defaults/main.yml b/roles/custom/matrix-cactus-comments-client/defaults/main.yml index 20532c8db..ef318b716 100644 --- a/roles/custom/matrix-cactus-comments-client/defaults/main.yml +++ b/roles/custom/matrix-cactus-comments-client/defaults/main.yml @@ -13,7 +13,7 @@ matrix_cactus_comments_client_public_path: "{{ matrix_cactus_comments_client_bas matrix_cactus_comments_client_public_path_file_permissions: "0644" # renovate: datasource=docker depName=joseluisq/static-web-server -matrix_cactus_comments_client_version: 2.26.0 +matrix_cactus_comments_client_version: 2.27.0 matrix_cactus_comments_client_container_image: "{{ matrix_container_global_registry_prefix }}joseluisq/static-web-server:{{ matrix_cactus_comments_client_container_image_tag }}" matrix_cactus_comments_client_container_image_tag: "{{ 'latest' if matrix_cactus_comments_client_version == 'latest' else (matrix_cactus_comments_client_version + '-alpine') }}" diff --git a/roles/custom/matrix-static-files/defaults/main.yml b/roles/custom/matrix-static-files/defaults/main.yml index 39fd06750..e76c383b2 100644 --- a/roles/custom/matrix-static-files/defaults/main.yml +++ b/roles/custom/matrix-static-files/defaults/main.yml @@ -8,7 +8,7 @@ matrix_static_files_enabled: true matrix_static_files_identifier: matrix-static-files # renovate: datasource=docker depName=joseluisq/static-web-server -matrix_static_files_version: 2.26.0 +matrix_static_files_version: 2.27.0 matrix_static_files_base_path: "{{ matrix_base_data_path }}/{{ 'static-files' if matrix_static_files_identifier == 'matrix-static-files' else matrix_static_files_identifier }}" matrix_static_files_config_path: "{{ matrix_static_files_base_path }}/config" From 1e9f472077e361e2fbfe6a2ac4b7693d43ad2040 Mon Sep 17 00:00:00 2001 From: Array in a Matrix Date: Mon, 12 Feb 2024 23:10:50 -0500 Subject: [PATCH 09/22] Add missing link to synapse config docs --- docs/configuring-playbook-synapse-admin.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/configuring-playbook-synapse-admin.md b/docs/configuring-playbook-synapse-admin.md index bb89b1660..1e3e8980e 100644 --- a/docs/configuring-playbook-synapse-admin.md +++ b/docs/configuring-playbook-synapse-admin.md @@ -17,7 +17,7 @@ matrix_synapse_admin_enabled: true **Note**: Synapse Admin requires Synapse's [Admin APIs](https://matrix-org.github.io/synapse/latest/usage/administration/admin_api/index.html) to function. Access to them is restricted with a valid access token, so exposing them publicly should not be a real security concern. Still, for additional security, we normally leave them unexposed, following [official Synapse reverse-proxying recommendations](https://github.com/element-hq/synapse/blob/master/docs/reverse_proxy.md#synapse-administration-endpoints). Because Synapse Admin needs these APIs to function, when installing Synapse Admin, the playbook **automatically** exposes the Synapse Admin API publicly for you. Depending on the homeserver implementation you're using (Synapse, Dendrite), this is equivalent to: -- for Synapse (our default homeserver implementation): `matrix_synapse_container_labels_public_client_synapse_admin_api_enabled: true` +- for [Synapse](./configuring-playbook-synapse.md) (our default homeserver implementation): `matrix_synapse_container_labels_public_client_synapse_admin_api_enabled: true` - for [Dendrite](./configuring-playbook-dendrite.md): `matrix_dendrite_container_labels_public_client_synapse_admin_api_enabled: true` From a381fa4b212e75d02664563dacd97baeb7e0780c Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Tue, 13 Feb 2024 14:56:42 +0200 Subject: [PATCH 10/22] Upgrade Synapse (v1.100.0 -> v1.101.0) --- roles/custom/matrix-synapse/defaults/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/custom/matrix-synapse/defaults/main.yml b/roles/custom/matrix-synapse/defaults/main.yml index 5067a1432..13e16b360 100644 --- a/roles/custom/matrix-synapse/defaults/main.yml +++ b/roles/custom/matrix-synapse/defaults/main.yml @@ -16,7 +16,7 @@ matrix_synapse_enabled: true matrix_synapse_github_org_and_repo: element-hq/synapse # renovate: datasource=docker depName=ghcr.io/element-hq/synapse -matrix_synapse_version: v1.100.0 +matrix_synapse_version: v1.101.0 matrix_synapse_username: '' matrix_synapse_uid: '' From 60fbcebd597f10654d3c3bbc943380a3d2ff021d Mon Sep 17 00:00:00 2001 From: Tupsi Date: Tue, 13 Feb 2024 17:42:09 +0100 Subject: [PATCH 11/22] Update configuring-playbook-bot-maubot.md works in encrypted rooms now, so I removed the notion that it does not. --- docs/configuring-playbook-bot-maubot.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/configuring-playbook-bot-maubot.md b/docs/configuring-playbook-bot-maubot.md index 11ab1cce2..bf2b1d14b 100644 --- a/docs/configuring-playbook-bot-maubot.md +++ b/docs/configuring-playbook-bot-maubot.md @@ -55,4 +55,4 @@ Choose a strong password for the bot. You can generate a good password with a co ## Obtaining an admin access token This can be done via `mbc login` then `mbc auth` (see the [maubot documentation](https://docs.mau.fi/maubot/usage/cli/auth.html)). To run these commands you'll need to open the bot docker container with `docker exec -it matrix-bot-maubot sh` -Alternatively, use Element or curl to [obtain an access token](obtaining-access-tokens.md). However these two methods won't allow the bot to work in encrypted rooms. +Alternatively, use Element or curl to [obtain an access token](obtaining-access-tokens.md). From d9940bd8074b84619f9443c6539d05a399879923 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Tue, 13 Feb 2024 19:06:14 +0200 Subject: [PATCH 12/22] Upgrade Element (v1.11.57 -> v1.11.58) --- roles/custom/matrix-client-element/defaults/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/custom/matrix-client-element/defaults/main.yml b/roles/custom/matrix-client-element/defaults/main.yml index 934bf885a..cc65b6402 100644 --- a/roles/custom/matrix-client-element/defaults/main.yml +++ b/roles/custom/matrix-client-element/defaults/main.yml @@ -11,7 +11,7 @@ matrix_client_element_container_image_self_build_repo: "https://github.com/eleme matrix_client_element_container_image_self_build_low_memory_system_patch_enabled: "{{ ansible_memtotal_mb < 4096 }}" # renovate: datasource=docker depName=vectorim/element-web -matrix_client_element_version: v1.11.57 +matrix_client_element_version: v1.11.58 matrix_client_element_docker_image: "{{ matrix_client_element_docker_image_name_prefix }}vectorim/element-web:{{ matrix_client_element_version }}" matrix_client_element_docker_image_name_prefix: "{{ 'localhost/' if matrix_client_element_container_image_self_build else matrix_container_global_registry_prefix }}" From 9eab0292d437efeeb959fbcafa94f5b3c3596465 Mon Sep 17 00:00:00 2001 From: Catalan Lover <48515417+FSG-Cat@users.noreply.github.com> Date: Wed, 14 Feb 2024 11:02:06 +0100 Subject: [PATCH 13/22] Increase Synapse caches and enable cache-autotuning by default (#3017) * Modify Synapse Cache Factor to use Auto Tune Synapse has the ability to as it calls in its config auto tune caches. This ability lets us set very high cache factors and then instead limit our resource use. Defaults for this commit are 1/10th of what Element apparently runs for EMS stuff and matrix.org on Cache Factor and upstream documentation defaults for auto tune. * Add vars to Synapse main.yml to control cache related config This commit adds various cache related vars to main.yml for Synapse. Some are auto tune and some are just adding explicit ways to control upstream vars. * Updated Auto Tune figures Autotuned figures have been bumped in consultation with other community members as to a reasonable level. Please note these defaults are more on the one of each workers side than they are on the monolith Side. * Fix YML Error The playbook is not happy with the previous state of this patch so this commit hopefully fixes it * Add to_json to various Synapse tuning related configs * Fix incorrect indication in homeserver.yaml.j2 * Minor cleanups * Synapse Cache Autotuning Documentation * Upgrade Synapse Cache Autotune to auto configure memory use * Update Synapse Tuning docs to reflect automatic memory use configuration * Fix Linting errors in synapses main.yml * Rename variables for consistency (matrix_synapse_caches_autotuning_* -> matrix_synapse_cache_autotuning_*) * Remove FIX ME comment about Synapse's `cache_autotuning` `docs/maintenance-synapse.md` and `roles/custom/matrix-synapse/defaults/main.yml` already contains documentation about these variables and the default values we set. * Improve "Tuning caches and cache autotuning" documentation for Synapse * Announce larger Synapse caches and cache auto-tuning --------- Co-authored-by: Slavi Pantaleev --- CHANGELOG.md | 20 ++++++ docs/maintenance-synapse.md | 28 +++++++- roles/custom/matrix-synapse/defaults/main.yml | 19 ++++- .../matrix-synapse/tasks/validate_config.yml | 3 + .../templates/synapse/homeserver.yaml.j2 | 70 ++++++++++--------- 5 files changed, 103 insertions(+), 37 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d8ebdd0ed..153be11fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,23 @@ +# 2024-02-14 + +## Much larger Synapse caches and cache auto-tuning enabled by default + +Thanks to [FSG-Cat](https://github.com/FSG-Cat), the playbook now uses much larger caches and enables Synapse's [cache auto-tuning functionality](https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#caches-and-associated-values). +This work and the default values used by the playbook are inspired by [Tom Foster](https://github.com/tcpipuk)'s [Synapse homeserver guide](https://tcpipuk.github.io/synapse/deployment/synapse.html). + +The playbook has always used a very conservative cache factor (`matrix_synapse_caches_global_factor`) value of `0.5`, which may be OK for small and underactive deployments, but is not ideal for larger servers. Paradoxically, a small global cache factor value [does not necessarily decrease RAM usage as a whole](https://github.com/matrix-org/synapse/issues/3939). + +The playbook now uses **a 20x larger cache factor** (currently `10`), adjusts a few other cache-related variables, and **enables cache auto-tuning** via the following variables: + +- `matrix_synapse_cache_autotuning_max_cache_memory_usage` - defaults to 1/8 of total RAM with a cap of 2GB; values are specified in bytes +- `matrix_synapse_cache_autotuning_target_cache_memory_usage` - defaults to 1/16 of total RAM with a cap of 1GB; values are specified in bytes +- `matrix_synapse_cache_autotuning_min_cache_ttl` - defaults to `30s` + +These values should be good defaults for most servers, but may change over time as we experiment further. + +Refer to our new [Tuning caches and cache autotuning](docs/maintenance-synapse.md#tuning-caches-and-cache-autotuning) documentation section for more details. + + # 2024-01-31 ## (Backward-compatibility break) Minor changes necessary for some people serving a static website at the base domain diff --git a/docs/maintenance-synapse.md b/docs/maintenance-synapse.md index ed1dee7c2..93c150022 100644 --- a/docs/maintenance-synapse.md +++ b/docs/maintenance-synapse.md @@ -74,8 +74,32 @@ Synapse's presence feature which tracks which users are online and which are off If you have enough compute resources (CPU & RAM), you can make Synapse better use of them by [enabling load-balancing with workers](configuring-playbook-synapse.md#load-balancing-with-workers). -Tuning Synapse's cache factor can help reduce RAM usage. [See the upstream documentation](https://github.com/element-hq/synapse#help-synapse-is-slow-and-eats-all-my-ram-cpu) for more information on what value to set the cache factor to. Use the variable `matrix_synapse_caches_global_factor` to set the cache factor. - [Tuning your PostgreSQL database](maintenance-postgres.md#tuning-postgresql) could also improve Synapse performance. The playbook tunes the integrated Postgres database automatically, but based on your needs you may wish to adjust tuning variables manually. If you're using an [external Postgres database](configuring-playbook-external-postgres.md), you will aslo need to tune Postgres manually. +### Tuning caches and cache autotuning + +Tuning Synapse's cache factor is useful for performance increases but also as part of controlling Synapse's memory use. Use the variable `matrix_synapse_caches_global_factor` to set the cache factor as part of this process. + +**The playbook defaults the global cache factor to a large value** (e.g. `10`). A smaller value (e.g. `0.5`) will decrease the amount used for caches, but will [not necessarily decrease RAM usage as a whole](https://github.com/matrix-org/synapse/issues/3939). + +Tuning the cache factor is useful only to a limited degree (as its crude to do in isolation) and therefore users who are tuning their cache factor should likely look into tuning autotune variables as well (see below). + +Cache autotuning is **enabled by default** and controlled via the following variables: + +- `matrix_synapse_cache_autotuning_max_cache_memory_usage` - defaults to 1/8 of total RAM with a cap of 2GB; values are specified in bytes +- `matrix_synapse_cache_autotuning_target_cache_memory_usage` - defaults to 1/16 of total RAM with a cap of 1GB; values are specified in bytes +- `matrix_synapse_cache_autotuning_min_cache_ttl` - defaults to `30s` + +You can **learn more about cache-autotuning and the global cache factor settings** in the [Synapse's documentation on caches and associated values](https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#caches-and-associated-values). + +To **disable cache auto-tuning**, unset all values: + +```yml +matrix_synapse_cache_autotuning_max_cache_memory_usage: '' +matrix_synapse_cache_autotuning_target_cache_memory_usage: '' +matrix_synapse_cache_autotuning_min_cache_ttl: '' +``` + +Users who wish to lower Synapse's RAM footprint should look into lowering the global cache factor and tweaking the autotune variables (or disabling auto-tuning). If your cache factor is too low for a given auto tune setting your caches will not reach autotune thresholds and autotune won't be able to do its job. Therefore, when auto-tuning is enabled (which it is by default), it's recommended to have your cache factor be large. + See also [How do I optimize this setup for a low-power server?](faq.md#how-do-i-optimize-this-setup-for-a-low-power-server). diff --git a/roles/custom/matrix-synapse/defaults/main.yml b/roles/custom/matrix-synapse/defaults/main.yml index 13e16b360..9b9f068fd 100644 --- a/roles/custom/matrix-synapse/defaults/main.yml +++ b/roles/custom/matrix-synapse/defaults/main.yml @@ -547,8 +547,23 @@ matrix_synapse_event_cache_size: "100K" # Controls cache sizes for Synapse. # Raise this to increase cache sizes or lower it to potentially lower memory use. -# To learn more, see: https://github.com/matrix-org/synapse/issues/3939 -matrix_synapse_caches_global_factor: 0.5 +# To learn more, see: +# - https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#caching +# - https://github.com/matrix-org/synapse/issues/3939 +# Defaults for timings of caches is from https://tcpipuk.github.io/synapse/deployment/synapse.html +# The idea with the timings used is that you get to evict soon but also you keep stuff around for a long time when its not forced out. +# Long cache lifetimes together with the low minimum TTL allows autotune to be the primary eviction method assuming size of cache is hit before we hit other caps. +matrix_synapse_caches_global_factor: 10 +matrix_synapse_caches_expire_caches: true +matrix_synapse_caches_cache_entry_ttl: "1080m" +matrix_synapse_caches_sync_response_cache_duration: "2m" +matrix_synapse_cache_autotuning_min_cache_ttl: "30s" +# The Cache tune math used here is a derivative of the same math used to autotune sizes for postgres. +# The memtotal variable can in theory be overiden to make Synapse think it has less ram to work with. +# But if your at the point of considering that just override the math or put static values in. +matrix_synapse_memtotal_kb: "{{ ansible_memtotal_mb*1024|int }}" +matrix_synapse_cache_autotuning_max_cache_memory_usage: "{{ 2097152 if (matrix_synapse_memtotal_kb|int/8)/1024 >= 2048 else matrix_synapse_memtotal_kb|int/8 }}" +matrix_synapse_cache_autotuning_target_cache_memory_usage: "{{ 1048576 if (matrix_synapse_memtotal_kb|int/16)/1024 >= 1024 else matrix_synapse_memtotal_kb|int/16 }}" # Controls whether Synapse will federate at all. # Disable this to completely isolate your server from the rest of the Matrix network. diff --git a/roles/custom/matrix-synapse/tasks/validate_config.yml b/roles/custom/matrix-synapse/tasks/validate_config.yml index 2f1a5e1c0..530ce4be6 100644 --- a/roles/custom/matrix-synapse/tasks/validate_config.yml +++ b/roles/custom/matrix-synapse/tasks/validate_config.yml @@ -89,6 +89,9 @@ - {'old': 'matrix_synapse_send_federation', 'new': ''} - {'old': 'matrix_synapse_start_pushers', 'new': ''} - {'old': 'matrix_synapse_spam_checker', 'new': ''} + - {'old': 'matrix_synapse_caches_autotuning_max_cache_memory_usage', 'new': 'matrix_synapse_cache_autotuning_max_cache_memory_usage'} + - {'old': 'matrix_synapse_caches_autotuning_target_cache_memory_usage', 'new': 'matrix_synapse_cache_autotuning_target_cache_memory_usage'} + - {'old': 'matrix_synapse_caches_autotuning_min_cache_ttl', 'new': 'matrix_synapse_cache_autotuning_min_cache_ttl'} - name: (Deprecation) Catch and report renamed settings in matrix_synapse_configuration_extension_yaml ansible.builtin.fail: diff --git a/roles/custom/matrix-synapse/templates/synapse/homeserver.yaml.j2 b/roles/custom/matrix-synapse/templates/synapse/homeserver.yaml.j2 index b6cc6428b..5206dce3f 100644 --- a/roles/custom/matrix-synapse/templates/synapse/homeserver.yaml.j2 +++ b/roles/custom/matrix-synapse/templates/synapse/homeserver.yaml.j2 @@ -760,49 +760,48 @@ federation_domain_whitelist: {{ matrix_synapse_federation_domain_whitelist|to_js # The number of events to cache in memory. Not affected by # caches.global_factor. # -event_cache_size: "{{ matrix_synapse_event_cache_size }}" +event_cache_size: {{ matrix_synapse_event_cache_size | to_json }} caches: - # Controls the global cache factor, which is the default cache factor - # for all caches if a specific factor for that cache is not otherwise - # set. - # - # This can also be set by the "SYNAPSE_CACHE_FACTOR" environment - # variable. Setting by environment variable takes priority over - # setting through the config file. - # - # Defaults to 0.5, which will half the size of all caches. - # - global_factor: {{ matrix_synapse_caches_global_factor }} - - # A dictionary of cache name to cache factor for that individual - # cache. Overrides the global cache factor for a given cache. - # - # These can also be set through environment variables comprised - # of "SYNAPSE_CACHE_FACTOR_" + the name of the cache in capital - # letters and underscores. Setting by environment variable - # takes priority over setting through the config file. - # Ex. SYNAPSE_CACHE_FACTOR_GET_USERS_WHO_SHARE_ROOM_WITH_USER=2.0 - # - # Some caches have '*' and other characters that are not - # alphanumeric or underscores. These caches can be named with or - # without the special characters stripped. For example, to specify - # the cache factor for `*stateGroupCache*` via an environment - # variable would be `SYNAPSE_CACHE_FACTOR_STATEGROUPCACHE=2.0`. - # - per_cache_factors: - #get_users_who_share_room_with_user: 2.0 + # Controls the global cache factor, which is the default cache factor + # for all caches if a specific factor for that cache is not otherwise + # set. + # + # This can also be set by the "SYNAPSE_CACHE_FACTOR" environment + # variable. Setting by environment variable takes priority over + # setting through the config file. + # + # Defaults to 0.5, which will half the size of all caches. + # + global_factor: {{ matrix_synapse_caches_global_factor | to_json }} + # A dictionary of cache name to cache factor for that individual + # cache. Overrides the global cache factor for a given cache. + # + # These can also be set through environment variables comprised + # of "SYNAPSE_CACHE_FACTOR_" + the name of the cache in capital + # letters and underscores. Setting by environment variable + # takes priority over setting through the config file. + # Ex. SYNAPSE_CACHE_FACTOR_GET_USERS_WHO_SHARE_ROOM_WITH_USER=2.0 + # + # Some caches have '*' and other characters that are not + # alphanumeric or underscores. These caches can be named with or + # without the special characters stripped. For example, to specify + # the cache factor for `*stateGroupCache*` via an environment + # variable would be `SYNAPSE_CACHE_FACTOR_STATEGROUPCACHE=2.0`. + # + per_cache_factors: + #get_users_who_share_room_with_user: 2.0 # Controls whether cache entries are evicted after a specified time # period. Defaults to true. Uncomment to disable this feature. # - #expire_caches: false + expire_caches: {{ matrix_synapse_caches_expire_caches | to_json }} # If expire_caches is enabled, this flag controls how long an entry can # be in a cache without having been accessed before being evicted. # Defaults to 30m. Uncomment to set a different time to live for cache entries. # - #cache_entry_ttl: 30m + cache_entry_ttl: {{ matrix_synapse_caches_cache_entry_ttl | to_json }} # Controls how long the results of a /sync request are cached for after # a successful response is returned. A higher duration can help clients with @@ -811,7 +810,12 @@ caches: # By default, this is zero, which means that sync responses are not cached # at all. # - #sync_response_cache_duration: 2m + sync_response_cache_duration: {{ matrix_synapse_caches_sync_response_cache_duration | to_json }} + + cache_autotuning: + max_cache_memory_usage: {{ matrix_synapse_cache_autotuning_max_cache_memory_usage | to_json }} + target_cache_memory_usage: {{ matrix_synapse_cache_autotuning_target_cache_memory_usage | to_json }} + min_cache_ttl: {{ matrix_synapse_cache_autotuning_min_cache_ttl | to_json }} ## Database ## From 8b0e25966e5f036a791613102fdf080bb35988a8 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Wed, 14 Feb 2024 12:20:53 +0200 Subject: [PATCH 14/22] Ensure cache_autotuning.max_cache_memory_usage & cache_autotuning.target_cache_memory_usage have int values Fixes Synapse failing to start with: > ValueError: invalid literal for int() with base 10: '2027264.0 Related to: https://github.com/spantaleev/matrix-docker-ansible-deploy/pull/3017 --- roles/custom/matrix-synapse/defaults/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/custom/matrix-synapse/defaults/main.yml b/roles/custom/matrix-synapse/defaults/main.yml index 9b9f068fd..2a137f006 100644 --- a/roles/custom/matrix-synapse/defaults/main.yml +++ b/roles/custom/matrix-synapse/defaults/main.yml @@ -562,8 +562,8 @@ matrix_synapse_cache_autotuning_min_cache_ttl: "30s" # The memtotal variable can in theory be overiden to make Synapse think it has less ram to work with. # But if your at the point of considering that just override the math or put static values in. matrix_synapse_memtotal_kb: "{{ ansible_memtotal_mb*1024|int }}" -matrix_synapse_cache_autotuning_max_cache_memory_usage: "{{ 2097152 if (matrix_synapse_memtotal_kb|int/8)/1024 >= 2048 else matrix_synapse_memtotal_kb|int/8 }}" -matrix_synapse_cache_autotuning_target_cache_memory_usage: "{{ 1048576 if (matrix_synapse_memtotal_kb|int/16)/1024 >= 1024 else matrix_synapse_memtotal_kb|int/16 }}" +matrix_synapse_cache_autotuning_max_cache_memory_usage: "{{ (2097152 if (matrix_synapse_memtotal_kb|int/8)/1024 >= 2048 else matrix_synapse_memtotal_kb|int/8) | int }}" +matrix_synapse_cache_autotuning_target_cache_memory_usage: "{{ (1048576 if (matrix_synapse_memtotal_kb|int/16)/1024 >= 1024 else matrix_synapse_memtotal_kb|int/16) | int }}" # Controls whether Synapse will federate at all. # Disable this to completely isolate your server from the rest of the Matrix network. From 1cd82cf06823fb7680fb4404b8bfab794cf6c3c3 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Wed, 14 Feb 2024 12:25:34 +0200 Subject: [PATCH 15/22] Fix unit inaccuracy in documentation for cache-autotuning-related variables Related to: https://github.com/spantaleev/matrix-docker-ansible-deploy/pull/3017 --- CHANGELOG.md | 4 ++-- docs/maintenance-synapse.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 153be11fa..dee6890f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,8 +9,8 @@ The playbook has always used a very conservative cache factor (`matrix_synapse_c The playbook now uses **a 20x larger cache factor** (currently `10`), adjusts a few other cache-related variables, and **enables cache auto-tuning** via the following variables: -- `matrix_synapse_cache_autotuning_max_cache_memory_usage` - defaults to 1/8 of total RAM with a cap of 2GB; values are specified in bytes -- `matrix_synapse_cache_autotuning_target_cache_memory_usage` - defaults to 1/16 of total RAM with a cap of 1GB; values are specified in bytes +- `matrix_synapse_cache_autotuning_max_cache_memory_usage` - defaults to 1/8 of total RAM with a cap of 2GB; values are specified in KB +- `matrix_synapse_cache_autotuning_target_cache_memory_usage` - defaults to 1/16 of total RAM with a cap of 1GB; values are specified in KB - `matrix_synapse_cache_autotuning_min_cache_ttl` - defaults to `30s` These values should be good defaults for most servers, but may change over time as we experiment further. diff --git a/docs/maintenance-synapse.md b/docs/maintenance-synapse.md index 93c150022..d620e2758 100644 --- a/docs/maintenance-synapse.md +++ b/docs/maintenance-synapse.md @@ -86,8 +86,8 @@ Tuning the cache factor is useful only to a limited degree (as its crude to do i Cache autotuning is **enabled by default** and controlled via the following variables: -- `matrix_synapse_cache_autotuning_max_cache_memory_usage` - defaults to 1/8 of total RAM with a cap of 2GB; values are specified in bytes -- `matrix_synapse_cache_autotuning_target_cache_memory_usage` - defaults to 1/16 of total RAM with a cap of 1GB; values are specified in bytes +- `matrix_synapse_cache_autotuning_max_cache_memory_usage` - defaults to 1/8 of total RAM with a cap of 2GB; values are specified in KB +- `matrix_synapse_cache_autotuning_target_cache_memory_usage` - defaults to 1/16 of total RAM with a cap of 1GB; values are specified in KB - `matrix_synapse_cache_autotuning_min_cache_ttl` - defaults to `30s` You can **learn more about cache-autotuning and the global cache factor settings** in the [Synapse's documentation on caches and associated values](https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#caches-and-associated-values). From 3d73ec887aec27483642820269ff832c349ae857 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Wed, 14 Feb 2024 13:36:20 +0200 Subject: [PATCH 16/22] Ensure integer values are used for cache_autotuning settings in homeserver.yaml We're casting everything it `int`, but since Jinja templates are involved, these values end up as strings anyway. Doing `| int | to_json` is good, but we should only cast numbers to integer, not empty strings, as that (0) may be interpreted differently by Synapse. To turn of auto-tuning, one is possibly supposed to pass empty strings: > This option defaults to off, enable it by providing values for the sub-options listed below. It could be that `0` is also considered "no value provided", but I haven't verified that. Related to https://github.com/spantaleev/matrix-docker-ansible-deploy/pull/3017 --- .../matrix-synapse/templates/synapse/homeserver.yaml.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/custom/matrix-synapse/templates/synapse/homeserver.yaml.j2 b/roles/custom/matrix-synapse/templates/synapse/homeserver.yaml.j2 index 5206dce3f..bf2a359f5 100644 --- a/roles/custom/matrix-synapse/templates/synapse/homeserver.yaml.j2 +++ b/roles/custom/matrix-synapse/templates/synapse/homeserver.yaml.j2 @@ -813,8 +813,8 @@ caches: sync_response_cache_duration: {{ matrix_synapse_caches_sync_response_cache_duration | to_json }} cache_autotuning: - max_cache_memory_usage: {{ matrix_synapse_cache_autotuning_max_cache_memory_usage | to_json }} - target_cache_memory_usage: {{ matrix_synapse_cache_autotuning_target_cache_memory_usage | to_json }} + max_cache_memory_usage: {{ ((matrix_synapse_cache_autotuning_max_cache_memory_usage | int | to_json) if matrix_synapse_cache_autotuning_max_cache_memory_usage else '') }} + target_cache_memory_usage: {{ ((matrix_synapse_cache_autotuning_target_cache_memory_usage | int | to_json) if matrix_synapse_cache_autotuning_target_cache_memory_usage else '') }} min_cache_ttl: {{ matrix_synapse_cache_autotuning_min_cache_ttl | to_json }} From d0cda27c9799bed5bf0229a629b044485024b7d4 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Wed, 14 Feb 2024 13:39:40 +0200 Subject: [PATCH 17/22] Fix Synapse cache auto-tuning variables to use bytes, not KB Fixup for https://github.com/spantaleev/matrix-docker-ansible-deploy/pull/3017 This reverts 1cd82cf06823fb7680 and also multiplies results by `1024` so as to pass bytes to Synapse, not KB (as done before). 1cd82cf06823fb7680 was correctly documenting what we were doing (passing KB values), but that's incorrect. Synapse's Config Conventions (https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#config-conventions) are supposed to clear it up, but they don't currently state what happens when you pass a plain number (without a unit suffix). Thankfully, the source code tells us: https://github.com/element-hq/synapse/blob/bc1db16086d0718c9c0bb61b32b825ba62049bb0/synapse/config/_base.py#L181-L206 > If an integer is provided it is treated as bytes and is unchanged. > > String byte sizes can have a suffix of ... > No suffix is understood as a plain byte count. We were previously passing strings, but that has been improved in 3d73ec887aec27483. Regardless, non-suffixed values seem to be treated as bytes by Synapse, so this patch changes the variables to use bytes. Moreover, we're moving from `matrix_synapse_memtotal_kb` to `matrix_synapse_cache_size_calculations_memtotal_bytes` as working with the base unit everywhere is preferrable. Here, we also introduce 2 new variables to allow for the caps to be tweaked: - `matrix_synapse_cache_size_calculations_max_cache_memory_usage_cap_bytes` - `matrix_synapse_cache_size_calculations_target_cache_memory_usage_cap_bytes` --- CHANGELOG.md | 4 +-- docs/maintenance-synapse.md | 4 +-- roles/custom/matrix-synapse/defaults/main.yml | 34 +++++++++++++++---- .../matrix-synapse/tasks/validate_config.yml | 1 + 4 files changed, 33 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dee6890f8..153be11fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,8 +9,8 @@ The playbook has always used a very conservative cache factor (`matrix_synapse_c The playbook now uses **a 20x larger cache factor** (currently `10`), adjusts a few other cache-related variables, and **enables cache auto-tuning** via the following variables: -- `matrix_synapse_cache_autotuning_max_cache_memory_usage` - defaults to 1/8 of total RAM with a cap of 2GB; values are specified in KB -- `matrix_synapse_cache_autotuning_target_cache_memory_usage` - defaults to 1/16 of total RAM with a cap of 1GB; values are specified in KB +- `matrix_synapse_cache_autotuning_max_cache_memory_usage` - defaults to 1/8 of total RAM with a cap of 2GB; values are specified in bytes +- `matrix_synapse_cache_autotuning_target_cache_memory_usage` - defaults to 1/16 of total RAM with a cap of 1GB; values are specified in bytes - `matrix_synapse_cache_autotuning_min_cache_ttl` - defaults to `30s` These values should be good defaults for most servers, but may change over time as we experiment further. diff --git a/docs/maintenance-synapse.md b/docs/maintenance-synapse.md index d620e2758..93c150022 100644 --- a/docs/maintenance-synapse.md +++ b/docs/maintenance-synapse.md @@ -86,8 +86,8 @@ Tuning the cache factor is useful only to a limited degree (as its crude to do i Cache autotuning is **enabled by default** and controlled via the following variables: -- `matrix_synapse_cache_autotuning_max_cache_memory_usage` - defaults to 1/8 of total RAM with a cap of 2GB; values are specified in KB -- `matrix_synapse_cache_autotuning_target_cache_memory_usage` - defaults to 1/16 of total RAM with a cap of 1GB; values are specified in KB +- `matrix_synapse_cache_autotuning_max_cache_memory_usage` - defaults to 1/8 of total RAM with a cap of 2GB; values are specified in bytes +- `matrix_synapse_cache_autotuning_target_cache_memory_usage` - defaults to 1/16 of total RAM with a cap of 1GB; values are specified in bytes - `matrix_synapse_cache_autotuning_min_cache_ttl` - defaults to `30s` You can **learn more about cache-autotuning and the global cache factor settings** in the [Synapse's documentation on caches and associated values](https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#caches-and-associated-values). diff --git a/roles/custom/matrix-synapse/defaults/main.yml b/roles/custom/matrix-synapse/defaults/main.yml index 2a137f006..b60347fbb 100644 --- a/roles/custom/matrix-synapse/defaults/main.yml +++ b/roles/custom/matrix-synapse/defaults/main.yml @@ -557,13 +557,35 @@ matrix_synapse_caches_global_factor: 10 matrix_synapse_caches_expire_caches: true matrix_synapse_caches_cache_entry_ttl: "1080m" matrix_synapse_caches_sync_response_cache_duration: "2m" + +# Controls how much memory this role thinks is available for cache-size-related calculations. +# By default, all of the server's memory is taken into account, but you can adjust this. +# You can also go for directly adjusting cache-sizes (matrix_synapse_cache_autotuning_max_cache_memory_usage, matrix_synapse_cache_autotuning_target_cache_memory_usage) instead of adjusting this. +matrix_synapse_cache_size_calculations_memtotal_bytes: "{{ (ansible_memtotal_mb * 1024 * 1024) | int }}" + +# Controls the cap to use for matrix_synapse_cache_autotuning_max_cache_memory_usage. +matrix_synapse_cache_size_calculations_max_cache_memory_usage_cap_bytes: "{{ (2 * 1024 * 1024 * 1024) }}" # 2GB + +# Controls the cap to use for matrix_synapse_cache_autotuning_target_cache_memory_usage. +matrix_synapse_cache_size_calculations_target_cache_memory_usage_cap_bytes: "{{ (1 * 1024 * 1024 * 1024) }}" # 1GB + matrix_synapse_cache_autotuning_min_cache_ttl: "30s" -# The Cache tune math used here is a derivative of the same math used to autotune sizes for postgres. -# The memtotal variable can in theory be overiden to make Synapse think it has less ram to work with. -# But if your at the point of considering that just override the math or put static values in. -matrix_synapse_memtotal_kb: "{{ ansible_memtotal_mb*1024|int }}" -matrix_synapse_cache_autotuning_max_cache_memory_usage: "{{ (2097152 if (matrix_synapse_memtotal_kb|int/8)/1024 >= 2048 else matrix_synapse_memtotal_kb|int/8) | int }}" -matrix_synapse_cache_autotuning_target_cache_memory_usage: "{{ (1048576 if (matrix_synapse_memtotal_kb|int/16)/1024 >= 1024 else matrix_synapse_memtotal_kb|int/16) | int }}" + +matrix_synapse_cache_autotuning_max_cache_memory_usage: |- + {{ + [ + (((matrix_synapse_cache_size_calculations_memtotal_bytes | int) / 8) | int), + (matrix_synapse_cache_size_calculations_max_cache_memory_usage_cap_bytes | int), + ] | min + }} + +matrix_synapse_cache_autotuning_target_cache_memory_usage: |- + {{ + [ + (((matrix_synapse_cache_size_calculations_memtotal_bytes | int) / 16) | int), + (matrix_synapse_cache_size_calculations_target_cache_memory_usage_cap_bytes | int), + ] | min + }} # Controls whether Synapse will federate at all. # Disable this to completely isolate your server from the rest of the Matrix network. diff --git a/roles/custom/matrix-synapse/tasks/validate_config.yml b/roles/custom/matrix-synapse/tasks/validate_config.yml index 530ce4be6..d29a70b1d 100644 --- a/roles/custom/matrix-synapse/tasks/validate_config.yml +++ b/roles/custom/matrix-synapse/tasks/validate_config.yml @@ -92,6 +92,7 @@ - {'old': 'matrix_synapse_caches_autotuning_max_cache_memory_usage', 'new': 'matrix_synapse_cache_autotuning_max_cache_memory_usage'} - {'old': 'matrix_synapse_caches_autotuning_target_cache_memory_usage', 'new': 'matrix_synapse_cache_autotuning_target_cache_memory_usage'} - {'old': 'matrix_synapse_caches_autotuning_min_cache_ttl', 'new': 'matrix_synapse_cache_autotuning_min_cache_ttl'} + - {'old': 'matrix_synapse_memtotal_kb', 'new': ''} - name: (Deprecation) Catch and report renamed settings in matrix_synapse_configuration_extension_yaml ansible.builtin.fail: From 972fc6b914fefd92a62e6dd0a7f4144840af5818 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Wed, 14 Feb 2024 13:46:55 +0200 Subject: [PATCH 18/22] Fix ansible-lint-reported error related to spaces before comments --- roles/custom/matrix-synapse/defaults/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/custom/matrix-synapse/defaults/main.yml b/roles/custom/matrix-synapse/defaults/main.yml index b60347fbb..9bdafe207 100644 --- a/roles/custom/matrix-synapse/defaults/main.yml +++ b/roles/custom/matrix-synapse/defaults/main.yml @@ -564,10 +564,10 @@ matrix_synapse_caches_sync_response_cache_duration: "2m" matrix_synapse_cache_size_calculations_memtotal_bytes: "{{ (ansible_memtotal_mb * 1024 * 1024) | int }}" # Controls the cap to use for matrix_synapse_cache_autotuning_max_cache_memory_usage. -matrix_synapse_cache_size_calculations_max_cache_memory_usage_cap_bytes: "{{ (2 * 1024 * 1024 * 1024) }}" # 2GB +matrix_synapse_cache_size_calculations_max_cache_memory_usage_cap_bytes: "{{ (2 * 1024 * 1024 * 1024) }}" # 2GB # Controls the cap to use for matrix_synapse_cache_autotuning_target_cache_memory_usage. -matrix_synapse_cache_size_calculations_target_cache_memory_usage_cap_bytes: "{{ (1 * 1024 * 1024 * 1024) }}" # 1GB +matrix_synapse_cache_size_calculations_target_cache_memory_usage_cap_bytes: "{{ (1 * 1024 * 1024 * 1024) }}" # 1GB matrix_synapse_cache_autotuning_min_cache_ttl: "30s" From b5f4030cd0d8462ae38c35a08b8b9680a4ca7157 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Wed, 14 Feb 2024 15:50:56 +0200 Subject: [PATCH 19/22] Update supported distros list I've just tested Rocky Linux v9 and it seems to work. I suppose the Docker situation (https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/300) on RHEL v8 has improved, so it probably works too. I see no reason AlmaLinux and other RHEL derivatives wouldn't work, but I have neither tested them, nor have confirmation from others about it. It's mostly a matter of us being able to install: - Docker, via https://github.com/geerlingguy/ansible-role-docker which seems to support various distros - a few other packages (systemd-timesyncd, etc). The list of supported distros has been reordered alphabetically. I've heard reports of SUSE Linux working well too, so it may also be added if confirmed again. Closes https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/300 --- docs/prerequisites.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/prerequisites.md b/docs/prerequisites.md index d68704397..d1259e6fc 100644 --- a/docs/prerequisites.md +++ b/docs/prerequisites.md @@ -2,11 +2,11 @@ To install Matrix services using this Ansible playbook, you need: -- (Recommended) An **x86** server ([What kind of server specs do I need?](faq.md#what-kind-of-server-specs-do-i-need)) running one of these operating systems: - - **CentOS** (7 only for now; [8 is not yet supported](https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/300)) - - **Debian** (10/Buster or newer) - - **Ubuntu** (18.04 or newer, although [20.04 may be problematic](ansible.md#supported-ansible-versions)) +- (Recommended) An **x86** server ([What kind of server specs do I need?](faq.md#what-kind-of-server-specs-do-i-need)) running one of these operating systems that make use of [systemd](https://systemd.io/): - **Archlinux** + - **CentOS**, **Rocky Linux**, **AlmaLinux**, or possibly other RHEL alternatives (although your mileage may vary) + - **Debian** (10/Buster or newer) + - **Ubuntu** (18.04 or newer, although [20.04 may be problematic](ansible.md#supported-ansible-versions) if you run the Ansible playbook on it) Generally, newer is better. We only strive to support released stable versions of distributions, not betas or pre-releases. This playbook can take over your whole server or co-exist with other services that you have there. From c203bef912682d737d3fab9a68115cfcd8a873fb Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Wed, 14 Feb 2024 18:40:57 +0200 Subject: [PATCH 20/22] Downgrade synapse-admin (0.9.1 -> 0.8.7) 0.9.x is broken: https://github.com/Awesome-Technologies/synapse-admin/issues/468 A fix for this major regression got merged 2 hours after 0.9.1 was tagged, but one week later there's still no 0.9.2. Shame. --- roles/custom/matrix-synapse-admin/defaults/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/custom/matrix-synapse-admin/defaults/main.yml b/roles/custom/matrix-synapse-admin/defaults/main.yml index c69e66be2..1dee1d756 100644 --- a/roles/custom/matrix-synapse-admin/defaults/main.yml +++ b/roles/custom/matrix-synapse-admin/defaults/main.yml @@ -12,7 +12,7 @@ matrix_synapse_admin_container_image_self_build: false matrix_synapse_admin_container_image_self_build_repo: "https://github.com/Awesome-Technologies/synapse-admin.git" # renovate: datasource=docker depName=awesometechnologies/synapse-admin -matrix_synapse_admin_version: 0.9.1 +matrix_synapse_admin_version: 0.8.7 matrix_synapse_admin_docker_image: "{{ matrix_synapse_admin_docker_image_name_prefix }}awesometechnologies/synapse-admin:{{ matrix_synapse_admin_version }}" matrix_synapse_admin_docker_image_name_prefix: "{{ 'localhost/' if matrix_synapse_admin_container_image_self_build else matrix_container_global_registry_prefix }}" matrix_synapse_admin_docker_image_force_pull: "{{ matrix_synapse_admin_docker_image.endswith(':latest') }}" From e19db8a563b218a6afda77a12e8fe4966959219f Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 14 Feb 2024 22:41:48 +0000 Subject: [PATCH 21/22] Update nginx Docker tag to v1.25.4 --- .../matrix-synapse-reverse-proxy-companion/defaults/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/custom/matrix-synapse-reverse-proxy-companion/defaults/main.yml b/roles/custom/matrix-synapse-reverse-proxy-companion/defaults/main.yml index b4ab73b0d..463bb2eb5 100644 --- a/roles/custom/matrix-synapse-reverse-proxy-companion/defaults/main.yml +++ b/roles/custom/matrix-synapse-reverse-proxy-companion/defaults/main.yml @@ -11,7 +11,7 @@ matrix_synapse_reverse_proxy_companion_enabled: true # renovate: datasource=docker depName=nginx -matrix_synapse_reverse_proxy_companion_version: 1.25.3-alpine +matrix_synapse_reverse_proxy_companion_version: 1.25.4-alpine matrix_synapse_reverse_proxy_companion_base_path: "{{ matrix_synapse_base_path }}/reverse-proxy-companion" matrix_synapse_reverse_proxy_companion_confd_path: "{{ matrix_synapse_reverse_proxy_companion_base_path }}/conf.d" From fbe848182582dbdc4120d21ae04174e3cd924e80 Mon Sep 17 00:00:00 2001 From: adam-kress Date: Thu, 15 Feb 2024 08:10:16 -0500 Subject: [PATCH 22/22] Upgrade Jitsi (v9220-0 -> v9258-0) --- requirements.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.yml b/requirements.yml index 2ed436791..125d75f9d 100644 --- a/requirements.yml +++ b/requirements.yml @@ -25,7 +25,7 @@ version: v10.3.1-2 name: grafana - src: git+https://github.com/mother-of-all-self-hosting/ansible-role-jitsi.git - version: v9220-0 + version: v9258-0 name: jitsi - src: git+https://gitlab.com/etke.cc/roles/ntfy.git version: v2.8.0-1