A cargo registry.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
missing 469bed53b8 crates from other registries do exist 3 months ago
src crates from other registries do exist 3 months ago
.gitignore initial commit 4 months ago
Cargo.lock rename in Cargo.toml 4 months ago
Cargo.toml rename in Cargo.toml 4 months ago
README.md forgor to update readme 3 months ago

README.md

warehouse

A simple cargo registry.

To run this, you need to:

  • Create a /etc/warehouse/warehouse.toml file with the following contents:

    working_dir = "/path/to/some/directory"
    postgres_uri = "postgres://user:pass@db_host/db_name"
    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:

    {
        "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:

    #!/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:

[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:

INSERT INTO users (login, credential) VALUES ('username', 'account token')

You can then give out the token for someone else to use with cargo login.