From patchwork Tue Jul 28 11:58:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre Neidhardt X-Patchwork-Id: 23433 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 208A927BBE1; Tue, 28 Jul 2020 13:00:16 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 536C327BBE3 for ; Tue, 28 Jul 2020 13:00:15 +0100 (BST) Received: from localhost ([::1]:40202 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k0OHG-00055O-RD for patchwork@mira.cbaines.net; Tue, 28 Jul 2020 08:00:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45296) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k0OH6-00053I-FX for guix-patches@gnu.org; Tue, 28 Jul 2020 08:00:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:45942) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k0OH6-0005Np-4c for guix-patches@gnu.org; Tue, 28 Jul 2020 08:00:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1k0OH4-0002Ew-Ue for guix-patches@gnu.org; Tue, 28 Jul 2020 08:00:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#41786] [PATCH 1/2] services: postgresql: Provide postgresql commands. Resent-From: Pierre Neidhardt Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 28 Jul 2020 12:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41786 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 41786@debbugs.gnu.org Received: via spool by 41786-submit@debbugs.gnu.org id=B41786.15959375438493 (code B ref 41786); Tue, 28 Jul 2020 12:00:02 +0000 Received: (at 41786) by debbugs.gnu.org; 28 Jul 2020 11:59:03 +0000 Received: from localhost ([127.0.0.1]:57482 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k0OG7-0002Ct-5i for submit@debbugs.gnu.org; Tue, 28 Jul 2020 07:59:03 -0400 Received: from relay8-d.mail.gandi.net ([217.70.183.201]:57743) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k0OG5-0002CH-H4 for 41786@debbugs.gnu.org; Tue, 28 Jul 2020 07:59:02 -0400 X-Originating-IP: 86.246.37.13 Received: from localhost.localdomain (lfbn-idf2-1-572-13.w86-246.abo.wanadoo.fr [86.246.37.13]) (Authenticated sender: mail@ambrevar.xyz) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 211F51BF204 for <41786@debbugs.gnu.org>; Tue, 28 Jul 2020 11:58:53 +0000 (UTC) From: Pierre Neidhardt Date: Tue, 28 Jul 2020 13:58:35 +0200 Message-Id: <20200728115836.23440-1-mail@ambrevar.xyz> X-Mailer: git-send-email 2.27.0 In-Reply-To: <87tuxujz52.fsf@gmail.com> References: <87tuxujz52.fsf@gmail.com> MIME-Version: 1.0 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" X-getmail-retrieved-from-mailbox: Patches * gnu/services/databases.scm (postgresql-service-type): Extend profile-service-type to provide postgresql commands. --- gnu/services/databases.scm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) base-commit: 64e8f2ec2dc6301019a5b93a82787ea6adaf8c76 diff --git a/gnu/services/databases.scm b/gnu/services/databases.scm index 473ece4e97..2bddf70f71 100644 --- a/gnu/services/databases.scm +++ b/gnu/services/databases.scm @@ -276,7 +276,9 @@ host all all ::1/128 md5")) (service-extension activation-service-type postgresql-activation) (service-extension account-service-type - (const %postgresql-accounts)))) + (const %postgresql-accounts)) + (service-extension profile-service-type + (compose list postgresql-configuration-postgresql)))) (default-value (postgresql-configuration)))) (define* (postgresql-service #:key (postgresql postgresql) From patchwork Tue Jul 28 11:58:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre Neidhardt X-Patchwork-Id: 23432 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 3B66027BBE1; Tue, 28 Jul 2020 13:00:15 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id CA00D27BBE3 for ; Tue, 28 Jul 2020 13:00:13 +0100 (BST) Received: from localhost ([::1]:40154 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k0OHF-00053X-Ae for patchwork@mira.cbaines.net; Tue, 28 Jul 2020 08:00:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45292) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k0OH6-00053A-5a for guix-patches@gnu.org; Tue, 28 Jul 2020 08:00:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:45944) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k0OH5-0005Op-RK for guix-patches@gnu.org; Tue, 28 Jul 2020 08:00:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1k0OH5-0002Fh-OP for guix-patches@gnu.org; Tue, 28 Jul 2020 08:00:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#41786] [PATCH 2/2] doc: Explain how to use psql with peer authentication. Resent-From: Pierre Neidhardt Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 28 Jul 2020 12:00:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41786 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 41786@debbugs.gnu.org Received: via spool by 41786-submit@debbugs.gnu.org id=B41786.15959375438499 (code B ref 41786); Tue, 28 Jul 2020 12:00:03 +0000 Received: (at 41786) by debbugs.gnu.org; 28 Jul 2020 11:59:03 +0000 Received: from localhost ([127.0.0.1]:57484 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k0OG7-0002Cv-Eq for submit@debbugs.gnu.org; Tue, 28 Jul 2020 07:59:03 -0400 Received: from relay8-d.mail.gandi.net ([217.70.183.201]:48267) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k0OG5-0002CJ-Jf for 41786@debbugs.gnu.org; Tue, 28 Jul 2020 07:59:02 -0400 X-Originating-IP: 86.246.37.13 Received: from localhost.localdomain (lfbn-idf2-1-572-13.w86-246.abo.wanadoo.fr [86.246.37.13]) (Authenticated sender: mail@ambrevar.xyz) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 5A6A11BF209 for <41786@debbugs.gnu.org>; Tue, 28 Jul 2020 11:58:55 +0000 (UTC) From: Pierre Neidhardt Date: Tue, 28 Jul 2020 13:58:36 +0200 Message-Id: <20200728115836.23440-2-mail@ambrevar.xyz> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200728115836.23440-1-mail@ambrevar.xyz> References: <87tuxujz52.fsf@gmail.com> <20200728115836.23440-1-mail@ambrevar.xyz> MIME-Version: 1.0 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" X-getmail-retrieved-from-mailbox: Patches * doc/guix.texi (Database Services): Add example of shell commands to use psql as system user. Also add troubleshooting tip when service fails to start because of incompatible cluster. --- doc/guix.texi | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/doc/guix.texi b/doc/guix.texi index 74c7417174..aba3f925b9 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -17260,6 +17260,24 @@ The PostgreSQL daemon loads its runtime configuration from @var{config-file}, creates a database cluster with @var{locale} as the default locale, stored in @var{data-directory}. It then listens on @var{port}. +If the services fails to start, it may be due to an incompatible +cluster already present in @var{data-directory}. Adjust it (or, if you +don't need the cluster anymore, delete @var{data-directory}), then +restart the service. + +Peer authentication is used by default and the @code{postgres} user +account has no shell, which prevents the direct execution of @code{psql} +commands as this user. To use @code{psql}, you can temporarily log in +as @code{postgres} using a shell, create a PostgreSQL superuser with the +same name as one of the system users and then create the associated +database. + +@example +sudo -u postgres -s /bin/sh +createuser --interface +createdb $MY_USER_LOGIN # Replace appropriately. +@end example + @cindex postgresql extension-packages Additional extensions are loaded from packages listed in @var{extension-packages}. Extensions are available at runtime. For instance,