From 2f578531baf5c033ae785501ee955381862ed314 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Tue, 13 Oct 2020 09:50:11 +0100 Subject: [PATCH 1/2] Update Docker samples --- build/docker/README.md | 27 +++++++++++++++++++----- build/docker/config/dendrite-config.yaml | 2 +- build/docker/postgres/create_db.sh | 2 +- 3 files changed, 24 insertions(+), 7 deletions(-) mode change 100644 => 100755 build/docker/postgres/create_db.sh diff --git a/build/docker/README.md b/build/docker/README.md index 45d96d1cb..7bf72e156 100644 --- a/build/docker/README.md +++ b/build/docker/README.md @@ -38,21 +38,38 @@ go run github.com/matrix-org/dendrite/cmd/generate-keys \ --tls-key=server.key ``` -## Starting Dendrite +## Starting Dendrite as a monolith deployment -Once in place, start the dependencies: +Create your config based on the `dendrite.yaml` configuration file in the `docker/config` +folder in the [Dendrite repository](https://github.com/matrix-org/dendrite). Additionally, +make the following changes to the configuration: + +- Enable Naffka: `use_naffka: true` + +Once in place, start the PostgreSQL dependency: ``` -docker-compose -f docker-compose.deps.yml up +docker-compose -f docker-compose.deps.yml up postgres ``` -Wait a few seconds for Kafka and Postgres to finish starting up, and then start a monolith: +Wait a few seconds for PostgreSQL to finish starting up, and then start a monolith: ``` docker-compose -f docker-compose.monolith.yml up ``` -... or start the polylith components: +## Starting Dendrite as a polylith deployment + +Create your config based on the `dendrite.yaml` configuration file in the `docker/config` +folder in the [Dendrite repository](https://github.com/matrix-org/dendrite). + +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: ``` docker-compose -f docker-compose.polylith.yml up diff --git a/build/docker/config/dendrite-config.yaml b/build/docker/config/dendrite-config.yaml index 2dc2f3b7d..106ab20dd 100644 --- a/build/docker/config/dendrite-config.yaml +++ b/build/docker/config/dendrite-config.yaml @@ -76,7 +76,7 @@ global: # Naffka database options. Not required when using Kafka. naffka_database: - connection_string: file:naffka.db + connection_string: postgresql://dendrite:itsasecret@postgres/dendrite_naffka?sslmode=disable max_open_conns: 100 max_idle_conns: 2 conn_max_lifetime: -1 diff --git a/build/docker/postgres/create_db.sh b/build/docker/postgres/create_db.sh old mode 100644 new mode 100755 index f8ee715a9..97514467b --- a/build/docker/postgres/create_db.sh +++ b/build/docker/postgres/create_db.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh for db in account device mediaapi syncapi roomserver signingkeyserver keyserver federationsender appservice e2ekey naffka; do createdb -U dendrite -O dendrite dendrite_$db From 73bc28b11f10a7ff1582b9e5b9cffe53cd029104 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Tue, 13 Oct 2020 09:54:07 +0100 Subject: [PATCH 2/2] Update docker-compose.deps.yml --- build/docker/docker-compose.deps.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build/docker/docker-compose.deps.yml b/build/docker/docker-compose.deps.yml index facfc01b3..afc572d0c 100644 --- a/build/docker/docker-compose.deps.yml +++ b/build/docker/docker-compose.deps.yml @@ -6,6 +6,9 @@ services: restart: always volumes: - ./postgres/create_db.sh:/docker-entrypoint-initdb.d/20-create_db.sh + # To persist your PostgreSQL databases outside of the Docker image, to + # prevent data loss, you will need to add something like this: + # - ./path/to/persistent/storage:/var/lib/postgresql/data environment: POSTGRES_PASSWORD: itsasecret POSTGRES_USER: dendrite