Proxy local binary caches via hydra-server
[?]
Feb 26, 2016, 4:27 PM
YAD7524SVEXNAZROAJNCWGU6IDYZKMANLW7UD6IVT64LJVSHZNIACDependencies
- [2]
MT5HGXFPHydra/62 fix, broken nar download - [3]
CJRWFVKZAdd a ‘latest-finished’ action - [4]
MNKXBLNCReturn 410 Gone (rather than 500) if an output is no longer available - [5]
IAYKPDXXHonor $NIX_STORE_DIR. - [6]
2N6GLXDMDon't cache nix-cache-info very long - [7]
IDT3SO3PGenerate *.narinfo files on the fly to support the binary cache substituter - [8]
IHUZXOK2Reply 404 for requests for non-existent .narinfo. - [9]
AFNDUSGDSet Expires headers for Hydra's binary cache - [10]
CQTN62OHDie tabs die - [11]
MVB7RRLT* Move NARs from the NixChannel controller to the Root controller and - [12]
5OXBTB3LDon't fall thru to Hydra::View::NARInfo - [13]
XE6HD7BPProvide the nix-cache-info file required by the binary cache substituter - [14]
3PNG7NIBRemove trailing whitespace - [15]
EWRCO2NDGive Hydra binary caches a low priority - [16]
NHBGHO57Set the Content-Type properly - [17]
SMM4HQTP* Put actions related to builds under /build (e.g. /log/<buildid> - [18]
J5UVLXOK* Start of a basic Catalyst web interface. - [19]
ZE23JEJTAdd a binary-cache-url file to channels to advertise the binary cache URL - [20]
HAI5TY47Make negative narinfo responses much smaller - [21]
AFEKITYDFix some warnings about undefined values - [22]
PRDDAI6WMinor tweak - [23]
UD2WKDUVUse queryPathFromHashPart to look up binary cache requests efficiently - [24]
W3HI52QVuse NIX_*_DIR env vars when defined
Change contents
- replacement in src/lib/Hydra/Controller/Root.pm at line 260
$path = ($ENV{NIX_STORE_DIR} || "/nix/store")."/$path";die if $path =~ /\//; - replacement in src/lib/Hydra/Controller/Root.pm at line 262
gone($c, "Path " . $path . " is no longer available.") unless isValidPath($path);my $storeMode = $c->config->{store_mode} // "direct"; - replacement in src/lib/Hydra/Controller/Root.pm at line 264
$c->stash->{current_view} = 'NixNAR';$c->stash->{storePath} = $path;if ($storeMode eq "s3-binary-cache") {notFound($c, "There is no binary cache here.");}elsif ($storeMode eq "local-binary-cache") {my $dir = $c->config->{binary_cache_dir};$c->serve_static_file($dir . "/nar/" . $path);}else {$path = $Nix::Config::storeDir . "/$path";gone($c, "Path " . $path . " is no longer available.") unless isValidPath($path);$c->stash->{current_view} = 'NixNAR';$c->stash->{storePath} = $path;} - replacement in src/lib/Hydra/Controller/Root.pm at line 286[7.101]→[7.47:93](∅→∅),[7.93]→[7.0:33](∅→∅),[7.33]→[7.139:195](∅→∅),[7.2332]→[7.139:195](∅→∅),[7.139]→[7.139:195](∅→∅),[7.195]→[5.0:70](∅→∅),[5.70]→[7.2722:2753](∅→∅),[7.230]→[7.2722:2753](∅→∅),[7.2753]→[7.24:157](∅→∅),[7.24]→[7.24:157](∅→∅),[7.157]→[7.34:61](∅→∅),[7.61]→[6.0:39](∅→∅),[6.39]→[7.259:298](∅→∅),[7.45]→[7.259:298](∅→∅),[7.61]→[7.259:298](∅→∅),[7.259]→[7.259:298](∅→∅)
$c->response->content_type('text/plain');$c->stash->{plain}->{data} =#"StoreDir: $Nix::Config::storeDir\n" . # FIXME"StoreDir: " . ($ENV{NIX_STORE_DIR} || "/nix/store") . "\n" ."WantMassQuery: 0\n" .# Give Hydra binary caches a very low priority (lower than the# static binary cache http://nixos.org/binary-cache)."Priority: 100\n";setCacheHeaders($c, 24 * 60 * 60);$c->forward('Hydra::View::Plain');my $storeMode = $c->config->{store_mode} // "direct";if ($storeMode eq "s3-binary-cache") {notFound($c, "There is no binary cache here.");}elsif ($storeMode eq "local-binary-cache") {my $dir = $c->config->{binary_cache_dir};$c->serve_static_file($dir . "/nix-cache-info");}else {$c->response->content_type('text/plain');$c->stash->{plain}->{data} ="StoreDir: $Nix::Config::storeDir\n" ."WantMassQuery: 0\n" .# Give Hydra binary caches a very low priority (lower than the# static binary cache http://nixos.org/binary-cache)."Priority: 100\n";setCacheHeaders($c, 24 * 60 * 60);$c->forward('Hydra::View::Plain');} - edit in src/lib/Hydra/Controller/Root.pm at line 314
my $hash = $c->req->captures->[0]; - replacement in src/lib/Hydra/Controller/Root.pm at line 315
die if length($hash) != 32;my $path = queryPathFromHashPart($hash);my $storeMode = $c->config->{store_mode} // "direct"; - replacement in src/lib/Hydra/Controller/Root.pm at line 317[7.471]→[7.126:144](∅→∅),[7.144]→[3.784:819](∅→∅),[7.28]→[7.144:194](∅→∅),[3.819]→[7.144:194](∅→∅),[7.144]→[7.144:194](∅→∅),[7.194]→[7.62:119](∅→∅),[7.119]→[7.255:298](∅→∅),[7.255]→[7.255:298](∅→∅),[7.298]→[7.46:84](∅→∅),[7.84]→[7.0:16](∅→∅),[7.298]→[7.0:16](∅→∅)
if (!$path) {$c->response->status(404);$c->response->content_type('text/plain');$c->stash->{plain}->{data} = "does not exist\n";$c->forward('Hydra::View::Plain');setCacheHeaders($c, 60 * 60);return;if ($storeMode eq "s3-binary-cache") {notFound($c, "There is no binary cache here.");}elsif ($storeMode eq "local-binary-cache") {my $dir = $c->config->{binary_cache_dir};$c->serve_static_file($dir . "/" . $c->req->captures->[0] . ".narinfo"); - edit in src/lib/Hydra/Controller/Root.pm at line 325
else {my $hash = $c->req->captures->[0];die if length($hash) != 32;my $path = queryPathFromHashPart($hash); - replacement in src/lib/Hydra/Controller/Root.pm at line 332
$c->stash->{storePath} = $path;$c->forward('Hydra::View::NARInfo');if (!$path) {$c->response->status(404);$c->response->content_type('text/plain');$c->stash->{plain}->{data} = "does not exist\n";$c->forward('Hydra::View::Plain');setCacheHeaders($c, 60 * 60);return;}$c->stash->{storePath} = $path;$c->forward('Hydra::View::NARInfo');}