services: postgresql: Change service default socket directory.

Fixes <https://bugs.gnu.org/46737>.

PostgreSQL running with a different socket directory to the default one in the
package itself breaks some services, this commit restores the previous
behaviour where PostgreSQL by default will run with a socket directory that
matches the default used by PostgreSQL packaged for Guix.

Switching to a different default value can happen, but only alongside changing
the PostgreSQL package.

* gnu/services/databases.scm (<postgresql-config-file>)[socket-directory]:
Change default to #false.
* doc/guix.texi (Database Services): Update documentation, and specify a
different value for disabling connections via sockets.
* gnu/tests/guix.scm (%guix-data-service-os): Use default PostgreSQL
behaviour.
* gnu/tests/monitoring.scm (%zabbix-os): Likewise.
* gnu/tests/web.scm (patchwork-os): Likewise.

Signed-off-by: Leo Famulari <leo@famulari.name>
This commit is contained in:
Christopher Baines 2021-04-12 21:41:41 +01:00 committed by Leo Famulari
parent 1bbed20332
commit c311147bd1
No known key found for this signature in database
GPG key ID: 2646FA30BACA7F08
5 changed files with 10 additions and 20 deletions

View file

@ -19830,12 +19830,15 @@ configuration.
@item @code{ident-file} (default: @code{%default-postgres-ident}) @item @code{ident-file} (default: @code{%default-postgres-ident})
Filename or G-expression for the user name mapping configuration. Filename or G-expression for the user name mapping configuration.
@item @code{socket-directory} (default: @code{"/var/run/postgresql"}) @item @code{socket-directory} (default: @code{#false})
Specifies the directory of the Unix-domain socket(s) on which PostgreSQL Specifies the directory of the Unix-domain socket(s) on which PostgreSQL
is to listen for connections from client applications. If set to is to listen for connections from client applications. If set to
@code{#false} PostgreSQL does not listen on any Unix-domain sockets, in @code{""} PostgreSQL does not listen on any Unix-domain sockets, in
which case only TCP/IP sockets can be used to connect to the server. which case only TCP/IP sockets can be used to connect to the server.
By default, the @code{#false} value means the PostgreSQL default value
will be used, which is currently @samp{/tmp}.
@item @code{extra-config} (default: @code{'()}) @item @code{extra-config} (default: @code{'()})
List of additional keys and values to include in the PostgreSQL config List of additional keys and values to include in the PostgreSQL config
file. Each entry in the list should be a list where the first element file. Each entry in the list should be a list where the first element

View file

@ -115,7 +115,7 @@ (define-record-type* <postgresql-config-file>
(ident-file postgresql-config-file-ident-file (ident-file postgresql-config-file-ident-file
(default %default-postgres-ident)) (default %default-postgres-ident))
(socket-directory postgresql-config-file-socket-directory (socket-directory postgresql-config-file-socket-directory
(default "/var/run/postgresql")) (default #false))
(extra-config postgresql-config-file-extra-config (extra-config postgresql-config-file-extra-config
(default '()))) (default '())))

View file

@ -164,10 +164,7 @@ (define %guix-data-service-os
" "
local all all trust local all all trust
host all all 127.0.0.1/32 trust host all all 127.0.0.1/32 trust
host all all ::1/128 trust")) host all all ::1/128 trust"))))))
;; XXX: Remove when postgresql default socket directory is
;; changed to /var/run/postgresql.
(socket-directory #f)))))
(service guix-data-service-type (service guix-data-service-type
(guix-data-service-configuration (guix-data-service-configuration
(host "0.0.0.0"))) (host "0.0.0.0")))

View file

@ -309,12 +309,7 @@ (define %zabbix-os
(service dhcp-client-service-type) (service dhcp-client-service-type)
(service postgresql-service-type (service postgresql-service-type
(postgresql-configuration (postgresql-configuration
(postgresql postgresql) (postgresql postgresql)))
;; XXX: Remove when postgresql default socket directory is
;; changed to /var/run/postgresql.
(config-file
(postgresql-config-file
(socket-directory #f)))))
(service zabbix-front-end-service-type (service zabbix-front-end-service-type
(zabbix-front-end-configuration (zabbix-front-end-configuration
(db-password "zabbix"))) (db-password "zabbix")))

View file

@ -569,12 +569,7 @@ (define (patchwork-os patchwork)
(listen '("8080")))))) (listen '("8080"))))))
(service postgresql-service-type (service postgresql-service-type
(postgresql-configuration (postgresql-configuration
(postgresql postgresql-10) (postgresql postgresql-10)))
;; XXX: Remove when postgresql default socket directory is
;; changed to /var/run/postgresql.
(config-file
(postgresql-config-file
(socket-directory #f)))))
(service patchwork-service-type (service patchwork-service-type
(patchwork-configuration (patchwork-configuration
(patchwork patchwork) (patchwork patchwork)