unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Julien Lepiller <julien@lepiller.eu>
To: guix-devel@gnu.org
Subject: Re: [PATCH] improve nginx-service
Date: Fri, 4 Nov 2016 23:12:53 +0100	[thread overview]
Message-ID: <20161104231253.4b52d70f@lepiller.eu> (raw)
In-Reply-To: <b4538183-4ee2-fffb-a2c3-96eb3323231d@crazy-compilers.com>

On Fri, 4 Nov 2016 22:28:07 +0100
Hartmut Goebel <h.goebel@crazy-compilers.com> wrote:

> Hi Julien
> 
> thanks for these patches. I applied them to current master, but I did
> not work out how to use the new features. I'd appreciate a more
> complete example.
> 
> 0001-Make-nginx-service-extensible.patch
> > +@deffn {Scheme Variable} nginx-service-type +This is the type for
> > the nginx web server. + +This service can be extended to add more
> > vhosts than the default one. + +@example +(simple-service
> > 'my-extra-vhost nginx-service-type + (list
> > (nginx-vhost-configuration (https-port #f)
> > + (root "/var/www/extra-website"))))  
> 
> I do not understand this. Why would I want to to this? Why not just
> add the vhost declaration when defining the service in the system
> declaration? Is this for vhost-types which have preset values for some
> configuration files? Then a different example might be useful, and/or
> some more explanation.

There is no real difference between the two. This is mostly usefull for
implementing new web services in the distro, but it is also good for
separating nginx configuration from web service configuration. I guess
that's a matter of taste.

> 
> It's a bit more obvious with patch 3, but even that example is not
> that obvious to me and could use some more explanation.
> 
> I've build a simple service like the gtk-doc-vhost in your second
> example, but it not manage to make it work: First I got "error: no
> target of type 'nginx'", so I re-added "(nginx-service)" to the system
> declaration. Then I got

Yes, the example adds a service that uses the nginx service, but does
not create it.

> 
>     gnu/services/web.scm:118:34: In procedure
> default-nginx-vhost-config: gnu/services/web.scm:118:34: In procedure
> struct_vtable: Wrong type argument in position 1 (expecting struct):
>     (nginx-vhost-configuration (root taler-landing-page))

What is your configuration exactly, and what is taler-landing-page?

> 
> Si I'd really appreciate seeing a more complete example either in the
> documentation of in gn/systems/examples/
> 
> > (system* (string-append #$nginx "/sbin/nginx") - "-c" #$config-file
> > "-t"))))) + "-c" #$(or config-file + (default-nginx-config
> > log-directory + run-directory vhosts)) + "-t")))))  
> 
> Nitpicking: I'd mode the "-t" to the front, since this is the
> important difference.
> 
> > (define nginx-shepherd-service (match-lambda - (($
> > <nginx-configuration> nginx log-directory run-directory
> > config-file) + (($ <nginx-configuration> nginx log-directory
> > run-directory vhosts config-file) (let* ((nginx-binary (file-append
> > nginx "/sbin/nginx")) (nginx-action (lambda args #~(lambda _ (zero?
> > - (system* #$nginx-binary "-c" #$config-file #$@args)))))) +
> > (system* #$nginx-binary "-c" #$(or config-file +
> > (default-nginx-config + log-directory + run-directory + vhosts))+
> > #$@args))))))  
> 
> To avoid duplicate code I suggest moving the "#$(or …)" part into a
> private function - if this is possible.
> 
> 
> 
> 0003-services-Accept-gexps-as-nginx-configuration-value.patch
> > +@example +(simple-service 'gtk-doc-vhost nginx-service-type + (list
> > (nginx-vhost-configuration  
> 
> git am says: trailing whitespace
> 
> > + " root " #$(nginx-vhost-configuration-root vhost) ";\n" + " index
> > " #$(config-index-strings (nginx-vhost-configuration-index vhost))
> > ";\n"
> > + " server_tokens " #$(if (nginx-vhost-configuration-server-tokens?
> > vhost) + "on" "off") ";\n"  
> 
> Could you please (maybe in another patch) add a way to include
> additional config lines? Both for the main server and each vhost.I'm
> gioing to need this for adding locations, backends and such.

I'd like to get these patches accepted first, but I'm already working
on adding more configuration lines.

Thanks for your review, I will fix that and come with a new patchset
quickly (with better documentation).

> 
> -- Regards Hartmut Goebel | Hartmut Goebel |
> h.goebel@crazy-compilers.com | | www.crazy-compilers.com | compilers
> which you thought are impossible |
> 
> 
> 

  reply	other threads:[~2016-11-04 22:13 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-16 12:33 [PATCH] improve nginx-service Julien Lepiller
2016-10-19 21:04 ` Ludovic Courtès
2016-10-20 12:37   ` Julien Lepiller
2016-10-24 20:51     ` Ludovic Courtès
2016-10-26 19:45       ` Julien Lepiller
2016-10-27 12:41         ` Ludovic Courtès
2016-10-27 17:59           ` Julien Lepiller
2016-10-30 21:46             ` Ludovic Courtès
2016-11-02  8:22               ` Hartmut Goebel
2016-11-03 14:54                 ` Ludovic Courtès
2016-11-03 22:38                   ` Hartmut Goebel
2016-11-04 13:21                     ` Ludovic Courtès
2016-11-04 18:01                       ` Julien Lepiller
2016-11-04 21:28                         ` Hartmut Goebel
2016-11-04 22:12                           ` Julien Lepiller [this message]
2016-11-04 22:34                             ` Hartmut Goebel
2016-11-06 11:11                               ` Julien Lepiller
2016-11-04 22:58                             ` Hartmut Goebel
2016-11-06 12:18                               ` Tobias Geerinckx-Rice
2016-11-06 17:19                                 ` Ludovic Courtès
2016-11-20 12:49                                   ` Julien Lepiller
2016-11-22 22:20                                     ` Hartmut Goebel
2016-11-23  9:26                                       ` julien lepiller
2016-11-25 10:53                                         ` Clément Lassieur
2016-11-25 11:46                                           ` is using eval good style in guile?(was: [PATCH] improve nginx-service) Hartmut Goebel
2016-11-25 13:29                                             ` is using eval good style in guile? Andy Wingo
2016-11-26 21:55                                               ` Clément Lassieur
2016-11-27 21:01                                         ` [PATCH] improve nginx-service Ludovic Courtès
2016-11-06 17:33                               ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161104231253.4b52d70f@lepiller.eu \
    --to=julien@lepiller.eu \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).