Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add firecracker install #667

Merged
merged 1 commit into from
Apr 6, 2022

Conversation

richardcase
Copy link
Sponsor Contributor

@richardcase richardcase commented Apr 6, 2022

This adds the ability to download and install Firecracker.

Description

This adds the following to enable user to install Firecracker as a system package:

arkade system install firecracker

Motivation and Context

Relates to #654

How Has This Been Tested?

Local testing in my development env but not on arm:

➜ go build && ./arkade system install firecracker --path ./out
Installing Firecracker to ./out
Installing version: v1.0.0 for: x86_64
Downloading from: https://github.com/firecracker-microvm/firecracker/releases/download/v1.0.0/firecracker-v1.0.0-x86_64.tgz
1.59 MiB / 1.59 MiB [------------------------------------------------------------------------------------------------------------------------------------] 100.00%
Downloaded to: /tmp/firecracker-v1.0.0-x86_64.tgz
Unpacking Firecracker to: /tmp/firecracker3308092613
Copying Firecracker binaries to: ./out

➜ out/firecracker --version
Firecracker v1.0.0

Supported snapshot data format versions: v0.23.0, v0.24.0, v0.25.0, v1.0.0

Are you a GitHub Sponsor (Yes/No?)

  • Yes
  • No

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist:

  • I have tested this on arm, or have added code to prevent deployment

@derek derek bot added the new-contributor label Apr 6, 2022
@alexellis
Copy link
Owner

Thanks for the PR.

I'd like to see firecracker installed as firecracker, with a default path of /usr/local/bin

This is how I install it presently:

install_firecracker() {
    if ! [ -e /usr/local/bin/firecracker ] ; then 
        curl -L -S -f -o /tmp/firecracker.tgz https://github.com/firecracker-microvm/firecracker/releases/download/v$FIRECRACKER_VER/firecracker-v$FIRECRACKER_VER-$ARCH.tgz
        if [ $? -ne 0 ]; then
            echo "Failed to download firecracker"
            exit 1
        fi
        sudo tar -xvf /tmp/firecracker.tgz -C /usr/local/bin/ --strip-components=1
        sudo mv /usr/local/bin/{firecracker-v$FIRECRACKER_VER-$ARCH,firecracker}
        sudo mv /usr/local/bin/{jailer-v$FIRECRACKER_VER-$ARCH,jailer}
        sudo mv /usr/local/bin/{seccompiler-bin-v$FIRECRACKER_VER-$ARCH,seccompiler-bin}
        sudo mv /usr/local/bin/{seccomp-filter-v$FIRECRACKER_VER-$ARCH.json,seccomp-filter.json}
    fi

}

Alex

cmd/system/firecracker.go Outdated Show resolved Hide resolved
Copy link
Owner

@alexellis alexellis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking forward to getting this in. I've left a couple of notes.

This adds the ability to download and install Firecracker.

Signed-off-by: Richard Case <richard@weave.works>
}
defer f.Close()

tempUnpackPath, err := os.MkdirTemp(os.TempDir(), "firecracker*")
Copy link
Owner

@alexellis alexellis Apr 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would we benefit from a defer os.Remove/Dir(tempUnpackPath)?

Copy link
Sponsor Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes i think you are right.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps you could do that in the next app you contribute? @Shikachuu is covering containerd but the rest are fair game.

Node should be fairly similar to add?

https://nodejs.org/en/download/

@alexellis alexellis merged commit 2d3df2c into alexellis:master Apr 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants