Brian McKenna —

I've been working on a Yesod webapp over the past few weeks. I noticed that the skeleton contained a deploy/Procfile . I also know of a couple of developers that have managed to get Haskell running on Heroku.

Heroku Cedar is the polyglot platform which allows you to push any binary that will run on their servers. I first tried using Ubuntu 12.04 to compile the binary. Bad mistake; Heroku uses 10.04 so the shared libraries won't match up.

After manually setting up a virtual machine just to be able to push - I eventually got it. If I wanted to push, I just had to get a copy of this special 6GB virtual machine.

I used Yesod's Procfile , something like this:

web: ./dist/build/my-haskell-project/my-haskell-project -p $PORT

And for some reason, I needed to trick Heroku into thinking it's running node.js, I created a package.json containing:

{ "name": "my-haskell-project", "version": "0.0.1", "dependencies": {} }

Then I realised that I should have made a Vagrant project instead of manually setting up a virtual machine. That way anyone could easily reproduce the deployment environment:

Ubuntu 10.04

GHC 7.0.4

Haskell Platform 2011.4.0.0

Heroku Toolbelt

It was actually very easy to make, thanks to John Bender's Snap blog post. I've put it up on Bitbucket.

To use it, you just need to connect:

git clone https://bitbucket.org/puffnfresh/vagrant-haskell-heroku.git cd vagrant-haskell-heroku vagrant up vagrant ssh

After you're in, you can build and push your GHC binary:

git clone git@bitbucket.org:puffnfresh/my-haskell-project.git cd my-haskell-project git checkout -b deploy cabal update cabal install git add -f dist/build/my-haskell-project/my-haskell-project git commit -m "Deploy `date`" git remote add heroku git@heroku.com:my-haskell-project.git git push -f heroku deploy:master

A much nicer solution would be to use Heroku's Buildpack support. That way you wouldn't need to push the binary; you could just push your Cabal project and it would be compiled on Heroku. Susan Potter started a Cabal Buildpack a while ago and has started thinking about using Vulcan to get ready-made GHC binaries. That'd be awesome.