guix-commits
[Top][All Lists]
Advanced

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

02/05: nginx: berlin: Make the 'guix publish' URL a parameter.


From: Ludovic Courtès
Subject: 02/05: nginx: berlin: Make the 'guix publish' URL a parameter.
Date: Tue, 4 Jun 2019 04:07:41 -0400 (EDT)

civodul pushed a commit to branch master
in repository maintenance.

commit 187a36628ffceda98dd12f13b9e9eb7a25c31763
Author: Ludovic Courtès <address@hidden>
Date:   Mon Jun 3 21:25:07 2019 +0200

    nginx: berlin: Make the 'guix publish' URL a parameter.
    
    * hydra/nginx/berlin.scm (%publish-locations): Rename to...
    (publish-locations): ... this.  Add 'url' parameter and honor it.
    (%berlin-locations): Rename to...
    (berlin-locations): ... this.  Add 'publish-url' parameter and honor
    it.
    (%berlin-servers): Adjust accordingly.
---
 hydra/nginx/berlin.scm | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/hydra/nginx/berlin.scm b/hydra/nginx/berlin.scm
index af7a9e4..8c8c9d2 100644
--- a/hydra/nginx/berlin.scm
+++ b/hydra/nginx/berlin.scm
@@ -22,16 +22,14 @@
                  (if privkey "privkey" "fullchain")
                  ".pem"))
 
-(define %publish-url "http://localhost:3000";)
-
-(define %publish-locations
-  ;; Nginx locations for 'guix publish'.
+(define (publish-locations url)
+  "Return the nginx location blocks for 'guix publish' running on URL."
   (list (nginx-location-configuration
          (uri "/nix-cache-info")
          (body
           (list
            (string-append
-            "proxy_pass " %publish-url "/nix-cache-info;")
+            "proxy_pass " url "/nix-cache-info;")
            ;; Cache this file since that's always the first thing we ask
            ;; for.
            "proxy_cache static;"
@@ -48,7 +46,7 @@
          (uri "/nar/")
          (body
           (list
-           (string-append "proxy_pass " %publish-url ";")
+           (string-append "proxy_pass " url ";")
            "client_body_buffer_size 256k;"
 
            ;; Be more tolerant of delays when fetching a nar.
@@ -85,7 +83,7 @@
            ;; on the atime of cached narinfos to determine whether a
            ;; narinfo can be removed from the cache, don't do any caching
            ;; here.
-           (string-append "proxy_pass " %publish-url ";")
+           (string-append "proxy_pass " url ";")
 
            ;; For HTTP pipelining.  This has a dramatic impact on
            ;; performance.
@@ -118,7 +116,7 @@
          (uri "/log/")
          (body
           (list
-           (string-append "proxy_pass " %publish-url ";")
+           (string-append "proxy_pass " url ";")
 
            ;; Enable caching for build logs.
            "proxy_cache logs;"
@@ -138,7 +136,7 @@
          (uri "/file/")
          (body
           (list
-           (string-append "proxy_pass " %publish-url ";")
+           (string-append "proxy_pass " url ";")
 
            "proxy_cache cas;"
            "proxy_cache_valid 200 200d;"          ; cache hits
@@ -159,8 +157,10 @@
    ;; as suggested at <https://weakdh.org/sysadmin.html>.
    "ssl_dhparam         /etc/dhparams.pem;"))
 
-(define %berlin-locations
-  (append %publish-locations
+(define (berlin-locations publish-url)
+  "Return nginx location blocks with 'guix publish' reachable at
+PUBLISH-URL."
+  (append (publish-locations publish-url)
           (list
            ;; Cuirass.
            (nginx-location-configuration
@@ -190,6 +190,8 @@
             (uri "/.well-known")
             (body (list "root /var/www;"))))))
 
+(define %publish-url "http://localhost:3000";)
+
 (define %berlin-servers
   (list
 
@@ -199,7 +201,7 @@
     (server-name '("berlin.guixsd.org"
                    "ci.guix.info"
                    "ci.guix.gnu.org"))
-    (locations %berlin-locations)
+    (locations (berlin-locations %publish-url))
     (raw-content
      (list
       "access_log  /var/log/nginx/http.access.log;"
@@ -262,7 +264,7 @@
                    "ci.guix.gnu.org"))
     (ssl-certificate (le "berlin.guixsd.org"))
     (ssl-certificate-key (le "berlin.guixsd.org" 'key))
-    (locations %berlin-locations)
+    (locations (berlin-locations %publish-url))
     (raw-content
      (append
       %tls-settings



reply via email to

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