Functionality: User faced functionality is available through `just upgrade-rust` recipe. It updates Rust versions in the following files through out the project: - .gitlab-ci.yml - Cargo.toml - clippy.toml - rust-toolchain.toml - Checks whether there are any changes of the working copy or in git index and refuse to proceed if any asking to commit or stash them. - Checks current git branch if it does not contains mentions of current stable Rust version (with underscores instead of dots) it interactively propose to create a new branch. - Pulls current stable Rust version from https://static.rust-lang.org/dist/channel-rust-stable.toml to upgrade to it if not specific version was given, i.e. `just upgrade-rust 1.90` upgrades version to 1.90 no metter what the current stable Rust version is at the moment. - Upgrades each of the place with where Rust version is used to pulled current stable Rust version outputing details about upgrade: - .gitlab-ci.yml - Cargo.toml - clippy.toml - rust-toolchain.toml - Interactively asks whether to commit the changes and if agreed commits them to git with detailed message of what was upgraded and to which version. - Reminds about the need to fix possible compilation and linting errors and warnings after upgrade. Implementation: Functionality is delivered through main public "upgrade-rust" just recipe and set of private (starts with underscore) recipes. Private recipes still can be called from command line (i.e. for debugging purposes) but they are not listed in the list of tasks when you type `just` or `just --list`. For example, you can still call `just _rust-stable-version` to see what is current stable version of Rust which is retrieved by script. "upgrade-rust" has dependency (or pre-dependency) "_ensure-no-vcs-changes" recipe to check for absence of code changes and post-dependency "_upgrade-rust-fixes-reminder" for the reminder of compilation and linting fixes. The main body of "upgrade-rust" recipe extract current versions of Rust from number of files (called OLD in the code) to be able to output upgrade messages of what was upgraded. For this it uses the following private recipes: - _current-ci-rust-version - _current-cargo-rust-version - _current-clippy-rust-version - _current-toolchain-rust-version Each of that recipes (with help of variables) encodes specifics of what, how and from which file should be retrieved. "_upgrade-rust-git-create-branch" makes check for the current git branch and interactively propose to create new one switching to it. The main workflow of version upgrade in different files is in "_upgrade-rust" private recipe (yep, there is upgrade-rust user faced recipe and _upgrade-rust a private one). "_upgrade-rust" is supplied with specific values to upgrade Rust version e.g. in .gitlab-ci.yml or in rust-toolchain.toml. So, "upgrade-rust" calls the following tasks - _upgrade-rust-ci - _upgrade-rust-cargo - _upgrade-rust-clippy - _upgrade-rust-toolchain to do the upgrade which supply details to "_upgrade-rust" and call it. After changes of version "upgrade-rust" calls "_upgrade-rust-git-commit" recipe to commit changes supplying all the details about upgrade, e.g. old versions, new version and list of files where Rust version was changed. "_upgrade-rust-git-commit" asks whether you want to commit changes, if you agree it makes up a commit message and produce commit. Functionality of editing quite heavily rely on "sed" utility with some help from tq (tomlq). For VCS related operations like branch creation, commiting "git" CLI is used. Extension: The implementation design makes it fairly easy to extend recipes to support new places where Rust has to be upgraded or remove such support if some files was removed from source tree. To add support for new place to perform upgrade: - Add bunch of variables to justfile, e.g. CARGO_FILE_NAME := 'Cargo.toml' CARGO_FILE_PATH := absolute_path(CARGO_FILE_NAME) CARGO_RUST_VERSION_QUERY := 'package.rust-version' Addition of CARGO_RUST_VERSION_QUERY depends on format of your file and how you will implement your "_current-cargo-rust-version". Obviously replace CARGO/cargo in names of variables and recipes with your place name. - Add "_current-cargo-rust-version" recipe to retrieve currently used Rust version from your location, rename the function according to the new place. - Add place specific upgrade recipe named properly, .e.g "_upgrade-rust-cargo" which calls to "_upgrade-rust" and supply all the required arguments like file path, file name, target version, sed command to change the version and some parts of the messages to make proper reporting about upgrade process. - Add newly added recipes to the for-loops in "upgrade-rust" recipe, so they can be called. - Add newly added FILE_PATH and FILE_NAME variables to the call of "_upgrade-rust-git-commit" in "upgrade-rust" recipe, so new place can be listed in git commit and the changes in it can be added to the commit. Changes: - Extend list of dependencies in README.md with command line tools required for "upgrade-rust" recipe: - curl - sed - tq (from `tomlq` crate) - git - Refer to "upgrade-rust" recipe in newly added "Contribution/Housekeeping" sesion of README.md. - Add bunch of variables to justfile related to number of private recipes to compound functionality of "upgrade-rust": - SED_RUST_VERSION_REGEX - RUST_MANIFEST_STABLE_TOML_URL - RUST_MANIFEST_STABLE_VERSION_QUERY - RUST_MANIFEST_STABLE_VERSION_PARSE_REGEX - DEFAULT_RUST_STABLE_VERSION_FORMAT - GITLAB_CI_FILE_NAME - GITLAB_CI_FILE_PATH - CARGO_FILE_NAME - CARGO_FILE_PATH - CARGO_RUST_VERSION_QUERY - CLIPPY_FILE_NAME - CLIPPY_FILE_PATH - CLIPPY_RUST_VERSION_QUERY - TOOLCHAIN_FILE_NAME - TOOLCHAIN_FILE_PATH - TOOLCHAIN_RUST_VERSION_QUERY - GIT_BRANCH_NAME_PREFIX - Add "upgrade-rust" recipe which upgrade Rust version in the following files: - .gitlab-ci.yml - Cargo.toml - clippy.toml - rust-toolchain.toml - Add private just recipes to delivery different aspects of compound functionality of "upgrade-rust" recipe: - _ensure-no-vcs-changes - _upgrade-rust-git-create-branch - _upgrade-rust-fixes-reminder - _upgrade-rust-git-commit - _upgrade-rust - _upgrade-rust-ci - _upgrade-rust-cargo - _upgrade-rust-clippy - _upgrade-rust-toolchain - _rust-stable-version - _current-ci-image - _current-ci-rust-version - _current-cargo-rust-version - _current-clippy-rust-version - _current-toolchain-rust-version
5.8 KiB
Hagrid
Hagrid is a verifying OpenPGP key server.
You can find general instructions and an API documentation at the running instance at https://keys.openpgp.org.
Please note that Hagrid is built and maintained only for the service at keys.openpgp.org. It is not maintained or officially supported as deployable software.
Compatibility note: Hagrid v2.0 uses an sqlite certificate store instead of the previous file based database. This means that it also no longer supports serving certificates directly via reverse proxy. You can us hagridctl to dump and import an old database.
License
Hagrid is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Hagrid is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with Hagrid. If not, see https://www.gnu.org/licenses/.
Quick Start
Building Hagrid requires a working stable Rust toolchain. The easiest way to get the toolchain is to download rustup.
Additionally, some external dependencies are required. Get them (on Debian or Ubuntu) with
sudo apt install gnutls-bin libssl-dev gcc llvm-dev libclang-dev build-essential pkg-config gettext libsqlite3-dev
After Rust and the other dependencies are installed, copy the config file (or run just init
), then simply compile and run:
cd hagrid
cp Rocket.toml.dist Rocket.toml
cargo run
This will spawn a web server listening on port 8080.
For deployment, a release build should be used (cargo build --release
). This
will be statically built, and can be copied anywhere. You will also need to
adjust Rocket.toml
accordingly. Hagrid uses sendmail
for mailing, so you
also need a working local mailer setup.
Development Dependencies
List of dependencies which are required or could be helpful for contribution to the project.
Category | Type | Name | Version | Verified Version | Notes |
---|---|---|---|---|---|
Shell | Obligatory | Zsh | >= 5.9 | 5.9 | Required for translated templates generation script. |
VCS/SCM | Obligatory | Git | >= 2.47.3 | 2.47.3 | Obviously, if going to get this repository you'll have the git CLI as dependency. But it also used in just upgrade-rust recipe to automate Rust upgrades. |
Shell | Preferrable | Bash | >= 5.2.15 | 5.2.15 | Required for scripts embedded into justfile . If you don't want to use just you probably don't need this shell. |
Command Runner | Preferrable | just |
>= 1.42.4 | 1.40.0 | All commands from justfile could be run without just , but it makes development more convenient. |
SQlite Prompt | Preferrable | sqlite3 |
>= 3.40.1 | 3.40.1 | Used by just db recipe to open interactive prompt to SQlite database of the project. |
Command Line HTTP client | Preferrable | curl |
>= 8.14.1 | 8.14.1 | Used by just _rust-stable-version recipe to determine current stable version of Rust. Indirectly, used by just upgrade-rust depends on curl through _rust-stable-version recipe. |
Text stream editor | Preferrable | sed |
>= 4.9 | 4.9 | Similar to curl , Used by just _rust-stable-version recipe to determine current stable version of Rust. Indirectly, used by just upgrade-rust depends on curl through _rust-stable-version recipe. |
TOML Query | Preferrable | tomlq | >= 0.2.2 | 0.2.2 | Similar to curl , Used by just _rust-stable-version recipe to determine current stable version of Rust. Indirectly, used by just upgrade-rust depends on curl through _rust-stable-version recipe. |
Community
We're in #hagrid
on OFTC IRC, also reachable via Matrix as #hagrid:stratum0.org
.
Contribution
Housekeeping
Rust version upgrade
Take a look at just upgrade-rust
recipe.
It bumps used version of Rust to the current stable version
(as declared by manifest).