From 4278e5418ecb99f43f2f58f6cd07d46d6667c0b0 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Fri, 16 Feb 2024 07:35:50 +0000 Subject: [PATCH] Force Dendrite into postgres --- hosts/linode/default.nix | 1 + hosts/linode/postgres.nix | 2 -- hosts/linode/synapse.nix | 26 +++++++++++++++++++++----- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/hosts/linode/default.nix b/hosts/linode/default.nix index 3a5464f..f55d93c 100644 --- a/hosts/linode/default.nix +++ b/hosts/linode/default.nix @@ -37,5 +37,6 @@ bind graphviz nix-du + pgloader ]; } diff --git a/hosts/linode/postgres.nix b/hosts/linode/postgres.nix index 2e3054f..4d53947 100644 --- a/hosts/linode/postgres.nix +++ b/hosts/linode/postgres.nix @@ -6,8 +6,6 @@ checkConfig = true; ensureDatabases = [ "dendrite" - "forgejo" - "monica" "nextcloud" ]; #initialScript = pkgs.writeText "create-matrix-db.sql" '' diff --git a/hosts/linode/synapse.nix b/hosts/linode/synapse.nix index 17d97c8..86f1fba 100644 --- a/hosts/linode/synapse.nix +++ b/hosts/linode/synapse.nix @@ -6,6 +6,7 @@ let domain = "${config.networking.domain}"; fqdn = "matrix.${domain}"; + conn = "postgresql:///dendrite?sslmode=disable&host=/run/postgresql"; in { services.nginx = { @@ -89,10 +90,25 @@ return 200 '${builtins.toJSON client}'; environmentFile = "/run/agenix/dendrite"; httpPort = 8448; # Identify ourselves as the root of our own domain - settings = { + settings = ( + (builtins.listToAttrs ( + (map (x: { name = x; value = { database.connection_string = conn; }; }) [ + "app_service_api" + "federation_api" + "key_server" + "media_api" + "mscs" + "relay_api" + "room_server" + "sync_api" + ]) + ) ) // + { + user_api.account_database.connection_string = conn; + user_api.device_database.connection_string = conn; global = { - database.args = { - connection_string = "postgresql://dendrite@localhost/dendrite?sslmode=disable"; + database = { + connection_string = conn; max_open_conns = 90; max_idle_conns = 5; conn_max_lifetime = -1; @@ -107,10 +123,10 @@ return 200 '${builtins.toJSON client}'; private_key = "/etc/dendrite.pem"; }; client_api = { - egistration_enabled = false; + registration_enabled = false; registration_shared_secret = "\${REGISTRATION_SHARED_SECRET}"; }; - }; + }); }; # Open networking ports for the server