warehouse/README.md

52 lines
1.5 KiB
Markdown
Raw Permalink Normal View History

2022-08-02 12:28:52 -05:00
# warehouse
A ~~simple~~ cargo registry.
To run this, you need to:
2022-09-08 13:15:59 -05:00
- Create a `/etc/warehouse/warehouse.toml` file with the following contents:
2022-08-02 12:28:52 -05:00
```toml
working_dir = "/path/to/some/directory"
2022-08-03 12:13:03 -05:00
postgres_uri = "postgres://user:pass@db_host/db_name"
2022-08-02 12:28:52 -05:00
listen_uri = "0.0.0.0:1234"
```
- Run a PostgreSQL database at the specified URI.
- Initialize a (not bare) git repository at `the_working_dir/index`
- Create a `index/config.json` file, with the following contents:
```json
{
"dl": "http://your.website:1234/api/v1/crates",
"api": "http://your.website:1234"
}
```
HTTPS is currently broken for an unknown reason.
- Write the following to `index/.git/hooks/post-commit`:
```sh
#!/bin/sh
exec git update-server-info
```
- Commit the `config.json` to git.
- Run any webserver at `index/.git`. (another method of serving git would also work)
Note: you may need to set `net.git-fetch-with-cli = true` in your `~/.cargo/config.toml`
The URL of that webserver/git repository is the URL of the registry.
Users must add the following to their `~/.cargo/config.toml`:
```toml
[registries]
foobarbaz = { index = "http://the.index.url" }
```
Creating accounts is currently not managed by this code. You will have to run the following query to add a user:
```sql
INSERT INTO users (login, credential) VALUES ('username', 'account token')
```
2022-08-03 12:13:03 -05:00
You can then give out the token for someone else to use with `cargo login`.