Hi,

Thanks for this nice writeup!  Would you like to turn it into a section
of the Cuirass (or Guix) manual?

Gabriel Wicki <gabr...@erlikon.ch> skribis:

> So here it is, my tiny writeup on how to upgrade postgres for cuirass
> to continue working.  It's actually kinda easy.
>
>  1. Stop and disable cuirass (to prevent it from starting and failing
>     after a reconfiguration):
>
>     sudo herd stop cuirass && sudo herd disable cuirass
>
>  2. Dump the database contents.  Ever too often (I tend to be somewhat
>     dense) I forget how to access postgres privileged content.  Don't
>     be like me.
>
>     sudo su - postgres -s /bin/sh -c pg_dumpall > /tmp/pg.dump

FWIW, I used the same approach on guix.bordeaux.inria.fr, which has a
relatively small database.

For ci.guix.gnu.org, which has a much bigger database, I used
‘pg_upgrade’ instead:

  https://www.postgresql.org/docs/current/pgupgrade.html

It went like this:

--8<---------------cut here---------------start------------->8---
sudo herd stop cuirass && sudo herd disable cuirass
sudo herd stop postgresql

mv /var/lib/postgresql/data{,.pg13}
sudo su - postgres -s /bin/sh -c "cd $PWD; 
/gnu/store/cng33vs1zdrqpmiz548kkvavc7x1xpd0-postgresql-15.8/bin/initdb -D 
/var/lib/postgresql/data --locale=en_US.UTF-8"

sudo su - postgres -s /bin/sh -c "cd $PWD; 
/gnu/store/cng33vs1zdrqpmiz548kkvavc7x1xpd0-postgresql-15.8/bin/pg_upgrade 
--old-datadir=/var/lib/postgresql/data.pg13 
--new-datadir=/var/lib/postgresql/data 
--old-bindir=/gnu/store/j9wnb7rvjzxdzghpvq1jmi2zfg4z2d8c-postgresql-13.15/bin 
--new-bindir=/gnu/store/cng33vs1zdrqpmiz548kkvavc7x1xpd0-postgresql-15.8/bin"
--8<---------------cut here---------------end--------------->8---

The store file names are those of Postgres 13 (the one that was used so
far) and 15 (as returned by ‘guix build postgresql@15’ with the target
Guix revision).

That was a couple of hours ago.  Apparently it went well, though
postgresql is slower than before so I wonder if there are options I
forgot to pass or something.

Ludo’.

Reply via email to