diff --git a/docs/src/user/basic_setup.md b/docs/src/user/basic_setup.md index 5e846dd11..a649c1a83 100644 --- a/docs/src/user/basic_setup.md +++ b/docs/src/user/basic_setup.md @@ -6,16 +6,35 @@ Youki currently only supports Linux Platform, and to use it on other platform yo Also note that Youki currently only supports and expects systemd as init system, and would not work on other systems. There is currently work on-going to put systemd dependent features behind a feature flag, but till then you will need a systemd enabled system to work with Youki. -## Requirements +## Build Requirements As Youki is written in Rust, you will need to install and setup Rust toolchain to compile it. The instructions for that can be found on Rust's official site [here](https://www.rust-lang.org/tools/install). +If you installed it using rustup, the correct compiler version will be setup automatically from `rust-toolchain.toml` in the repo root. -You can use Youki by itself to start and run containers, but it can be a little tedious, as it is a low-level container runtime. You can use a High-level container runtime, with its runtime set to Youki, so that it will be easier to use. Both of these are explained in the [Basic Usage](./basic_usage.md). For using it along with an high-level runtime, you will to install one such as Docker or Podman. This documentation uses Docker in its examples, which can be installed from [here](https://docs.docker.com/engine/install). +### Build with cross-rs + +You can compile youki using [cross-rs](https://github.com/cross-rs/cross), which provides: +* Seamless compilation for different architectures (see `Cross.toml` in the repo root for the list of supported targets) +* No build time dependencies (compilation runs in a container) +* No runtime dependencies when building static binaries (musl targets) + +The only build dependency is [cross-rs](https://github.com/cross-rs/cross?tab=readme-ov-file#installation) and its [dependencies](https://github.com/cross-rs/cross?tab=readme-ov-file#dependencies) (rustup and docker or podman). + + +```console +$ CARGO=cross TARGET=musl just youki-dev # or youki-release +``` + +### Build without cross-rs -To compile and run, Youki itself depends on some underlying libraries being installed. You can install them using your respective package manager as shown below. +Install the build dependencies and then run: +```console +$ just youki-dev # or youki-release +``` -### Debian, Ubuntu and related distributions +Install the build dependencies using your distribution's package manger +#### Debian, Ubuntu and related distributions ```console $ sudo apt-get install \ pkg-config \ @@ -27,8 +46,7 @@ $ sudo apt-get install \ libssl-dev ``` -### Fedora, CentOS, RHEL and related distributions - +#### Fedora, CentOS, RHEL and related distributions ```console $ sudo dnf install \ pkg-config \ @@ -39,20 +57,33 @@ $ sudo dnf install \ openssl-devel ``` +## Runtime requirements + +The static binary (musl) builds of youki have no additional runtime requirements. Otherwise you need to install the runtime requirements using your distribution's package manager: + +#### Debian, Ubuntu and related distributions +```console +$ sudo apt-get install libseccomp2 +``` + +#### Fedora, CentOS, RHEL and related distributions +```console +$ sudo dnf install libseccomp +``` + +## Running youki + +You can use Youki by itself to start and run containers, but it can be a little tedious, as it is a low-level container runtime. You can use a High-level container runtime, with its runtime set to Youki, so that it will be easier to use. Both of these are explained in the [Basic Usage](./basic_usage.md). For using it along with an high-level runtime, you will to install one such as Docker or Podman. This documentation uses Docker in its examples, which can be installed from [here](https://docs.docker.com/engine/install). + --- ## Quick install -Install from the GitHub release. -Note that this way also requires the aforementioned installation. +Install from the GitHub release as root: ```console -$ wget -qO youki-0.3.1.tar.gz https://github.com/containers/youki/releases/download/v0.3.1/youki-0.3.1-$(uname -m).tar.gz -$ tar -zxvf youki-0.3.1.tar.gz youki -# Maybe you need root privileges. -$ mv youki /usr/local/bin/youki -$ rm youki-0.3.1.tar.gz +# curl -sSfL https://github.com/containers/youki/releases/download/v0.3.1/youki-0.3.1-$(uname -m)-musl.tar.gz | tar -xzvC /usr/bin/ youki ``` diff --git a/scripts/build.sh b/scripts/build.sh index 0a5cd3302..2515384f3 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -42,6 +42,22 @@ if [ "${VERSION}" = release ]; then OPTION="--release" fi +# expand target shortcuts +case "$TARGET" in + musl) + TARGET="$(uname -m)-unknown-linux-musl" + ;; + gnu|glibc) + TARGET="$(uname -m)-unknown-linux-gnu" + ;; + arm64|aarch64) + TARGET="aarch64-unknown-linux-musl" + ;; + amd64|x86_64) + TARGET="x86_64-unknown-linux-musl" + ;; +esac + FEATURES=() if [ -n "${features}" ]; then FEATURES=("--features=${features}") diff --git a/scripts/release_tag.sh b/scripts/release_tag.sh index 2d051a1a3..1c9232770 100755 --- a/scripts/release_tag.sh +++ b/scripts/release_tag.sh @@ -13,11 +13,7 @@ END_MARKER="" echo "\`\`\`console -\$ wget -qO youki-${VERSION}.tar.gz https://github.com/containers/youki/releases/download/v${VERSION}/youki-${VERSION}-\$(uname -m).tar.gz -\$ tar -zxvf youki-${VERSION}.tar.gz youki -# Maybe you need root privileges. -\$ mv youki /usr/local/bin/youki -\$ rm youki-${VERSION}.tar.gz +# curl -sSfL https://github.com/containers/youki/releases/download/v${VERSION}/youki-${VERSION}-\$(uname -m)-musl.tar.gz | tar -xzvC /usr/bin/ youki \`\`\`" > replace_content.txt awk -v start="$START_MARKER" -v end="$END_MARKER" -v newfile="replace_content.txt" '