From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Thompson, David" Subject: Re: [PATCH] gnu: services: Add nginx-service. Date: Tue, 18 Aug 2015 20:23:41 -0400 Message-ID: References: <873801rqsi.fsf@izanagi.i-did-not-set--mail-host-address--so-tickle-me> <87io8cmvuz.fsf@gnu.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]:36295) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZRrAO-0003cN-TG for guix-devel@gnu.org; Tue, 18 Aug 2015 20:23:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZRrAL-0003Nq-N5 for guix-devel@gnu.org; Tue, 18 Aug 2015 20:23:44 -0400 Received: from mail-yk0-f179.google.com ([209.85.160.179]:34482) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZRrAL-0003NI-JZ for guix-devel@gnu.org; Tue, 18 Aug 2015 20:23:41 -0400 Received: by ykdt205 with SMTP id t205so176362477ykd.1 for ; Tue, 18 Aug 2015 17:23:41 -0700 (PDT) In-Reply-To: <87io8cmvuz.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-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: =?UTF-8?Q?Ludovic_Court=C3=A8s?= Cc: guix-devel On Tue, Aug 18, 2015 at 11:58 AM, Ludovic Court=C3=A8s wrote= : > "Thompson, David" skribis: > >> From c2da6c04eb1a12d0ee2f56a3954673f3bddc122b Mon Sep 17 00:00:00 2001 >> From: David Thompson >> Date: Sun, 2 Aug 2015 23:29:53 -0400 >> Subject: [PATCH] gnu: services: Add nginx-service. >> >> * gnu/services/web.scm: New file. >> * gnu-system.am (GNU_SYSTEM_MODULES): Add it. > > [...] > >> +(define (default-nginx-config log-directory run-directory) >> + (text-file* "nginx.conf" >> + "user nginx nginx;\n" >> + "pid " run-directory "/pid;\n" >> + "error_log " log-directory "/error.log info;\n" >> + "http {\n" >> + " access_log " log-directory "/access.log;\n" >> + " root /var/www;\n" >> + " server {}\n" >> + "}\n" >> + "events {}\n")) >> + >> +(define* (nginx-service #:key (nginx nginx) >> + (log-directory "/var/log/nginx") >> + (run-directory "/var/run/nginx") >> + (config-file >> + (default-nginx-config log-directory run-direct= ory))) > > There=E2=80=99s this annoying thing that here =E2=80=98config-file=E2=80= =99 is a monadic value > when we=E2=80=99d instead prefer a =E2=80=9Cfile-like object.=E2=80=9D > > To work around it you could use =E2=80=98plain-file=E2=80=99 and make the= default config > file independent of the parameters. The obvious issue is that if the > user specifies LOG-DIRECTORY or RUN-DIRECTORY different from the > default, yet use the default config files, things will break. But maybe > that=E2=80=99s an acceptable drawback? Yeah, I'm not sure which way to go here, and I feel like this will be an issue in many services to come. Services often have to know some details about the configuration to create directories and files that the daemon won't just create on its own. For context, I chose the current implementation because Mark told me that he didn't like the idea of the default configuration file being independent of the #:log-directory and #:run-directory arguments, and I agreed it was not good. > Lastly, could you add a =E2=80=9CWeb Services=E2=80=9D section under =E2= =80=9CServices=E2=80=9D in the > manual? Yes, I can do that. - Dave