From patchwork Fri Oct 2 18:40:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christopher Baines X-Patchwork-Id: 24443 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 5597127BBEA; Fri, 2 Oct 2020 19:42:20 +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,UNPARSEABLE_RELAY 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 ESMTPS id C90DF27BBE9 for ; Fri, 2 Oct 2020 19:42:19 +0100 (BST) Received: from localhost ([::1]:37746 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kOQ0Y-0000UR-Ug for patchwork@mira.cbaines.net; Fri, 02 Oct 2020 14:42:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57302) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kOQ0J-0000U4-GR for guix-patches@gnu.org; Fri, 02 Oct 2020 14:42:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:59261) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kOQ0I-0002LG-Vj for guix-patches@gnu.org; Fri, 02 Oct 2020 14:42:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kOQ0I-0002nH-UJ for guix-patches@gnu.org; Fri, 02 Oct 2020 14:42:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#43771] [PATCH 3/5] Remove the postgresql-service procedure Resent-From: Christopher Baines Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 02 Oct 2020 18:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43771 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 43771@debbugs.gnu.org Received: via spool by 43771-submit@debbugs.gnu.org id=B43771.160166406510645 (code B ref 43771); Fri, 02 Oct 2020 18:42:02 +0000 Received: (at 43771) by debbugs.gnu.org; 2 Oct 2020 18:41:05 +0000 Received: from localhost ([127.0.0.1]:42568 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kOPzN-0002lX-8G for submit@debbugs.gnu.org; Fri, 02 Oct 2020 14:41:05 -0400 Received: from mira.cbaines.net ([212.71.252.8]:44622) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kOPzK-0002ko-Rx for 43771@debbugs.gnu.org; Fri, 02 Oct 2020 14:41:03 -0400 Received: from localhost (188.28.111.33.threembb.co.uk [188.28.111.33]) by mira.cbaines.net (Postfix) with ESMTPSA id 2B24C27BBEA for <43771@debbugs.gnu.org>; Fri, 2 Oct 2020 19:41:02 +0100 (BST) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id 61143908 for <43771@debbugs.gnu.org>; Fri, 2 Oct 2020 18:40:59 +0000 (UTC) From: Christopher Baines Date: Fri, 2 Oct 2020 19:40:57 +0100 Message-Id: <20201002184059.29033-3-mail@cbaines.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201002184059.29033-1-mail@cbaines.net> References: <20201002184059.29033-1-mail@cbaines.net> 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 It's unnecessary, using the service type directly is a better approach. While this is unfortunately a breaking change, I'm also looking at making breaking changes to the service type configuration, so I don't think this can be avoided. --- doc/guix.texi | 40 +++++++++++++++++++++++++++++--------- gnu/services/databases.scm | 19 ------------------ 2 files changed, 31 insertions(+), 28 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 4197cd562a..641b410acf 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -17738,15 +17738,12 @@ The @code{(gnu services databases)} module provides the following services. @subsubheading PostgreSQL -@deffn {Scheme Procedure} postgresql-service [#:postgresql postgresql] @ - [#:config-file] [#:data-directory ``/var/lib/postgresql/data''] @ - [#:port 5432] [#:locale ``en_US.utf8''] [#:extension-packages '()] -Return a service that runs @var{postgresql}, the PostgreSQL database -server. +The following example describes a PostgreSQL service with the default +configuration. -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}. +@lisp +(service postgresql-service-type) +@end lisp 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 @@ -17766,6 +17763,29 @@ createuser --interactive createdb $MY_USER_LOGIN # Replace appropriately. @end example +@deftp {Data Type} postgresql-configuration +Data type representing the configuration for the +@code{postgresql-service-type}. + +@table @asis +@item @var{postgresql} (default: @code{postgresql}) +PostgreSQL package to use for the service. + +@item @var{port} (default: @code{5432}) +Port on which PostgreSQL should listen. + +@item @var{locale} (default: @code{"en_US.utf8"}) +Locale to use as the default when creating the database cluster. + +@item @var{config-file} (default: @code{(postgresql-config-file)}) +The configuration file to use when running PostgreSQL. The default +behaviour uses the postgresql-config-file record with the default values +for the fields. + +@item @var{data-directory} (default: @code{"/var/lib/postgresql/data"}) +Directory in which to store the data. + +@item @var{extension-packages} (default: @code{'()}) @cindex postgresql extension-packages Additional extensions are loaded from packages listed in @var{extension-packages}. Extensions are available at runtime. For instance, @@ -17801,7 +17821,9 @@ psql -U postgres There is no need to add this field for contrib extensions such as hstore or dblink as they are already loadable by postgresql. This field is only required to add extensions provided by other packages. -@end deffn + +@end table +@end deftp @subsubheading MariaDB/MySQL diff --git a/gnu/services/databases.scm b/gnu/services/databases.scm index 2bddf70f71..efad182a68 100644 --- a/gnu/services/databases.scm +++ b/gnu/services/databases.scm @@ -281,25 +281,6 @@ host all all ::1/128 md5")) (compose list postgresql-configuration-postgresql)))) (default-value (postgresql-configuration)))) -(define* (postgresql-service #:key (postgresql postgresql) - (port 5432) - (locale "en_US.utf8") - (config-file (postgresql-config-file)) - (data-directory "/var/lib/postgresql/data") - (extension-packages '())) - "Return a service that runs @var{postgresql}, the PostgreSQL database server. - -The PostgreSQL daemon loads its runtime configuration from @var{config-file} -and stores the database cluster in @var{data-directory}." - (service postgresql-service-type - (postgresql-configuration - (postgresql postgresql) - (port port) - (locale locale) - (config-file config-file) - (data-directory data-directory) - (extension-packages extension-packages)))) - ;;; ;;; Memcached