2024-04-13 11:31:08 +00:00
|
|
|
{pkgs, ...}: {
|
|
|
|
containers.postgresql = {
|
|
|
|
autoStart = true;
|
|
|
|
privateNetwork = true;
|
|
|
|
hostAddress6 = "fc00::1";
|
|
|
|
localAddress6 = "fc00::2";
|
|
|
|
ephemeral = true;
|
|
|
|
bindMounts = {
|
|
|
|
persist = {
|
|
|
|
mountPoint = "/persist";
|
|
|
|
hostPath = "/persist/postgresql";
|
2024-04-13 11:53:00 +00:00
|
|
|
isReadOnly = false;
|
2024-04-13 11:31:08 +00:00
|
|
|
};
|
|
|
|
backup = {
|
|
|
|
mountPoint = "/backup";
|
|
|
|
hostPath = "/persist/backup/postgresql";
|
2024-04-13 11:53:00 +00:00
|
|
|
isReadOnly = false;
|
2024-04-13 11:31:08 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = {pkgs, ...}: {
|
|
|
|
services.postgresql = {
|
|
|
|
enable = true;
|
|
|
|
package = pkgs.postgresql_16;
|
|
|
|
dataDir = "/persist/16";
|
|
|
|
};
|
|
|
|
services.postgresqlBackup = {
|
|
|
|
enable = true;
|
|
|
|
pgdumpOptions = "-C";
|
|
|
|
location = "/backup";
|
|
|
|
compression = "zstd";
|
|
|
|
compressionLevel = 19;
|
|
|
|
};
|
|
|
|
networking.firewall = {
|
|
|
|
enable = true;
|
|
|
|
};
|
2024-04-13 11:54:31 +00:00
|
|
|
system.stateVersion = "24.05";
|
2024-04-13 11:31:08 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|