!CcTBuBritXGywOEGWJ:matrix.org

NixOS Binary Cache Self-Hosting

158 Members
About how to host a very large-scale binary cache and more54 Servers

Load older messages


SenderMessageTime
24 Aug 2023
@brian:bmcgee.ie@brian:bmcgee.ie A PATCH would technically be the 'correct' way to do this I guess 15:27:29
@brian:bmcgee.ie@brian:bmcgee.ieOr it looks like ETag and If-Match is how you can prevent this https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag#avoiding_mid-air_collisions15:28:56
@brian:bmcgee.ie@brian:bmcgee.ieNix client would refresh and try again 15:29:34
@linus:schreibt.jetzt@linus:schreibt.jetztI think generally something like attic is a better approach to a binary cache anyway15:29:51
@brian:bmcgee.ie@brian:bmcgee.ieattic is using it's own client right?15:31:25
@brian:bmcgee.ie@brian:bmcgee.ieinstead of the http interface15:31:30
@linus:schreibt.jetzt@linus:schreibt.jetztit can serve Nix's protocol read-only as well15:31:44
@brian:bmcgee.ie@brian:bmcgee.ieMakes sense now why Domen did it aswell15:32:00
@brian:bmcgee.ie@brian:bmcgee.iethe http interface is fine for read15:32:11
@brian:bmcgee.ie@brian:bmcgee.ienot that great for the writes15:32:18
@brian:bmcgee.ie@brian:bmcgee.ieFor context, I'm playing around with my own cache implementation which is why I'm interested 15:33:05
@linus:schreibt.jetzt@linus:schreibt.jetztone thing I'd like to have in Attic is the ability to have signatures from the client in addition to server-managed signing keys15:34:12
@brian:bmcgee.ie@brian:bmcgee.ieHave it merge on upload?15:34:34
@linus:schreibt.jetzt@linus:schreibt.jetztwell currently attic just stores a single signature for each narinfo (which is a database table entry, not an actual file), and that signature is generated by the server at upload time15:36:02
@linus:schreibt.jetzt@linus:schreibt.jetztbut it means that you have to trust the server much more than if the client could provide its own signatures15:36:24
@brian:bmcgee.ie@brian:bmcgee.iemakes sense, also what happens with key rotation on the server 15:37:06
@linus:schreibt.jetzt@linus:schreibt.jetztkey rotation is generally a tricky topic with nix https://github.com/NixOS/rfcs/pull/14915:37:58
@zhaofeng:zhaofeng.liZhaofeng Li
In reply to @linus:schreibt.jetzt
well currently attic just stores a single signature for each narinfo (which is a database table entry, not an actual file), and that signature is generated by the server at upload time

The signature is generated at download time using the the per-cache private key managed by the server. It does store client-supplied signatures in the database but they aren't exposed at the moment. I wrote a bit more here: https://github.com/zhaofengli/attic/issues/80#issuecomment-1684347741

(oh right, forgot to respond)

15:40:33
@zhaofeng:zhaofeng.liZhaofeng Li So we can easily have client-managed signatures now by changing how narinfo is generated (need to fix serialization for multiple signatures), but I'd prefer to have a complete story UX-wise (the client should be able to automatically sign on upload) 15:42:27
@zhaofeng:zhaofeng.liZhaofeng Li
In reply to @brian:bmcgee.ie
makes sense, also what happens with key rotation on the server
You currently can rotate the server-managed key with attic cache configure --regenerate-keypair, but all clients who download need to reconfigure their trusted public keys
15:44:35
@zhaofeng:zhaofeng.liZhaofeng LiSo the resulting experience can be frustrating15:44:56
@linus:schreibt.jetzt@linus:schreibt.jetzt
In reply to @zhaofeng:zhaofeng.li

The signature is generated at download time using the the per-cache private key managed by the server. It does store client-supplied signatures in the database but they aren't exposed at the moment. I wrote a bit more here: https://github.com/zhaofengli/attic/issues/80#issuecomment-1684347741

(oh right, forgot to respond)

oops, sorry for talking nonsense 🙃
15:54:44
@brian:bmcgee.ie@brian:bmcgee.ie Am I right in thinking, that with a custom client for pushing to the cache, that's where you're calculating the chunks / doing the heavy lifting for the de-duplication? Zhaofeng Li: 17:57:05
@brian:bmcgee.ie@brian:bmcgee.ieOperating on the uncompressed store paths instead of having to decompress them on the server side 17:57:43
@zhaofeng:zhaofeng.liZhaofeng Li
In reply to @brian:bmcgee.ie
Am I right in thinking, that with a custom client for pushing to the cache, that's where you're calculating the chunks / doing the heavy lifting for the de-duplication? Zhaofeng Li:
Actually deduplication is handled server-side and is transparent to the client. As a result, the upload API is very simple and the client just streams the entire uncompressed NAR to the server
19:09:49
@brian:bmcgee.ie@brian:bmcgee.ie
In reply to @zhaofeng:zhaofeng.li
Actually deduplication is handled server-side and is transparent to the client. As a result, the upload API is very simple and the client just streams the entire uncompressed NAR to the server
🤔
19:15:05
@brian:bmcgee.ie@brian:bmcgee.ieSo you dedupe the nar archive not the uncompressed form?19:15:43
@brian:bmcgee.ie@brian:bmcgee.ieNaively I would have thought it better to operate on the uncompressed store path 19:16:25
@brian:bmcgee.ie@brian:bmcgee.ieAh wait, does nar offer any compression? Is that why you specify zstd or xz when working with the cache. 19:18:24
@brian:bmcgee.ie@brian:bmcgee.ie* Ah wait, does nar offer any compression? Is that why you specify zstd or xz when working with a cache. 19:18:52

Show newer messages


Back to Room ListRoom Version: 10