From 0b67c90d2a8563f844d9745a915267a07c68691b Mon Sep 17 00:00:00 2001 From: Markus Schmidl Date: Sat, 25 Nov 2023 21:39:32 +0100 Subject: [PATCH] move data-hoarder postgres to registry --- modules/data-hoarder/chemo.nix | 8 +------- modules/data-hoarder/data-accumulator.nix | 8 +------- modules/data-hoarder/datacare.nix | 8 +------- modules/data-hoarder/postgres.nix | 4 ++-- modules/data-hoarder/trekkie.nix | 7 +------ registry/data-hoarder/default.nix | 8 ++++++++ 6 files changed, 14 insertions(+), 29 deletions(-) diff --git a/modules/data-hoarder/chemo.nix b/modules/data-hoarder/chemo.nix index 5ad399b..773718b 100644 --- a/modules/data-hoarder/chemo.nix +++ b/modules/data-hoarder/chemo.nix @@ -2,13 +2,7 @@ TLMS.chemo = { inherit (registry.grpc-data_accumulator-chemo) host port; enable = true; - database = { - host = "127.0.0.1"; - port = config.services.postgresql.port; - passwordFile = config.sops.secrets.postgres_password.path; - user = "tlms"; - database = "tlms"; - }; + database = registry.postgres; GRPC = [ { inherit (registry.grpc-chemo-bureaucrat) host port; diff --git a/modules/data-hoarder/data-accumulator.nix b/modules/data-hoarder/data-accumulator.nix index c3b5ebb..1c422ba 100644 --- a/modules/data-hoarder/data-accumulator.nix +++ b/modules/data-hoarder/data-accumulator.nix @@ -2,13 +2,7 @@ TLMS.dataAccumulator = { inherit (registry.port-data_accumulator) host port; enable = true; - database = { - host = "127.0.0.1"; - port = config.services.postgresql.port; - passwordFile = config.sops.secrets.postgres_password.path; - user = "tlms"; - database = "tlms"; - }; + database = registry.postgres; GRPC = [{ inherit (registry.grpc-data_accumulator-chemo) host port; name = "CHEMO"; diff --git a/modules/data-hoarder/datacare.nix b/modules/data-hoarder/datacare.nix index 381c912..7d8a242 100644 --- a/modules/data-hoarder/datacare.nix +++ b/modules/data-hoarder/datacare.nix @@ -2,13 +2,7 @@ TLMS.datacare = { enable = true; http = registry.port-datacare; - database = { - host = "127.0.0.1"; - port = config.services.postgresql.port; - user = "tlms"; - database = "tlms"; - passwordFile = config.sops.secrets.postgres_password.path; - }; + database = registry.postgres; allowedIpsExport = [ "10.13.37.0/24" ]; saltFile = config.sops.secrets.postgres_password_hash_salt.path; user = "datacare"; diff --git a/modules/data-hoarder/postgres.nix b/modules/data-hoarder/postgres.nix index feedd18..089a250 100644 --- a/modules/data-hoarder/postgres.nix +++ b/modules/data-hoarder/postgres.nix @@ -1,9 +1,9 @@ -{ lib, pkgs, config, inputs, self, ... }: { +{ lib, pkgs, config, inputs, self, registry, ... }: { services.postgresql = { + inherit (registry.postgres) port; enable = true; enableTCPIP = true; - port = 5432; authentication = let senpai-ip = self.nixosConfigurations.notice-me-senpai.config.deployment-TLMS.net.wg.addr4; diff --git a/modules/data-hoarder/trekkie.nix b/modules/data-hoarder/trekkie.nix index 430ead5..8705dbc 100644 --- a/modules/data-hoarder/trekkie.nix +++ b/modules/data-hoarder/trekkie.nix @@ -3,12 +3,7 @@ inherit (registry.port-trekkie) host port; enable = true; saltPath = config.sops.secrets.postgres_password_hash_salt.path; - database = { - host = "127.0.0.1"; - port = config.services.postgresql.port; - passwordFile = config.sops.secrets.postgres_password.path; - user = "tlms"; - }; + database = registry.postgres; redis = registry.redis-trekkie; grpc = registry.grpc-trekkie-chemo; logLevel = "info"; diff --git a/registry/data-hoarder/default.nix b/registry/data-hoarder/default.nix index 7c62b44..94457a4 100644 --- a/registry/data-hoarder/default.nix +++ b/registry/data-hoarder/default.nix @@ -52,4 +52,12 @@ rec { host = "localhost"; port = 6379; }; + + postgres = { + host = "127.0.0.1"; + user = "tlms"; + database = "tlms"; + port = 5432; + passwordFile = "/run/secrets/postgres_password"; + }; }