From 580a256c3794ee272577232675ab73c9bc9a8178 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Fri, 17 Dec 2021 14:20:34 +0000 Subject: [PATCH] More Docker updates --- build/docker/README.md | 22 +++++----------------- build/docker/config/dendrite.yaml | 13 +++++++++++++ build/docker/docker-compose.monolith.yml | 6 ++++++ build/docker/docker-compose.polylith.yml | 14 ++++++++++++++ build/docker/postgres/create_db.sh | 2 +- 5 files changed, 39 insertions(+), 18 deletions(-) diff --git a/build/docker/README.md b/build/docker/README.md index 19e4234c5..37ed039f7 100644 --- a/build/docker/README.md +++ b/build/docker/README.md @@ -28,7 +28,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 (based on the [`dendrite-config.yaml`](https://raw.githubusercontent.com/matrix-org/dendrite/master/dendrite-config.yaml) +- `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.) - `matrix_key.pem` server key, as generated using `cmd/generate-keys` - `server.crt` certificate file @@ -50,15 +50,9 @@ 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-config.yaml`](https://raw.githubusercontent.com/matrix-org/dendrite/master/dendrite-config.yaml) configuration file in the `build/docker/config` folder of this repository. And rename the config file to `dendrite.yml` (and put it in your `config` directory). +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. -Once in place, start the PostgreSQL dependency: - -``` -docker-compose -f docker-compose.deps.yml up postgres -``` - -Wait a few seconds for PostgreSQL to finish starting up, and then start a monolith: +Then start the deployment: ``` docker-compose -f docker-compose.monolith.yml up @@ -66,15 +60,9 @@ docker-compose -f docker-compose.monolith.yml up ## Starting Dendrite as a polylith deployment -Create your config based on the [`dendrite-config.yaml`](https://raw.githubusercontent.com/matrix-org/dendrite/master/dendrite-config.yaml) configuration file in the `build/docker/config` folder of this repository. And rename the config file to `dendrite.yml` (and put it in your `config` directory). +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. -Once in place, start all the dependencies: - -``` -docker-compose -f docker-compose.deps.yml up -``` - -Wait a few seconds for PostgreSQL and Kafka to finish starting up, and then start a polylith: +Then start the deployment: ``` docker-compose -f docker-compose.polylith.yml up diff --git a/build/docker/config/dendrite.yaml b/build/docker/config/dendrite.yaml index 0eea81acb..de7491c9e 100644 --- a/build/docker/config/dendrite.yaml +++ b/build/docker/config/dendrite.yaml @@ -265,6 +265,19 @@ media_api: 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: diff --git a/build/docker/docker-compose.monolith.yml b/build/docker/docker-compose.monolith.yml index 8e2ddc7ef..1a8fe4eee 100644 --- a/build/docker/docker-compose.monolith.yml +++ b/build/docker/docker-compose.monolith.yml @@ -12,6 +12,11 @@ services: environment: POSTGRES_PASSWORD: itsasecret POSTGRES_USER: dendrite + healthcheck: + test: ["CMD-SHELL", "pg_isready -U dendrite"] + interval: 5s + timeout: 5s + retries: 5 networks: - internal @@ -32,6 +37,7 @@ services: - postgres networks: - internal + restart: unless-stopped networks: internal: diff --git a/build/docker/docker-compose.polylith.yml b/build/docker/docker-compose.polylith.yml index e0538ad7a..207d0451a 100644 --- a/build/docker/docker-compose.polylith.yml +++ b/build/docker/docker-compose.polylith.yml @@ -12,6 +12,11 @@ services: environment: POSTGRES_PASSWORD: itsasecret POSTGRES_USER: dendrite + healthcheck: + test: ["CMD-SHELL", "pg_isready -U dendrite"] + interval: 5s + timeout: 5s + retries: 5 networks: - internal @@ -40,6 +45,7 @@ services: - postgres networks: - internal + restart: unless-stopped media_api: hostname: media_api @@ -50,6 +56,7 @@ services: - ./media:/var/dendrite/media networks: - internal + restart: unless-stopped sync_api: hostname: sync_api @@ -62,6 +69,7 @@ services: - postgres networks: - internal + restart: unless-stopped room_server: hostname: room_server @@ -74,6 +82,7 @@ services: - postgres networks: - internal + restart: unless-stopped edu_server: hostname: edu_server @@ -85,6 +94,7 @@ services: - jetstream networks: - internal + restart: unless-stopped federation_api: hostname: federation_api @@ -97,6 +107,7 @@ services: - postgres networks: - internal + restart: unless-stopped key_server: hostname: key_server @@ -109,6 +120,7 @@ services: - postgres networks: - internal + restart: unless-stopped user_api: hostname: user_api @@ -121,6 +133,7 @@ services: - postgres networks: - internal + restart: unless-stopped appservice_api: hostname: appservice_api @@ -135,6 +148,7 @@ services: - postgres - room_server - user_api + restart: unless-stopped networks: internal: diff --git a/build/docker/postgres/create_db.sh b/build/docker/postgres/create_db.sh index a7107e272..9093738e4 100755 --- a/build/docker/postgres/create_db.sh +++ b/build/docker/postgres/create_db.sh @@ -1,5 +1,5 @@ #!/bin/sh -for db in userapi_accounts userapi_devices mediaapi syncapi roomserver keyserver federationapi appservice naffka; do +for db in userapi_accounts userapi_devices mediaapi syncapi roomserver keyserver federationapi appservice mscs; do createdb -U dendrite -O dendrite dendrite_$db done