guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] gnu: services: Add nginx-service.


From: Thompson, David
Subject: Re: [PATCH] gnu: services: Add nginx-service.
Date: Tue, 18 Aug 2015 20:23:41 -0400

On Tue, Aug 18, 2015 at 11:58 AM, Ludovic Courtès <address@hidden> wrote:
> "Thompson, David" <address@hidden> skribis:
>
>> From c2da6c04eb1a12d0ee2f56a3954673f3bddc122b Mon Sep 17 00:00:00 2001
>> From: David Thompson <address@hidden>
>> 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-directory)))
>
> There’s this annoying thing that here ‘config-file’ is a monadic value
> when we’d instead prefer a “file-like object.”
>
> To work around it you could use ‘plain-file’ 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’s 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 “Web Services” section under “Services” in the
> manual?

Yes, I can do that.

- Dave



reply via email to

[Prev in Thread] Current Thread [Next in Thread]