A while back, scaleway announced some very affordable bare metal servers: for €3 a month you get 4 (ARM) cores, 2GB of RAM, and a 50GB SSD.

I’ve wanted to try out ARM in the server room for some time, and I wanted a chance to use the fantastic servant library, so I’ve built an example REST API and web-app using servant and deployed it on scaleway. You can see the demo running here.

This blog post is about how to get compiling with a modern (7.10) GHC on a Scaleway ARM server running their stock Ubuntu 15.04 image. A better solution might be cross-compiling, but this is a simple-ish way to get Haskell/Servant code running on Scaleway.

The REST API

First, a quick summary of the demo.

The demo is a simple messageboard, consisting of only threads and comments. It serves endpoints as either JSON or HTML, so you can view content through your browser. I didn’t bother adding HTML forms, so to add comments or threads, you’ll need to make a POST request yourself. Check out the example curl scripts in the the github repo.

A note on quality: the demo isn’t very well written- it’s the first thing I made with servant. If you’re looking for servant examples, you should go to the official docs.

Getting GHC 7.10 on Scaleway’s Ubuntu 15.04 Image

I used GHC 7.10.2, which you can download here. I’ll refer to it below by something like <ghc_arm_package.tar.xz> instead of its full name.

You should now be able to run the example curl scripts to populate the demo with some fake data, e.g.:

./curl/populate.sh

Difficulties

Things went pretty smoothly in general, but I did encounter a couple of minor hiccups:

Compiling is pretty slow on these boxes. That said, I’m comparing against my laptop, which has an i5 and 16GB of RAM. It also uses binary distributions of haskell packages, so I don’t really have a fair comparison :-)

I saw cabal/GHC run out of memory once, while trying to compile too many packages simultaneously.

These aren’t really huge problems. In a production setting you’d probably be running a CI server. That could be an ARM server, or a cross compiler running on x86. This at least shows that Haskell on ARM is not too hard :-)

Final Thoughts

It’s dead easy to get a machine running on Scaleway. Their UI is simple, and it takes only a few clicks to get a machine running. I’m not really sure what kind of projects would be well suited to Scaleway boxes, but at €3 you might as well play around with one!