guix-commits
[Top][All Lists]
Advanced

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

01/01: nginx: berlin: Really pass a "worker_processes" directive.


From: Ludovic Courtès
Subject: 01/01: nginx: berlin: Really pass a "worker_processes" directive.
Date: Wed, 27 Nov 2019 16:24:35 -0500 (EST)

civodul pushed a commit to branch master
in repository maintenance.

commit bd9c3308f5b4c7b0d604a1a041072039add36093
Author: Ludovic Courtès <address@hidden>
Date:   Wed Nov 27 22:23:28 2019 +0100

    nginx: berlin: Really pass a "worker_processes" directive.
    
    * hydra/nginx/berlin.scm (%extra-content): Comment out
    "worker_processes" directive.
    (%nginx-configuration): Rename to...
    (%nginx-configuration/intermediate): ... this.
    (%nginx-config-file, %nginx-configuration): New variables.
---
 hydra/nginx/berlin.scm | 29 +++++++++++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)

diff --git a/hydra/nginx/berlin.scm b/hydra/nginx/berlin.scm
index b619433..71191a6 100644
--- a/hydra/nginx/berlin.scm
+++ b/hydra/nginx/berlin.scm
@@ -694,8 +694,11 @@ PUBLISH-URL."
 
 (define %extra-content
   (list
+   ;; FIXME: <nginx-configuration> doesn't currently provide a way to pass
+   ;; top-level directives like those below.
+
    ;; This is a 72-core machine, but let's not use all of them for nginx.
-   "worker_processes 16;"
+   ;; "worker_processes 16;"
 
    ;; "pcre_jit on;"
    ;; "events { worker_connections  1024; }"
@@ -758,8 +761,30 @@ PUBLISH-URL."
    ;; Cache timeouts for a little while to avoid increasing pressure.
    "proxy_cache_valid 504 30s;"))
 
-(define %nginx-configuration
+(define %nginx-configuration/intermediate
   (nginx-configuration
    (server-blocks %berlin-servers)
    (extra-content
     (string-join %extra-content "\n"))))
+
+(define %nginx-config-file
+  ;; XXX: This hack allows us to add a "worker_processes" directive at the
+  ;; top level.
+  (let ((generated ((@@ (gnu services web) default-nginx-config)
+                    %nginx-configuration/intermediate)))
+    (computed-file "nginx.conf"
+                   (with-imported-modules '((guix build utils))
+                     #~(begin
+                         (use-modules (guix build utils))
+
+                         (call-with-output-file #$output
+                           (lambda (port)
+                             (display "worker_processes 16;\n"
+                                      port)
+                             (call-with-input-file #$generated
+                               (lambda (input)
+                                 (dump-port input port))))))))))
+
+(define %nginx-configuration
+  (nginx-configuration
+   (file %nginx-config-file)))



reply via email to

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