forked from DGNum/infrastructure
feat(compute01): Upgrade postgres to 16.2
This commit is contained in:
parent
17a6e085b5
commit
0eb813c8bf
2 changed files with 30 additions and 23 deletions
|
@ -4,7 +4,7 @@
|
|||
services.postgresql = {
|
||||
enable = true;
|
||||
|
||||
package = pkgs.postgresql_14;
|
||||
package = pkgs.postgresql_16;
|
||||
|
||||
settings = {
|
||||
checkpoint_completion_target = 0.90625;
|
||||
|
@ -25,4 +25,10 @@
|
|||
work_mem = "83886kB";
|
||||
};
|
||||
};
|
||||
|
||||
dgn-console = {
|
||||
# Update the versions below for upgrading
|
||||
pg-upgrade-to = pkgs.postgresql_16.withPackages (ps: [ ps.postgis ]);
|
||||
pg-upgrade-from = pkgs.postgresql_16.withPackages (ps: [ ps.postgis ]);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -16,6 +16,11 @@ in
|
|||
default = true;
|
||||
};
|
||||
|
||||
pg-upgrade-from = mkOption {
|
||||
type = lib.types.package;
|
||||
default = config.services.postgresql.package;
|
||||
};
|
||||
|
||||
pg-upgrade-to = mkOption {
|
||||
type = lib.types.package;
|
||||
default = pkgs.postgresql_15;
|
||||
|
@ -77,21 +82,17 @@ in
|
|||
tcpdump
|
||||
])
|
||||
++ [ config.boot.kernelPackages.perf ]
|
||||
++
|
||||
lib.optional
|
||||
(config.services.postgresql.enable && config.services.postgresql.package != cfg.pg-upgrade-to)
|
||||
(
|
||||
++ lib.optional (config.services.postgresql.enable && cfg.pg-upgrade-from != cfg.pg-upgrade-to) (
|
||||
pkgs.writeScriptBin "upgrade-pg-cluster" ''
|
||||
set -eux
|
||||
# XXX it's perhaps advisable to stop all services that depend on postgresql
|
||||
systemctl stop postgresql
|
||||
|
||||
export NEWDATA="/var/lib/postgresql/${cfg.pg-upgrade-to.psqlSchema}"
|
||||
|
||||
export NEWBIN="${cfg.pg-upgrade-to}/bin"
|
||||
|
||||
export OLDDATA="${config.services.postgresql.dataDir}"
|
||||
export OLDBIN="${config.services.postgresql.package}/bin"
|
||||
export OLDBIN="${cfg.pg-upgrade-from}/bin"
|
||||
|
||||
install -d -m 0700 -o postgres -g postgres "$NEWDATA"
|
||||
cd "$NEWDATA"
|
||||
|
|
Loading…
Reference in a new issue