So I'm operating in an airgapped environment. To still have access to crates I set up a private registry (kellnr in this case)
Now i want to download crates on a non airgapped system, bring them through the airgap and upload them to kellnr. how can I achieve this without downloading each dependency manually?
I tried downloading with cargo collect but i get this
❯ cargo collect --crate-name actix-web -o test
2024-11-14T07:49:53.196906Z INFO cargo_collect: Collect dependencies recursively...
Error: Crate not found
Private registry is a wrong tool for this job. It will cause you an endless misery, because crates can't be simply copied, they need to be republished with their metadata rewritten for the registry URL, and will always be considered as different crates that are incompatible with crates.io.
For airgapped environments Cargo has support for crates.io mirrors, which it calls source replacement.
I'm sorry I should have been more clear. I'm already doing exactly that with kellnr
But let's assume I sit behind a firewall that doesn't allow kellnr to proxy crates.io. (I don't know yet if that's the case, the security team still has to take a look at it) is there ANY way to download crates on one machine and on another machine upload them to kellnr or another mirror without doing it one by one
Source replacement is not only for proxies. Cargo supports air-gapped builds and even has two source replacement formats for it: a local directory with a registry copy with a full index, downloaded with cargo-local-registry, or local directory with project specific copy, downloaded using cargo vendor— see the docs.
I did not expect airgapped machines to be networked. For this you can use source replacement with a URL and mirror/serve crates using this mirroring tool: