GNU bug report logs - #29628
services: nginx: Replace 'http-port' and 'https-port' with 'listen'.

Previous Next

Package: guix-patches;

Reported by: Clément Lassieur <clement <at> lassieur.org>

Date: Sat, 9 Dec 2017 19:30:01 UTC

Severity: normal

Done: Clément Lassieur <clement <at> lassieur.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 29628 in the body.
You can then email your comments to 29628 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#29628; Package guix-patches. (Sat, 09 Dec 2017 19:30:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Clément Lassieur <clement <at> lassieur.org>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Sat, 09 Dec 2017 19:30:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Clément Lassieur <clement <at> lassieur.org>
To: guix-patches <at> gnu.org
Subject: services: nginx: Replace 'http-port' and 'https-port' with 'listen'.
Date: Sat, 09 Dec 2017 19:41:19 +0100
This patch allows to set several 'listen' directives, each of them being
a string.

See http://nginx.org/en/docs/http/ngx_http_core_module.html#listen.

It may break user configurations.




Information forwarded to guix-patches <at> gnu.org:
bug#29628; Package guix-patches. (Sat, 09 Dec 2017 19:37:01 GMT) Full text and rfc822 format available.

Message #8 received at 29628 <at> debbugs.gnu.org (full text, mbox):

From: Clément Lassieur <clement <at> lassieur.org>
To: 29628 <at> debbugs.gnu.org
Subject: [PATCH] services: nginx: Replace 'http-port' and 'https-port' with
 'listen'.
Date: Sat,  9 Dec 2017 20:35:49 +0100
* doc/guix.texi (Web Services, Version Control Services): Update accordingly.
* gnu/services/certbot.scm (certbot-nginx-server-configurations): Likewise.
* gnu/services/version-control.scm (%cgit-configuration-nginx): Likewise.
* gnu/services/web.scm (<nginx-server-configuration>,
emit-nginx-server-config): Likewise.
* gnu/tests/version-control.scm (%cgit-configuration-nginx,
%git-nginx-configuration): Likewise.
* gnu/tests/web.scm (%nginx-servers): Likewise.
---
 doc/guix.texi                    | 28 +++++++++++++---------------
 gnu/services/certbot.scm         |  4 ++--
 gnu/services/version-control.scm |  3 ++-
 gnu/services/web.scm             | 16 ++++++----------
 gnu/tests/version-control.scm    |  7 +++----
 gnu/tests/web.scm                |  4 ++--
 6 files changed, 28 insertions(+), 34 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index c14df7fcd..ab1e5d057 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -14814,7 +14814,7 @@ A simple example configuration is given below.
              (list (nginx-server-configuration
                      (server-name '("www.example.com"))
                      (root "/srv/http/www.example.com")
-                     (https-port #f)
+                     (listen '("80"))
                      (ssl-certificate #f)
                      (ssl-certificate-key #f))))))
 @end example
@@ -14826,7 +14826,7 @@ blocks, as in this example:
 @example
 (simple-service 'my-extra-server nginx-service-type
                 (list (nginx-server-configuration
-                        (https-port #f)
+                        (listen '("80"))
                         (ssl-certificate #f)
                         (ssl-certificate-key #f)
                         (root "/srv/http/extra-website")
@@ -14874,7 +14874,7 @@ HTTPS.
              (list (nginx-server-configuration
                      (server-name '("www.example.com"))
                      (root "/srv/http/www.example.com")
-                     (https-port #f)
+                     (listen '("80"))
                      (ssl-certificate #f)
                      (ssl-certificate-key #f))))))
 @end example
@@ -14899,7 +14899,7 @@ requests with two servers.
       (list (nginx-server-configuration
               (server-name '("www.example.com"))
               (root "/srv/http/www.example.com")
-              (https-port #f)
+              (listen '("80"))
               (ssl-certificate #f)
               (ssl-certificate-key #f)
               (locations
@@ -14933,17 +14933,15 @@ Data type representing the configuration of an nginx server block.
 This type has the following parameters:
 
 @table @asis
-@item @code{http-port} (default: @code{80})
-Nginx will listen for HTTP connection on this port.  Set it at @code{#f} if
-nginx should not listen for HTTP (non secure) connection for this
-@dfn{server block}.
+@item @code{listen} (default: @code{'("80" "443 ssl")})
+Each @code{listen} directive sets the address and port for IP, or the
+path for a UNIX-domain socket on which the server will accept requests.
+Both address and port, or only address or only port can be specified.
+An address may also be a hostname, for example:
 
-@item @code{https-port} (default: @code{443})
-Nginx will listen for HTTPS connection on this port.  Set it at @code{#f} if
-nginx should not listen for HTTPS (secure) connection for this @dfn{server block}.
-
-Note that nginx can listen for HTTP and HTTPS connections in the same
-@dfn{server block}.
+@example
+'("127.0.0.1:8000" "127.0.0.1" "8000" "*:8000" "localhost:8000")
+@end example
 
 @item @code{server-name} (default: @code{(list 'default)})
 A list of server names this server represents. @code{'default} represents the
@@ -17545,7 +17543,7 @@ serve the default @file{/srv/git} over HTTPS might be:
           (server-blocks
            (list
             (nginx-server-configuration
-             (http-port #f)
+             (listen '("443 ssl"))
              (server-name "git.my-host.org")
              (ssl-certificate
               "/etc/letsencrypt/live/git.my-host.org/fullchain.pem")
diff --git a/gnu/services/certbot.scm b/gnu/services/certbot.scm
index dc072ea8d..fe7afe135 100644
--- a/gnu/services/certbot.scm
+++ b/gnu/services/certbot.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2016 ng0 <ng0 <at> we.make.ritual.n0.is>
 ;;; Copyright © 2016 Sou Bunnbu <iyzsong <at> member.fsf.org>
+;;; Copyright © 2017 Clément Lassieur <clement <at> lassieur.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -97,8 +98,7 @@
      (map
       (lambda (host)
         (nginx-server-configuration
-         (http-port 80)
-         (https-port #f)
+         (listen '("80"))
          (ssl-certificate #f)
          (ssl-certificate-key #f)
          (server-name (list host))
diff --git a/gnu/services/version-control.scm b/gnu/services/version-control.scm
index fce2ce1c2..6bf656949 100644
--- a/gnu/services/version-control.scm
+++ b/gnu/services/version-control.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2016 ng0 <ng0 <at> we.make.ritual.n0.is>
 ;;; Copyright © 2016 Sou Bunnbu <iyzsong <at> member.fsf.org>
 ;;; Copyright © 2017 Oleg Pykhalov <go.wigust <at> gmail.com>
+;;; Copyright © 2017 Clément Lassieur <clement <at> lassieur.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -231,7 +232,7 @@ access to exported repositories under @file{/srv/git}."
                "fastcgi_param HTTP_HOST $server_name;"
                "fastcgi_pass 127.0.0.1:9000;")))))
     (try-files (list "$uri" "@cgit"))
-    (https-port #f)
+    (listen '("80"))
     (ssl-certificate #f)
     (ssl-certificate-key #f))))
 
diff --git a/gnu/services/web.scm b/gnu/services/web.scm
index 9d713003c..7373d5671 100644
--- a/gnu/services/web.scm
+++ b/gnu/services/web.scm
@@ -4,6 +4,7 @@
 ;;; Copyright © 2016 ng0 <ng0 <at> we.make.ritual.n0.is>
 ;;; Copyright © 2016, 2017 Julien Lepiller <julien <at> lepiller.eu>
 ;;; Copyright © 2017 Christopher Baines <mail <at> cbaines.net>
+;;; Copyright © 2017 Clément Lassieur <clement <at> lassieur.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -43,8 +44,7 @@
             <nginx-server-configuration>
             nginx-server-configuration
             nginx-server-configuration?
-            nginx-server-configuration-http-port
-            nginx-server-configuartion-https-port
+            nginx-server-configuration-listen
             nginx-server-configuration-server-name
             nginx-server-configuration-root
             nginx-server-configuration-locations
@@ -87,10 +87,8 @@
 (define-record-type* <nginx-server-configuration>
   nginx-server-configuration make-nginx-server-configuration
   nginx-server-configuration?
-  (http-port           nginx-server-configuration-http-port
-                       (default 80))
-  (https-port          nginx-server-configuration-https-port
-                       (default 443))
+  (listen              nginx-server-configuration-listen
+                       (default '("80" "443 ssl")))
   (server-name         nginx-server-configuration-server-name
                        (default (list 'default)))
   (root                nginx-server-configuration-root
@@ -173,8 +171,7 @@ of index files."
       "      }\n"))))
 
 (define (emit-nginx-server-config server)
-  (let ((http-port (nginx-server-configuration-http-port server))
-        (https-port (nginx-server-configuration-https-port server))
+  (let ((listen (nginx-server-configuration-listen server))
         (server-name (nginx-server-configuration-server-name server))
         (ssl-certificate (nginx-server-configuration-ssl-certificate server))
         (ssl-certificate-key
@@ -203,8 +200,7 @@ of index files."
        ("ssl-certificate-key" . ,ssl-certificate-key)))
     (list
      "    server {\n"
-     (and/l http-port  "      listen " (number->string <>) ";\n")
-     (and/l https-port "      listen " (number->string <>) " ssl;\n")
+     (map (lambda (directive) (list "      listen " directive ";\n")) listen)
      "      server_name " (config-domain-strings server-name) ";\n"
      (and/l ssl-certificate     "      ssl_certificate " <> ";\n")
      (and/l ssl-certificate-key "      ssl_certificate_key " <> ";\n")
diff --git a/gnu/tests/version-control.scm b/gnu/tests/version-control.scm
index 2cbacf0ef..7367861b0 100644
--- a/gnu/tests/version-control.scm
+++ b/gnu/tests/version-control.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2017 Oleg Pykhalov <go.wigust <at> gmail.com>
 ;;; Copyright © 2017 Ludovic Courtès <ludo <at> gnu.org>
+;;; Copyright © 2017 Clément Lassieur <clement <at> lassieur.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -78,8 +79,7 @@
                "fastcgi_param HTTP_HOST $server_name;"
                "fastcgi_pass 127.0.0.1:9000;")))))
     (try-files (list "$uri" "@cgit"))
-    (http-port 19418)
-    (https-port #f)
+    (listen '("19418"))
     (ssl-certificate #f)
     (ssl-certificate-key #f))))
 
@@ -211,8 +211,7 @@ HTTP-PORT."
    (server-blocks
     (list
      (nginx-server-configuration
-      (http-port 19418)
-      (https-port #f)
+      (listen '("19418"))
       (ssl-certificate #f)
       (ssl-certificate-key #f)
       (locations
diff --git a/gnu/tests/web.scm b/gnu/tests/web.scm
index 3fa272c67..4c6614dc4 100644
--- a/gnu/tests/web.scm
+++ b/gnu/tests/web.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2017 Ludovic Courtès <ludo <at> gnu.org>
+;;; Copyright © 2017 Clément Lassieur <clement <at> lassieur.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -45,8 +46,7 @@
   ;; Server blocks.
   (list (nginx-server-configuration
          (root "/srv")
-         (http-port 8042)
-         (https-port #f)
+         (listen '("8042"))
          (ssl-certificate #f)
          (ssl-certificate-key #f))))
 
-- 
2.15.1





Information forwarded to guix-patches <at> gnu.org:
bug#29628; Package guix-patches. (Sat, 16 Dec 2017 21:30:02 GMT) Full text and rfc822 format available.

Message #11 received at 29628 <at> debbugs.gnu.org (full text, mbox):

From: Christopher Baines <mail <at> cbaines.net>
To: Clément Lassieur <clement <at> lassieur.org>
Cc: 29628 <at> debbugs.gnu.org
Subject: Re: [bug#29628] [PATCH] services: nginx: Replace 'http-port' and
 'https-port' with 'listen'.
Date: Sat, 16 Dec 2017 21:29:23 +0000
[Message part 1 (text/plain, inline)]
Clément Lassieur <clement <at> lassieur.org> writes:

> * doc/guix.texi (Web Services, Version Control Services): Update accordingly.
> * gnu/services/certbot.scm (certbot-nginx-server-configurations): Likewise.
> * gnu/services/version-control.scm (%cgit-configuration-nginx): Likewise.
> * gnu/services/web.scm (<nginx-server-configuration>,
> emit-nginx-server-config): Likewise.
> * gnu/tests/version-control.scm (%cgit-configuration-nginx,
> %git-nginx-configuration): Likewise.
> * gnu/tests/web.scm (%nginx-servers): Likewise.

This looks good to me. Unfortunately this conflicts with some changes I
made to the nginx service, so it would be good if you could send an
updated patch.

I think an extra use of the old configuration might have also appeared
in the docs/services as well.

Thanks,

Chris
[signature.asc (application/pgp-signature, inline)]

Reply sent to Clément Lassieur <clement <at> lassieur.org>:
You have taken responsibility. (Mon, 18 Dec 2017 11:07:02 GMT) Full text and rfc822 format available.

Notification sent to Clément Lassieur <clement <at> lassieur.org>:
bug acknowledged by developer. (Mon, 18 Dec 2017 11:07:02 GMT) Full text and rfc822 format available.

Message #16 received at 29628-done <at> debbugs.gnu.org (full text, mbox):

From: Clément Lassieur <clement <at> lassieur.org>
To: Christopher Baines <mail <at> cbaines.net>
Cc: 29628-done <at> debbugs.gnu.org
Subject: Re: [bug#29628] [PATCH] services: nginx: Replace 'http-port' and
 'https-port' with 'listen'.
Date: Mon, 18 Dec 2017 12:06:43 +0100
Christopher Baines <mail <at> cbaines.net> writes:

> Clément Lassieur <clement <at> lassieur.org> writes:
>
>> * doc/guix.texi (Web Services, Version Control Services): Update accordingly.
>> * gnu/services/certbot.scm (certbot-nginx-server-configurations): Likewise.
>> * gnu/services/version-control.scm (%cgit-configuration-nginx): Likewise.
>> * gnu/services/web.scm (<nginx-server-configuration>,
>> emit-nginx-server-config): Likewise.
>> * gnu/tests/version-control.scm (%cgit-configuration-nginx,
>> %git-nginx-configuration): Likewise.
>> * gnu/tests/web.scm (%nginx-servers): Likewise.
>
> This looks good to me. Unfortunately this conflicts with some changes I
> made to the nginx service, so it would be good if you could send an
> updated patch.
>
> I think an extra use of the old configuration might have also appeared
> in the docs/services as well.

I updated it and pushed it.  Thank you for reviewing!

Clément




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 15 Jan 2018 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 7 years and 160 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.