[Update] I've outlined a much cleaner way of updating GHC to 7.8 here. This doesn't involve installing the pre-compiled binaries from Ubuntu 12.
I've been working with Haskell about as much as I've been writing on this blog -- very little. So, two birds...
I've got a couple projects coming up that need websites built so I decided that would be a good excuse to learn some more Haskell. After digging around I decided Yesod is likely the most mature web framework so I tried it out. I didn't want to stop at the "install and run locally" phase as that gives a false sense of simplicity when dealing with web frameworks. I think it's more telling to set up a demo site and then deploy it to a (near) production setting.
I host everything on Digital Ocean these days. I wrote previously about a quick way to harden a virgin install to make it more secure and easier to use. I didn't bother this time since everything was torn down quickly but if you're looking at a production install you'll want to think about making it more secure.
The preferred way of running Yesod in production is Keter, which acts as a reverse proxy, monitors applications, gracefully deploys new versions and some other fun stuff. The Keter docs cover everything very well. What is complicated about it is the fact that we're going to need to compile a binary version of Keter and it's not a good idea to compile that binary on your production machine. The same goes for the Yesod binaries. Both the Keter and Yesod docs talk about why, so I won't do it here.
Why is this a problem? Well unless you're running the same OS locally and on your server you're going to have to put together another server or a virtual machine that you can compile the binaries on. Given that my SSD rMBP is woefully light in the storage department I opted for the former. Why not just compile on the same machine? Well, for just trying things out we could do that, but the whole point of testing this is to see what the Haskell ecosystem is like for actually getting the site up and running.
What I ended up doing is firing up two instances (droplets) of Ubuntu 14.04 x64, one a minimal $5/month version that will hold the production site and another, beefier, $40/month droplet (dual core, 4GB ram) to compile our binaries on. Don't worry about the cost as you'll probably be using it for less than an hour and will only be billed for that much.
The main issue you're going to run into here is the available Haskell platform package's GHC version is 7.6 while the newer version is 7.8 (which is what I installed on my Mac). As far as I can tell, projects created with Yesod for 7.6 are not compatible with 7.8. In order to work around this we can either install a binary bundle of the Haskell platform or compile from source (available on the same page). I thought the latter was more of a gamble so I decided to use the pre-compiled binaries. The page does say that it works on Ubuntu 14. Of course, it then trails off with something, something, extra packages, something, symlink.
Good news, I figured out what all of that extra stuff is so you don't have to. The short version is that the Ubuntu 14 image (at least the one DO is using) is missing a few things, but that's easy enough to sort out.
Read more »