hosts/kazuki: hopefully making the cache faster

This commit is contained in:
Nikodem Rabuliński 2024-02-10 20:56:20 +01:00
parent d26b96d770
commit 0d51bd1aa8
2 changed files with 15 additions and 5 deletions

View file

@ -23,12 +23,12 @@ in {
type = "local"; type = "local";
path = "/storage-box"; path = "/storage-box";
}; };
compression.type = "zstd"; compression.type = "none";
chunking = { chunking = {
nar-size-threshold = 64 * 1024; nar-size-threshold = 0;
min-size = 16 * 1024; min-size = 0;
avg-size = 64 * 1024; avg-size = 0;
max-size = 256 * 1024; max-size = 0;
}; };
api-endpoint = "https://cache.nrab.lol/"; api-endpoint = "https://cache.nrab.lol/";
allowed-hosts = ["cache.nrab.lol"]; allowed-hosts = ["cache.nrab.lol"];
@ -75,12 +75,21 @@ in {
}; };
extraConfig = '' extraConfig = ''
client_max_body_size 8G; client_max_body_size 8G;
proxy_cache nixstore;
proxy_cache_use_stale error timeout http_500 http_502;
proxy_cache_lock on;
proxy_cache_key $request_uri;
proxy_cache_valid 200 24h;
''; '';
}; };
upstreams."attic".servers = { upstreams."attic".servers = {
"localhost:${toString atticPort}" = {}; "localhost:${toString atticPort}" = {};
}; };
appendHttpConfig = ''
proxy_cache_path /var/cache/nginx/nixstore levels=1:2 keys_zone=nixstore:10m max_size=10g inactive=24h use_temp_path=off;
'';
}; };
security.acme.certs."cache.nrab.lol" = { security.acme.certs."cache.nrab.lol" = {

View file

@ -19,6 +19,7 @@
"uid=${toString config.users.users.atticd.uid}" "uid=${toString config.users.users.atticd.uid}"
"gid=${toString config.users.groups.atticd.gid}" "gid=${toString config.users.groups.atticd.gid}"
"credentials=${config.age.secrets.storage-box-creds.path}" "credentials=${config.age.secrets.storage-box-creds.path}"
"cache=none"
]; ];
}; };