How to install Weave's Ignite for Firecracker VMs with simple script
Tags: devops, bash, firecracker, ignite
Published: 2022-02-20 15:29:23

Since I want to get more into [Firecracker MicroVMs](https://firecracker-microvm.github.io/) I started playing around with [Weave’s Ignite](https://ignite.readthedocs.io/en/stable/) which gives a familiar interface to `docker` to interact with the VMs. I do this with [DigitalOcean’s](https://m.do.co/c/c0cb5eb6c95e) droplets  (Affiliate link, get $100 in credits for 60 days for free) since they have KVM enabled and are pretty inexpensive. This script will also work on the $5/month Droplets. Since I set up a new droplet every time to save costs when testing Ignite out I wanted to keep it simple and "automate" the installation with a quick bash script. The steps are taken from the installation page from the [Ignite docs](https://ignite.readthedocs.io/en/stable/installation/)). 

First, you have to create the script on your VPS which can be done by opening it with an editor of choice. On a Digital Ocean droplet, you can use for example `vim`. To create the bash script file type `vim install-ignite.sh` in your terminal window.

## The script
Now we go over to the more interesting part of the post. The script itself. It will install all the dependencies of Ignite (as of February 2022) and install Ignite afterwards. After the installation, it will check if `ignite` was installed successfully by checking the currently installed version. So now go forward and copy the following script in your open editor.

```sh
#! /usr/bin/bash

# Update apt-get repository and install dependencies
apt-get update && apt-get install -y --no-install-recommends dmsetup openssh-client git binutils

# Install containerd if it's not present -- prevents breaking docker-ce installations
which containerd || apt-get install -y --no-install-recommends containerd

# Installing CNI
# Current version from https://github.com/containernetworking/cni/releases
export CNI_VERSION=v1.0.1
ARCH=$([ "$(uname -m)" = "x86_64" ] && echo amd64 || echo arm64)
export ARCH
sudo mkdir -p /opt/cni/bin
curl -sSL "https://github.com/containernetworking/plugins/releases/download/${CNI_VERSION}/cni-plugins-linux-${ARCH}-${CNI_VERSION}.tgz" | sudo tar -xz -C /opt/cni/bin

# Installing Ignite
# Get the current version from https://github.com/weaveworks/ignite/releases
export VERSION=v0.10.0
GOARCH=$(go env GOARCH 2>/dev/null || echo "amd64")
export GOARCH

for binary in ignite ignited; do
    echo "Installing ${binary}..."
    curl -sfLo ${binary} "https://github.com/weaveworks/ignite/releases/download/${VERSION}/${binary}-${GOARCH}"
    chmod +x ${binary}
    sudo mv ${binary} /usr/local/bin
done

# Check if the installation was successful
ignite version
```

## Make it executable
To use the script now we have to make it executable. This is easily done with `chmod +x install-ignite.sh`. Now we can start the script with `./install-ignite.sh` from the directory you created the script in.

## Have fun with Weave’s Ignite
The CLI feels very familiar with everyone who knows about `docker` commands. Starting a new VM can be done with `ignite run weaveworks/ignite-ubuntu`. From there have fun playing around with Ignite.

That's it for now but you can be sure that there will be more posts about Firecracker MicroVMs and how to use them in the future.

Thank you for reading, 
Niklas