Download all crates on Rust official crates site and keep sync with it. This can be used to setup a static mirror site of https://crates.io. This can be used with cargo-mirror to make dependency download faster when building Rust project.
- Python3 (yes python3, python2 is dead)
- Good bandwidth (at least can access aws-s3 service of us region)
- Large hard disk (at least 3G, I downloaded all crates to my computer, it's about 2G atm.)
- Clone this repo:
git clone https://github.com/tennix/crates-mirror
- Fire a python virtualenv:
cd crates-mirror pyvenv env source env/bin/activate pip install -r requirements.txt
- Run this program:
python app.py
- (Optional)Serve a mirror site:
cd crates python -m http.server 8000
Note: for production, you should make this program auto-restarted when dies (supervisord like tools is needed). And also use a production web server (nginx, apache etc.) to serve the mirror site