From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: [PATCH] gnu: Add postgresql-service. Date: Wed, 06 May 2015 22:27:14 +0200 Message-ID: <87k2wlqwnx.fsf@gnu.org> References: <87y4l53vg6.fsf@fsf.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:60562) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yq5ua-0007oE-RQ for guix-devel@gnu.org; Wed, 06 May 2015 16:27:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yq5uX-0005ah-Cx for guix-devel@gnu.org; Wed, 06 May 2015 16:27:20 -0400 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:34017) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yq5uX-0005ad-AQ for guix-devel@gnu.org; Wed, 06 May 2015 16:27:17 -0400 In-Reply-To: <87y4l53vg6.fsf@fsf.org> (David Thompson's message of "Sun, 03 May 2015 22:52:57 -0400") 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-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: David Thompson Cc: guix-devel@gnu.org David Thompson skribis: > From 888bb58253ab708f38609aa839e77a46a96bd0df Mon Sep 17 00:00:00 2001 > From: David Thompson > Date: Sun, 3 May 2015 17:02:59 -0400 > Subject: [PATCH] gnu: Add postgresql-service. > > * gnu/services/databases.scm: New file. > * gnu-system.am (GNU_SYSTEM_MODULES): Add it. > * doc/guix.texi ("Database Services"): New subsubsection. Nice! I haven=E2=80=99t tested it, but it looks good. I only have minor comments: > +;;; Copyright =C2=A9 2015 Line truncated. :-) > +(define %default-postgres-hba > + (text-file* "pg_hba.conf" > + "local all all trust\n" > + "host all all 127.0.0.1/32 trust\n" > + "host all all ::1/128 trust\n")) > + > +(define %default-postgres-ident > + (text-file* "pg_ident.conf" > + "# MAPNAME SYSTEM-USERNAME PG-USERNAME")) Since these two are purely text (they do not contain references to store items), =E2=80=98text-file=E2=80=99 is enough and even better. (=E2=80=98text-file*=E2=80=99 returns a derivation that builds the file, an= d that derivation depends on Guile; conversely, =E2=80=98text-file=E2=80=99 simply= creates a new file in the store.) > + ;; Drop privileges and init state directory in a new > + ;; process. Wait for it to finish before proceeding. > + (match (primitive-fork) > + (0 > + (setgid (passwd:gid user)) > + (setuid (passwd:uid user)) > + (primitive-exit (system* initdb "-D" #$data-directory))) It may be a good idea to wrap the child process=E2=80=99s body in: (dynamic-wind (const #t) (lambda () ...) (lambda () (primitive-exit 1))) This makes sure that it doesn=E2=80=99t keep going if an exception is thrown (yes it=E2=80=99s quite ugly.) OK to push with these changes! Thanks, Ludo=E2=80=99.