diff --git a/ops/nixos/kusakabe/default.nix b/ops/nixos/kusakabe/default.nix index 1404dbf72d..1aeb021242 100644 --- a/ops/nixos/kusakabe/default.nix +++ b/ops/nixos/kusakabe/default.nix @@ -94,6 +94,9 @@ in { # k8s 80 443 6443 22623 + + # PostgreSQL + 5432 ]; allowedTCPPorts = [ 80 443 ]; }; @@ -259,5 +262,23 @@ in { }; users.users.lukegb.extraGroups = lib.mkAfter [ "libvirtd" ]; + services.postgresql = { + enable = true; + authentication = '' + host all all 137.74.77.21/32 md5 + host all all 137.74.77.22/32 md5 + host all all 137.74.77.23/32 md5 + ''; + ensureDatabases = [ + "twitterchiver" + ]; + ensureUsers = [{ + name = "twitterchiver"; + ensurePermissions = { "DATABASE twitterchiver" = "ALL PRIVILEGES"; }; + }]; + enableTCPIP = true; + }; + services.postgresqlBackup.enable = true; + system.stateVersion = "20.03"; }