From feb4b5555e67fc7d193be3b87b9a0bdd7ab92352 Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Mon, 24 Jun 2019 16:39:12 +0100 Subject: [PATCH 01/11] Make it clearer that the template dir is relative to synapse's root dir --- docs/sample_config.yaml | 55 +++++++++++++++++------------------ synapse/config/emailconfig.py | 2 +- 2 files changed, 28 insertions(+), 29 deletions(-) diff --git a/docs/sample_config.yaml b/docs/sample_config.yaml index 92a23245ff99..4d7e6f3eb5ac 100644 --- a/docs/sample_config.yaml +++ b/docs/sample_config.yaml @@ -23,6 +23,29 @@ server_name: "SERVERNAME" # pid_file: DATADIR/homeserver.pid +# CPU affinity mask. Setting this restricts the CPUs on which the +# process will be scheduled. It is represented as a bitmask, with the +# lowest order bit corresponding to the first logical CPU and the +# highest order bit corresponding to the last logical CPU. Not all CPUs +# may exist on a given system but a mask may specify more CPUs than are +# present. +# +# For example: +# 0x00000001 is processor #0, +# 0x00000003 is processors #0 and #1, +# 0xFFFFFFFF is all processors (#0 through #31). +# +# Pinning a Python process to a single CPU is desirable, because Python +# is inherently single-threaded due to the GIL, and can suffer a +# 30-40% slowdown due to cache blow-out and thread context switching +# if the scheduler happens to schedule the underlying threads across +# different cores. See +# https://www.mirantis.com/blog/improve-performance-python-programs-restricting-single-cpu/. +# +# This setting requires the affinity package to be installed! +# +#cpu_affinity: 0xFFFFFFFF + # The path to the web client which will be served at /_matrix/client/ # if 'webclient' is configured under the 'listeners' configuration. # @@ -54,15 +77,11 @@ pid_file: DATADIR/homeserver.pid # #require_auth_for_profile_requests: true -# If set to 'false', requires authentication to access the server's public rooms -# directory through the client API. Defaults to 'true'. -# -#allow_public_rooms_without_auth: false - -# If set to 'false', forbids any other homeserver to fetch the server's public -# rooms directory via federation. Defaults to 'true'. +# If set to 'true', requires authentication to access the server's +# public rooms directory through the client API, and forbids any other +# homeserver to fetch it via federation. Defaults to 'false'. # -#allow_public_rooms_over_federation: false +#restrict_public_rooms_to_local_users: true # The default room version for newly created rooms. # @@ -406,13 +425,6 @@ acme: # #domain: matrix.example.com - # file to use for the account key. This will be generated if it doesn't - # exist. - # - # If unspecified, we will use CONFDIR/client.key. - # - account_key_file: DATADIR/acme_account.key - # List of allowed TLS fingerprints for this server to publish along # with the signing keys for this server. Other matrix servers that # make HTTPS requests to this server will check that the TLS @@ -1339,16 +1351,3 @@ password_config: # alias: "*" # room_id: "*" # action: allow - - -# Server admins can define a Python module that implements extra rules for -# allowing or denying incoming events. In order to work, this module needs to -# override the methods defined in synapse/events/third_party_rules.py. -# -# This feature is designed to be used in closed federations only, where each -# participating server enforces the same rules. -# -#third_party_event_rules: -# module: "my_custom_project.SuperRulesSet" -# config: -# example_option: 'things' diff --git a/synapse/config/emailconfig.py b/synapse/config/emailconfig.py index 07df7b7173c1..67b023223a64 100644 --- a/synapse/config/emailconfig.py +++ b/synapse/config/emailconfig.py @@ -261,7 +261,7 @@ def default_config(self, config_dir_path, server_name, **kwargs): # # Template directory. All template files should be stored within this # # directory # # - # #template_dir: res/templates + # #template_dir: synapse/res/templates # # # Templates for email notifications # # From 0ff332018201078e27026a76cfb01d5802318a38 Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Mon, 24 Jun 2019 16:42:23 +0100 Subject: [PATCH 02/11] Add changelog --- changelog.d/5543.misc | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/5543.misc diff --git a/changelog.d/5543.misc b/changelog.d/5543.misc new file mode 100644 index 000000000000..54c6bb3bd7dd --- /dev/null +++ b/changelog.d/5543.misc @@ -0,0 +1 @@ +Make the config clearer in that email.template_dir was relative to the project's root directory, not the `synapse/` folder. From 0b64176b705196d0e76cea578ea33d1e26e531b1 Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Mon, 24 Jun 2019 16:45:02 +0100 Subject: [PATCH 03/11] Fix sample config --- docs/sample_config.yaml | 58 +++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/docs/sample_config.yaml b/docs/sample_config.yaml index 4d7e6f3eb5ac..35f77ab6e03e 100644 --- a/docs/sample_config.yaml +++ b/docs/sample_config.yaml @@ -23,29 +23,6 @@ server_name: "SERVERNAME" # pid_file: DATADIR/homeserver.pid -# CPU affinity mask. Setting this restricts the CPUs on which the -# process will be scheduled. It is represented as a bitmask, with the -# lowest order bit corresponding to the first logical CPU and the -# highest order bit corresponding to the last logical CPU. Not all CPUs -# may exist on a given system but a mask may specify more CPUs than are -# present. -# -# For example: -# 0x00000001 is processor #0, -# 0x00000003 is processors #0 and #1, -# 0xFFFFFFFF is all processors (#0 through #31). -# -# Pinning a Python process to a single CPU is desirable, because Python -# is inherently single-threaded due to the GIL, and can suffer a -# 30-40% slowdown due to cache blow-out and thread context switching -# if the scheduler happens to schedule the underlying threads across -# different cores. See -# https://www.mirantis.com/blog/improve-performance-python-programs-restricting-single-cpu/. -# -# This setting requires the affinity package to be installed! -# -#cpu_affinity: 0xFFFFFFFF - # The path to the web client which will be served at /_matrix/client/ # if 'webclient' is configured under the 'listeners' configuration. # @@ -77,11 +54,15 @@ pid_file: DATADIR/homeserver.pid # #require_auth_for_profile_requests: true -# If set to 'true', requires authentication to access the server's -# public rooms directory through the client API, and forbids any other -# homeserver to fetch it via federation. Defaults to 'false'. +# If set to 'false', requires authentication to access the server's public rooms +# directory through the client API. Defaults to 'true'. # -#restrict_public_rooms_to_local_users: true +#allow_public_rooms_without_auth: false + +# If set to 'false', forbids any other homeserver to fetch the server's public +# rooms directory via federation. Defaults to 'true'. +# +#allow_public_rooms_over_federation: false # The default room version for newly created rooms. # @@ -425,6 +406,13 @@ acme: # #domain: matrix.example.com + # file to use for the account key. This will be generated if it doesn't + # exist. + # + # If unspecified, we will use CONFDIR/client.key. + # + account_key_file: DATADIR/acme_account.key + # List of allowed TLS fingerprints for this server to publish along # with the signing keys for this server. Other matrix servers that # make HTTPS requests to this server will check that the TLS @@ -1110,7 +1098,7 @@ password_config: # # Template directory. All template files should be stored within this # # directory # # -# #template_dir: res/templates +# #template_dir: synapse/res/templates # # # Templates for email notifications # # @@ -1351,3 +1339,17 @@ password_config: # alias: "*" # room_id: "*" # action: allow + + +# Server admins can define a Python module that implements extra rules for +# allowing or denying incoming events. In order to work, this module needs to +# override the methods defined in synapse/events/third_party_rules.py. +# +# This feature is designed to be used in closed federations only, where each +# participating server enforces the same rules. +# +#third_party_event_rules: +# module: "my_custom_project.SuperRulesSet" +# config: +# example_option: 'things' + From 4ec2cb82240f96a8df6da5a0b18d4284b3782242 Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Mon, 24 Jun 2019 16:45:58 +0100 Subject: [PATCH 04/11] Remove whitespace at the end of sample config --- docs/sample_config.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/sample_config.yaml b/docs/sample_config.yaml index 35f77ab6e03e..a422d99e9d77 100644 --- a/docs/sample_config.yaml +++ b/docs/sample_config.yaml @@ -1352,4 +1352,3 @@ password_config: # module: "my_custom_project.SuperRulesSet" # config: # example_option: 'things' - From cc0ad07df92be9b2d93296e60865e9d1b5e351aa Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Mon, 24 Jun 2019 16:48:53 +0100 Subject: [PATCH 05/11] Update changelog --- changelog.d/5543.misc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.d/5543.misc b/changelog.d/5543.misc index 54c6bb3bd7dd..793620a73120 100644 --- a/changelog.d/5543.misc +++ b/changelog.d/5543.misc @@ -1 +1 @@ -Make the config clearer in that email.template_dir was relative to the project's root directory, not the `synapse/` folder. +Make the config clearer in that email.template_dir is relative to the Synapse's root directory, not the `synapse/` folder within it. From 91fa5ea0cd9aefdb6e6aec9d51dc97fa129ea918 Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Mon, 24 Jun 2019 18:10:01 +0100 Subject: [PATCH 06/11] Update with more information about the template_dir --- synapse/config/emailconfig.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/synapse/config/emailconfig.py b/synapse/config/emailconfig.py index 67b023223a64..80fd6fd17ff8 100644 --- a/synapse/config/emailconfig.py +++ b/synapse/config/emailconfig.py @@ -66,6 +66,7 @@ def read_config(self, config, **kwargs): # work for the same reason.) if not template_dir: template_dir = pkg_resources.resource_filename("synapse", "res/templates") + raise ConfigError(template_dir) self.email_template_dir = os.path.abspath(template_dir) @@ -233,11 +234,13 @@ def default_config(self, config_dir_path, server_name, **kwargs): # app_name: Matrix # # # Enable email notifications by default + # # # notif_for_new_users: True # # # Defining a custom URL for Riot is only needed if email notifications # # should contain links to a self-hosted installation of Riot; when set # # the "app_name" setting is ignored + # # # riot_base_url: "http://localhost/riot" # # # Enable sending password reset emails via the configured, trusted @@ -250,18 +253,24 @@ def default_config(self, config_dir_path, server_name, **kwargs): # # # # If this option is set to false and SMTP options have not been # # configured, resetting user passwords via email will be disabled + # # # #trust_identity_server_for_password_resets: false # # # Configure the time that a validation email or text message code # # will expire after sending # # # # This is currently used for password resets + # # # #validation_token_lifetime: 1h # # # Template directory. All template files should be stored within this # # directory # # - # #template_dir: synapse/res/templates + # # If not set, the default location is `(location of Synapse's + # # virtualenv)/res/templates`. Using an absolute path is recommended + # # when changing this option from the default. + # # + # #template_dir: synapse-env/res/templates # # # Templates for email notifications # # From 949c73defd127b2f5c02e6966484cc1e387d58e8 Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Mon, 24 Jun 2019 18:12:14 +0100 Subject: [PATCH 07/11] Regen sample config --- docs/sample_config.yaml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/sample_config.yaml b/docs/sample_config.yaml index a422d99e9d77..36ddeeefaf1a 100644 --- a/docs/sample_config.yaml +++ b/docs/sample_config.yaml @@ -1070,11 +1070,13 @@ password_config: # app_name: Matrix # # # Enable email notifications by default +# # # notif_for_new_users: True # # # Defining a custom URL for Riot is only needed if email notifications # # should contain links to a self-hosted installation of Riot; when set # # the "app_name" setting is ignored +# # # riot_base_url: "http://localhost/riot" # # # Enable sending password reset emails via the configured, trusted @@ -1087,18 +1089,24 @@ password_config: # # # # If this option is set to false and SMTP options have not been # # configured, resetting user passwords via email will be disabled +# # # #trust_identity_server_for_password_resets: false # # # Configure the time that a validation email or text message code # # will expire after sending # # # # This is currently used for password resets +# # # #validation_token_lifetime: 1h # # # Template directory. All template files should be stored within this # # directory # # -# #template_dir: synapse/res/templates +# # If not set, the default location is `(location of Synapse's +# # virtualenv)/res/templates`. Using an absolute path is recommended +# # when changing this option from the default. +# # +# #template_dir: synapse-env/res/templates # # # Templates for email notifications # # @@ -1121,7 +1129,6 @@ password_config: # #password_reset_template_success_html: password_reset_success.html # #password_reset_template_failure_html: password_reset_failure.html - #password_providers: # - module: "ldap_auth_provider.LdapAuthProvider" # config: From 3bd8b678e31c85dab4c9c3f5991dcf69ccca8bf3 Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Mon, 24 Jun 2019 18:15:06 +0100 Subject: [PATCH 08/11] Remove debugging exception --- synapse/config/emailconfig.py | 1 - 1 file changed, 1 deletion(-) diff --git a/synapse/config/emailconfig.py b/synapse/config/emailconfig.py index 80fd6fd17ff8..3aff6a03b9a9 100644 --- a/synapse/config/emailconfig.py +++ b/synapse/config/emailconfig.py @@ -66,7 +66,6 @@ def read_config(self, config, **kwargs): # work for the same reason.) if not template_dir: template_dir = pkg_resources.resource_filename("synapse", "res/templates") - raise ConfigError(template_dir) self.email_template_dir = os.path.abspath(template_dir) From 0ec9bb310d58bdfe399c401f13123c5c55c09af0 Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Mon, 24 Jun 2019 18:15:48 +0100 Subject: [PATCH 09/11] Fix sample config --- docs/sample_config.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/sample_config.yaml b/docs/sample_config.yaml index 36ddeeefaf1a..f6450272a0e1 100644 --- a/docs/sample_config.yaml +++ b/docs/sample_config.yaml @@ -1129,6 +1129,7 @@ password_config: # #password_reset_template_success_html: password_reset_success.html # #password_reset_template_failure_html: password_reset_failure.html + #password_providers: # - module: "ldap_auth_provider.LdapAuthProvider" # config: From e77231d53df166f7da2d440ee874672b9c5161f7 Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Thu, 27 Jun 2019 13:33:16 +0100 Subject: [PATCH 10/11] better wording --- synapse/config/emailconfig.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/synapse/config/emailconfig.py b/synapse/config/emailconfig.py index 3aff6a03b9a9..9591daba0db7 100644 --- a/synapse/config/emailconfig.py +++ b/synapse/config/emailconfig.py @@ -263,13 +263,13 @@ def default_config(self, config_dir_path, server_name, **kwargs): # #validation_token_lifetime: 1h # # # Template directory. All template files should be stored within this - # # directory + # # directory. If not set, default templates from within the Synapse + # # package will be used # # - # # If not set, the default location is `(location of Synapse's - # # virtualenv)/res/templates`. Using an absolute path is recommended - # # when changing this option from the default. + # # For the list of default templates, please see + # # https://github.com/matrix-org/synapse/tree/master/synapse/res/templates # # - # #template_dir: synapse-env/res/templates + # #template_dir: res/templates # # # Templates for email notifications # # From b2a65ed4a29ad9ae2e39417974d8dbf9587e7a6d Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Thu, 27 Jun 2019 13:38:12 +0100 Subject: [PATCH 11/11] sample config --- docs/sample_config.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/sample_config.yaml b/docs/sample_config.yaml index f6450272a0e1..a0f81e10a0be 100644 --- a/docs/sample_config.yaml +++ b/docs/sample_config.yaml @@ -1100,13 +1100,13 @@ password_config: # #validation_token_lifetime: 1h # # # Template directory. All template files should be stored within this -# # directory +# # directory. If not set, default templates from within the Synapse +# # package will be used # # -# # If not set, the default location is `(location of Synapse's -# # virtualenv)/res/templates`. Using an absolute path is recommended -# # when changing this option from the default. +# # For the list of default templates, please see +# # https://github.com/matrix-org/synapse/tree/master/synapse/res/templates # # -# #template_dir: synapse-env/res/templates +# #template_dir: res/templates # # # Templates for email notifications # #