I have been experimenting with Raspberry Pi computers with the intent of having a small cloud that I can take with me to talks.
Plusses:
- I can have a good sized cluster in a small volume.
- Low power draw (6W or less per computer)
- With the release of the Pi 2, distribution based upon available resources is available.
Minuses:
- Binaries need to be recompiled in many cases
- Memory is limited
- Processing power is limited
The last one, particularly with the new Pi 2 B’s quad core processor is less of an issue. Additionally, the Pi 2 has more memory than its predecessor.
All in all, though, given that many lowend cloud instances have 512M or 1G ram, I think that the Pi is of a decent size for experimentation. I may even try to be masochistic enough to try Hadoop on the cluster.
Hardware
At present, the cluster consists of the following:
- 2 stacks from HDZConcepts
- Four Pi B+ — these were on sale, so I purchased some. A couple of days later, the new version was released.
- Five Pi 2 B
- A 16 port 10/100 switch
- Power supply rated for 60 watts
There are a couple of extra PI; one of each flavour. These I’ve been using for some experiments & compiling; I’m not sure what role they will play as yet.
Software
Docker
Previously the choices for running Docker with Raspberry Pi’s were limited to either running Archlinux, Raspbian updated to Jessie, or attempting to make the release from [Resin.io](http://resin.io} work with more current versions. I was able, after much time elapsed, to update stock Raspbian to Jessie, then compile Docker 1.4.x on a Pi B+. This took many hours.
Recently, however, a very compelling possibility emerged.
The wonderful people at Hypriot announced that Docker 1.4.1 is working on the Pi 2, and that they have a very lightweight image with it (that works on both Pi B+ and Pi 2)!!! on their blog: Kick-Ass Raspberry Pi 2 having a forbidden love affair with Docker 1.4.1
Update
They have since announced support for 1.5: Heavily ARMed after major upgrade: Raspberry Pi with Docker 1.5.0 – Docker Pirates ARMed with explosive stuff
Swarm
Swarm is written in Go and the current methodology is rather than to ship a binary executable, the commands are run from within a Docker container. I’d started the process of bootstrapping a Golang container for the Pi when I happily discovered that someone else had done so.
In order to create a swarm container for the Raspberry Pi, clone the git repository for swarm:
1 2 |
git clone https://github.com/docker/swarm |
The Dockerfile
needs to be edited; there are a few differences which are necessitated by the different platform and differences which result. Here is the resulting Dockerfile
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
FROM hypriot/rpi-golang COPY . /gopath/src/github.com/docker/swarm WORKDIR /gopath/src/github.com/docker/swarm ENV GOPATH /gopath/src/github.com/docker/swarm/Godeps/_workspace:$GOPATH RUN CGO_ENABLED=0 go install -v -a -tags netgo -ldflags "-w -X github.com/docker/swarm/version.GITCOMMIT `git rev-parse --short HEAD`" ENV SWARM_HOST :2375 EXPOSE 2375 VOLUME $HOME/.swarm ENTRYPOINT ["swarm"] CMD ["--help"] |
Once the Dockerfile has been edited, then compile it like this:
1 2 |
docker build -t rpi-swarm . |
You now have a working swarm container and can run swarm commands as follows:
1 2 |
docker run -rm rpi-swarm help |
Future
I have started a repository for Dockerfiles (and changes necessary) for building containers on the Pi. It can be found at aetherical/rpi-dockerfiles.
I will soon post scripts and a demo of using swarm with the raspberry pi….