From b15da3a2e56bb4f3913701c6a9020d6629f78c86 Mon Sep 17 00:00:00 2001 From: coolneng Date: Thu, 14 Nov 2019 02:30:12 +0100 Subject: [PATCH] Set up PostgreSQL with daily backups --- modules/hardware-configuration.nix | 29 +++++++++++++++++------------ modules/webstack.nix | 12 ++++++++++++ 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/modules/hardware-configuration.nix b/modules/hardware-configuration.nix index a4710b4..7acbc4e 100644 --- a/modules/hardware-configuration.nix +++ b/modules/hardware-configuration.nix @@ -23,11 +23,26 @@ fsType = "zfs"; }; + fileSystems."/vault/git" = + { device = "vault/git"; + fsType = "zfs"; + }; + + fileSystems."/vault/syncthing" = + { device = "vault/syncthing"; + fsType = "zfs"; + }; + fileSystems."/vault/backups" = { device = "vault/backups"; fsType = "zfs"; }; + fileSystems."/vault/nextcloud" = + { device = "vault/nextcloud"; + fsType = "zfs"; + }; + fileSystems."/vault/backups/monolith" = { device = "vault/backups/monolith"; fsType = "zfs"; @@ -38,18 +53,8 @@ fsType = "zfs"; }; - fileSystems."/vault/git" = - { device = "vault/git"; - fsType = "zfs"; - }; - - fileSystems."/vault/nextcloud" = - { device = "vault/nextcloud"; - fsType = "zfs"; - }; - - fileSystems."/vault/syncthing" = - { device = "vault/syncthing"; + fileSystems."/vault/backups/zion/databases" = + { device = "vault/backups/zion/databases"; fsType = "zfs"; }; diff --git a/modules/webstack.nix b/modules/webstack.nix index c4355cb..868848d 100644 --- a/modules/webstack.nix +++ b/modules/webstack.nix @@ -7,6 +7,7 @@ php postgresql_11 libressl + wallabag ]; services.nginx = { @@ -73,9 +74,20 @@ }; }; + # Generate dhparams security.dhparams = { enable = true; params = { nginx.bits = 2048; }; }; + # Enable PostgreSQL with daily backup + services.postgresql.enable = true; + + services.postgresqlBackup = { + enable = true; + backupAll = true; + location = "/vault/backups/zion/databases"; + startAt = "*-*-* 05:15:00"; + }; + }