configuration.nix/hosts/wynne/services/apps/postgresql.nix

33 lines
939 B
Nix
Raw Normal View History

2024-07-20 20:15:13 +05:30
{ config, pkgs, ... }: {
services = {
2024-07-20 20:15:41 +05:30
prometheus.exporters.postgres = {
enable = true;
2024-11-17 14:06:41 +05:30
listenAddress = config.nodeconfig.facts.wireguard-ip;
2024-07-20 20:15:41 +05:30
port = 9187;
runAsLocalSuperUser = true;
};
2024-07-20 20:15:13 +05:30
postgresql = {
enable = true;
dataDir = "/mnt/data/postgresql/${config.services.postgresql.package.psqlSchema}";
authentication = pkgs.lib.mkOverride 10 ''
local all all trust
host all all 127.0.0.1/8 trust
host all all ::1/128 trust
host all all 10.10.10.0/24 trust
'';
2024-09-23 20:48:06 +05:30
ensureDatabases = [ "dendrite" "forgejo" ];
2024-07-20 23:16:14 +05:30
ensureUsers = [
2024-07-20 23:16:33 +05:30
{
name = "dendrite";
ensureDBOwnership = true;
}
2024-09-23 20:48:06 +05:30
{
name = "forgejo";
ensureDBOwnership = true;
}
2024-07-20 23:16:14 +05:30
];
2024-07-20 20:15:13 +05:30
};
};
systemd.services.postgresql.unitConfig.RequiresMountsFor = [ "/mnt/data" ];
}