seperated psql backup into multiple files
This commit is contained in:
parent
5c78b2f2e2
commit
73836ebb0b
3 changed files with 36 additions and 12 deletions
|
|
@ -1,5 +1,20 @@
|
||||||
{ pkgs, config, ... }:
|
{ pkgs, config, ... }:
|
||||||
{
|
{
|
||||||
|
|
||||||
|
services.postgresql = {
|
||||||
|
ensureDatabases = [ "nextcloud" ];
|
||||||
|
ensureUsers = [
|
||||||
|
{
|
||||||
|
name = "nextcloud";
|
||||||
|
ensurePermissions = {
|
||||||
|
"DATABASE nextcloud" = "ALL PRIVILEGES";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
services.postgresqlBackup.databases = [ "nextcloud" ];
|
||||||
|
|
||||||
services.nextcloud = {
|
services.nextcloud = {
|
||||||
autoUpdateApps.enable = true;
|
autoUpdateApps.enable = true;
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
|
||||||
|
|
@ -3,32 +3,39 @@
|
||||||
services.postgresql = {
|
services.postgresql = {
|
||||||
enable = true;
|
enable = true;
|
||||||
package = pkgs.postgresql_14;
|
package = pkgs.postgresql_14;
|
||||||
ensureDatabases = [ "nextcloud" ];
|
#ensureDatabases = [ "nextcloud" ];
|
||||||
ensureUsers = [
|
#ensureUsers = [
|
||||||
{
|
# {
|
||||||
name = "nextcloud";
|
# name = "nextcloud";
|
||||||
ensurePermissions = {
|
# ensurePermissions = {
|
||||||
"DATABASE nextcloud" = "ALL PRIVILEGES";
|
# "DATABASE nextcloud" = "ALL PRIVILEGES";
|
||||||
};
|
# };
|
||||||
}
|
# }
|
||||||
];
|
#];
|
||||||
};
|
};
|
||||||
|
|
||||||
services.postgresqlBackup = {
|
services.postgresqlBackup = {
|
||||||
enable = true;
|
enable = true;
|
||||||
startAt = "*-*-* *:30:00";
|
startAt = "*-*-* *:30:00";
|
||||||
compression = "zstd";
|
compression = "zstd";
|
||||||
|
databases = [
|
||||||
|
"postgres"
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
services.logrotate = {
|
services.logrotate = {
|
||||||
enable = true;
|
|
||||||
paths.postgresqlBackup = {
|
paths.postgresqlBackup = {
|
||||||
path = "${config.services.postgresqlBackup.location}/all.sql.zstd";
|
path = "${config.services.postgresqlBackup.location}/*.sql.zstd";
|
||||||
user = "postgres";
|
user = "postgres";
|
||||||
group = "postgres";
|
group = "postgres";
|
||||||
keep = 24;
|
keep = 24;
|
||||||
frequency = "hourly";
|
frequency = "hourly";
|
||||||
extraConfig = "extension = .zstd";
|
extraConfig = ''
|
||||||
|
dateext
|
||||||
|
dateformat _%Y-%m-%d:%H
|
||||||
|
extension = .zstd
|
||||||
|
'';
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,8 @@ in
|
||||||
authentication = "host tandoor tandoor 10.88.0.0/16 md5";
|
authentication = "host tandoor tandoor 10.88.0.0/16 md5";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
services.postgresqlBackup.databases = [ "tandoor" ];
|
||||||
|
|
||||||
networking.firewall.interfaces.cni-podman0.allowedTCPPorts = [ 5432 ];
|
networking.firewall.interfaces.cni-podman0.allowedTCPPorts = [ 5432 ];
|
||||||
|
|
||||||
services.nginx.virtualHosts."${domain}" = {
|
services.nginx.virtualHosts."${domain}" = {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue