aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Alexander <neilalexander@users.noreply.github.com>2022-05-12 12:05:55 +0100
committerGitHub <noreply@github.com>2022-05-12 12:05:55 +0100
commitfc670f03a2ac13adc7e022bcb21b82ad874d6706 (patch)
treed844a59c9efb0867ad15d953d1dfcdc6d59e6fd0
parent0d1505a4c1ccca7c5cf4a64faf5d1044d8aa96f9 (diff)
Separate sample configs for monolith and polylith (#2456)
* Update sample configs * Update references * Remove sections that are dead in the monolith sample
-rw-r--r--README.md2
-rw-r--r--build/docker/README.md7
-rw-r--r--build/docker/config/dendrite.yaml348
-rw-r--r--dendrite-sample.monolith.yaml279
-rw-r--r--dendrite-sample.polylith.yaml (renamed from dendrite-config.yaml)215
-rw-r--r--docs/FAQ.md2
-rw-r--r--docs/installation/7_configuration.md10
7 files changed, 377 insertions, 486 deletions
diff --git a/README.md b/README.md
index 9c38dee9..ed09e971 100644
--- a/README.md
+++ b/README.md
@@ -71,7 +71,7 @@ $ ./bin/generate-keys --tls-cert server.crt --tls-key server.key
# Copy and modify the config file - you'll need to set a server name and paths to the keys
# at the very least, along with setting up the database connection strings.
-$ cp dendrite-config.yaml dendrite.yaml
+$ cp dendrite-sample.monolith.yaml dendrite.yaml
# Build and run the server:
$ ./bin/dendrite-monolith-server --tls-cert server.crt --tls-key server.key --config dendrite.yaml
diff --git a/build/docker/README.md b/build/docker/README.md
index 7425d96c..261519fd 100644
--- a/build/docker/README.md
+++ b/build/docker/README.md
@@ -27,8 +27,7 @@ There are three sample `docker-compose` files:
The `docker-compose` files refer to the `/etc/dendrite` volume as where the
runtime config should come from. The mounted folder must contain:
-- `dendrite.yaml` configuration file (from the [Docker config folder](https://github.com/matrix-org/dendrite/tree/master/build/docker/config)
- sample in the `build/docker/config` folder of this repository.)
+- `dendrite.yaml` configuration file (based on one of the sample config files)
- `matrix_key.pem` server key, as generated using `cmd/generate-keys`
- `server.crt` certificate file
- `server.key` private key file for the above certificate
@@ -49,7 +48,7 @@ The key files will now exist in your current working directory, and can be mount
## Starting Dendrite as a monolith deployment
-Create your config based on the [`dendrite.yaml`](https://github.com/matrix-org/dendrite/tree/master/build/docker/config) configuration file in the `build/docker/config` folder of this repository.
+Create your config based on the [`dendrite-sample.monolith.yaml`](https://github.com/matrix-org/dendrite/blob/main/dendrite-sample.monolith.yaml) sample configuration file.
Then start the deployment:
@@ -59,7 +58,7 @@ docker-compose -f docker-compose.monolith.yml up
## Starting Dendrite as a polylith deployment
-Create your config based on the [`dendrite-config.yaml`](https://github.com/matrix-org/dendrite/tree/master/build/docker/config) configuration file in the `build/docker/config` folder of this repository.
+Create your config based on the [`dendrite-sample.polylith.yaml`](https://github.com/matrix-org/dendrite/blob/main/dendrite-sample.polylith.yaml) sample configuration file.
Then start the deployment:
diff --git a/build/docker/config/dendrite.yaml b/build/docker/config/dendrite.yaml
deleted file mode 100644
index 94dcf455..00000000
--- a/build/docker/config/dendrite.yaml
+++ /dev/null
@@ -1,348 +0,0 @@
-# This is the Dendrite configuration file.
-#
-# The configuration is split up into sections - each Dendrite component has a
-# configuration section, in addition to the "global" section which applies to
-# all components.
-#
-# At a minimum, to get started, you will need to update the settings in the
-# "global" section for your deployment, and you will need to check that the
-# database "connection_string" line in each component section is correct.
-#
-# Each component with a "database" section can accept the following formats
-# for "connection_string":
-# SQLite: file:filename.db
-# file:///path/to/filename.db
-# PostgreSQL: postgresql://user:pass@hostname/database?params=...
-#
-# SQLite is embedded into Dendrite and therefore no further prerequisites are
-# needed for the database when using SQLite mode. However, performance with
-# PostgreSQL is significantly better and recommended for multi-user deployments.
-# SQLite is typically around 20-30% slower than PostgreSQL when tested with a
-# small number of users and likely will perform worse still with a higher volume
-# of users.
-#
-# The "max_open_conns" and "max_idle_conns" settings configure the maximum
-# number of open/idle database connections. The value 0 will use the database
-# engine default, and a negative value will use unlimited connections. The
-# "conn_max_lifetime" option controls the maximum length of time a database
-# connection can be idle in seconds - a negative value is unlimited.
-
-# The version of the configuration file.
-version: 2
-
-# Global Matrix configuration. This configuration applies to all components.
-global:
- # The domain name of this homeserver.
- server_name: example.com
-
- # The path to the signing private key file, used to sign requests and events.
- private_key: matrix_key.pem
-
- # The paths and expiry timestamps (as a UNIX timestamp in millisecond precision)
- # to old signing private keys that were formerly in use on this domain. These
- # keys will not be used for federation request or event signing, but will be
- # provided to any other homeserver that asks when trying to verify old events.
- # old_private_keys:
- # - private_key: old_matrix_key.pem
- # expired_at: 1601024554498
-
- # How long a remote server can cache our server signing key before requesting it
- # again. Increasing this number will reduce the number of requests made by other
- # servers for our key but increases the period that a compromised key will be
- # considered valid by other homeservers.
- key_validity_period: 168h0m0s
-
- # The server name to delegate server-server communications to, with optional port
- # e.g. localhost:443
- well_known_server_name: ""
-
- # Lists of domains that the server will trust as identity servers to verify third
- # party identifiers such as phone numbers and email addresses.
- trusted_third_party_id_servers:
- - matrix.org
- - vector.im
-
- # Disables federation. Dendrite will not be able to make any outbound HTTP requests
- # to other servers and the federation API will not be exposed.
- disable_federation: false
-
- # Configures the handling of presence events.
- presence:
- # Whether inbound presence events are allowed, e.g. receiving presence events from other servers
- enable_inbound: false
- # Whether outbound presence events are allowed, e.g. sending presence events to other servers
- enable_outbound: false
-
- # Configuration for NATS JetStream
- jetstream:
- # A list of NATS Server addresses to connect to. If none are specified, an
- # internal NATS server will be started automatically when running Dendrite
- # in monolith mode. It is required to specify the address of at least one
- # NATS Server node if running in polylith mode.
- addresses:
- - jetstream:4222
-
- # Keep all NATS streams in memory, rather than persisting it to the storage
- # path below. This option is present primarily for integration testing and
- # should not be used on a real world Dendrite deployment.
- in_memory: false
-
- # Persistent directory to store JetStream streams in. This directory
- # should be preserved across Dendrite restarts.
- storage_path: ./
-
- # The prefix to use for stream names for this homeserver - really only
- # useful if running more than one Dendrite on the same NATS deployment.
- topic_prefix: Dendrite
-
- # Configuration for Prometheus metric collection.
- metrics:
- # Whether or not Prometheus metrics are enabled.
- enabled: false
-
- # HTTP basic authentication to protect access to monitoring.
- basic_auth:
- username: metrics
- password: metrics
-
- # DNS cache options. The DNS cache may reduce the load on DNS servers
- # if there is no local caching resolver available for use.
- dns_cache:
- # Whether or not the DNS cache is enabled.
- enabled: false
-
- # Maximum number of entries to hold in the DNS cache, and
- # for how long those items should be considered valid in seconds.
- cache_size: 256
- cache_lifetime: 300
-
-# Configuration for the Appservice API.
-app_service_api:
- internal_api:
- listen: http://0.0.0.0:7777
- connect: http://appservice_api:7777
- database:
- connection_string: postgresql://dendrite:itsasecret@postgres/dendrite_appservice?sslmode=disable
- max_open_conns: 10
- max_idle_conns: 2
- conn_max_lifetime: -1
-
- # Appservice configuration files to load into this homeserver.
- config_files: []
-
-# Configuration for the Client API.
-client_api:
- internal_api:
- listen: http://0.0.0.0:7771
- connect: http://client_api:7771
- external_api:
- listen: http://0.0.0.0:8071
-
- # Prevents new users from being able to register on this homeserver, except when
- # using the registration shared secret below.
- registration_disabled: true
-
- # If set, allows registration by anyone who knows the shared secret, regardless of
- # whether registration is otherwise disabled.
- registration_shared_secret: ""
-
- # Whether to require reCAPTCHA for registration.
- enable_registration_captcha: false
-
- # Settings for ReCAPTCHA.
- recaptcha_public_key: ""
- recaptcha_private_key: ""
- recaptcha_bypass_secret: ""
- recaptcha_siteverify_api: ""
-
- # TURN server information that this homeserver should send to clients.
- turn:
- turn_user_lifetime: ""
- turn_uris: []
- turn_shared_secret: ""
- turn_username: ""
- turn_password: ""
-
- # Settings for rate-limited endpoints. Rate limiting will kick in after the
- # threshold number of "slots" have been taken by requests from a specific
- # host. Each "slot" will be released after the cooloff time in milliseconds.
- rate_limiting:
- enabled: true
- threshold: 5
- cooloff_ms: 500
-
-# Configuration for the Federation API.
-federation_api:
- internal_api:
- listen: http://0.0.0.0:7772
- connect: http://federation_api:7772
- external_api:
- listen: http://0.0.0.0:8072
- database:
- connection_string: postgresql://dendrite:itsasecret@postgres/dendrite_federationapi?sslmode=disable
- max_open_conns: 10
- max_idle_conns: 2
- conn_max_lifetime: -1
-
- # How many times we will try to resend a failed transaction to a specific server. The
- # backoff is 2**x seconds, so 1 = 2 seconds, 2 = 4 seconds, 3 = 8 seconds etc.
- send_max_retries: 16
-
- # Disable the validation of TLS certificates of remote federated homeservers. Do not
- # enable this option in production as it presents a security risk!
- disable_tls_validation: false
-
- # Use the following proxy server for outbound federation traffic.
- proxy_outbound:
- enabled: false
- protocol: http
- host: localhost
- port: 8080
-
- # Perspective keyservers to use as a backup when direct key fetches fail. This may
- # be required to satisfy key requests for servers that are no longer online when
- # joining some rooms.
- key_perspectives:
- - server_name: matrix.org
- keys:
- - key_id: ed25519:auto
- public_key: Noi6WqcDj0QmPxCNQqgezwTlBKrfqehY1u2FyWP9uYw
- - key_id: ed25519:a_RXGa
- public_key: l8Hft5qXKn1vfHrg3p4+W8gELQVo8N13JkluMfmn2sQ
-
- # This option will control whether Dendrite will prefer to look up keys directly
- # or whether it should try perspective servers first, using direct fetches as a
- # last resort.
- prefer_direct_fetch: false
-
-# Configuration for the Key Server (for end-to-end encryption).
-key_server:
- internal_api:
- listen: http://0.0.0.0:7779
- connect: http://key_server:7779
- database:
- connection_string: postgresql://dendrite:itsasecret@postgres/dendrite_keyserver?sslmode=disable
- max_open_conns: 10
- max_idle_conns: 2
- conn_max_lifetime: -1
-
-# Configuration for the Media API.
-media_api:
- internal_api:
- listen: http://0.0.0.0:7774
- connect: http://media_api:7774
- external_api:
- listen: http://0.0.0.0:8074
- database:
- connection_string: postgresql://dendrite:itsasecret@postgres/dendrite_mediaapi?sslmode=disable
- max_open_conns: 10
- max_idle_conns: 2
- conn_max_lifetime: -1
-
- # Storage path for uploaded media. May be relative or absolute.
- base_path: /var/dendrite/media
-
- # The maximum allowed file size (in bytes) for media uploads to this homeserver
- # (0 = unlimited).
- max_file_size_bytes: 10485760
-
- # Whether to dynamically generate thumbnails if needed.
- dynamic_thumbnails: false
-
- # The maximum number of simultaneous thumbnail generators to run.
- max_thumbnail_generators: 10
-
- # A list of thumbnail sizes to be generated for media content.
- thumbnail_sizes:
- - width: 32
- height: 32
- method: crop
- - width: 96
- height: 96
- method: crop
- - width: 640
- height: 480
- method: scale
-
-# Configuration for experimental MSC's
-mscs:
- # A list of enabled MSC's
- # Currently valid values are:
- # - msc2836 (Threading, see https://github.com/matrix-org/matrix-doc/pull/2836)
- # - msc2946 (Spaces Summary, see https://github.com/matrix-org/matrix-doc/pull/2946)
- mscs: []
- database:
- connection_string: postgresql://dendrite:itsasecret@postgres/dendrite_mscs?sslmode=disable
- max_open_conns: 5
- max_idle_conns: 2
- conn_max_lifetime: -1
-
-# Configuration for the Room Server.
-room_server:
- internal_api:
- listen: http://0.0.0.0:7770
- connect: http://room_server:7770
- database:
- connection_string: postgresql://dendrite:itsasecret@postgres/dendrite_roomserver?sslmode=disable
- max_open_conns: 10
- max_idle_conns: 2
- conn_max_lifetime: -1
-
-# Configuration for the Sync API.
-sync_api:
- internal_api:
- listen: http://0.0.0.0:7773
- connect: http://sync_api:7773
- external_api:
- listen: http://0.0.0.0:8073
- database:
- connection_string: postgresql://dendrite:itsasecret@postgres/dendrite_syncapi?sslmode=disable
- max_open_conns: 10
- max_idle_conns: 2
- conn_max_lifetime: -1
-
-# Configuration for the User API.
-user_api:
- internal_api:
- listen: http://0.0.0.0:7781
- connect: http://user_api:7781
- account_database:
- connection_string: postgresql://dendrite:itsasecret@postgres/dendrite_userapi_accounts?sslmode=disable
- max_open_conns: 10
- max_idle_conns: 2
- conn_max_lifetime: -1
-
-# Configuration for the Push Server API.
-push_server:
- internal_api:
- listen: http://localhost:7782
- connect: http://localhost:7782
- database:
- connection_string: postgresql://dendrite:itsasecret@postgres/dendrite_pushserver?sslmode=disable
- max_open_conns: 10
- max_idle_conns: 2
- conn_max_lifetime: -1
-
-# Configuration for Opentracing.
-# See https://github.com/matrix-org/dendrite/tree/master/docs/tracing for information on
-# how this works and how to set it up.
-tracing:
- enabled: false
- jaeger:
- serviceName: ""
- disabled: false
- rpc_metrics: false
- tags: []
- sampler: null
- reporter: null
- headers: null
- baggage_restrictions: null
- throttler: null
-
-# Logging configuration, in addition to the standard logging that is sent to
-# stdout by Dendrite.
-logging:
- - type: file
- level: info
- params:
- path: /var/log/dendrite
diff --git a/dendrite-sample.monolith.yaml b/dendrite-sample.monolith.yaml
new file mode 100644
index 00000000..e974dbcb
--- /dev/null
+++ b/dendrite-sample.monolith.yaml
@@ -0,0 +1,279 @@
+# This is the Dendrite configuration file.
+#
+# The configuration is split up into sections - each Dendrite component has a
+# configuration section, in addition to the "global" section which applies to
+# all components.
+
+# The version of the configuration file.
+version: 2
+
+# Global Matrix configuration. This configuration applies to all components.
+global:
+ # The domain name of this homeserver.
+ server_name: localhost
+
+ # The path to the signing private key file, used to sign requests and events.
+ # Note that this is NOT the same private key as used for TLS! To generate a
+ # signing key, use "./bin/generate-keys --private-key matrix_key.pem".
+ private_key: matrix_key.pem
+
+ # The paths and expiry timestamps (as a UNIX timestamp in millisecond precision)
+ # to old signing private keys that were formerly in use on this domain. These
+ # keys will not be used for federation request or event signing, but will be
+ # provided to any other homeserver that asks when trying to verify old events.
+ old_private_keys:
+ # - private_key: old_matrix_key.pem
+ # expired_at: 1601024554498
+
+ # How long a remote server can cache our server signing key before requesting it
+ # again. Increasing this number will reduce the number of requests made by other
+ # servers for our key but increases the period that a compromised key will be
+ # considered valid by other homeservers.
+ key_validity_period: 168h0m0s
+
+ # Global database connection pool, for PostgreSQL monolith deployments only. If
+ # this section is populated then you can omit the "database" blocks in all other
+ # sections. For polylith deployments, or monolith deployments using SQLite databases,
+ # you must configure the "database" block for each component instead.
+ database:
+ connection_string: postgresql://username:password@hostname/dendrite?sslmode=disable
+ max_open_conns: 100
+ max_idle_conns: 5
+ conn_max_lifetime: -1
+
+ # The server name to delegate server-server communications to, with optional port
+ # e.g. localhost:443
+ well_known_server_name: ""
+
+ # Lists of domains that the server will trust as identity servers to verify third
+ # party identifiers such as phone numbers and email addresses.
+ trusted_third_party_id_servers:
+ - matrix.org
+ - vector.im
+
+ # Disables federation. Dendrite will not be able to communicate with other servers
+ # in the Matrix federation and the federation API will not be exposed.
+ disable_federation: false
+
+ # Configures the handling of presence events. Inbound controls whether we receive
+ # presence events from other servers, outbound controls whether we send presence
+ # events for our local users to other servers.
+ presence:
+ enable_inbound: false
+ enable_outbound: false
+
+ # Configures phone-home statistics reporting. These statistics contain the server
+ # name, number of active users and some information on your deployment config.
+ # We use this information to understand how Dendrite is being used in the wild.
+ report_stats:
+ enabled: false
+ endpoint: https://matrix.org/report-usage-stats/push
+
+ # Server notices allows server admins to send messages to all users on the server.
+ server_notices:
+ enabled: false
+ # The local part, display name and avatar URL (as a mxc:// URL) for the user that
+ # will send the server notices. These are visible to all users on the deployment.
+ local_part: "_server"
+ display_name: "Server Alerts"
+ avatar_url: ""
+ # The room name to be used when sending server notices. This room name will
+ # appear in user clients.
+ room_name: "Server Alerts"
+
+ # Configuration for NATS JetStream
+ jetstream:
+ # A list of NATS Server addresses to connect to. If none are specified, an
+ # internal NATS server will be started automatically when running Dendrite in
+ # monolith mode. For polylith deployments, it is required to specify the address
+ # of at least one NATS Server node.
+ addresses:
+ # - localhost:4222
+
+ # Persistent directory to store JetStream streams in. This directory should be
+ # preserved across Dendrite restarts.
+ storage_path: ./
+
+ # The prefix to use for stream names for this homeserver - really only useful
+ # if you are running more than one Dendrite server on the same NATS deployment.
+ topic_prefix: Dendrite
+
+ # Configuration for Prometheus metric collection.
+ metrics:
+ enabled: false
+ basic_auth:
+ username: metrics
+ password: metrics
+
+ # Optional DNS cache. The DNS cache may reduce the load on DNS servers if there
+ # is no local caching resolver available for use.
+ dns_cache:
+ enabled: false
+ cache_size: 256
+ cache_lifetime: "5m" # 5 minutes; https://pkg.go.dev/time@master#ParseDuration
+
+# Configuration for the Appservice API.
+app_service_api:
+ # Disable the validation of TLS certificates of appservices. This is
+ # not recommended in production since it may allow appservice traffic
+ # to be sent to an insecure endpoint.
+ disable_tls_validation: false
+
+ # Appservice configuration files to load into this homeserver.
+ config_files:
+ # - /path/to/appservice_registration.yaml
+
+# Configuration for the Client API.
+client_api:
+ # Prevents new users from being able to register on this homeserver, except when
+ # using the registration shared secret below.
+ registration_disabled: true
+
+ # Prevents new guest accounts from being created. Guest registration is also
+ # disabled implicitly by setting 'registration_disabled' above.
+ guests_disabled: true
+
+ # If set, allows registration by anyone who knows the shared secret, regardless
+ # of whether registration is otherwise disabled.
+ registration_shared_secret: ""
+
+ # Whether to require reCAPTCHA for registration. If you have enabled registration
+ # then this is HIGHLY RECOMMENDED to reduce the risk of your homeserver being used
+ # for coordinated spam attacks.
+ enable_registration_captcha: false
+
+ # Settings for ReCAPTCHA.
+ recaptcha_public_key: ""
+ recaptcha_private_key: ""
+ recaptcha_bypass_secret: ""
+ recaptcha_siteverify_api: ""
+
+ # TURN server information that this homeserver should send to clients.
+ turn:
+ turn_user_lifetime: ""
+ turn_uris:
+ # - turn:turn.server.org?transport=udp
+ # - turn:turn.server.org?transport=tcp
+ turn_shared_secret: ""
+ turn_username: ""
+ turn_password: ""
+
+ # Settings for rate-limited endpoints. Rate limiting kicks in after the threshold
+ # number of "slots" have been taken by requests from a specific host. Each "slot"
+ # will be released after the cooloff time in milliseconds.
+ rate_limiting:
+ enabled: true
+ threshold: 5
+ cooloff_ms: 500
+
+# Configuration for the Federation API.
+federation_api:
+ # How many times we will try to resend a failed transaction to a specific server. The
+ # backoff is 2**x seconds, so 1 = 2 seconds, 2 = 4 seconds, 3 = 8 seconds etc. Once
+ # the max retries are exceeded, Dendrite will no longer try to send transactions to
+ # that server until it comes back to life and connects to us again.
+ send_max_retries: 16
+
+ # Disable the validation of TLS certificates of remote federated homeservers. Do not
+ # enable this option in production as it presents a security risk!
+ disable_tls_validation: false
+
+ # Perspective keyservers to use as a backup when direct key fetches fail. This may
+ # be required to satisfy key requests for servers that are no longer online when
+ # joining some rooms.
+ key_perspectives:
+ - server_name: matrix.org
+ keys:
+ - key_id: ed25519:auto
+ public_key: Noi6WqcDj0QmPxCNQqgezwTlBKrfqehY1u2FyWP9uYw
+ - key_id: ed25519:a_RXGa
+ public_key: l8Hft5qXKn1vfHrg3p4+W8gELQVo8N13JkluMfmn2sQ
+
+ # This option will control whether Dendrite will prefer to look up keys directly
+ # or whether it should try perspective servers first, using direct fetches as a
+ # last resort.
+ prefer_direct_fetch: false
+
+# Configuration for the Media API.
+media_api:
+ # Storage path for uploaded media. May be relative or absolute.
+ base_path: ./media_store
+
+ # The maximum allowed file size (in bytes) for media uploads to this homeserver
+ # (0 = unlimited). If using a reverse proxy, ensure it allows requests at least
+ #this large (e.g. the client_max_body_size setting in nginx).
+ max_file_size_bytes: 10485760
+
+ # Whether to dynamically generate thumbnails if needed.
+ dynamic_thumbnails: false
+
+ # The maximum number of simultaneous thumbnail generators to run.
+ max_thumbnail_generators: 10
+
+ # A list of thumbnail sizes to be generated for media content.
+ thumbnail_sizes:
+ - width: 32
+ height: 32
+ method: crop
+ - width: 96
+ height: 96
+ method: crop
+ - width: 640
+ height: 480
+ method: scale
+
+# Configuration for enabling experimental MSCs on this homeserver.
+mscs:
+ mscs:
+ # - msc2836 # (Threading, see https://github.com/matrix-org/matrix-doc/pull/2836)
+ # - msc2946 # (Spaces Summary, see https://github.com/matrix-org/matrix-doc/pull/2946)
+
+# Configuration for the Sync API.
+sync_api:
+ # This option controls which HTTP header to inspect to find the real remote IP
+ # address of the client. This is likely required if Dendrite is running behind
+ # a reverse proxy server.
+ # real_ip_header: X-Real-IP
+
+# Configuration for the User API.
+user_api:
+ # The cost when hashing passwords on registration/login. Default: 10. Min: 4, Max: 31
+ # See https://pkg.go.dev/golang.org/x/crypto/bcrypt for more information.
+ # Setting this lower makes registration/login consume less CPU resources at the cost
+ # of security should the database be compromised. Setting this higher makes registration/login
+ # consume more CPU resources but makes it harder to brute force password hashes. This value
+ # can be lowered if performing tests or on embedded Dendrite instances (e.g WASM builds).
+ bcrypt_cost: 10
+
+ # The length of time that a token issued for a relying party from
+ # /_matrix/client/r0/user/{userId}/openid/request_token endpoint
+ # is considered to be valid in milliseconds.
+ # The default lifetime is 3600000ms (60 minutes).
+ # openid_token_lifetime_ms: 3600000
+
+# Configuration for Opentracing.
+# See https://github.com/matrix-org/dendrite/tree/master/docs/tracing for information on
+# how this works and how to set it up.
+tracing:
+ enabled: false
+ jaeger:
+ serviceName: ""
+ disabled: false
+ rpc_metrics: false
+ tags: []
+ sampler: null
+ reporter: null
+ headers: null
+ baggage_restrictions: null
+ throttler: null
+
+# Logging configuration. The "std" logging type controls the logs being sent to
+# stdout. The "file" logging type controls logs being written to a log folder on
+# the disk. Supported log levels are "debug", "info", "warn", "error".
+logging:
+ - type: std
+ level: info
+ - type: file
+ level: info
+ params:
+ path: ./logs
diff --git a/dendrite-config.yaml b/dendrite-sample.polylith.yaml
index 7709e0c8..4b67aaa9 100644
--- a/dendrite-config.yaml
+++ b/dendrite-sample.polylith.yaml
@@ -3,29 +3,6 @@
# The configuration is split up into sections - each Dendrite component has a
# configuration section, in addition to the "global" section which applies to
# all components.
-#
-# At a minimum, to get started, you will need to update the settings in the
-# "global" section for your deployment, and you will need to check that the
-# database "connection_string" line in each component section is correct.
-#
-# Each component with a "database" section can accept the following formats
-# for "connection_string":
-# SQLite: file:filename.db
-# file:///path/to/filename.db
-# PostgreSQL: postgresql://user:pass@hostname/database?params=...
-#
-# SQLite is embedded into Dendrite and therefore no further prerequisites are
-# needed for the database when using SQLite mode. However, performance with
-# PostgreSQL is significantly better and recommended for multi-user deployments.
-# SQLite is typically around 20-30% slower than PostgreSQL when tested with a
-# small number of users and likely will perform worse still with a higher volume
-# of users.
-#
-# The "max_open_conns" and "max_idle_conns" settings configure the maximum
-# number of open/idle database connections. The value 0 will use the database
-# engine default, and a negative value will use unlimited connections. The
-# "conn_max_lifetime" option controls the maximum length of time a database
-# connection can be idle in seconds - a negative value is unlimited.
# The version of the configuration file.
version: 2
@@ -44,9 +21,9 @@ global:
# to old signing private keys that were formerly in use on this domain. These
# keys will not be used for federation request or event signing, but will be
# provided to any other homeserver that asks when trying to verify old events.
- # old_private_keys:
- # - private_key: old_matrix_key.pem
- # expired_at: 1601024554498
+ old_private_keys:
+ # - private_key: old_matrix_key.pem
+ # expired_at: 1601024554498
# How long a remote server can cache our server signing key before requesting it
# again. Increasing this number will reduce the number of requests made by other
@@ -54,16 +31,6 @@ global:
# considered valid by other homeservers.
key_validity_period: 168h0m0s
- # Global database connection pool, for PostgreSQL monolith deployments only. If
- # this section is populated then you can omit the "database" blocks in all other
- # sections. For polylith deployments, or monolith deployments using SQLite databases,
- # you must configure the "database" block for each component instead.
- # database:
- # connection_string: postgres://user:pass@hostname/database?sslmode=disable
- # max_open_conns: 100
- # max_idle_conns: 5
- # conn_max_lifetime: -1
-
# The server name to delegate server-server communications to, with optional port
# e.g. localhost:443
well_known_server_name: ""
@@ -74,105 +41,90 @@ global:
- matrix.org
- vector.im
- # Disables federation. Dendrite will not be able to make any outbound HTTP requests
- # to other servers and the federation API will not be exposed.
+ # Disables federation. Dendrite will not be able to communicate with other servers
+ # in the Matrix federation and the federation API will not be exposed.
disable_federation: false
- # Configures the handling of presence events.
+ # Configures the handling of presence events. Inbound controls whether we receive
+ # presence events from other servers, outbound controls whether we send presence
+ # events for our local users to other servers.
presence:
- # Whether inbound presence events are allowed, e.g. receiving presence events from other servers
enable_inbound: false
- # Whether outbound presence events are allowed, e.g. sending presence events to other servers
enable_outbound: false
- # Configures opt-in anonymous stats reporting.
+ # Configures phone-home statistics reporting. These statistics contain the server
+ # name, number of active users and some information on your deployment config.
+ # We use this information to understand how Dendrite is being used in the wild.
report_stats:
- # Whether this instance sends anonymous usage stats
enabled: false
-
- # The endpoint to report the anonymized homeserver usage statistics to.
- # Defaults to https://matrix.org/report-usage-stats/push
endpoint: https://matrix.org/report-usage-stats/push
- # Server notices allows server admins to send messages to all users.
+ # Server notices allows server admins to send messages to all users on the server.
server_notices:
enabled: false
- # The server localpart to be used when sending notices, ensure this is not yet taken
+ # The local part, display name and avatar URL (as a mxc:// URL) for the user that
+ # will send the server notices. These are visible to all users on the deployment.
local_part: "_server"
- # The displayname to be used when sending notices
- display_name: "Server alerts"
- # The mxid of the avatar to use
+ display_name: "Server Alerts"
avatar_url: ""
- # The roomname to be used when creating messages
+ # The room name to be used when sending server notices. This room name will
+ # appear in user clients.
room_name: "Server Alerts"
# Configuration for NATS JetStream
jetstream:
# A list of NATS Server addresses to connect to. If none are specified, an
- # internal NATS server will be started automatically when running Dendrite
- # in monolith mode. It is required to specify the address of at least one
- # NATS Server node if running in polylith mode.
+ # internal NATS server will be started automatically when running Dendrite in
+ # monolith mode. For polylith deployments, it is required to specify the address
+ # of at least one NATS Server node.
addresses:
- # - localhost:4222
-
- # Keep all NATS streams in memory, rather than persisting it to the storage
- # path below. This option is present primarily for integration testing and
- # should not be used on a real world Dendrite deployment.
- in_memory: false
+ - hostname:4222
- # Persistent directory to store JetStream streams in. This directory
- # should be preserved across Dendrite restarts.
- storage_path: ./
-
- # The prefix to use for stream names for this homeserver - really only
- # useful if running more than one Dendrite on the same NATS deployment.
+ # The prefix to use for stream names for this homeserver - really only useful
+ # if you are running more than one Dendrite server on the same NATS deployment.
topic_prefix: Dendrite
# Configuration for Prometheus metric collection.
metrics:
- # Whether or not Prometheus metrics are enabled.
enabled: false
-
- # HTTP basic authentication to protect access to monitoring.
basic_auth:
username: metrics
password: metrics
- # DNS cache options. The DNS cache may reduce the load on DNS servers
- # if there is no local caching resolver available for use.
+ # Optional DNS cache. The DNS cache may reduce the load on DNS servers if there
+ # is no local caching resolver available for use.
dns_cache:
- # Whether or not the DNS cache is enabled.
enabled: false
-
- # Maximum number of entries to hold in the DNS cache, and
- # for how long those items should be considered valid in seconds.
cache_size: 256
- cache_lifetime: "5m" # 5minutes; see https://pkg.go.dev/time@master#ParseDuration for more
+ cache_lifetime: "5m" # 5 minutes; https://pkg.go.dev/time@master#ParseDuration
# Configuration for the Appservice API.
app_service_api:
internal_api:
- listen: http://localhost:7777 # Only used in polylith deployments
- connect: http://localhost:7777 # Only used in polylith deployments
+ listen: http://[::]:7777 # The listen address for incoming API requests
+ connect: http://app_service_api:7777 # The connect address for other components to use
+
+ # Database configuration for this component.
database:
- connection_string: file:appservice.db
+ connection_string: postgresql://username@password:hostname/dendrite_appservice?sslmode=disable
max_open_conns: 10
max_idle_conns: 2
conn_max_lifetime: -1
# Disable the validation of TLS certificates of appservices. This is
# not recommended in production since it may allow appservice traffic
- # to be sent to an unverified endpoint.
+ # to be sent to an insecure endpoint.
disable_tls_validation: false
# Appservice configuration files to load into this homeserver.
- config_files: []
+ config_files:
+ # - /path/to/appservice_registration.yaml
# Configuration for the Client API.
client_api:
internal_api:
- listen: http://localhost:7771 # Only used in polylith deployments
- connect: http://localhost:7771 # Only used in polylith deployments
+ listen: http://[::]:7771 # The listen address for incoming API requests
+ connect: http://client_api:7771 # The connect address for other components to use
external_api:
listen: http://[::]:8071
@@ -184,11 +136,13 @@ client_api:
# disabled implicitly by setting 'registration_disabled' above.
guests_disabled: true
- # If set, allows registration by anyone who knows the shared secret, regardless of
- # whether registration is otherwise disabled.
+ # If set, allows registration by anyone who knows the shared secret, regardless
+ # of whether registration is otherwise disabled.
registration_shared_secret: ""
- # Whether to require reCAPTCHA for registration.
+ # Whether to require reCAPTCHA for registration. If you have enabled registration
+ # then this is HIGHLY RECOMMENDED to reduce the risk of your homeserver being used
+ # for coordinated spam attacks.
enable_registration_captcha: false
# Settings for ReCAPTCHA.
@@ -200,14 +154,16 @@ client_api:
# TURN server information that this homeserver should send to clients.
turn:
turn_user_lifetime: ""
- turn_uris: []
+ turn_uris:
+ # - turn:turn.server.org?transport=udp
+ # - turn:turn.server.org?transport=tcp
turn_shared_secret: ""
turn_username: ""
turn_password: ""
- # Settings for rate-limited endpoints. Rate limiting will kick in after the
- # threshold number of "slots" have been taken by requests from a specific
- # host. Each "slot" will be released after the cooloff time in milliseconds.
+ # Settings for rate-limited endpoints. Rate limiting kicks in after the threshold
+ # number of "slots" have been taken by requests from a specific host. Each "slot"
+ # will be released after the cooloff time in milliseconds.
rate_limiting:
enabled: true
threshold: 5
@@ -216,18 +172,20 @@ client_api:
# Configuration for the Federation API.
federation_api:
internal_api:
- listen: http://localhost:7772 # Only used in polylith deployments
- connect: http://localhost:7772 # Only used in polylith deployments
+ listen: http://[::]:7772 # The listen address for incoming API requests
+ connect: http://federation_api:7772 # The connect address for other components to use
external_api:
listen: http://[::]:8072
database:
- connection_string: file:federationapi.db
+ connection_string: postgresql://username@password:hostname/dendrite_federationapi?sslmode=disable
max_open_conns: 10
max_idle_conns: 2
conn_max_lifetime: -1
# How many times we will try to resend a failed transaction to a specific server. The
- # backoff is 2**x seconds, so 1 = 2 seconds, 2 = 4 seconds, 3 = 8 seconds etc.
+ # backoff is 2**x seconds, so 1 = 2 seconds, 2 = 4 seconds, 3 = 8 seconds etc. Once
+ # the max retries are exceeded, Dendrite will no longer try to send transactions to
+ # that server until it comes back to life and connects to us again.
send_max_retries: 16
# Disable the validation of TLS certificates of remote federated homeservers. Do not
@@ -253,10 +211,10 @@ federation_api:
# Configuration for the Key Server (for end-to-end encryption).
key_server:
internal_api:
- listen: http://localhost:7779 # Only used in polylith deployments
- connect: http://localhost:7779 # Only used in polylith deployments
+ listen: http://[::]:7779 # The listen address for incoming API requests
+ connect: http://key_server:7779 # The connect address for other components to use
database:
- connection_string: file:keyserver.db
+ connection_string: postgresql://username@password:hostname/dendrite_keyserver?sslmode=disable
max_open_conns: 10
max_idle_conns: 2
conn_max_lifetime: -1
@@ -264,12 +222,12 @@ key_server:
# Configuration for the Media API.
media_api:
internal_api:
- listen: http://localhost:7774 # Only used in polylith deployments
- connect: http://localhost:7774 # Only used in polylith deployments
+ listen: http://[::]:7774 # The listen address for incoming API requests
+ connect: http://media_api:7774 # The connect address for other components to use
external_api:
listen: http://[::]:8074
database:
- connection_string: file:mediaapi.db
+ connection_string: postgresql://username@password:hostname/dendrite_mediaapi?sslmode=disable
max_open_conns: 5
max_idle_conns: 2
conn_max_lifetime: -1
@@ -278,8 +236,8 @@ media_api:
base_path: ./media_store
# The maximum allowed file size (in bytes) for media uploads to this homeserver
- # (0 = unlimited). If using a reverse proxy, ensure it allows requests at
- # least this large (e.g. client_max_body_size in nginx.)
+ # (0 = unlimited). If using a reverse proxy, ensure it allows requests at least
+ #this large (e.g. the client_max_body_size setting in nginx).
max_file_size_bytes: 10485760
# Whether to dynamically generate thumbnails if needed.
@@ -300,15 +258,13 @@ media_api:
height: 480
method: scale
-# Configuration for experimental MSC's
+# Configuration for enabling experimental MSCs on this homeserver.
mscs:
- # A list of enabled MSC's
- # Currently valid values are:
- # - msc2836 (Threading, see https://github.com/matrix-org/matrix-doc/pull/2836)
- # - msc2946 (Spaces Summary, see https://github.com/matrix-org/matrix-doc/pull/2946)
- mscs: []
+ mscs:
+ # - msc2836 # (Threading, see https://github.com/matrix-org/matrix-doc/pull/2836)
+ # - msc2946 # (Spaces Summary, see https://github.com/matrix-org/matrix-doc/pull/2946)
database:
- connection_string: file:mscs.db
+ connection_string: postgresql://username@password:hostname/dendrite_mscs?sslmode=disable
max_open_conns: 5
max_idle_conns: 2
conn_max_lifetime: -1
@@ -316,10 +272,10 @@ mscs:
# Configuration for the Room Server.
room_server:
internal_api:
- listen: http://localhost:7770 # Only used in polylith deployments
- connect: http://localhost:7770 # Only used in polylith deployments
+ listen: http://[::]:7770 # The listen address for incoming API requests
+ connect: http://room_server:7770 # The connect address for other components to use
database:
- connection_string: file:roomserver.db
+ connection_string: postgresql://username@password:hostname/dendrite_roomserver?sslmode=disable
max_open_conns: 10
max_idle_conns: 2
conn_max_lifetime: -1
@@ -327,12 +283,12 @@ room_server:
# Configuration for the Sync API.
sync_api:
internal_api:
- listen: http://localhost:7773 # Only used in polylith deployments
- connect: http://localhost:7773 # Only used in polylith deployments
+ listen: http://[::]:7773 # The listen address for incoming API requests
+ connect: http://sync_api:7773 # The connect address for other components to use
external_api:
listen: http://[::]:8073
database:
- connection_string: file:syncapi.db
+ connection_string: postgresql://username@password:hostname/dendrite_syncapi?sslmode=disable
max_open_conns: 10
max_idle_conns: 2
conn_max_lifetime: -1
@@ -344,21 +300,23 @@ sync_api:
# Configuration for the User API.
user_api:
- # The cost when hashing passwords on registration/login. Default: 10. Min: 4, Max: 31
- # See https://pkg.go.dev/golang.org/x/crypto/bcrypt for more information.
- # Setting this lower makes registration/login consume less CPU resources at the cost of security
- # should the database be compromised. Setting this higher makes registration/login consume more
- # CPU resources but makes it harder to brute force password hashes.
- # This value can be low if performing tests or on embedded Dendrite instances (e.g WASM builds)
- # bcrypt_cost: 10
internal_api:
- listen: http://localhost:7781 # Only used in polylith deployments
- connect: http://localhost:7781 # Only used in polylith deployments
+ listen: http://[::]:7781 # The listen address for incoming API requests
+ connect: http://user_api:7781 # The connect address for other components to use
account_database:
- connection_string: file:userapi_accounts.db
+ connection_string: postgresql://username@password:hostname/dendrite_userapi?sslmode=disable
max_open_conns: 10
max_idle_conns: 2
conn_max_lifetime: -1
+
+ # The cost when hashing passwords on registration/login. Default: 10. Min: 4, Max: 31
+ # See https://pkg.go.dev/golang.org/x/crypto/bcrypt for more information.
+ # Setting this lower makes registration/login consume less CPU resources at the cost
+ # of security should the database be compromised. Setting this higher makes registration/login
+ # consume more CPU resources but makes it harder to brute force password hashes. This value
+ # can be lowered if performing tests or on embedded Dendrite instances (e.g WASM builds).
+ bcrypt_cost: 10
+
# The length of time that a token issued for a relying party from
# /_matrix/client/r0/user/{userId}/openid/request_token endpoint
# is considered to be valid in milliseconds.
@@ -381,12 +339,13 @@ tracing:
baggage_restrictions: null
throttler: null
-# Logging configuration
+# Logging configuration. The "std" logging type controls the logs being sent to
+# stdout. The "file" logging type controls logs being written to a log folder on
+# the disk. Supported log levels are "debug", "info", "warn", "error".
logging:
- type: std
level: info
- type: file
- # The logging level, must be one of debug, info, warn, error, fatal, panic.
level: info
params:
path: ./logs
diff --git a/docs/FAQ.md b/docs/FAQ.md
index 571726d6..47f39b9e 100644
--- a/docs/FAQ.md
+++ b/docs/FAQ.md
@@ -58,7 +58,7 @@ Bridges known to work (as of v0.5.1):
* [Signal](https://docs.mau.fi/bridges/python/signal/index.html)
* [probably all other mautrix bridges](https://docs.mau.fi/bridges/)
-Remember to add the config file(s) to the `app_service_api` [config](https://github.com/matrix-org/dendrite/blob/de38be469a23813921d01bef3e14e95faab2a59e/dendrite-config.yaml#L130-L131).
+Remember to add the config file(s) to the `app_service_api` section of the config file.
## Is it possible to prevent communication with the outside world?
diff --git a/docs/installation/7_configuration.md b/docs/installation/7_configuration.md
index 868aba6e..e676afbe 100644
--- a/docs/installation/7_configuration.md
+++ b/docs/installation/7_configuration.md
@@ -7,11 +7,13 @@ permalink: /installation/configuration
# Populate the configuration
-The configuration file is used to configure Dendrite. A sample configuration file,
-called [`dendrite-config.yaml`](https://github.com/matrix-org/dendrite/blob/main/dendrite-config.yaml),
-is present in the top level of the Dendrite repository.
+The configuration file is used to configure Dendrite. Sample configuration files are
+present in the top level of the Dendrite repository:
-You will need to duplicate this file, calling it `dendrite.yaml` for example, and then
+* [`dendrite-sample.monolith.yaml`](https://github.com/matrix-org/dendrite/blob/main/dendrite-sample.monolith.yaml)
+* [`dendrite-sample.polylith.yaml`](https://github.com/matrix-org/dendrite/blob/main/dendrite-sample.polylith.yaml)
+
+You will need to duplicate the sample, calling it `dendrite.yaml` for example, and then
tailor it to your installation. At a minimum, you will need to populate the following
sections: