From 4b878360f5c9238a38a24be0ae228d21bd1a8464 Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Sat, 3 Oct 2020 23:13:20 +0000 Subject: [PATCH] kusakabe: add postgresql for twitterchiver --- ops/nixos/kusakabe/default.nix | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) 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"; }