Run Ethereum in a docker container on your Raspberry Pi

For a project I need to run geth 1.6 in a docker container on my Raspberry Pi that has raspbian jessie installed. I was looking online for such a docker image, but after some searching I gave up and just created my own docker image.

I am using this image as a basis for other docker images that set a geth node up for a private ethereum blockchain. There are a dozen of Ethereum docker images already, but none (that I could find) played nice with the ARM architecture of the rpi.

You can find the prebuild image on dockerhub/askmike/ethereum-raspbian.

Running ethereum in docker on your rpi is as easy as:

docker pull askmike/ethereum-raspbian:latest
docker run -t askmike/ethereum-raspbian:latest

Note that if you are going to use this for anything serious (or if money is involved) always compile from source! The Dockerfile can be found on github/askmike/ethereum-raspbian-docker. It builds on top of an image that installs golang (so geth can be compiled), you can get that from dockerhub/askmike/golang-raspbian (dockerfile on github/askmike/golang-raspbian).

If the images don’t work for you, please post an issue on github :)

Monitoring nodejs apps with Prometheus

Now we’ve set up Prometheus we can very easily start logging interesting metrics from our nodejs app.

The idea is that we will include an external node module in our app, that module will provide easy functions for the by Prometheus supported metric types. In this post we will use the metric types Counter and Gauge. The module will then expose the statistics using a lightweight express server, which Prometheus will scrape.


Setting up Prometheus on Ubuntu 16.04

Prometheus is a great open source monitoring system by soundcloud. I personally use it on a single server to:

  • Monitor the health on the server
  • Monitor web traffic (nginx)
  • Monitor the backend of my apps (written in nodejs)

In this post I’ll install Prometheus (version 1.1.3) and Promdash (a graphical UI from the same creators).


Realtime Globe in webgl

I just open sourced the globe behind the Realtime Bitcoin Globe. When I published the globe almost a year ago it was based on this awesome project by the Google Data Arts team. That project is great for plotting data in a very specific way (a barchart plotted in 3d on a 3d earth. At that time it took me quite a bit of hacking to make it work for my needs.

I just got around to rewriting the globe from scratch (well, on top of three.js) and I figured why not open source it.

gif of the globe

The main idea is that you can use it as a base for showing something that is happening in realtime somewhere on earth. It currently only supports two different block types (a static one, and a “levitating” one that gets pulled out of the earth), but adding more should be fairly straight forward. I am open to pull requests.

I already made one for showing realtime bitcoin transactions, but you can use the globe as a base for:

  • Showing tweets with a specific hashtag in realtime.
  • Showing instagram posts with a specific tag in realtime (with a preview for example).
  • Showing visitors on your website in realtime.
  • Showing realtime airplanes in the sky.
  • Showing realtime foursquare checkins at fish restaurants.
  • Showing users of your app in realtime.
  • Whatever you can think of!

Hoganizer: Precompile mustache templates for the frontend

Normally when I start working on a new webapp I end up using Jade as a template language, to get the templates working on the frontend I use a wonderful tool called templatizer which pre compiles all jade templates into plain javascript functions. I love this workflow because it has some awesome advantages like:

  • Insanely fast rendering, because you are just running vanillaJS functions with strings in them.
  • You still get to write your templates in a very friendly format: a .jade file for each template.
  • The compiled templates are stored in .js files, which means you have a lot of control over the client side caching.
  • The whole template parsing engine doesn’t need to go over the wire, this way your total JS size goes down.

But this time I started a new project and we decided to go for mustache instead of jade. After some searching I came across Twitter’s fast implementation of the mustache spec: hogan.js. The library not only promises to be very fast, but also that it consists of different modules that would make it easy to pre compile templates on the server.

There already were some wrappers available, but none fit quite right into my workflow: it must be easy to hook into my buildscript & must have some way of supporting client side development.

Meet Hoganizer, a small wrapper around the Hogan compiler to make this easier.