all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Christopher Baines <mail@cbaines.net>
To: 43771@debbugs.gnu.org
Subject: [bug#43771] [PATCH v2 3/5] services: databases: Deprecate the postgresql-service procedure.
Date: Mon, 19 Oct 2020 20:02:57 +0100	[thread overview]
Message-ID: <20201019190259.11356-3-mail@cbaines.net> (raw)
In-Reply-To: <20201019190259.11356-1-mail@cbaines.net>

Using the service type directly is a better approach, making it easier to
configure the service.

* gnu/services/databases.scm (postgresql-service): Deprecate this procedure.
* doc/guix.texi (PostgreSQL): Update the documentation for the use of (service
postgresql-service-type).
---
 doc/guix.texi              | 40 +++++++++++++++++++++++++++++---------
 gnu/services/databases.scm | 14 +++++++------
 2 files changed, 39 insertions(+), 15 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index d6d610acae..8aaa896c8d 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -18180,15 +18180,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
@@ -18208,6 +18205,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,
@@ -18243,7 +18263,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..7908a3e0f6 100644
--- a/gnu/services/databases.scm
+++ b/gnu/services/databases.scm
@@ -30,6 +30,7 @@
   #:use-module (gnu packages databases)
   #:use-module (guix build-system trivial)
   #:use-module (guix build union)
+  #:use-module (guix deprecation)
   #:use-module (guix modules)
   #:use-module (guix packages)
   #:use-module (guix records)
@@ -281,12 +282,13 @@ 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 '()))
+(define-deprecated (postgresql-service #:key (postgresql postgresql)
+                                       (port 5432)
+                                       (locale "en_US.utf8")
+                                       (config-file (postgresql-config-file))
+                                       (data-directory "/var/lib/postgresql/data")
+                                       (extension-packages '()))
+  postgresql-service-type
   "Return a service that runs @var{postgresql}, the PostgreSQL database server.
 
 The PostgreSQL daemon loads its runtime configuration from @var{config-file}
-- 
2.28.0





  parent reply	other threads:[~2020-10-19 19:04 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-02 18:36 [bug#43771] [PATCH 0/5] PostgreSQL service improvements Christopher Baines
2020-10-02 18:40 ` [bug#43771] [PATCH 1/5] Replace (postgresql-service) with (service postgresql-service-type) Christopher Baines
2020-10-02 18:40   ` [bug#43771] [PATCH 2/5] Add some subheadings in to the Databases section of the docs Christopher Baines
2020-10-02 18:40   ` [bug#43771] [PATCH 3/5] Remove the postgresql-service procedure Christopher Baines
2020-10-05  8:33     ` Ludovic Courtès
2020-10-19 19:01       ` Christopher Baines
2020-10-02 18:40   ` [bug#43771] [PATCH 4/5] Define postgresql-10 Christopher Baines
2020-10-02 18:40   ` [bug#43771] [PATCH 5/5] Don't specify a default postgresql version to use for the service Christopher Baines
2020-10-05  8:34 ` [bug#43771] [PATCH 0/5] PostgreSQL service improvements Ludovic Courtès
2020-10-19 19:02   ` [bug#43771] [PATCH v2 1/5] tests: monitoring: Use (service postgresql-service-type) Christopher Baines
2020-10-19 19:02     ` [bug#43771] [PATCH v2 2/5] doc: Add subheadings in to the Databases section Christopher Baines
2020-10-19 19:02     ` Christopher Baines [this message]
2020-10-19 19:02     ` [bug#43771] [PATCH v2 4/5] gnu: databases: Define postgresql-10 Christopher Baines
2020-10-19 19:02     ` [bug#43771] [PATCH v2 5/5] services: databases: Don't specify a default postgresql version Christopher Baines
2020-10-19 21:02   ` [bug#43771] [PATCH 0/5] PostgreSQL service improvements Christopher Baines
2020-10-20 21:32     ` Ludovic Courtès
2020-10-20 22:41       ` bug#43771: " Christopher Baines

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

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

  git send-email \
    --in-reply-to=20201019190259.11356-3-mail@cbaines.net \
    --to=mail@cbaines.net \
    --cc=43771@debbugs.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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.