2
0
Fork 0
mirror of git://git.savannah.gnu.org/guix/maintenance.git synced 2023-12-14 03:33:04 +01:00
maintenance/hydra/nginx/mirror-locations.conf
Leo Famulari 5f682a0815
hydra: nginx: Caching mirrors *really* proxy ci.guix.gnu.org.
This is a followup to commit 577b1d5b69.

* hydra/nginx/mirror-locations.conf: Fix 'cuix' typo.
2020-12-03 14:45:42 -05:00

126 lines
3.6 KiB
Plaintext

# Configuration of the various locations being mirrored.
# This file is meant to be included in the mirror configuration file.
location = / {
return 301 https://ci.guix.gnu.org;
}
location = /index.html {
return 301 https://ci.guix.gnu.org;
}
location = /nix-cache-info {
proxy_pass http://ci.guix.gnu.org/nix-cache-info;
# Cache this file since that's always the first thing we ask for.
proxy_cache static;
proxy_cache_valid 200 100d; # cache hits for a looong time.
proxy_cache_valid any 5m; # cache misses/others for 5 min.
proxy_ignore_client_abort on;
# We need to hide and ignore the Set-Cookie header
# to enable caching.
proxy_hide_header Set-Cookie;
proxy_ignore_headers Set-Cookie;
}
# Match both /nar and /guix/nar.
location ~ /nar/ {
proxy_pass http://ci.guix.gnu.org;
client_body_buffer_size 256k;
# Be more tolerant of delays when fetching a nar.
proxy_read_timeout 60s;
proxy_send_timeout 60s;
# XXX: If builds were all bit-reproducible, we could cache nars
# much longer. However they are not, so we can end up with hash
# mismatches between the narinfos and the cached nars we have.
# Thus, cache for a limited amount of time.
proxy_cache nar;
proxy_cache_valid 200 30d; # cache hits for 1 month
proxy_cache_valid any 5m; # others for 5m
proxy_ignore_client_abort on;
# Nars are already compressed.
gzip off;
# We need to hide and ignore the Set-Cookie header
# to enable caching.
proxy_hide_header Set-Cookie;
proxy_ignore_headers Set-Cookie;
# Provide a 'content-length' header so that 'guix substitute-binary'
# knows upfront how much it is downloading.
#add_header Content-Length $body_bytes_sent;
}
location ~ \.narinfo$ {
proxy_pass http://ci.guix.gnu.org;
# For HTTP pipelining. This has a dramatic impact on performance.
client_body_buffer_size 128k;
# Narinfos requests are short, serve many of them on a connection.
keepalive_requests 600;
# Do not tolerate slowness of ci.guix.gnu.org when fetching
# narinfos: better return 504 quickly than wait forever.
proxy_connect_timeout 2s;
proxy_read_timeout 2s;
proxy_send_timeout 2s;
# Cache for narinfo files. We assume that upstream runs 'guix
# publish' and provides 'Cache-Control' headers that we can just
# blindly honor.
proxy_cache narinfo;
proxy_cache_valid 504 5m; # timeout, when ci.guix.gnu.org is overloaded
# Advertise a shorter TTL than what upstream provides to be on the
# safe side.
expires 7d;
proxy_ignore_client_abort on;
# We need to hide and ignore Hydra's Set-Cookie header
# to enable caching.
proxy_hide_header Set-Cookie;
proxy_ignore_headers Set-Cookie;
}
location /log/ {
proxy_pass http://ci.guix.gnu.org;
# Enable caching for build logs.
proxy_cache logs;
proxy_cache_valid 200 60d; # cache hits.
proxy_cache_valid 504 3m; # timeout, when ci.guix.gnu.org is overloaded
proxy_cache_valid any 20m; # cache misses/others
proxy_ignore_client_abort on;
# We need to hide and ignore the Set-Cookie header
# to enable caching.
proxy_hide_header Set-Cookie;
proxy_ignore_headers Set-Cookie;
}
# Content-addressed files served by 'guix publish'.
location /file/ {
proxy_pass http://ci.guix.gnu.org;
proxy_cache cas;
proxy_cache_valid 200 200d; # cache hits
proxy_cache_valid any 5m; # cache misses/others
proxy_ignore_client_abort on;
}
# For use by Certbot.
location /.well-known {
root /var/www;
}