I'm so excited crates.io has arrived!! :tada: Great work, Alex and everyone!!!
This is a longer-term feature request... one thing that has been an occasional yet painful experience with rubygems.org or npmjs.org is when they're down. At various points in time, my coworkers and I have tried to set up mirrors under our control of both of these and it never went very smoothly, neither on the setup or usage side of things.
I would love love love to have mirroring be something officially supported and encouraged for the health of the community, but I realize this is a difficult problem too :)
Thank you for your work!! :heart:
This would also involve adding support for non-Github auth (preferably LDAP) and non-S3/Github storage.
Architecturally I believe it's relatively easy to do. A "mirror" would essentially just be a clone of the official index along with an updated download url in its configuration. Updating a mirror would just be updating the index and perhaps downloading all the new versions that were created.
Implementing this, however, and getting cargo to think that mirrors and normal registries are the same would be somewhat difficult.
@sfackler, those may be more useful for non-official entire instances, as I would suspect that a mirror would reflect whatever the crates.io site uses. That being said, I'd love for it to be easy to spin up a local instance of a registry to use entirely independently (with a number of configuration options like auth/storage). Might be a bit harder though :)
At work we use Artifactory to both serve as a repository for internal packages and to provide a transparent mirror/cache of the maven.org packages we use. New packages are transparently pulled down as needed, but we don't mirror the whole world since that'd be crazy. Something like that would probably be best served as a separate project, though it'd hopefully be able to pull in a bunch of the logic/types from crates.io.
I've written a simple caching server. Similar to Artifactory it pulls down transparently those crates that are really requested. Currently it is only a simple application without any interface or anything. Also it only mirrors an index. It's not possible to add or yank crates to the mirror.
This feels linked to https://github.com/rust-lang/rust/issues/44931
For initial fetch, we should provide daily database dumps which is less overhead to serve and better compressed.
For dynamic syncing, the Kubernetes model is a very friendly way to organize the API.
Would like to bump this issue a bit since it looks like not getting love from guys for a long time - people from certain parts of the world (in my case, China mainland) does not have decent connectivity to some most used CDNs, so that mirroring is a must for getting a decent speed of using the repository.
Almost all the other languages have some form of mirroring being widely used, for example[1] we have CPAN/CTAN/CRAN, pypi, julia, etc. There are lots of Nexus instances to partially mirror the Maven Central repository. If crates.io can be mirrored in some way, it will surely make Rust users' lives easier in those places.
[1]https://mirrors.tuna.tsinghua.edu.cn/
[2]https://github.com/tuna/issues/issues/941
a bit background: TUNA mirror is the largest syncing source of other mirrors in the country, with an average rsync traffic of more than 1Gbps
We have built a tool to mirror static.crates.io at https://github.com/sjtug/mirror-clone . Meanwhile, we have also set up an experimental full-mirror of static.crates.io at https://s3.jcloud.sjtu.edu.cn/899a892efef34b1b944a19981040f55b-oss01/crates.io/crates/{crate}/{crate}-{version}.crate
Most helpful comment
We have built a tool to mirror
static.crates.ioat https://github.com/sjtug/mirror-clone . Meanwhile, we have also set up an experimental full-mirror ofstatic.crates.ioathttps://s3.jcloud.sjtu.edu.cn/899a892efef34b1b944a19981040f55b-oss01/crates.io/crates/{crate}/{crate}-{version}.crate