From patchwork Mon Dec 9 15:59:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gabriel Wicki X-Patchwork-Id: 34694 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 0CD8B27BBEA; Mon, 9 Dec 2024 16:00:34 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id D2FE127BBE9 for ; Mon, 9 Dec 2024 16:00:32 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tKgB5-0002GX-Ml; Mon, 09 Dec 2024 11:00:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tKgB1-0002Ds-1P for guix-patches@gnu.org; Mon, 09 Dec 2024 11:00:03 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tKgB0-00006W-I1 for guix-patches@gnu.org; Mon, 09 Dec 2024 11:00:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:From:Date:To:Subject; bh=Hm88uy//R/davu93TAEIonZlVL5jjFgv9riNN716V5Q=; b=v44ZJvcJ+U/bp5nD0f9JP+Jp/GtZT2vs9Jd4Pas4WSgpGHnl8arRb3HN2JGGM2wyBxw7FBwt0/yUkyvwrNi52Fes1R3xO/rDTAr0u0VUyjmNo0uUmarvB3AusbYb9mgO/cSj4l6atzofl8eO0veC1HZ53w2IN6wFAQD7FMY3V1kZXPKWi1dWgxeewg94qJ6QXjmPfse0qcB1i+z4sAWm/S14LQGL16f4Zxx6Wf1b625g2Kt0sjcaPu1sGnWuyLMq+fmpSF5NzWS+ASW7AznmpSCUD2ggdA9At8jFqKsLP4wu5rpRfkrInVcbdueJRX9yueXVn0LCBVErg1qt677VBQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tKgAz-0004ny-VV for guix-patches@gnu.org; Mon, 09 Dec 2024 11:00:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#74751] [PATCH] doc: cookbook: Document postgres upgrade for cuirass. Resent-From: Gabriel Wicki Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 09 Dec 2024 16:00:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 74751 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 74751@debbugs.gnu.org Cc: ludo@gnu.org, maxim.cournoyer@gmail.com X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.173375998518399 (code B ref -1); Mon, 09 Dec 2024 16:00:01 +0000 Received: (at submit) by debbugs.gnu.org; 9 Dec 2024 15:59:45 +0000 Received: from localhost ([127.0.0.1]:55255 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tKgAj-0004mh-0h for submit@debbugs.gnu.org; Mon, 09 Dec 2024 10:59:45 -0500 Received: from lists.gnu.org ([209.51.188.17]:38088) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tKgAe-0004mU-Fc for submit@debbugs.gnu.org; Mon, 09 Dec 2024 10:59:43 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tKgAe-0002Bd-6I for guix-patches@gnu.org; Mon, 09 Dec 2024 10:59:40 -0500 Received: from cotopaxi.ee.ethz.ch ([129.132.148.196]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tKgAb-00004r-Ck; Mon, 09 Dec 2024 10:59:39 -0500 Received: from localhost (antispam.ee.ethz.ch [129.132.2.16]) by cotopaxi.ee.ethz.ch (Postfix) with ESMTP id E08AE1FF89; Mon, 9 Dec 2024 16:59:31 +0100 (CET) X-Virus-Scanned: by amavisd at antispam.ee.ethz.ch Received: from cotopaxi.ee.ethz.ch ([129.132.148.196]) by localhost (antispam.ee.ethz.ch [129.132.2.16]) (amavisd-new, port 10028) with ESMTP id CJnrAFlHHtV8; Mon, 9 Dec 2024 16:59:26 +0100 (CET) Received: from blackbox (212-51-128-25.fiber7.init7.net [212.51.128.25]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: gabriel) by cotopaxi.ee.ethz.ch (Postfix) with ESMTPSA; Mon, 9 Dec 2024 16:59:26 +0100 (CET) Date: Mon, 9 Dec 2024 16:59:20 +0100 From: Gabriel Wicki Message-ID: MIME-Version: 1.0 Content-Disposition: inline Received-SPF: permerror client-ip=129.132.148.196; envelope-from=gabriel@erlikon.ch; helo=cotopaxi.ee.ethz.ch X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, T_SPF_PERMERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * doc/guix-cookbook.texi(System Management): New chapter. [Upgrade Postgres for Cuirass] New node. Change-Id: I23aae16b1f50b6c40c56b78712dfd6eae3834761 --- doc/guix-cookbook.texi | 103 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) base-commit: 9d09b0cf841fb657a1aec12e9bab68e00c2b493c diff --git a/doc/guix-cookbook.texi b/doc/guix-cookbook.texi index bbc5ca9dcd..57e39f12d9 100644 --- a/doc/guix-cookbook.texi +++ b/doc/guix-cookbook.texi @@ -86,6 +86,7 @@ Top * Software Development:: Environments, continuous integration, etc. * Environment management:: Control environment * Installing Guix on a Cluster:: High-performance computing. +* Guix System Management:: System Management specifics. * Acknowledgments:: Thanks! * GNU Free Documentation License:: The license of this document. @@ -199,6 +200,10 @@ Top * Cluster Disk Usage:: Disk usage considerations. * Cluster Security Considerations:: Keeping the cluster secure. +Guix System Management + +* Upgrade Postgres for Cuirass:: How to handle deprecation of the default postgres package. + @end detailmenu @end menu @@ -5524,6 +5529,104 @@ Cluster Security Considerations This will report whether profiles exist that refer to this specific glibc variant. +@c ********************************************************************* +@node Guix System Management +@chapter Guix System Management +@cindex system management +@cindex sysadmin + +Since Guix does not handle packaging, system configuration and services +the way other (more ``classical'') distributions do, some workflows tend +to unfold slightly different as we are used to and need slight +adjustment. This chapter intends to help with such manners. + +@menu +* Upgrade Postgres for Cuirass:: Upgrading from the default postgres. +@end menu + +@node Upgrade Postgres for Cuirass +@section Upgrade Postgres for Cuirass + +With the deprecation of the default value for the postgres package in +postgresql-configuration (see b93434e656eba4260df82158a96c295000d3ff44), +system upgrades need some manual action before they can take place. +Here's a handy guide on how to. + +Please note that this is a straight-forward way for smaller datasets. +For larger databases +@url{https://www.postgresql.org/docs/current/pgupgrade.html, +@code{pg_upgrade}} may be the better choice. Handling the service and +system upgrade as described in this guide still applies, though. + +@enumerate +@item +Stop and disable cuirass. + +Prevent the service from starting and failing after a reconfiguration: + + @code{sudo herd stop cuirass && sudo herd disable cuirass} + +@item +Dump the database contents. + + @code{sudo su - postgres -s /bin/sh -c pg_dumpall > /tmp/pg.dump} + +@item +Add or alter the postgres service. + +Depending on whether your postgres service is defined implicitly +(through the dependency from the cuirass service) or its own entry in +your operating system's @code{(services)} property, you need to either +add 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 the relevant +files and then re-initialize after a failed upgrade to postgres 16. + +@lisp +(service postgresql-service-type + (postgresql-configuration + (postgresql (@ (gnu packages databases) postgresql-15)))) +@end lisp + +Note: If you for some reason didn't read the text here but somewhat +blindly followed the examples and @emph{did upgrade to 16}, here's how +you reset the state: + +@enumerate +@item +Delete the database instance files. + +They default to live under @file{/var/lib/postgres/data}. + +@item +Re-initialize postgres. + +@code{sudo su - postgres -s /bin/sh -c 'pg_ctl init -D +/var/lib/postgres/data'} +@end enumerate + +@item +Reconfigure your system. + +@code{sudo guix system reconfigure path/to/your/altered/config.scm} + +@item +Restore database contents. + +@code{sudo su - postgres -s /bin/sh -c 'psql -d postgres -f /tmp/pg.dump'} + +@item +Enable and start the service. + +@example +sudo herd enable cuirass +sudo herd start cuirass +@end example + +@end enumerate + @c ********************************************************************* @node Acknowledgments