1
0
mirror of https://git.savannah.gnu.org/git/guix.git synced 2026-04-06 21:20:33 +02:00

services: postgresql: Add log directory support.

* gnu/services/databases.scm (postgresql-configuration-log-directory): New
procedure.
(<postgresql-configuration>)[log-directory]: New field.
(postgresql-activation): Create the log directory.
(postgresql-shepherd-service): Honor it.
* gnu/tests/databases.scm (%postgresql-log-directory): New variable.
(log-file): New test case.
* doc/guix.texi (Database Services): Document it.
This commit is contained in:
Mathieu Othacehe
2021-01-18 10:52:25 +01:00
parent 6c0679215f
commit fe4b882350
3 changed files with 53 additions and 8 deletions

View File

@@ -214,6 +214,9 @@
;;; The PostgreSQL service.
;;;
(define %postgresql-log-directory
"/var/log/postgresql")
(define %postgresql-os
(simple-operating-system
(service postgresql-service-type
@@ -262,6 +265,23 @@
(start-service 'postgres))
marionette))
(test-assert "log-file"
(marionette-eval
'(begin
(use-modules (ice-9 ftw)
(ice-9 match))
(current-output-port
(open-file "/dev/console" "w0"))
(let ((server-log-file
(string-append #$%postgresql-log-directory
"/pg_ctl.log")))
(and (file-exists? server-log-file)
(display
(call-with-input-file server-log-file
get-string-all)))
#t))
marionette))
(test-end)
(exit (= (test-runner-fail-count (test-runner-current)) 0)))))