Crates.io | private-crate-hub |
lib.rs | private-crate-hub |
version | 0.1.0 |
source | src |
created_at | 2024-08-11 04:22:23.889463 |
updated_at | 2024-08-11 04:22:23.889463 |
description | A private Rust crate registry that securely stores your crate data in a GitHub repository, simplifying management and distribution while ensuring version control, backups, and access only for authorized users. |
homepage | |
repository | |
max_upload_size | |
id | 1332967 |
size | 77,477 |
Private-Crate-Hub is a private Rust crate registry designed to store all your crate data inside a GitHub repository. It provides an easy and secure way to manage and distribute your private Rust crates, ensuring that your code is versioned, backed up, and accessible only to authorized users.
When working with private Rust projects, especially when using tools like release-plz
, publishing to the public crates.io registry isn't an option. Managing a private registry typically involves setting up a SQL database, S3 storage, and other infrastructure that can be overkill for small projects.
For my use case, I only have a small number of packages (~100), so I wanted a solution that was simpler and didn't require extensive infrastructure. GitHub, being a robust platform with built-in version control, security, and backup features, is an ideal choice for this purpose. By using GitHub as the storage backend, I eliminate the need to maintain a database, handle backups, or incur additional costs. Private-Crate-Hub makes managing private crates straightforward, leveraging GitHub's capabilities to keep things simple and efficient.
You can quickly get started with Private-Crate-Hub using Docker. This method requires minimal setup and ensures that the environment is consistent.
docker pull giangndm/private-crate-hub:latest
You can run the Private-Crate-Hub Docker container with the following environment variables:
Here’s the Docker command:
docker run -e GITHUB_TOKEN=your_github_token \
-e OWNER=your_github_username_or_org \
-e REPO=your_repository_name \
-e BRANCH=your_branch_name \
-e PUBLIC_ENDPOINT=https://your-public-endpoint.com \
-e AUTHORIZATION=your_authorization_token \
giangndm/private-crate-hub:latest
[registry]
global-credential-providers = ["cargo:token"]
[registries]
my-registry = { index = "sparse+http://your-public-endpoint.com/index/" }
Add the registry
field to each private library:
lib1 = { path = "../../crates/lib1", version = "0.1.2", registry = "my-registry" }