unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: Gabriel Wicki <gabriel@erlikon.ch>
To: help-guix@gnu.org
Subject: Upgrade postgres for cuirass
Date: Fri, 29 Nov 2024 17:33:58 +0100	[thread overview]
Message-ID: <7ighizgp4lsdxxqxdoufy6bqwymndnaei2tv37pcxmnbjx6bzu@mogcc4xr5hco> (raw)

Aloha, howdy and hello!

This isn't your usual call for help - this is my help to you!  Since
postgres was recently unset all of us running cuirass on default
postgres versions need to take some action.  Since I guess a bunch of
users will be affected, I summarized the necessary steps in hope to
help before you have to ask.  It may contain errors, mistakes or false
promises, use at your own risk.


This is for all of you who know perfectly well that they will figure out
how to do it but still prefer to do some of the tasks on the stack in a
sheepishly follow the tutorial step-by-step fashion.  I know I am like
that with far too many of the tasks piling up on my virtual task-heap.

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

 3. Add the postgres service to your system configuration - or alter
    the already existing configuration to reflect your intended
    version upgrade.  Be careful not to upgrade directly to
    postgres-16 -- cuirass service for some reason doesn't like that.
    I had to find and purge and then re-initialize after a failed
    upgrade to postgres 16.

    #+begin_quote
    (service postgresql-service-type
             (postgresql-configuration
              (postgresql (@ (gnu packages databases) postgresql-15))))
    #+end_quote

    If you for some reason didn't read the text here but somewhat
    blindly followed the examples and **did upgrade to 16**, here's
    how you reset the state:

    a) Delete the database instance files; they default to live under
    /var/lib/postgres/data.

    b) Re-initialize:
    sudo su - postgres -s /bin/sh -c 'pg_ctl init -D /var/lib/postgres/data'

 4. Reconfigure your system.
    sudo guix system reconfigure path/to/your/altered/config.scm

 5. Restore database contents:
    sudo su - postgres -s /bin/sh -c 'psql -d postgres -f /tmp/pg.dump'

 6. Enable and start the service(s)
    sudo herd enable cuirass
    sudo herd start cuirass

That's it, fellow guix!


Happy hacking and have a nice weekend!
gabber


                 reply	other threads:[~2024-11-29 16:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7ighizgp4lsdxxqxdoufy6bqwymndnaei2tv37pcxmnbjx6bzu@mogcc4xr5hco \
    --to=gabriel@erlikon.ch \
    --cc=help-guix@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).