Archived
1
0
Fork 0

services: databases: Deprecate the postgresql-service procedure.

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).
This commit is contained in:
Christopher Baines 2020-10-02 19:06:50 +01:00
parent 93576e4475
commit a698df72d3
No known key found for this signature in database
GPG key ID: 5E28A33B0B84F577
2 changed files with 39 additions and 15 deletions

View file

@ -18453,15 +18453,12 @@ The @code{(gnu services databases)} module provides the following services.
@subsubheading PostgreSQL @subsubheading PostgreSQL
@deffn {Scheme Procedure} postgresql-service [#:postgresql postgresql] @ The following example describes a PostgreSQL service with the default
[#:config-file] [#:data-directory ``/var/lib/postgresql/data''] @ configuration.
[#:port 5432] [#:locale ``en_US.utf8''] [#:extension-packages '()]
Return a service that runs @var{postgresql}, the PostgreSQL database
server.
The PostgreSQL daemon loads its runtime configuration from @var{config-file}, @lisp
creates a database cluster with @var{locale} as the default (service postgresql-service-type)
locale, stored in @var{data-directory}. It then listens on @var{port}. @end lisp
If the services fails to start, it may be due to an incompatible 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 cluster already present in @var{data-directory}. Adjust it (or, if you
@ -18481,6 +18478,29 @@ createuser --interactive
createdb $MY_USER_LOGIN # Replace appropriately. createdb $MY_USER_LOGIN # Replace appropriately.
@end example @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 @cindex postgresql extension-packages
Additional extensions are loaded from packages listed in Additional extensions are loaded from packages listed in
@var{extension-packages}. Extensions are available at runtime. For instance, @var{extension-packages}. Extensions are available at runtime. For instance,
@ -18516,7 +18536,9 @@ psql -U postgres
There is no need to add this field for contrib extensions such as hstore or 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 dblink as they are already loadable by postgresql. This field is only
required to add extensions provided by other packages. required to add extensions provided by other packages.
@end deffn
@end table
@end deftp
@subsubheading MariaDB/MySQL @subsubheading MariaDB/MySQL

View file

@ -30,6 +30,7 @@
#:use-module (gnu packages databases) #:use-module (gnu packages databases)
#:use-module (guix build-system trivial) #:use-module (guix build-system trivial)
#:use-module (guix build union) #:use-module (guix build union)
#:use-module (guix deprecation)
#:use-module (guix modules) #:use-module (guix modules)
#:use-module (guix packages) #:use-module (guix packages)
#:use-module (guix records) #:use-module (guix records)
@ -281,12 +282,13 @@ host all all ::1/128 md5"))
(compose list postgresql-configuration-postgresql)))) (compose list postgresql-configuration-postgresql))))
(default-value (postgresql-configuration)))) (default-value (postgresql-configuration))))
(define* (postgresql-service #:key (postgresql postgresql) (define-deprecated (postgresql-service #:key (postgresql postgresql)
(port 5432) (port 5432)
(locale "en_US.utf8") (locale "en_US.utf8")
(config-file (postgresql-config-file)) (config-file (postgresql-config-file))
(data-directory "/var/lib/postgresql/data") (data-directory "/var/lib/postgresql/data")
(extension-packages '())) (extension-packages '()))
postgresql-service-type
"Return a service that runs @var{postgresql}, the PostgreSQL database server. "Return a service that runs @var{postgresql}, the PostgreSQL database server.
The PostgreSQL daemon loads its runtime configuration from @var{config-file} The PostgreSQL daemon loads its runtime configuration from @var{config-file}