diff --git a/modules/nextcloud.nix b/modules/nextcloud.nix index 3e2ce4e..48d3322 100644 --- a/modules/nextcloud.nix +++ b/modules/nextcloud.nix @@ -1,5 +1,20 @@ { pkgs, config, ... }: { + + services.postgresql = { + ensureDatabases = [ "nextcloud" ]; + ensureUsers = [ + { + name = "nextcloud"; + ensurePermissions = { + "DATABASE nextcloud" = "ALL PRIVILEGES"; + }; + } + ]; + }; + + services.postgresqlBackup.databases = [ "nextcloud" ]; + services.nextcloud = { autoUpdateApps.enable = true; enable = true; diff --git a/modules/postgresql.nix b/modules/postgresql.nix index e188207..5f3cfd8 100644 --- a/modules/postgresql.nix +++ b/modules/postgresql.nix @@ -3,32 +3,39 @@ services.postgresql = { enable = true; package = pkgs.postgresql_14; - ensureDatabases = [ "nextcloud" ]; - ensureUsers = [ - { - name = "nextcloud"; - ensurePermissions = { - "DATABASE nextcloud" = "ALL PRIVILEGES"; - }; - } - ]; + #ensureDatabases = [ "nextcloud" ]; + #ensureUsers = [ + # { + # name = "nextcloud"; + # ensurePermissions = { + # "DATABASE nextcloud" = "ALL PRIVILEGES"; + # }; + # } + #]; }; services.postgresqlBackup = { enable = true; startAt = "*-*-* *:30:00"; compression = "zstd"; + databases = [ + "postgres" + ]; }; services.logrotate = { - enable = true; paths.postgresqlBackup = { - path = "${config.services.postgresqlBackup.location}/all.sql.zstd"; + path = "${config.services.postgresqlBackup.location}/*.sql.zstd"; user = "postgres"; group = "postgres"; keep = 24; frequency = "hourly"; - extraConfig = "extension = .zstd"; + extraConfig = '' + dateext + dateformat _%Y-%m-%d:%H + extension = .zstd + ''; + }; }; } diff --git a/modules/tandoor.nix b/modules/tandoor.nix index af82bb5..0aae190 100644 --- a/modules/tandoor.nix +++ b/modules/tandoor.nix @@ -44,6 +44,8 @@ in authentication = "host tandoor tandoor 10.88.0.0/16 md5"; }; + services.postgresqlBackup.databases = [ "tandoor" ]; + networking.firewall.interfaces.cni-podman0.allowedTCPPorts = [ 5432 ]; services.nginx.virtualHosts."${domain}" = {