* [bug#43771] [PATCH 0/5] PostgreSQL service improvements @ 2020-10-02 18:36 Christopher Baines 2020-10-02 18:40 ` [bug#43771] [PATCH 1/5] Replace (postgresql-service) with (service postgresql-service-type) Christopher Baines 2020-10-05 8:34 ` [bug#43771] [PATCH 0/5] PostgreSQL service improvements Ludovic Courtès 0 siblings, 2 replies; 17+ messages in thread From: Christopher Baines @ 2020-10-02 18:36 UTC (permalink / raw) To: 43771 Christopher Baines (5): Replace (postgresql-service) with (service postgresql-service-type) Add some subheadings in to the Databases section of the docs Remove the postgresql-service procedure Define postgresql-10 Don't specify a default postgresql version to use for the service doc/guix.texi | 52 +++++++++++++++++++++++++++++++------- gnu/packages/databases.scm | 2 ++ gnu/services/databases.scm | 25 ++---------------- gnu/tests/databases.scm | 4 ++- gnu/tests/guix.scm | 1 + gnu/tests/monitoring.scm | 4 ++- gnu/tests/web.scm | 4 ++- 7 files changed, 57 insertions(+), 35 deletions(-) ^ permalink raw reply [flat|nested] 17+ messages in thread
* [bug#43771] [PATCH 1/5] Replace (postgresql-service) with (service postgresql-service-type) 2020-10-02 18:36 [bug#43771] [PATCH 0/5] PostgreSQL service improvements Christopher Baines @ 2020-10-02 18:40 ` 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 ` (3 more replies) 2020-10-05 8:34 ` [bug#43771] [PATCH 0/5] PostgreSQL service improvements Ludovic Courtès 1 sibling, 4 replies; 17+ messages in thread From: Christopher Baines @ 2020-10-02 18:40 UTC (permalink / raw) To: 43771 As I'm looking at removing the procedure, in favour of always using the service type. --- gnu/tests/monitoring.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gnu/tests/monitoring.scm b/gnu/tests/monitoring.scm index d20b8ac59e..17b9edc3ac 100644 --- a/gnu/tests/monitoring.scm +++ b/gnu/tests/monitoring.scm @@ -307,7 +307,7 @@ zabbix||{} (let ((base-os (simple-operating-system (service dhcp-client-service-type) - (postgresql-service) + (service postgresql-service-type) (service zabbix-front-end-service-type (zabbix-front-end-configuration (db-password "zabbix"))) -- 2.28.0 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* [bug#43771] [PATCH 2/5] Add some subheadings in to the Databases section of the docs 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 ` Christopher Baines 2020-10-02 18:40 ` [bug#43771] [PATCH 3/5] Remove the postgresql-service procedure Christopher Baines ` (2 subsequent siblings) 3 siblings, 0 replies; 17+ messages in thread From: Christopher Baines @ 2020-10-02 18:40 UTC (permalink / raw) To: 43771 To make it clearer where the relevant documentation for a particular service starts and ends. --- doc/guix.texi | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/doc/guix.texi b/doc/guix.texi index 79c79b6a96..4197cd562a 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -17736,6 +17736,8 @@ details. @cindex SQL 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 '()] @@ -17801,6 +17803,8 @@ dblink as they are already loadable by postgresql. This field is only required to add extensions provided by other packages. @end deffn +@subsubheading MariaDB/MySQL + @deffn {Scheme Procedure} mysql-service [#:config (mysql-configuration)] Return a service that runs @command{mysqld}, the MySQL or MariaDB database server. @@ -17825,6 +17829,8 @@ TCP port on which the database server listens for incoming connections. @end table @end deftp +@subsubheading Memcached + @defvr {Scheme Variable} memcached-service-type This is the service type for the @uref{https://memcached.org/, Memcached} service, which provides a distributed in memory cache. The @@ -17857,6 +17863,8 @@ Additional command line options to pass to @code{memcached}. @end table @end deftp +@subsubheading MongoDB + @defvr {Scheme Variable} mongodb-service-type This is the service type for @uref{https://www.mongodb.com/, MongoDB}. The value for the service type is a @code{mongodb-configuration} object. @@ -17883,6 +17891,8 @@ MongoDB is configured to use through the configuration file. @end table @end deftp +@subsubheading Redis + @defvr {Scheme Variable} redis-service-type This is the service type for the @uref{https://redis.io/, Redis} key/value store, whose value is a @code{redis-configuration} object. -- 2.28.0 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* [bug#43771] [PATCH 3/5] Remove the postgresql-service procedure 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 ` Christopher Baines 2020-10-05 8:33 ` Ludovic Courtès 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 3 siblings, 1 reply; 17+ messages in thread From: Christopher Baines @ 2020-10-02 18:40 UTC (permalink / raw) To: 43771 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)))) - \f ;;; ;;; Memcached -- 2.28.0 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* [bug#43771] [PATCH 3/5] Remove the postgresql-service procedure 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 0 siblings, 1 reply; 17+ messages in thread From: Ludovic Courtès @ 2020-10-05 8:33 UTC (permalink / raw) To: Christopher Baines; +Cc: 43771 Hi, Christopher Baines <mail@cbaines.net> skribis: > 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. [...] > -(define* (postgresql-service #:key (postgresql postgresql) > - (port 5432) > - (locale "en_US.utf8") Here I’d suggest to keep it as ‘define-deprecated’, like we did for other such procedures. Otherwise LGTM. Thanks, Ludo’. ^ permalink raw reply [flat|nested] 17+ messages in thread
* [bug#43771] [PATCH 3/5] Remove the postgresql-service procedure 2020-10-05 8:33 ` Ludovic Courtès @ 2020-10-19 19:01 ` Christopher Baines 0 siblings, 0 replies; 17+ messages in thread From: Christopher Baines @ 2020-10-19 19:01 UTC (permalink / raw) To: Ludovic Courtès; +Cc: 43771 [-- Attachment #1: Type: text/plain, Size: 863 bytes --] Ludovic Courtès <ludo@gnu.org> writes: > Hi, > > Christopher Baines <mail@cbaines.net> skribis: > >> 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. > > [...] > >> -(define* (postgresql-service #:key (postgresql postgresql) >> - (port 5432) >> - (locale "en_US.utf8") > > Here I’d suggest to keep it as ‘define-deprecated’, like we did for > other such procedures. Ah, yeah, I discounted that initially, as I didn't see a way to adapt it to the new behaviour, but the deprecated procedure can just have the old behaviour. I'll send some updated patches with it deprecated. [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 987 bytes --] ^ permalink raw reply [flat|nested] 17+ messages in thread
* [bug#43771] [PATCH 4/5] Define postgresql-10 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-02 18:40 ` 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 3 siblings, 0 replies; 17+ messages in thread From: Christopher Baines @ 2020-10-02 18:40 UTC (permalink / raw) To: 43771 So that it can be used, rather than postgresql. Because the major version of the package is important, as it relates to the compatability with the data files used by the service, it's useful to have a stable name to refer to a package for version 10 of PostgreSQL. --- gnu/packages/databases.scm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gnu/packages/databases.scm b/gnu/packages/databases.scm index ece4580c36..8cab3eb115 100644 --- a/gnu/packages/databases.scm +++ b/gnu/packages/databases.scm @@ -1038,6 +1038,8 @@ TIMESTAMP. It also supports storage of binary large objects, including pictures, sounds, or video.") (license (license:x11-style "file://COPYRIGHT")))) +(define-public postgresql-10 postgresql) + (define-public postgresql-11 (package (inherit postgresql) -- 2.28.0 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* [bug#43771] [PATCH 5/5] Don't specify a default postgresql version to use for the service 2020-10-02 18:40 ` [bug#43771] [PATCH 1/5] Replace (postgresql-service) with (service postgresql-service-type) Christopher Baines ` (2 preceding siblings ...) 2020-10-02 18:40 ` [bug#43771] [PATCH 4/5] Define postgresql-10 Christopher Baines @ 2020-10-02 18:40 ` Christopher Baines 3 siblings, 0 replies; 17+ messages in thread From: Christopher Baines @ 2020-10-02 18:40 UTC (permalink / raw) To: 43771 Currently, if the postgresql package major version changes, this is going to break the service upon upgrade, because PostgreSQL will reject the data files from the differing major version of the service. Because it's important to either keep running a particular major version, or intentionally upgrade, I think the configuration would be better with no default. I think this is also going to be helpful when trying to assist users upgrading PostgreSQL. --- doc/guix.texi | 6 ++++-- gnu/services/databases.scm | 6 ++---- gnu/tests/databases.scm | 4 +++- gnu/tests/guix.scm | 1 + gnu/tests/monitoring.scm | 4 +++- gnu/tests/web.scm | 4 +++- 6 files changed, 16 insertions(+), 9 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 641b410acf..4ce0072ed4 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -17742,7 +17742,9 @@ The following example describes a PostgreSQL service with the default configuration. @lisp -(service postgresql-service-type) +(service postgresql-service-type + (postgresql-configuration + (postgresql postgresql-10))) @end lisp If the services fails to start, it may be due to an incompatible @@ -17768,7 +17770,7 @@ Data type representing the configuration for the @code{postgresql-service-type}. @table @asis -@item @var{postgresql} (default: @code{postgresql}) +@item @var{postgresql} PostgreSQL package to use for the service. @item @var{port} (default: @code{5432}) diff --git a/gnu/services/databases.scm b/gnu/services/databases.scm index efad182a68..96d2dc4935 100644 --- a/gnu/services/databases.scm +++ b/gnu/services/databases.scm @@ -146,8 +146,7 @@ host all all ::1/128 md5")) (define-record-type* <postgresql-configuration> postgresql-configuration make-postgresql-configuration postgresql-configuration? - (postgresql postgresql-configuration-postgresql ;<package> - (default postgresql)) + (postgresql postgresql-configuration-postgresql) ;<package> (port postgresql-configuration-port (default 5432)) (locale postgresql-configuration-locale @@ -278,8 +277,7 @@ host all all ::1/128 md5")) (service-extension account-service-type (const %postgresql-accounts)) (service-extension profile-service-type - (compose list postgresql-configuration-postgresql)))) - (default-value (postgresql-configuration)))) + (compose list postgresql-configuration-postgresql)))))) \f ;;; diff --git a/gnu/tests/databases.scm b/gnu/tests/databases.scm index e0544bbcd2..d3045cc3f7 100644 --- a/gnu/tests/databases.scm +++ b/gnu/tests/databases.scm @@ -215,7 +215,9 @@ (define %postgresql-os (simple-operating-system - (service postgresql-service-type))) + (service postgresql-service-type + (postgresql-configuration + (postgresql postgresql-10))))) (define (run-postgresql-test) "Run tests in %POSTGRESQL-OS." diff --git a/gnu/tests/guix.scm b/gnu/tests/guix.scm index 6139e31cf0..ebee8d43af 100644 --- a/gnu/tests/guix.scm +++ b/gnu/tests/guix.scm @@ -83,6 +83,7 @@ (service dhcp-client-service-type) (service postgresql-service-type (postgresql-configuration + (postgresql postgresql-10) (config-file (postgresql-config-file (hba-file diff --git a/gnu/tests/monitoring.scm b/gnu/tests/monitoring.scm index 17b9edc3ac..7371b02fe1 100644 --- a/gnu/tests/monitoring.scm +++ b/gnu/tests/monitoring.scm @@ -307,7 +307,9 @@ zabbix||{} (let ((base-os (simple-operating-system (service dhcp-client-service-type) - (service postgresql-service-type) + (service postgresql-service-type + (postgresql-configuration + (postgresql postgresql-10))) (service zabbix-front-end-service-type (zabbix-front-end-configuration (db-password "zabbix"))) diff --git a/gnu/tests/web.scm b/gnu/tests/web.scm index 7513eab2e4..7f4518acd2 100644 --- a/gnu/tests/web.scm +++ b/gnu/tests/web.scm @@ -567,7 +567,9 @@ HTTP-PORT." (config (httpd-config-file (listen '("8080")))))) - (service postgresql-service-type) + (service postgresql-service-type + (postgresql-configuration + (postgresql postgresql-10))) (service patchwork-service-type (patchwork-configuration (patchwork patchwork) -- 2.28.0 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* [bug#43771] [PATCH 0/5] PostgreSQL service improvements 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-05 8:34 ` 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 21:02 ` [bug#43771] [PATCH 0/5] PostgreSQL service improvements Christopher Baines 1 sibling, 2 replies; 17+ messages in thread From: Ludovic Courtès @ 2020-10-05 8:34 UTC (permalink / raw) To: Christopher Baines; +Cc: 43771 Christopher Baines <mail@cbaines.net> skribis: > Christopher Baines (5): > Replace (postgresql-service) with (service postgresql-service-type) > Add some subheadings in to the Databases section of the docs > Remove the postgresql-service procedure > Define postgresql-10 > Don't specify a default postgresql version to use for the service It all LGTM… except for commit logs. :-) Please add the conventional subject line and ChangeLog-style entries. I’m sorry to spoil your Monday morning. :-) Ludo’. ^ permalink raw reply [flat|nested] 17+ messages in thread
* [bug#43771] [PATCH v2 1/5] tests: monitoring: Use (service postgresql-service-type). 2020-10-05 8:34 ` [bug#43771] [PATCH 0/5] PostgreSQL service improvements Ludovic Courtès @ 2020-10-19 19:02 ` Christopher Baines 2020-10-19 19:02 ` [bug#43771] [PATCH v2 2/5] doc: Add subheadings in to the Databases section Christopher Baines ` (3 more replies) 2020-10-19 21:02 ` [bug#43771] [PATCH 0/5] PostgreSQL service improvements Christopher Baines 1 sibling, 4 replies; 17+ messages in thread From: Christopher Baines @ 2020-10-19 19:02 UTC (permalink / raw) To: 43771 As I'm looking at removing the procedure, in favour of always using the service type. * gnu/tests/monitoring.scm (%zabbix-os): Use (service postgresql-service-type) rather than (postgresql-service). --- gnu/tests/monitoring.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gnu/tests/monitoring.scm b/gnu/tests/monitoring.scm index d20b8ac59e..17b9edc3ac 100644 --- a/gnu/tests/monitoring.scm +++ b/gnu/tests/monitoring.scm @@ -307,7 +307,7 @@ zabbix||{} (let ((base-os (simple-operating-system (service dhcp-client-service-type) - (postgresql-service) + (service postgresql-service-type) (service zabbix-front-end-service-type (zabbix-front-end-configuration (db-password "zabbix"))) -- 2.28.0 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* [bug#43771] [PATCH v2 2/5] doc: Add subheadings in to the Databases section. 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 ` Christopher Baines 2020-10-19 19:02 ` [bug#43771] [PATCH v2 3/5] services: databases: Deprecate the postgresql-service procedure Christopher Baines ` (2 subsequent siblings) 3 siblings, 0 replies; 17+ messages in thread From: Christopher Baines @ 2020-10-19 19:02 UTC (permalink / raw) To: 43771 To make it clearer where the relevant documentation for a particular service starts and ends. * doc/guix.texi (Database Services): Add subheadings. --- doc/guix.texi | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/doc/guix.texi b/doc/guix.texi index 130985d30f..d6d610acae 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -18178,6 +18178,8 @@ details. @cindex SQL 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 '()] @@ -18243,6 +18245,8 @@ dblink as they are already loadable by postgresql. This field is only required to add extensions provided by other packages. @end deffn +@subsubheading MariaDB/MySQL + @deffn {Scheme Procedure} mysql-service [#:config (mysql-configuration)] Return a service that runs @command{mysqld}, the MySQL or MariaDB database server. @@ -18267,6 +18271,8 @@ TCP port on which the database server listens for incoming connections. @end table @end deftp +@subsubheading Memcached + @defvr {Scheme Variable} memcached-service-type This is the service type for the @uref{https://memcached.org/, Memcached} service, which provides a distributed in memory cache. The @@ -18299,6 +18305,8 @@ Additional command line options to pass to @code{memcached}. @end table @end deftp +@subsubheading MongoDB + @defvr {Scheme Variable} mongodb-service-type This is the service type for @uref{https://www.mongodb.com/, MongoDB}. The value for the service type is a @code{mongodb-configuration} object. @@ -18325,6 +18333,8 @@ MongoDB is configured to use through the configuration file. @end table @end deftp +@subsubheading Redis + @defvr {Scheme Variable} redis-service-type This is the service type for the @uref{https://redis.io/, Redis} key/value store, whose value is a @code{redis-configuration} object. -- 2.28.0 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* [bug#43771] [PATCH v2 3/5] services: databases: Deprecate the postgresql-service procedure. 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 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 3 siblings, 0 replies; 17+ messages in thread From: Christopher Baines @ 2020-10-19 19:02 UTC (permalink / raw) To: 43771 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 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* [bug#43771] [PATCH v2 4/5] gnu: databases: Define postgresql-10. 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 ` [bug#43771] [PATCH v2 3/5] services: databases: Deprecate the postgresql-service procedure Christopher Baines @ 2020-10-19 19:02 ` Christopher Baines 2020-10-19 19:02 ` [bug#43771] [PATCH v2 5/5] services: databases: Don't specify a default postgresql version Christopher Baines 3 siblings, 0 replies; 17+ messages in thread From: Christopher Baines @ 2020-10-19 19:02 UTC (permalink / raw) To: 43771 So that it can be used, rather than postgresql. Because the major version of the package is important, as it relates to the compatability with the data files used by the service, it's useful to have a stable name to refer to a package for version 10 of PostgreSQL. * gnu/packages/databases.scm (postgresql-10): New variable. --- gnu/packages/databases.scm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gnu/packages/databases.scm b/gnu/packages/databases.scm index 1236f57018..0d8342b04a 100644 --- a/gnu/packages/databases.scm +++ b/gnu/packages/databases.scm @@ -1040,6 +1040,8 @@ TIMESTAMP. It also supports storage of binary large objects, including pictures, sounds, or video.") (license (license:x11-style "file://COPYRIGHT")))) +(define-public postgresql-10 postgresql) + (define-public postgresql-11 (package (inherit postgresql) -- 2.28.0 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* [bug#43771] [PATCH v2 5/5] services: databases: Don't specify a default postgresql version. 2020-10-19 19:02 ` [bug#43771] [PATCH v2 1/5] tests: monitoring: Use (service postgresql-service-type) Christopher Baines ` (2 preceding siblings ...) 2020-10-19 19:02 ` [bug#43771] [PATCH v2 4/5] gnu: databases: Define postgresql-10 Christopher Baines @ 2020-10-19 19:02 ` Christopher Baines 3 siblings, 0 replies; 17+ messages in thread From: Christopher Baines @ 2020-10-19 19:02 UTC (permalink / raw) To: 43771 Currently, if the postgresql package major version changes, this is going to break the service upon upgrade, because PostgreSQL will reject the data files from the differing major version of the service. Because it's important to either keep running a particular major version, or intentionally upgrade, I think the configuration would be better with no default. I think this is also going to be helpful when trying to assist users upgrading PostgreSQL. * gnu/services/databases.scm (<postgresql-configuration>): Remove default for postgresql. (postgresql-service-type): Remove the default value. * gnu/tests/databases.scm (%postgresql-os): Update accordingly. * gnu/tests/guix.scm (%guix-data-service-os): Update accordingly. * gnu/tests/monitoring.scm (%zabbix-os): Update accordingly. * gnu/tests/web.scm (patchwork-os): Update accordingly. * doc/guix.texi (PostgreSQL): Update accordingly. --- doc/guix.texi | 6 ++++-- gnu/services/databases.scm | 6 ++---- gnu/tests/databases.scm | 4 +++- gnu/tests/guix.scm | 1 + gnu/tests/monitoring.scm | 4 +++- gnu/tests/web.scm | 4 +++- 6 files changed, 16 insertions(+), 9 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 8aaa896c8d..bc62a1f797 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -18184,7 +18184,9 @@ The following example describes a PostgreSQL service with the default configuration. @lisp -(service postgresql-service-type) +(service postgresql-service-type + (postgresql-configuration + (postgresql postgresql-10))) @end lisp If the services fails to start, it may be due to an incompatible @@ -18210,7 +18212,7 @@ Data type representing the configuration for the @code{postgresql-service-type}. @table @asis -@item @var{postgresql} (default: @code{postgresql}) +@item @var{postgresql} PostgreSQL package to use for the service. @item @var{port} (default: @code{5432}) diff --git a/gnu/services/databases.scm b/gnu/services/databases.scm index 7908a3e0f6..d7b4594b9e 100644 --- a/gnu/services/databases.scm +++ b/gnu/services/databases.scm @@ -147,8 +147,7 @@ host all all ::1/128 md5")) (define-record-type* <postgresql-configuration> postgresql-configuration make-postgresql-configuration postgresql-configuration? - (postgresql postgresql-configuration-postgresql ;<package> - (default postgresql)) + (postgresql postgresql-configuration-postgresql) ;<package> (port postgresql-configuration-port (default 5432)) (locale postgresql-configuration-locale @@ -279,8 +278,7 @@ host all all ::1/128 md5")) (service-extension account-service-type (const %postgresql-accounts)) (service-extension profile-service-type - (compose list postgresql-configuration-postgresql)))) - (default-value (postgresql-configuration)))) + (compose list postgresql-configuration-postgresql)))))) (define-deprecated (postgresql-service #:key (postgresql postgresql) (port 5432) diff --git a/gnu/tests/databases.scm b/gnu/tests/databases.scm index e0544bbcd2..d3045cc3f7 100644 --- a/gnu/tests/databases.scm +++ b/gnu/tests/databases.scm @@ -215,7 +215,9 @@ (define %postgresql-os (simple-operating-system - (service postgresql-service-type))) + (service postgresql-service-type + (postgresql-configuration + (postgresql postgresql-10))))) (define (run-postgresql-test) "Run tests in %POSTGRESQL-OS." diff --git a/gnu/tests/guix.scm b/gnu/tests/guix.scm index 20b67d55d3..af7d8f0b21 100644 --- a/gnu/tests/guix.scm +++ b/gnu/tests/guix.scm @@ -156,6 +156,7 @@ (service dhcp-client-service-type) (service postgresql-service-type (postgresql-configuration + (postgresql postgresql-10) (config-file (postgresql-config-file (hba-file diff --git a/gnu/tests/monitoring.scm b/gnu/tests/monitoring.scm index 17b9edc3ac..7371b02fe1 100644 --- a/gnu/tests/monitoring.scm +++ b/gnu/tests/monitoring.scm @@ -307,7 +307,9 @@ zabbix||{} (let ((base-os (simple-operating-system (service dhcp-client-service-type) - (service postgresql-service-type) + (service postgresql-service-type + (postgresql-configuration + (postgresql postgresql-10))) (service zabbix-front-end-service-type (zabbix-front-end-configuration (db-password "zabbix"))) diff --git a/gnu/tests/web.scm b/gnu/tests/web.scm index 7513eab2e4..7f4518acd2 100644 --- a/gnu/tests/web.scm +++ b/gnu/tests/web.scm @@ -567,7 +567,9 @@ HTTP-PORT." (config (httpd-config-file (listen '("8080")))))) - (service postgresql-service-type) + (service postgresql-service-type + (postgresql-configuration + (postgresql postgresql-10))) (service patchwork-service-type (patchwork-configuration (patchwork patchwork) -- 2.28.0 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* [bug#43771] [PATCH 0/5] PostgreSQL service improvements 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 21:02 ` Christopher Baines 2020-10-20 21:32 ` Ludovic Courtès 1 sibling, 1 reply; 17+ messages in thread From: Christopher Baines @ 2020-10-19 21:02 UTC (permalink / raw) To: Ludovic Courtès; +Cc: 43771 [-- Attachment #1: Type: text/plain, Size: 682 bytes --] Ludovic Courtès <ludo@gnu.org> writes: > Christopher Baines <mail@cbaines.net> skribis: > >> Christopher Baines (5): >> Replace (postgresql-service) with (service postgresql-service-type) >> Add some subheadings in to the Databases section of the docs >> Remove the postgresql-service procedure >> Define postgresql-10 >> Don't specify a default postgresql version to use for the service > > It all LGTM… except for commit logs. :-) Please add the conventional > subject line and ChangeLog-style entries. I’m sorry to spoil your > Monday morning. :-) I've finally got around now to revising the commit messages and sent some updated patches. [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 987 bytes --] ^ permalink raw reply [flat|nested] 17+ messages in thread
* [bug#43771] [PATCH 0/5] PostgreSQL service improvements 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 0 siblings, 1 reply; 17+ messages in thread From: Ludovic Courtès @ 2020-10-20 21:32 UTC (permalink / raw) To: Christopher Baines; +Cc: 43771 Hi, Christopher Baines <mail@cbaines.net> skribis: > Ludovic Courtès <ludo@gnu.org> writes: > >> Christopher Baines <mail@cbaines.net> skribis: >> >>> Christopher Baines (5): >>> Replace (postgresql-service) with (service postgresql-service-type) >>> Add some subheadings in to the Databases section of the docs >>> Remove the postgresql-service procedure >>> Define postgresql-10 >>> Don't specify a default postgresql version to use for the service >> >> It all LGTM… except for commit logs. :-) Please add the conventional >> subject line and ChangeLog-style entries. I’m sorry to spoil your >> Monday morning. :-) > > I've finally got around now to revising the commit messages and sent > some updated patches. Perfect, go for it! Thanks, Ludo’. ^ permalink raw reply [flat|nested] 17+ messages in thread
* bug#43771: [PATCH 0/5] PostgreSQL service improvements 2020-10-20 21:32 ` Ludovic Courtès @ 2020-10-20 22:41 ` Christopher Baines 0 siblings, 0 replies; 17+ messages in thread From: Christopher Baines @ 2020-10-20 22:41 UTC (permalink / raw) To: Ludovic Courtès; +Cc: 43771-done [-- Attachment #1: Type: text/plain, Size: 937 bytes --] Ludovic Courtès <ludo@gnu.org> writes: > Hi, > > Christopher Baines <mail@cbaines.net> skribis: > >> Ludovic Courtès <ludo@gnu.org> writes: >> >>> Christopher Baines <mail@cbaines.net> skribis: >>> >>>> Christopher Baines (5): >>>> Replace (postgresql-service) with (service postgresql-service-type) >>>> Add some subheadings in to the Databases section of the docs >>>> Remove the postgresql-service procedure >>>> Define postgresql-10 >>>> Don't specify a default postgresql version to use for the service >>> >>> It all LGTM… except for commit logs. :-) Please add the conventional >>> subject line and ChangeLog-style entries. I’m sorry to spoil your >>> Monday morning. :-) >> >> I've finally got around now to revising the commit messages and sent >> some updated patches. > > Perfect, go for it! Great, I've pushed these as bdcf4d88d58798eca7811c8b1fbd4638168d05c3 now. Thanks! [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 987 bytes --] ^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2020-10-20 22:42 UTC | newest] Thread overview: 17+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 ` [bug#43771] [PATCH v2 3/5] services: databases: Deprecate the postgresql-service procedure Christopher Baines 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
Code repositories for project(s) associated with this public inbox https://git.savannah.gnu.org/cgit/guix.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).