-
Notifications
You must be signed in to change notification settings - Fork 624
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a deploy to heroku button and instructions on running a mirror! #440
Changes from 2 commits
4560d6d
ecaeebe
9fde4ce
62fc9f7
6760e7c
b53a148
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ Source code for the default registry for Cargo users. Can be found online at | |
|
||
[crates-io]: https://crates.io | ||
|
||
## Installation | ||
## Development Setup | ||
|
||
* `git clone` this repository | ||
* `npm install` | ||
|
@@ -121,3 +121,62 @@ For more information on using ember-cli, visit | |
|
||
For more information on using cargo, visit | ||
[doc.crates.io](http://doc.crates.io/). | ||
|
||
## Deploy a read-only, download-API-only mirror | ||
|
||
This mirror will function as a read-only duplicate of crates.io's API. You will | ||
be able to download crates using your index and your mirror, but the crate files | ||
will still come from crates.io's S3 storage. | ||
|
||
Your mirror will not: | ||
|
||
- Allow users to sign up/sign in | ||
- Allow crate publish | ||
- Keep track of any statistics | ||
- Display available crates in its UI | ||
|
||
### API server | ||
|
||
To deploy the API on Heroku, use this button: | ||
|
||
[![Deploy](https://www.herokucdn.com/deploy/button.svg)][deploy] | ||
|
||
[deploy]: https://heroku.com/deploy | ||
|
||
You do not need to fill in any of the optional fields. | ||
|
||
### Index mirror | ||
|
||
You also need a mirror of the crates.io git index, and your index needs to point | ||
to your API server. | ||
|
||
1. `git clone https://github.com/rust-lang/crates.io-index.git` | ||
2. Edit the config.json file to point to your API server so it looks like: | ||
|
||
```json | ||
{ | ||
"dl": "https://[your heroku app name].herokuapp.com/api/v1/crates", | ||
"api": "https://[your heroku app name].herokuapp.com/" | ||
} | ||
``` | ||
|
||
3. Commit and push to wherever you will be hosting your index (ex: github, | ||
gitlab, an internal git server) | ||
4. In your cargo project, replace the crates.io source with your source by | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Crap this is still in nightly cargo only, isn't it... I'll look up the versions and specify them. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah yeah might be worth mentioning that as well as the dates it'll be released into stable Rust. |
||
changing your `.cargo/config` to point to wherever you are hosting your git | ||
index: | ||
|
||
```toml | ||
[source] | ||
|
||
[source.mirror] | ||
registry = "https://[host and path to your git server]/crates.io-index" | ||
|
||
[source.crates-io] | ||
replace-with = "mirror" | ||
registry = 'https://doesnt-matter-but-must-be-present' | ||
``` | ||
|
||
5. In order to keep your mirror index up to date, schedule a `git pull` of the | ||
official index. How to do this depends on how you are hosting your index, | ||
but could be done through `cron` or a scheduled CI job, for example. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{ | ||
"name": "Crates.io Mirror", | ||
"description": "A mirror of crates.io", | ||
"repository": "https://github.com/rust-lang/crates.io", | ||
"env": { | ||
"HEROKU": "1", | ||
"MIRROR": "1", | ||
"GH_CLIENT_ID": { | ||
"value": "", | ||
"required": false | ||
}, | ||
"GH_CLIENT_SECRET": { | ||
"value": "", | ||
"required": false | ||
}, | ||
"GIT_REPO_CHECKOUT": "./tmp/index-co", | ||
"GIT_REPO_URL": "https://github.com/rust-lang/crates.io-index.git", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This in theory needs to be the mirror of the index, right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In theory, yes, and eventually it will need to be in practice, but for the moment it doesn't actually matter since client-side cargo is the only thing that uses the index. I'll update the instructions though so that people have it set for when we do start using it. |
||
"S3_BUCKET": "crates-io", | ||
"S3_ACCESS_KEY": { | ||
"value": "", | ||
"required": false | ||
}, | ||
"S3_SECRET_KEY": { | ||
"value": "", | ||
"required": false | ||
}, | ||
"SESSION_KEY": { | ||
"generator": "secret" | ||
} | ||
}, | ||
"formation": { | ||
"web": { | ||
"quantity": 1, | ||
"size": "Free" | ||
} | ||
}, | ||
"addons": [ | ||
"heroku-postgresql:hobby-dev" | ||
], | ||
"buildpacks": [ | ||
{ | ||
"url": "https://github.com/rcaught/heroku-buildpack-cmake" | ||
}, | ||
{ | ||
"url": "https://github.com/alexcrichton/heroku-buildpack-rust" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder, can revisions be specified here as well? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They can indeed! I will do so! |
||
}, | ||
{ | ||
"url": "https://github.com/tonycoco/heroku-buildpack-ember-cli" | ||
}, | ||
{ | ||
"url": "https://github.com/ryandotsmith/nginx-buildpack.git" | ||
} | ||
] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this section perhaps also mention that this is a work-in-progress? Ideally we'd make all deployment a one-click operation, but hopefully coming soon!