update docker configs, upgrade postgres
Signed-off-by: ahuston-0 <aliceghuston@gmail.com>
This commit is contained in:
62
systems/palatine-hill/postgresql.nix
Normal file
62
systems/palatine-hill/postgresql.nix
Normal file
@ -0,0 +1,62 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
# sudo -u postgres vacuumdb --all --analyze-in-stages
|
||||
# /var/lib/postgresql/16/delete_old_cluster.sh
|
||||
let
|
||||
vars = import ./vars.nix;
|
||||
dataDir = "${vars.primary_db}/postgresql/nix/${config.services.postgresql.package.psqlSchema}";
|
||||
backupLocation = "${vars.primary_db}/postgresql/nix_backups";
|
||||
in
|
||||
{
|
||||
services = {
|
||||
postgresql = {
|
||||
inherit dataDir;
|
||||
enable = true;
|
||||
enableJIT = true;
|
||||
package = pkgs.postgresql_16;
|
||||
identMap = ''
|
||||
# ArbitraryMapName systemUser DBUser
|
||||
superuser_map root postgres
|
||||
superuser_map alice postgres
|
||||
# Let other names login as themselves
|
||||
superuser_map /^(.*)$ \1
|
||||
'';
|
||||
|
||||
# initialScript = config.sops.secrets."postgres/init".path;
|
||||
ensureDatabases = [ "atticd" ];
|
||||
ensureUsers = [
|
||||
{
|
||||
name = "atticd";
|
||||
ensureDBOwnership = true;
|
||||
}
|
||||
];
|
||||
|
||||
refreshCollation = true;
|
||||
vacuumAnalyzeTimer.enable = true;
|
||||
upgrade = {
|
||||
enable = true;
|
||||
stopServices = [
|
||||
"hydra-evaluator"
|
||||
"hydra-init"
|
||||
"hydra-notify"
|
||||
"hydra-queue-runner"
|
||||
"hydra-send-stats"
|
||||
"hydra-server"
|
||||
"atticd"
|
||||
];
|
||||
};
|
||||
};
|
||||
postgresqlBackup = {
|
||||
enable = true;
|
||||
compression = "zstd";
|
||||
compressionLevel = 19;
|
||||
pgdumpOptions = "--create --clean";
|
||||
location = backupLocation;
|
||||
};
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user