mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-22 05:23:09 -06:00
More cleanup
This commit is contained in:
parent
c8e69aaa67
commit
004b136313
|
|
@ -113,8 +113,7 @@ global:
|
||||||
jetstream:
|
jetstream:
|
||||||
# A list of NATS Server addresses to connect to. If none are specified, an
|
# 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
|
# internal NATS server will be started automatically when running Dendrite in
|
||||||
# monolith mode. For polylith deployments, it is required to specify the address
|
# monolith mode.
|
||||||
# of at least one NATS Server node.
|
|
||||||
addresses:
|
addresses:
|
||||||
# - localhost:4222
|
# - localhost:4222
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,11 +35,6 @@ possible to migrate an existing Synapse deployment to Dendrite.
|
||||||
|
|
||||||
No, Dendrite has a very different database schema to Synapse and the two are not interchangeable.
|
No, Dendrite has a very different database schema to Synapse and the two are not interchangeable.
|
||||||
|
|
||||||
## Should I run a monolith or a polylith deployment?
|
|
||||||
|
|
||||||
Monolith deployments are always preferred where possible, and at this time, are far better tested than polylith deployments are. The only reason to consider a polylith deployment is if you wish to run different Dendrite components on separate physical machines, but this is an advanced configuration which we don't
|
|
||||||
recommend.
|
|
||||||
|
|
||||||
## Can I configure which port Dendrite listens on?
|
## Can I configure which port Dendrite listens on?
|
||||||
|
|
||||||
Yes, use the cli flag `-http-bind-address`.
|
Yes, use the cli flag `-http-bind-address`.
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,5 @@ or alternatively, in the [installation](installation/) folder:
|
||||||
3. [Preparing database storage](installation/3_database.md)
|
3. [Preparing database storage](installation/3_database.md)
|
||||||
4. [Generating signing keys](installation/4_signingkey.md)
|
4. [Generating signing keys](installation/4_signingkey.md)
|
||||||
5. [Installing as a monolith](installation/5_install_monolith.md)
|
5. [Installing as a monolith](installation/5_install_monolith.md)
|
||||||
6. [Installing as a polylith](installation/6_install_polylith.md)
|
6. [Populate the configuration](installation/7_configuration.md)
|
||||||
7. [Populate the configuration](installation/7_configuration.md)
|
7. [Starting the monolith](installation/8_starting_monolith.md)
|
||||||
8. [Starting the monolith](installation/8_starting_monolith.md)
|
|
||||||
9. [Starting the polylith](installation/9_starting_polylith.md)
|
|
||||||
|
|
|
||||||
|
|
@ -57,22 +57,16 @@ github.com/matrix-org/util/unique.go:55: UniqueStrings 100.0%
|
||||||
total: (statements) 53.7%
|
total: (statements) 53.7%
|
||||||
```
|
```
|
||||||
The total coverage for this run is the last line at the bottom. However, this value is misleading because Dendrite can run in many different configurations,
|
The total coverage for this run is the last line at the bottom. However, this value is misleading because Dendrite can run in many different configurations,
|
||||||
which will never be tested in a single test run (e.g sqlite or postgres, monolith or polylith). To get a more accurate value, additional processing is required
|
which will never be tested in a single test run (e.g sqlite or postgres). To get a more accurate value, additional processing is required
|
||||||
to remove packages which will never be tested and extension MSCs:
|
to remove packages which will never be tested and extension MSCs:
|
||||||
```bash
|
```bash
|
||||||
# These commands are all similar but change which package paths are _removed_ from the output.
|
# These commands are all similar but change which package paths are _removed_ from the output.
|
||||||
|
|
||||||
# For Postgres (monolith)
|
# For Postgres
|
||||||
go tool cover -func=/path/to/server-0/integrationcover.log | grep 'github.com/matrix-org/dendrite' | grep -Ev 'inthttp|sqlite|setup/mscs|api_trace' > coverage.txt
|
go tool cover -func=/path/to/server-0/integrationcover.log | grep 'github.com/matrix-org/dendrite' | grep -Ev 'inthttp|sqlite|setup/mscs|api_trace' > coverage.txt
|
||||||
|
|
||||||
# For Postgres (polylith)
|
# For SQLite
|
||||||
go tool cover -func=/path/to/server-0/integrationcover.log | grep 'github.com/matrix-org/dendrite' | grep -Ev 'sqlite|setup/mscs|api_trace' > coverage.txt
|
|
||||||
|
|
||||||
# For SQLite (monolith)
|
|
||||||
go tool cover -func=/path/to/server-0/integrationcover.log | grep 'github.com/matrix-org/dendrite' | grep -Ev 'inthttp|postgres|setup/mscs|api_trace' > coverage.txt
|
go tool cover -func=/path/to/server-0/integrationcover.log | grep 'github.com/matrix-org/dendrite' | grep -Ev 'inthttp|postgres|setup/mscs|api_trace' > coverage.txt
|
||||||
|
|
||||||
# For SQLite (polylith)
|
|
||||||
go tool cover -func=/path/to/server-0/integrationcover.log | grep 'github.com/matrix-org/dendrite' | grep -Ev 'postgres|setup/mscs|api_trace' > coverage.txt
|
|
||||||
```
|
```
|
||||||
|
|
||||||
A total value can then be calculated using:
|
A total value can then be calculated using:
|
||||||
|
|
|
||||||
|
|
@ -46,10 +46,10 @@ tracing:
|
||||||
param: 1
|
param: 1
|
||||||
```
|
```
|
||||||
|
|
||||||
then run the monolith server with `--api true` to use polylith components which do tracing spans:
|
then run the monolith server:
|
||||||
|
|
||||||
```
|
```
|
||||||
./dendrite-monolith-server --tls-cert server.crt --tls-key server.key --config dendrite.yaml --api true
|
./dendrite-monolith-server --tls-cert server.crt --tls-key server.key --config dendrite.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
## Checking traces
|
## Checking traces
|
||||||
|
|
|
||||||
|
|
@ -1,73 +0,0 @@
|
||||||
---
|
|
||||||
title: Starting the polylith
|
|
||||||
parent: Installation
|
|
||||||
has_toc: true
|
|
||||||
nav_order: 10
|
|
||||||
permalink: /installation/start/polylith
|
|
||||||
---
|
|
||||||
|
|
||||||
# Starting the polylith
|
|
||||||
|
|
||||||
Once you have completed all of the preparation and installation steps,
|
|
||||||
you can start your Dendrite polylith deployment by starting the various components
|
|
||||||
using the `dendrite-polylith-multi` personalities.
|
|
||||||
|
|
||||||
## Start the reverse proxy
|
|
||||||
|
|
||||||
Ensure that your reverse proxy is started and is proxying the correct
|
|
||||||
endpoints to the correct components. Software such as [NGINX](https://www.nginx.com) or
|
|
||||||
[HAProxy](http://www.haproxy.org) can be used for this purpose. A [sample configuration
|
|
||||||
for NGINX](https://github.com/matrix-org/dendrite/blob/main/docs/nginx/polylith-sample.conf)
|
|
||||||
is provided.
|
|
||||||
|
|
||||||
## Starting the components
|
|
||||||
|
|
||||||
Each component must be started individually:
|
|
||||||
|
|
||||||
### Client API
|
|
||||||
|
|
||||||
```bash
|
|
||||||
./dendrite-polylith-multi -config /path/to/dendrite.yaml clientapi
|
|
||||||
```
|
|
||||||
|
|
||||||
### Sync API
|
|
||||||
|
|
||||||
```bash
|
|
||||||
./dendrite-polylith-multi -config /path/to/dendrite.yaml syncapi
|
|
||||||
```
|
|
||||||
|
|
||||||
### Media API
|
|
||||||
|
|
||||||
```bash
|
|
||||||
./dendrite-polylith-multi -config /path/to/dendrite.yaml mediaapi
|
|
||||||
```
|
|
||||||
|
|
||||||
### Federation API
|
|
||||||
|
|
||||||
```bash
|
|
||||||
./dendrite-polylith-multi -config /path/to/dendrite.yaml federationapi
|
|
||||||
```
|
|
||||||
|
|
||||||
### Roomserver
|
|
||||||
|
|
||||||
```bash
|
|
||||||
./dendrite-polylith-multi -config /path/to/dendrite.yaml roomserver
|
|
||||||
```
|
|
||||||
|
|
||||||
### Appservice API
|
|
||||||
|
|
||||||
```bash
|
|
||||||
./dendrite-polylith-multi -config /path/to/dendrite.yaml appservice
|
|
||||||
```
|
|
||||||
|
|
||||||
### User API
|
|
||||||
|
|
||||||
```bash
|
|
||||||
./dendrite-polylith-multi -config /path/to/dendrite.yaml userapi
|
|
||||||
```
|
|
||||||
|
|
||||||
### Key server
|
|
||||||
|
|
||||||
```bash
|
|
||||||
./dendrite-polylith-multi -config /path/to/dendrite.yaml keyserver
|
|
||||||
```
|
|
||||||
|
|
@ -16,12 +16,6 @@ Users can run Dendrite in one of two modes which dictate how these components ar
|
||||||
server with generally low overhead. This mode dramatically simplifies deployment complexity and offers the
|
server with generally low overhead. This mode dramatically simplifies deployment complexity and offers the
|
||||||
best balance between performance and resource usage for low-to-mid volume deployments.
|
best balance between performance and resource usage for low-to-mid volume deployments.
|
||||||
|
|
||||||
* **Polylith mode** runs all components in isolated processes. Components communicate through an external NATS
|
|
||||||
server and HTTP APIs, which incur considerable overhead. While this mode allows for more granular control of
|
|
||||||
resources dedicated toward individual processes, given the additional communications overhead, it is only
|
|
||||||
necessary for very large deployments.
|
|
||||||
|
|
||||||
Given our current state of development, **we recommend monolith mode** for all deployments.
|
|
||||||
|
|
||||||
## Databases
|
## Databases
|
||||||
|
|
||||||
|
|
@ -85,21 +79,15 @@ If using the PostgreSQL database engine, you should install PostgreSQL 12 or lat
|
||||||
|
|
||||||
### NATS Server
|
### NATS Server
|
||||||
|
|
||||||
Monolith deployments come with a built-in [NATS Server](https://github.com/nats-io/nats-server) and
|
Dendrite comes with a built-in [NATS Server](https://github.com/nats-io/nats-server) and
|
||||||
therefore do not need this to be manually installed. If you are planning a monolith installation, you
|
therefore does not need this to be manually installed. If you are planning a monolith installation, you
|
||||||
do not need to do anything.
|
do not need to do anything.
|
||||||
|
|
||||||
Polylith deployments, however, currently need a standalone NATS Server installation with JetStream
|
|
||||||
enabled.
|
|
||||||
|
|
||||||
To do so, follow the [NATS Server installation instructions](https://docs.nats.io/running-a-nats-service/introduction/installation) and then [start your NATS deployment](https://docs.nats.io/running-a-nats-service/introduction/running). JetStream must be enabled, either by passing the `-js` flag to `nats-server`,
|
|
||||||
or by specifying the `store_dir` option in the the `jetstream` configuration.
|
|
||||||
|
|
||||||
### Reverse proxy
|
### Reverse proxy
|
||||||
|
|
||||||
A reverse proxy such as [Caddy](https://caddyserver.com), [NGINX](https://www.nginx.com) or
|
A reverse proxy such as [Caddy](https://caddyserver.com), [NGINX](https://www.nginx.com) or
|
||||||
[HAProxy](http://www.haproxy.org) is required for polylith deployments and is useful for monolith
|
[HAProxy](http://www.haproxy.org) is useful for deployments. Configuring those is not covered in this documentation, although sample configurations
|
||||||
deployments. Configuring those is not covered in this documentation, although sample configurations
|
|
||||||
for [Caddy](https://github.com/matrix-org/dendrite/blob/main/docs/caddy) and
|
for [Caddy](https://github.com/matrix-org/dendrite/blob/main/docs/caddy) and
|
||||||
[NGINX](https://github.com/matrix-org/dendrite/blob/main/docs/nginx) are provided.
|
[NGINX](https://github.com/matrix-org/dendrite/blob/main/docs/nginx) are provided.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,34 +0,0 @@
|
||||||
---
|
|
||||||
title: Installing as a polylith
|
|
||||||
parent: Installation
|
|
||||||
has_toc: true
|
|
||||||
nav_order: 6
|
|
||||||
permalink: /installation/install/polylith
|
|
||||||
---
|
|
||||||
|
|
||||||
# Installing as a polylith
|
|
||||||
|
|
||||||
You can install the Dendrite polylith binary into `$GOPATH/bin` by using `go install`:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
go install ./cmd/dendrite-polylith-multi
|
|
||||||
```
|
|
||||||
|
|
||||||
Alternatively, you can specify a custom path for the binary to be written to using `go build`:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
go build -o /usr/local/bin/ ./cmd/dendrite-polylith-multi
|
|
||||||
```
|
|
||||||
|
|
||||||
The `dendrite-polylith-multi` binary is a "multi-personality" binary which can run as
|
|
||||||
any of the components depending on the supplied command line parameters.
|
|
||||||
|
|
||||||
## Reverse proxy
|
|
||||||
|
|
||||||
Polylith deployments require a reverse proxy in order to ensure that requests are
|
|
||||||
sent to the correct endpoint. You must ensure that a suitable reverse proxy is installed
|
|
||||||
and configured.
|
|
||||||
|
|
||||||
Sample configurations are provided
|
|
||||||
for [Caddy](https://github.com/matrix-org/dendrite/blob/main/docs/caddy/polylith/Caddyfile)
|
|
||||||
and [NGINX](https://github.com/matrix-org/dendrite/blob/main/docs/nginx/polylith-sample.conf).
|
|
||||||
|
|
@ -7,11 +7,10 @@ permalink: /installation/configuration
|
||||||
|
|
||||||
# Configuring Dendrite
|
# Configuring Dendrite
|
||||||
|
|
||||||
A YAML configuration file is used to configure Dendrite. Sample configuration files are
|
A YAML configuration file is used to configure Dendrite. A sample configuration file is
|
||||||
present in the top level of the Dendrite repository:
|
present in the top level of the Dendrite repository:
|
||||||
|
|
||||||
* [`dendrite-sample.monolith.yaml`](https://github.com/matrix-org/dendrite/blob/main/dendrite-sample.monolith.yaml)
|
* [`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
|
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
|
tailor it to your installation. At a minimum, you will need to populate the following
|
||||||
|
|
@ -46,10 +45,9 @@ global:
|
||||||
## JetStream configuration
|
## JetStream configuration
|
||||||
|
|
||||||
Monolith deployments can use the built-in NATS Server rather than running a standalone
|
Monolith deployments can use the built-in NATS Server rather than running a standalone
|
||||||
server. If you are building a polylith deployment, or you want to use a standalone NATS
|
server. If you want to use a standalone NATS Server anyway, you can also configure that too.
|
||||||
Server anyway, you can also configure that too.
|
|
||||||
|
|
||||||
### Built-in NATS Server (monolith only)
|
### Built-in NATS Server
|
||||||
|
|
||||||
In the `global` section, under the `jetstream` key, ensure that no server addresses are
|
In the `global` section, under the `jetstream` key, ensure that no server addresses are
|
||||||
configured and set a `storage_path` to a persistent folder on the filesystem:
|
configured and set a `storage_path` to a persistent folder on the filesystem:
|
||||||
|
|
@ -63,7 +61,7 @@ global:
|
||||||
topic_prefix: Dendrite
|
topic_prefix: Dendrite
|
||||||
```
|
```
|
||||||
|
|
||||||
### Standalone NATS Server (monolith and polylith)
|
### Standalone NATS Server
|
||||||
|
|
||||||
To use a standalone NATS Server instance, you will need to configure `addresses` field
|
To use a standalone NATS Server instance, you will need to configure `addresses` field
|
||||||
to point to the port that your NATS Server is listening on:
|
to point to the port that your NATS Server is listening on:
|
||||||
|
|
@ -86,7 +84,7 @@ one address in the `addresses` field.
|
||||||
Configuring database connections varies based on the [database configuration](database)
|
Configuring database connections varies based on the [database configuration](database)
|
||||||
that you chose.
|
that you chose.
|
||||||
|
|
||||||
### Global connection pool (monolith with a single PostgreSQL database only)
|
### Global connection pool
|
||||||
|
|
||||||
If you are running a monolith deployment and want to use a single connection pool to a
|
If you are running a monolith deployment and want to use a single connection pool to a
|
||||||
single PostgreSQL database, then you must uncomment and configure the `database` section
|
single PostgreSQL database, then you must uncomment and configure the `database` section
|
||||||
|
|
@ -109,7 +107,7 @@ override the `global` database configuration.
|
||||||
|
|
||||||
### Per-component connections (all other configurations)
|
### Per-component connections (all other configurations)
|
||||||
|
|
||||||
If you are building a polylith deployment, are using SQLite databases or separate PostgreSQL
|
If you are are using SQLite databases or separate PostgreSQL
|
||||||
databases per component, then you must instead configure the `database` sections under each
|
databases per component, then you must instead configure the `database` sections under each
|
||||||
of the component blocks ,e.g. under the `app_service_api`, `federation_api`, `key_server`,
|
of the component blocks ,e.g. under the `app_service_api`, `federation_api`, `key_server`,
|
||||||
`media_api`, `mscs`, `room_server`, `sync_api` and `user_api` blocks.
|
`media_api`, `mscs`, `room_server`, `sync_api` and `user_api` blocks.
|
||||||
|
|
|
||||||
|
|
@ -477,10 +477,6 @@ func (u *DeviceListUpdater) processServerUser(ctx context.Context, serverName go
|
||||||
return e.RetryAfter, err
|
return e.RetryAfter, err
|
||||||
} else if e.Blacklisted {
|
} else if e.Blacklisted {
|
||||||
return time.Hour * 8, err
|
return time.Hour * 8, err
|
||||||
} else if e.Code >= 300 {
|
|
||||||
// We didn't get a real FederationClientError (e.g. in polylith mode, where gomatrix.HTTPError
|
|
||||||
// are "converted" to FederationClientError), but we probably shouldn't hit them every $waitTime seconds.
|
|
||||||
return hourWaitTime, err
|
|
||||||
}
|
}
|
||||||
case net.Error:
|
case net.Error:
|
||||||
// Use the default waitTime, if it's a timeout.
|
// Use the default waitTime, if it's a timeout.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue