From 56f0efbe29db6bf6df82b4385889cd67b7ea46b2 Mon Sep 17 00:00:00 2001 From: utam0k Date: Sat, 19 Jun 2021 17:43:56 +0900 Subject: [PATCH 1/2] prepare Vagrant instead of devcontainer for platforms other than linux. --- .devcontainer/Dockerfile | 15 ------------- .devcontainer/devcontainer.json | 28 ------------------------ .devcontainer/scripts/init.sh | 4 ---- .devcontainer/scripts/setup_test.sh | 9 -------- .devcontainer/scripts/test.sh | 34 ----------------------------- README.md | 15 ++++++++++++- Vagrantfile | 30 +++++++++++++++++++++++++ 7 files changed, 44 insertions(+), 91 deletions(-) delete mode 100644 .devcontainer/Dockerfile delete mode 100644 .devcontainer/devcontainer.json delete mode 100755 .devcontainer/scripts/init.sh delete mode 100755 .devcontainer/scripts/setup_test.sh delete mode 100755 .devcontainer/scripts/test.sh create mode 100644 Vagrantfile diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile deleted file mode 100644 index a7b012931..000000000 --- a/.devcontainer/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -FROM mcr.microsoft.com/vscode/devcontainers/rust:1 - -WORKDIR /workspaces -RUN curl -fsSL get.docker.com -o get-docker.sh && sh get-docker.sh && rm get-docker.sh -RUN rustup component add rust-src clippy -RUN curl -L https://github.com/rust-analyzer/rust-analyzer/releases/latest/download/rust-analyzer-x86_64-unknown-linux-gnu.gz \ - -o /usr/local/cargo/bin/rust-analyzer.gz && gzip -d /usr/local/cargo/bin/rust-analyzer.gz \ - && chmod +x /usr/local/cargo/bin/rust-analyzer -RUN wget https://dl.google.com/go/go1.13.5.linux-amd64.tar.gz && tar -C /usr/local -xzf go1.13.5.linux-amd64.tar.gz -RUN mkdir /workspaces/go -ENV PATH $PATH:/usr/local/go/bin -ENV GOPATH /workspaces/go -ENV YOUKI_LOGLEVEL debug -ENV RUNTIME /workspaces/youki/target/x86_64-unknown-linux-gnu/debug/youki -ENTRYPOINT ["sh"] diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json deleted file mode 100644 index 7f33a63c2..000000000 --- a/.devcontainer/devcontainer.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "youki", - "dockerFile": "Dockerfile", - "overrideCommand": true, - "mounts": [ - "source=/var/run/docker.sock,target=/var/run/docker-host.sock,type=bind" - ], - "runArgs": [ - "--cap-add=SYS_PTRACE", - "--security-opt", - "seccomp=unconfined", - "--privileged" - ], - "postStartCommand": [ - ".devcontainer/scripts/init.sh" - ], - "extensions": [ - "matklad.rust-analyzer" - ], - "settings": { - "rust-analyzer.server.path": "/usr/local/cargo/bin/rust-analyzer", - "rust-analyzer.checkOnSave.command": "clippy", - // ref. https://github.com/rust-analyzer/rust-analyzer/issues/6038 - "rust-analyzer.diagnostics.disabled": [ - "unresolved-import" - ] - } -} \ No newline at end of file diff --git a/.devcontainer/scripts/init.sh b/.devcontainer/scripts/init.sh deleted file mode 100755 index 4cf7c60a5..000000000 --- a/.devcontainer/scripts/init.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -RUST_BACKTRACE=full YOUKI_LOG_LEVEL=debug YOUKI_MODE=/var/lib/docker/containers/ dockerd --experimental --add-runtime="youki=/workspaces/youki/target/x86_64-unknown-linux-gnu/debug/youki" & -cargo build diff --git a/.devcontainer/scripts/setup_test.sh b/.devcontainer/scripts/setup_test.sh deleted file mode 100755 index 7944a55fe..000000000 --- a/.devcontainer/scripts/setup_test.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -go get github.com/opencontainers/runtime-tools -cd /workspaces/go/src/github.com/opencontainers/runtime-tools -make runtimetest validation-executables -if [ ! -e /workspaces/runtime-tools ]; then - ln -s /workspaces/go/src/github.com/opencontainers/runtime-tools /workspaces -fi -# YOUKI_LOGLEVEL=debug RUNTIME=/workspaces/youki/target/x86_64-unknown-linux-gnu/debug/youki validation/kill/kill.t diff --git a/.devcontainer/scripts/test.sh b/.devcontainer/scripts/test.sh deleted file mode 100755 index c79a7b58b..000000000 --- a/.devcontainer/scripts/test.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash - -test_cases=("default/default.t" "create/create.t" "start/start.t") -# Testing delete and kill is too time consuming. -# test_cases=("default/default.t" "create/create.t" "start/start.t" "delete/delete.t" "kill/kill.t") - -RED='\033[0;31m' -GREEN='\033[0;32m' -NC='\033[0m' # No Color - -COLUMNS=$(tput cols) -expect_err_num=8 -act_err_num=0 - -for case in "${test_cases[@]}"; do - title="Running $case" - printf "\n%*s\n" $(((${#title}+$COLUMNS)/2)) "$title" - IFS=$'\n' errors=($(RUST_BACKTRACE=1 cd /workspaces/runtime-tools && ../runtime-tools/validation/$case | grep "not ok")) - - if [ ${#errors[@]} -eq 0 ]; then - echo -e "${GREEN}Passed all tess${NC}" - else - for err in "${errors[@]}"; do - act_err_num=$((++act_err_num)) - echo $err - done - fi -done - -echo -if [ $act_err_num -ne $expect_err_num ]; then - echo -e "${RED}The number of failures was as unexpected.${NC}" - exit 1 -fi \ No newline at end of file diff --git a/README.md b/README.md index 374219f7a..747a2533d 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ youki is not at the practical stage yet. However, it is getting closer to practi # Getting Started Local build is only supported on linux. -For other platforms, please use the devcontainer that we prepared. +For other platforms, please use [Vagrantfile](#setting-up-vagrant) that we prepared. ## Requires @@ -105,6 +105,19 @@ $ git submodule update --init --recursive $ ./integration_test.sh ``` +### Setting up Vagrant +You can try youki on platforms other than linux by using the Vagrantfile we have prepared. + +``` +$ git clone git@github.com:containers/youki.git +$ cd youki +$ vagrant up +$ vagrant ssh +# in virtual machine +$ cd youki # in virtual machine +$ ./build.sh +``` + # Community We also have an active [Discord](https://discord.gg/h7R3HgWUct) if you'd like to come and chat with us. diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 000000000..ffd27b519 --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,30 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +Vagrant.configure("2") do |config| + config.vm.box = "fedora/33-cloud-base" + config.vm.provider :virtualbox do |v| + v.memory = 2048 + v.cpus = 2 + end + config.vm.provider :libvirt do |v| + v.memory = 2048 + v.cpus = 2 + end + + config.vm.synced_folder '.', '/vagrant', disabled: true + + config.vm.provision "shell", inline: <<-SHELL + set -e -u -o pipefail + yum install -y git gcc docker + grubby --update-kernel=ALL --args="systemd.unified_cgroup_hierarchy=0" + service docker start + SHELL + + config.vm.provision "shell", privileged: false, inline: <<-SHELL + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + echo "export PATH=$PATH:$HOME/.cargo/bin" >> ~/.bashrc + + git clone https://github.com/containers/youki + SHELL + end From e0f1ccc2dcd66b97afbfe05225beacd5f1838498 Mon Sep 17 00:00:00 2001 From: utam0k Date: Sun, 4 Jul 2021 14:55:39 +0900 Subject: [PATCH 2/2] remove each platform-specific setting in Vagrantfile --- Vagrantfile | 9 --------- 1 file changed, 9 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index ffd27b519..5200403ba 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -3,15 +3,6 @@ Vagrant.configure("2") do |config| config.vm.box = "fedora/33-cloud-base" - config.vm.provider :virtualbox do |v| - v.memory = 2048 - v.cpus = 2 - end - config.vm.provider :libvirt do |v| - v.memory = 2048 - v.cpus = 2 - end - config.vm.synced_folder '.', '/vagrant', disabled: true config.vm.provision "shell", inline: <<-SHELL