[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Running service migrations during upgrades

From: Efraim Flashner
Subject: Re: Running service migrations during upgrades
Date: Sun, 20 Sep 2020 23:53:01 +0300

On Sun, Sep 20, 2020 at 02:39:45PM +0200, Marius Bakke wrote:
> Hello Guix,
> Some services require administrator interaction when they are updated.
> The most prominent examples here are MySQL/MariaDB and PostgresQL.
> For the former, running 'mysql_upgrade' in-place is generally sufficient
> and fairly safe.
> For the latter, the procedure is more involved, and requires making a
> full backup, as well as access to the old _and_ new PostgreSQL
> packages.
> There is a patch to update MariaDB here:
> Users of mysql-service-type will need to run 'mysql_upgrade' afterwards.
> I have been considering adding an AUTO-UPGRADE? parameter of
> mysql-service-type that runs 'mysql_upgrade' as part of the activation
> script.
> Another approach is adding a 'herd upgrade' Shepherd action along with a
> news entry describing what to do.  Of course it is possible to do both,
> having 'auto-upgrade?' _and_ a Shepherd action for manual upgrades.
> Thoughts?
> While that works for MariaDB, I'm not sure what to do about Postgres.
> For those unfamiliar, the procedure for upgrading from PostgreSQL 10
> (current default) to 11 (available in Guix) is roughly:
>   sudo cp -a /var/lib/postgresql/data /var/lib/postgresql/data10
>   sudo -u postgres $(guix build postgresql)/bin/pg_upgrade \
>     --old-bindir=$(guix build postgresql@10)/bin \
>     --new-bindir=$(guix build postgresql)/bin \
>     --old-datadir=/var/lib/postgresql/data10 \
>     --new-datadir=/var/lib/postgresql/data
> In order to automate it, we need to somehow preserve the "previous"
> version of PostgreSQL so that we can reach it when the major version
> changes.  Or add an 'upgrade-from' parameter to
> postgresql-service-type.
> How do other distros deal with this?

It looks like Debian has a whole package named "postgres-common" to deal
with updating postgres databases and clusers to newer versions.

> On a related note, a 'herd backup' action might be a prerequisite for
> doing such potentially dangerous operations...
> I will try to add a 'mysql_upgrade' pass to 'mysql-service-type' in time
> for the MariaDB upgrade, but tips regarding backups, potential pitfalls,
> and especially Postgres welcome.
> PS: I'm mostly busy for some time still, but can be reached on #guix or
> by private email if you want my feedback on something.  :-)

Efraim Flashner   <>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

Attachment: signature.asc
Description: PGP signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]