[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
01/02: nginx: hydra.gnu.org: Get narinfos and nars from 'guix publish'.
From: |
Ludovic Courtès |
Subject: |
01/02: nginx: hydra.gnu.org: Get narinfos and nars from 'guix publish'. |
Date: |
Wed, 22 Mar 2017 17:44:01 -0400 (EDT) |
civodul pushed a commit to branch master
in repository maintenance.
commit e3eece42f874563389329607403aa0795bbde7a6
Author: Ludovic Courtès <address@hidden>
Date: Wed Mar 22 22:24:19 2017 +0100
nginx: hydra.gnu.org: Get narinfos and nars from 'guix publish'.
* hydra/nginx/hydra.gnu.org-locations.conf: Add 'location' block for
/guix/nar/.
---
hydra/nginx/hydra.gnu.org-locations.conf | 39 ++++++++++++++++++++++++++++----
1 file changed, 35 insertions(+), 4 deletions(-)
diff --git a/hydra/nginx/hydra.gnu.org-locations.conf
b/hydra/nginx/hydra.gnu.org-locations.conf
index 4d14505..566e7f1 100644
--- a/hydra/nginx/hydra.gnu.org-locations.conf
+++ b/hydra/nginx/hydra.gnu.org-locations.conf
@@ -26,7 +26,37 @@ location ~ ^/nar/.*-(texlive-texmf-|texlive-20150523-texmf) {
break;
}
+location /guix/nar/ {
+ # Served by:
+ # guix publish -p 9999 -u nobody -C7 --nar-path=guix/nar
--public-key=/home/hydra/narinfo-key.pub
--private-key=/home/hydra/narinfo-key.sec
+ proxy_pass http://127.0.0.1:9999;
+
+ client_body_buffer_size 256k;
+
+ # Enable caching for nar files, to avoid reconstructing and recompressing
+ # archives.
+ proxy_cache nar;
+ proxy_cache_valid 200 15d; # cache hits for 15 days.
+ proxy_cache_valid 504 3m; # timeout, when the machine is overloaded
+ proxy_cache_valid any 1m; # cache misses/others for 1 min.
+
+ proxy_ignore_client_abort on;
+
+ # Be more tolerant of delays when fetching a nar. Using a shorter
+ # timeout leads to users retrying, which in turn triggers another
+ # export-and-compress process, which quickly brings the machine
+ # down.
+ proxy_read_timeout 60s;
+ proxy_send_timeout 60s;
+
+ # Nars are already compressed.
+ gzip off;
+}
+
location /nar/ {
+ # Legacy: served by Hydra. Dumps are made by spawning
+ # "nix-store --export foo | bzip2", which is CPU-intensive.
+ # Additionally, Starman (Hydra's HTTP server) seems to be pretty slow.
proxy_pass http://127.0.0.1:3000;
client_body_buffer_size 256k;
@@ -41,7 +71,7 @@ location /nar/ {
proxy_ignore_client_abort on;
# Be more tolerant of delays when fetching a nar. Using a shorter
- # timeout leads to users retrying, which in turns triggers another
+ # timeout leads to users retrying, which in turn triggers another
# "nix-store --dump foo | bzip2" process, which quickly brings the
# machine down.
proxy_read_timeout 60s;
@@ -86,7 +116,9 @@ location ~ /(nix-cache-info|static|logo|favicon\.ico) {
}
location ~ \.narinfo$ {
- proxy_pass http://127.0.0.1:3000;
+ # Narinfos served by 'guix publish' (see above). If we change the
+ # port to 3000, then they are served by Hydra.
+ proxy_pass http://127.0.0.1:9999;
# For HTTP pipelining. This has a dramatic impact on performance.
client_body_buffer_size 128k;
@@ -119,9 +151,8 @@ location ~ \.narinfo$ {
# Content-addressed files served by 'guix publish'. No need to cache
# it because it is served right from the store without any additional
-# processing.
+# processing (see above for the full 'guix publish' command).
location /file/ {
- # Launch as 'guix publish -p 9999 -u nobody --listen=127.0.0.1'.
proxy_pass http://127.0.0.1:9999;
proxy_connect_timeout 3s;