From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christopher Baines Subject: [PATCH 1/2] services: postgresql: Add port to configuration Date: Wed, 14 Dec 2016 08:35:48 +0000 Message-ID: <20161214083549.32602-1-mail@cbaines.net> References: <871sxbl941.fsf@gnu.org> Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:54450) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cH52Z-00038W-PF for guix-devel@gnu.org; Wed, 14 Dec 2016 03:35:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cH52V-0005AI-Qo for guix-devel@gnu.org; Wed, 14 Dec 2016 03:35:55 -0500 Received: from li622-129.members.linode.com ([212.71.249.129]:48244 helo=mira.cbaines.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cH52V-00059y-Fo for guix-devel@gnu.org; Wed, 14 Dec 2016 03:35:51 -0500 Received: from localhost (host-92-2-35-94.as43234.net [92.2.35.94]) by mira.cbaines.net (Postfix) with ESMTPSA id 0216813E1EB for ; Wed, 14 Dec 2016 08:35:50 +0000 (GMT) Received: from chris by localhost with local (Exim 4.88) (envelope-from ) id 1cH52T-0008WE-Ed for guix-devel@gnu.org; Wed, 14 Dec 2016 08:35:49 +0000 In-Reply-To: <871sxbl941.fsf@gnu.org> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: guix-devel@gnu.org * gnu/services/databases.scm (): Add port field. (postgresql-shepherd-service): Pass port to postgres. (postgresql-service): Add port default. --- doc/guix.texi | 7 ++++--- gnu/services/databases.scm | 9 +++++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index f1c5963f7..af5869314 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -10150,13 +10150,14 @@ Users need to be in the @code{lp} group to access the D-Bus service. The @code{(gnu services databases)} module provides the following services. @deffn {Scheme Procedure} postgresql-service [#:postgresql postgresql] @ - [#:config-file] [#:data-directory ``/var/lib/postgresql/data''] + [#:config-file] [#:data-directory ``/var/lib/postgresql/data''] @ + [#:port 5432] 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}. +@var{config-file}, stores the database cluster in @var{data-directory} and +listens on @var{port}. @end deffn @deffn {Scheme Procedure} mysql-service [#:config (mysql-configuration)] diff --git a/gnu/services/databases.scm b/gnu/services/databases.scm index f7e08e696..7cdcfc4d7 100644 --- a/gnu/services/databases.scm +++ b/gnu/services/databases.scm @@ -48,6 +48,8 @@ postgresql-configuration? (postgresql postgresql-configuration-postgresql ; (default postgresql)) + (port postgresql-configuration-port + (default 5432)) (config-file postgresql-configuration-file) (data-directory postgresql-configuration-data-directory)) @@ -80,7 +82,7 @@ host all all ::1/128 trust")) (define postgresql-activation (match-lambda - (($ postgresql config-file data-directory) + (($ postgresql port config-file data-directory) #~(begin (use-modules (guix build utils) (ice-9 match)) @@ -108,7 +110,7 @@ host all all ::1/128 trust")) (define postgresql-shepherd-service (match-lambda - (($ postgresql config-file data-directory) + (($ postgresql port config-file data-directory) (let ((start-script ;; Wrapper script that switches to the 'postgres' user before ;; launching daemon. @@ -121,6 +123,7 @@ host all all ::1/128 trust")) (system* postgres (string-append "--config-file=" #$config-file) + "-p" (number->string #$port) "-D" #$data-directory))))) (list (shepherd-service (provision '(postgres)) @@ -140,6 +143,7 @@ host all all ::1/128 trust")) (const %postgresql-accounts)))))) (define* (postgresql-service #:key (postgresql postgresql) + (port 5432) (config-file %default-postgres-config) (data-directory "/var/lib/postgresql/data")) "Return a service that runs @var{postgresql}, the PostgreSQL database server. @@ -149,6 +153,7 @@ and stores the database cluster in @var{data-directory}." (service postgresql-service-type (postgresql-configuration (postgresql postgresql) + (port port) (config-file config-file) (data-directory data-directory)))) -- 2.11.0