Skip to content
An alternative crate registry, implemented in Rust.
Rust HTML TSQL JavaScript CSS
Branch: master
Clone or download
Hirevo Merge pull request #23 from agoops/master
Introduce `max_conns` for DatabaseConfig
Latest commit 71dd63e Dec 9, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github/workflows Added CI action for building user docs Nov 21, 2019
assets Added account management pages Oct 9, 2019
docs Added database documentation in user docs Dec 5, 2019
migrations Added database migrations Oct 12, 2019
src Update src/db/mod.rs Dec 8, 2019
syntect-dumps Improved README renderer to generate permalinks to headers Sep 11, 2019
syntect-syntaxes Added premises for rendering crate readmes Jul 18, 2019
syntect-themes Added premises for rendering crate readmes Jul 18, 2019
templates Fixed styling issue with search bar font Nov 20, 2019
wasm-pbkdf2 Added account management pages Oct 9, 2019
.gitignore Introduce connection_pool_max_size config Dec 3, 2019
.gitmodules Added premises for rendering crate readmes Jul 18, 2019
Cargo.lock (Re)added Github Actions Nov 8, 2019
Cargo.toml (Re)added Github Actions Nov 8, 2019
LICENSE-APACHE
LICENSE-MIT Added Apache 2.0 / MIT dual license Oct 10, 2019
README.md Update README.md Dec 8, 2019
alexandrie.toml Remove connection pool default from sample config file and include ex… Dec 5, 2019
diesel.toml Added premises for rendering crate readmes Jul 18, 2019
rust-toolchain Added GitHub Actions build test Sep 11, 2019

README.md

Alexandrie

Modular alternative crate registry for Rust

About

Alexandrie is an alternative crate registry suitable for use with Cargo.

This repository implements the Cargo APIs and interacts with a crate index as specified in the Cargo's Alternative Registries RFC.
This allows to have a private registry to host crates that are specific to what your doing and not suitable for publication on crates.io while maintaining the same build experience as with crates from crates.io.

Goals

  • Offer customizable crate storage strategies (local on-disk, S3, Git Repo, etc...).
  • Offer multiple backing database options (MySQL, PostgreSQL or SQLite).
  • An optional integrated (server-side rendered) front-end.

Current state

  • The core Cargo APIs are all functional.
  • The optional front-end is very usable, although still in active development.

Things yet to do

  • Complete the front-end: in-progress
  • Keywords: done
  • Categories: done
  • Crate (un)yanking: done
  • User management: done
  • Crate version tracking in DB (download counts per version, etc...): planned
  • Ability to re-render READMEs (to migrate themes): planned
  • Search by keywords or categories: planned
  • More Store implementors: planned
  • More Indexer implementors: planned

How to build

Alexandrie is built using [Tide][Tide] and offers multiple options to be used as its database.
To build, you can run cargo build [--release].

Before running it, you need to configure your instance in the alexandrie.toml file.

The database is configured through the [database] table:

[database]
# Replace the '<...>' placeholders by the real values.

# For MySQL
url = "mysql://<user>:<password>@<hostname>:<port>/<database>"

# For PostgreSQL
url = "postgresql://<user>:<password>@<hostname>:<port>/<database>"

# For SQLite
url = "<path-to-sqlite-file>"
# or:
url = ":memory:" # ephemeral in-memory database, doesn't persists between restarts

Optionally, specify the maximum number of threads for the database connection pool.

max_conns = 1

If not specified, the diesel-rs default value is used.

Then, you can configure the crates' tarballs storage strategy and the crate index management strategy that you want to use.
Here is how to do it (these are also the defaults, you can leave them out if you want):

[index]
type = "command-line"
path = "crate-index"

[storage]
type = "disk"
path = "crate-storage"

You can also configure things like the address and port of the server:

[general]
addr = "127.0.0.1"
port = 3000

To run the registry, be sure to clone your crate index at the location designated by the path key in [index].
The default for it is ./crate-index.
To clone an existing crate index, you can run:

# Replace the '<...>' placeholders by the real ones.
git clone <url-of-the-crate-index> <path-from-config>

If you want to create one, you can refer to the Cargo's Alternative Registries RFC to learn about the layout of such an index.
You can also visit the crates.io index or the crates.polomack.eu index as deployed examples.

Once everything is configured, you can run with: cargo run [--release].

Then, if you want to use this index with Cargo, you can follow these steps:

  • Edit or create the ~/.cargo/config file, and add the following code:
    # Replace the '<...>' placeholders by the real ones.
    [registries.<name-of-your-registry>]
    index = "<url-of-the-crate-index>"
  • Then, run cargo login --registry <name-of-your-registry> and enter your author token.
    To generate a token, you need to register as an author first. You can do this using the frontend by:
    • Registering at /account/register.
    • Generating a token at /account/manage.
  • You can now use the registry using cargo [search|publish] --registry <name-of-your-registry>

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

You can’t perform that action at this time.