VEGAS/nix: move to cluster/services/attic and adapt for migration

This commit is contained in:
Max Headroom 2023-06-16 17:12:38 +02:00
parent 116d257fc4
commit 2aeb766afb
4 changed files with 27 additions and 9 deletions

View file

@ -8,18 +8,34 @@ let
port = builtins.head (builtins.tail addrSplit); port = builtins.head (builtins.tail addrSplit);
in in
{ {
services.nginx.upstreams.nar-serve.extraConfig = '' services.nginx.upstreams = {
random; nar-serve.extraConfig = ''
server ${config.links.nar-serve-self.tuple} fail_timeout=0; random;
server ${config.links.nar-serve-nixos-org.tuple} fail_timeout=0; server ${config.links.nar-serve-self.tuple} fail_timeout=0;
''; server ${config.links.nar-serve-nixos-org.tuple} fail_timeout=0;
'';
nix-store.servers = {
"${config.links.atticServer.tuple}" = {
fail_timeout = 0;
};
"${host}:${port}" = {
fail_timeout = 0;
backup = true;
};
};
};
services.nginx.appendHttpConfig = '' services.nginx.appendHttpConfig = ''
proxy_cache_path /var/cache/nginx/nixstore levels=1:2 keys_zone=nixstore:10m max_size=10g inactive=24h use_temp_path=off; proxy_cache_path /var/cache/nginx/nixstore levels=1:2 keys_zone=nixstore:10m max_size=10g inactive=24h use_temp_path=off;
''; '';
services.nginx.virtualHosts."cache.${tools.meta.domain}" = vhosts.basic // { services.nginx.virtualHosts."cache.${tools.meta.domain}" = vhosts.basic // {
locations = { locations = {
"= /".return = "302 /404"; "= /".return = "302 /404";
"/".proxyPass = "http://${host}:${port}/nix-store$request_uri"; "/" = {
proxyPass = "http://nix-store/nix-store$request_uri";
extraConfig = ''
proxy_next_upstream error http_500 http_404;
'';
};
"/nix/store" = { "/nix/store" = {
proxyPass = "http://nar-serve"; proxyPass = "http://nar-serve";
extraConfig = '' extraConfig = ''

View file

@ -4,7 +4,11 @@
server = [ "VEGAS" ]; server = [ "VEGAS" ];
}; };
nixos = { nixos = {
server = ./server.nix; server = [
./server.nix
./binary-cache.nix
./nar-serve.nix
];
}; };
}; };
} }

View file

@ -24,8 +24,6 @@
./services/jokes ./services/jokes
./services/mail ./services/mail
./services/minecraft ./services/minecraft
./services/nix/binary-cache.nix
./services/nix/nar-serve.nix
./services/reflex ./services/reflex
./services/sso ./services/sso
./services/vault ./services/vault