Running a Keep Beacon Node on ARM Devices

https://cdn-images-1.medium.com/max/800/1*LTCdSD5JosNpJlWpqrA8pQ.jpeg

tldr; move straight to Running the Docker Image section in this document if you dont wish to create build your own docker images from codebase. I have created couple of Docker images for armv7 and arm64 devices which can be pulled from https://hub.docker.com/r/mutedtommy/keep-client

This article describes my experience running a Keep Network beacon node on a Raspberry Pi device and also instructions how you can do the same on any ARM device.

I had this Pi device with me since quite some time and I finally decided to put it to some constructive use and hence began my quest to run a Keep Network beacon node on it.

I started experimenting with building the keep-core natively on Raspberry Pi. I realised very quickly that it’s probably is not the best idea because the device was maxing out on CPU usage very frequently and builds were running forever without any end in sight. A couple of time when the build actually finished I saw some errors which prevented me from running the keep-client successfully.

Then I thought about why to take all the trouble when I could use Docker! I promptly pulled a keep-client Docker image and tried to run it. But guess what? It didn’t work! I slowly came to the realisation that I was trying to run a Docker image not meant for the CPU architecture (ARM)Raspberry PI runs on. I started looking at the options about how I could create Docker images which run on ARM architecture and stumbled across this very helpful article.

Prepping for it

Before you start your own adventure of a running beacon node on an ARM device you can do with some preparation. Follow instructions on https://medium.com/@novysf/run-a-keep-network-testnet-node-37096946af35 up to “Create all directories and files used by KEEP client” section.

Create an ARM Compatible Docker Image

You can create an ARM-compatible (or any other platform) docker image by using docker buildx command. Buildx is not avaialable with Docker by default you have to install or enable it. Follow the steps on this article to enable buildx. Once done, try the following command from the command prompt.

$ docker buildx ls

If you see something like the following image you are good to go!

https://cdn-images-1.medium.com/max/800/1*rQVEo11ijUyaQZV27Lfg-Q.png

Before you start creating a Docker image for your arm device make sure you are creating it for the right CPU architecture. To validate the CPU architecture of your ARM device connect to your device and execute lscpu from the command prompt. When I run this command on my Raspberry Pi I see the following information which tells me it runs on an armv7 processor. See the first line in screen-shot below.

https://cdn-images-1.medium.com/max/800/1*4edUDKQyBkDvlRnpyR4IyQ.png

I will be using linux/arm64 platform build for this example. You can choose to build for any platform out of linux/amd64, linux/arm64, linux/ppc64le, linux/s390x, linux/386, linux/arm/v7, linux/arm/v6. I used a Mac to build this image.

Word of advice; don’t try to build for too many platforms in one go. It will smash your CPU and if successful will create humongous images. Trust me! I have tried. Build for one platform at a time.