Crates Registry is a tool for serving and publishing crates and serving rustup installation in offline networks.

Overview

Crates Registry

Description

Crates Registry is a tool for serving and publishing crates and serving rustup installation in offline networks. (like Verdaccio as npm registry) The project partially uses code from these open source projects: panamax project and cargo-http-registry and they deserve credit accordingly.

Installation

Crates Registry can be installed with cargo:

$ cargo install crates-registry

Also available in docker (recommended for serving use):

$ docker run -d --name crates-registry -e RUST_LOG=info -v /path/to/mirror-folder:/registry -p 80:80 crates-registry:latest serve -s <server ip> --root-registry /registry 

(Modify /path/to/registry port and server-IP as needed)

Usage

There are several possible uses:

  • Packing - Pack rust installation in the online network.
  • Unpacking - Unpacking new rust installation into the registry folder (also possible through the UI).
  • Serving - Serve the registry in your offline network.

Packing

Packing rust installations on the online side to serve later in the offline network. We download the rust installations in self-contained directories and pack the directory in tar file. packing example:

$ crates-registry pack --pack-file packed_file.tar --rust-versions 1.67.1,04-03-2023-nightly --platfroms x86_64-unknown-linux-gnu

Run crates-registry pack --help for all available options.

Unpacking

Unpack the packed file that contains the rustup installations in the registry folder. You can load the tar file through the UI at http://server-adress/manage-installations. Follow the instructions in the page. Another option is to load the tar file using the unpack command:

$ crates-registry pack --packed-file /packed_file.tar --root-registry /path/to/registry/folder

Serving

The Crates Registry provides an HTTP server that can handle serving the crates and rustup installations fast and at scale. serving example:

$ docker run -d --name crates-registry -e RUST_LOG=info -v /path/to/mirror-folder:/registry -p 80:80 crates-registry:latest serve -s <server ip> --root-registry /registry 

(Modify /path/to/registry port and server-IP as needed) Run crates-registry serve --help for all available options.

Configuring your environment

Once you have a server set up and running, it's time to tell your rust components to use it.

Setting environment variables

To ensure rustup knows where to look for the Rust components, we need to set some environment variables. Assuming the server is hosted at http://crates.registry/:

export RUSTUP_DIST_SERVER=http://crates.registry
export RUSTUP_UPDATE_ROOT=http://crates.registry/rustup

These need to be set whenever rustup is used, so these should be added to your .bashrc file (or equivalent).

Rustup

To install rustup you can download the rustup-init file. The rustup-init file you want depends on your architecture. Assuming you're running desktop Linux on a 64-bit machine:

wget http://crates.registry/rustup/dist/x86_64-unknown-linux-gnu/rustup-init
chmod +x rustup-init
./rustup-init

This will let you install rustup the similarly following the steps from https://rustup.rs. This will also let you use rustup to keep your Rust installation updated in the future.

Cargo

Cargo also needs to be configured to point to the mirror. This can be done by adding the following lines to ~/.cargo/config (creating the file if it doesn't exist):

[source.my-mirror]
registry = "http://crates.registry/git/index"
[source.crates-io]
replace-with = "my-mirror"

# For publish crates.
[registries]
my-registry = { index = "https://crates.registry/git/index" }

Cargo should now be pointing to the correct location to use the mirror.

Import crates to the registry.

Tow utilities to import new crates:

You can also publish crates using the cargo publish command.

License

Licensed under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 and the Apache License (Version 2.0)

You might also like...
A CLI tool to convet Hex color code or RGB to color code, RGB, HSL and color name(if exists)
A CLI tool to convet Hex color code or RGB to color code, RGB, HSL and color name(if exists)

iro -色- A CLI tool to convert the hex color code or RGB to color code, RGB, HSL, color name(if exists, according to jonathantneal/color-names). Usage

A dynamic output configuration tool that automatically detects and configures connected outputs based on a set of profiles.

shikane A dynamic output configuration tool that automatically detects and configures connected outputs based on a set of profiles. Each profile speci

🛠️ | System tool for all my lovers
🛠️ | System tool for all my lovers

HEAD 💖 love-fetch Original code ferris-fetch 💖 🛠️ System tool for all my lovers 💖 How to install it 🔨 cargo install love-fetch License 📑

Tool to make Solus packaging even easier.

A small tool to make packaging for Solus even easier. Features Remove all packages from the local solbuild repo.

Benchmarking web frameworks written in rust with rewrk tool.

Web Framework Benchmarks Benchmarking web frameworks written in rust with rewrk tool.

Lightweight tool for simple deployment (server+client)

deploy Lightweight tool for simple deployment (server+client) Usage You first need a key value pair: deploy generate-keys Public-Key: Used on the serv

A cog-like tool, written in Rust.

Corg A cog-like tool, written in Rust. The primary difference between Cog and Corg is how Corg executes code blocks. Being written in Rust, it cannot

A crude tool to convert from Bitwarden json format to lastpass

Pass-Merger A crude tool to convert from Bitwarden json format to lastpass. Steps to Deduplicate entries from Bitwarden Export all passwords from Chro

A tool using binrw to read FFXIV data files

last-legend-dob A tool using binrw to read FFXIV data files. Mainly made to harvest the music from the game files for personal consumption, since it t

Owner
TalYRoni
TalYRoni
An asynchronous API client for a light installation at the University of Kiel

An asynchronous API client for a light installation at the University of Kiel

FW 2 Nov 22, 2022
Find out who is pretending to be offline

Dinkleberg Find out who is pretending to be offline Preview Disclaimer Dinkleberg was developed for educational, private and fair use. I am not respon

oSumAtrIX 40 Dec 28, 2022
Efficent platform for inference and serving local LLMs including an OpenAI compatible API server.

candle-vllm Efficient platform for inference and serving local LLMs including an OpenAI compatible API server. Features OpenAI compatible API server p

Eric Buehler 21 Nov 15, 2023
OpenAI compatible API for serving LLAMA-2 model

Cria - Local llama OpenAI-compatible API The objective is to serve a local llama-2 model by mimicking an OpenAI API service. The llama2 model runs on

AmineDiro 66 Aug 8, 2023
Asset-Pool is a decentralized lending protocol and enables users to lend through their social networks

Run If you need to, set up your Substrate development environment . Then, build and run a development chain: $ cargo run -- --dev --tmp Once the node

antimatter-repo 11 Oct 22, 2022
Macros to make writing proc-macro crates easy

proc-easy Macros to make writing proc-macro crates easy. This crate provides mainly macros and supporting types and traits to reduce amount of boilerp

Zakarum 7 Jan 1, 2023
A library and tool for automata and formal languages, inspired by JFLAP

Sugarcubes is a library and application for automata and formal languages. It is inspired by JFLAP, and is intended to eventually to be an alternative to JFLAP.

Henry Sloan 22 Nov 2, 2022
Schema2000 is a tool that parses exsiting JSON documents and tries to derive a JSON schema from these documents.

Schema 2000 Schema2000 is a tool that parses exsiting JSON documents and tries to derive a JSON schema from these documents. Currently, Schema2000 is

REWE Digital GmbH 12 Dec 6, 2022
CLI tool that make it easier to perform multiple lighthouse runs towards a single target and output the result in a "plotable" format.

Lighthouse Groupie CLI tool that make it easier to perform multiple lighthouse runs towards a single target and output the result in a "plotable" form

Polestar 1 Jan 12, 2022
A tool to calculate mean and standard deviation from multiple tests using PageSpeed Insights API.

psi-sample PSI Test tool is an open source tool to assist web developers that runs Page Speed Insight test manually! Installing To install the psi-tes

Igor Brasileiro 14 Sep 10, 2022