feat(compute01): Upgrade postgres to 16.2
All checks were successful
build configuration / build_vault01 (push) Successful in 1m15s
build configuration / build_rescue01 (push) Successful in 1m15s
build configuration / build_storage01 (push) Successful in 1m18s
build configuration / build_web02 (push) Successful in 1m24s
lint / check (push) Successful in 25s
build configuration / build_web01 (push) Successful in 1m51s
build configuration / build_compute01 (push) Successful in 1m58s
build configuration / push_to_cache (push) Successful in 2m14s
All checks were successful
build configuration / build_vault01 (push) Successful in 1m15s
build configuration / build_rescue01 (push) Successful in 1m15s
build configuration / build_storage01 (push) Successful in 1m18s
build configuration / build_web02 (push) Successful in 1m24s
lint / check (push) Successful in 25s
build configuration / build_web01 (push) Successful in 1m51s
build configuration / build_compute01 (push) Successful in 1m58s
build configuration / push_to_cache (push) Successful in 2m14s
This commit is contained in:
parent
17a6e085b5
commit
0eb813c8bf
2 changed files with 30 additions and 23 deletions
|
@ -4,7 +4,7 @@
|
||||||
services.postgresql = {
|
services.postgresql = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
package = pkgs.postgresql_14;
|
package = pkgs.postgresql_16;
|
||||||
|
|
||||||
settings = {
|
settings = {
|
||||||
checkpoint_completion_target = 0.90625;
|
checkpoint_completion_target = 0.90625;
|
||||||
|
@ -25,4 +25,10 @@
|
||||||
work_mem = "83886kB";
|
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;
|
default = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
pg-upgrade-from = mkOption {
|
||||||
|
type = lib.types.package;
|
||||||
|
default = config.services.postgresql.package;
|
||||||
|
};
|
||||||
|
|
||||||
pg-upgrade-to = mkOption {
|
pg-upgrade-to = mkOption {
|
||||||
type = lib.types.package;
|
type = lib.types.package;
|
||||||
default = pkgs.postgresql_15;
|
default = pkgs.postgresql_15;
|
||||||
|
@ -77,31 +82,27 @@ in
|
||||||
tcpdump
|
tcpdump
|
||||||
])
|
])
|
||||||
++ [ config.boot.kernelPackages.perf ]
|
++ [ config.boot.kernelPackages.perf ]
|
||||||
++
|
++ lib.optional (config.services.postgresql.enable && cfg.pg-upgrade-from != cfg.pg-upgrade-to) (
|
||||||
lib.optional
|
pkgs.writeScriptBin "upgrade-pg-cluster" ''
|
||||||
(config.services.postgresql.enable && config.services.postgresql.package != cfg.pg-upgrade-to)
|
set -eux
|
||||||
(
|
# XXX it's perhaps advisable to stop all services that depend on postgresql
|
||||||
pkgs.writeScriptBin "upgrade-pg-cluster" ''
|
systemctl stop postgresql
|
||||||
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 NEWDATA="/var/lib/postgresql/${cfg.pg-upgrade-to.psqlSchema}"
|
||||||
|
export NEWBIN="${cfg.pg-upgrade-to}/bin"
|
||||||
|
|
||||||
export NEWBIN="${cfg.pg-upgrade-to}/bin"
|
export OLDDATA="${config.services.postgresql.dataDir}"
|
||||||
|
export OLDBIN="${cfg.pg-upgrade-from}/bin"
|
||||||
|
|
||||||
export OLDDATA="${config.services.postgresql.dataDir}"
|
install -d -m 0700 -o postgres -g postgres "$NEWDATA"
|
||||||
export OLDBIN="${config.services.postgresql.package}/bin"
|
cd "$NEWDATA"
|
||||||
|
sudo -u postgres $NEWBIN/initdb -D "$NEWDATA"
|
||||||
|
|
||||||
install -d -m 0700 -o postgres -g postgres "$NEWDATA"
|
sudo -u postgres $NEWBIN/pg_upgrade \
|
||||||
cd "$NEWDATA"
|
--old-datadir "$OLDDATA" --new-datadir "$NEWDATA" \
|
||||||
sudo -u postgres $NEWBIN/initdb -D "$NEWDATA"
|
--old-bindir $OLDBIN --new-bindir $NEWBIN \
|
||||||
|
"$@"
|
||||||
sudo -u postgres $NEWBIN/pg_upgrade \
|
''
|
||||||
--old-datadir "$OLDDATA" --new-datadir "$NEWDATA" \
|
);
|
||||||
--old-bindir $OLDBIN --new-bindir $NEWBIN \
|
|
||||||
"$@"
|
|
||||||
''
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue