From f9fc034556a35a504ed77d3ed08d5ee49fd5aab7 Mon Sep 17 00:00:00 2001 From: June Date: Wed, 6 Dec 2023 00:52:05 +0100 Subject: [PATCH] Set PostgreSQL package to PostgreSQL 15 for matrix host Also remove the upgrade script again. Bascially do steps 4 and 5 of the following section of the manual: https://nixos.org/manual/nixos/stable/#module-services-postgres-upgrading --- config/hosts/matrix/postgresql.nix | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/config/hosts/matrix/postgresql.nix b/config/hosts/matrix/postgresql.nix index 9cfdb46..a241efd 100644 --- a/config/hosts/matrix/postgresql.nix +++ b/config/hosts/matrix/postgresql.nix @@ -3,6 +3,7 @@ { services.postgresql = { enable = true; + package = pkgs.postgresql_15; initialScript = pkgs.writeText "synapse-init.sql" '' CREATE ROLE "matrix-synapse" WITH LOGIN PASSWORD 'synapse'; @@ -14,33 +15,4 @@ dataDir = "/mnt/data/postgresql/${config.services.postgresql.package.psqlSchema}"; }; - - # Modified version of the script for upgrading PostgreSQL from here: - # https://nixos.org/manual/nixos/stable/#module-services-postgres-upgrading - environment.systemPackages = [ - (let - newPostgres = pkgs.postgresql_15; - in pkgs.writeScriptBin "upgrade-pg-cluster" '' - set -eux - - systemctl stop matrix-synapse.service - systemctl stop postgresql.service - - export NEWDATA="/mnt/data/postgresql/${newPostgres.psqlSchema}" - - export NEWBIN="${newPostgres}/bin" - - export OLDDATA="${config.services.postgresql.dataDir}" - export OLDBIN="${config.services.postgresql.package}/bin" - - install -d -m 0700 -o postgres -g postgres "$NEWDATA" - cd "$NEWDATA" - sudo -u postgres $NEWBIN/initdb -D "$NEWDATA" - - sudo -u postgres $NEWBIN/pg_upgrade \ - --old-datadir "$OLDDATA" --new-datadir "$NEWDATA" \ - --old-bindir $OLDBIN --new-bindir $NEWBIN \ - "$@" - '') - ]; }