The demo app is running here.
The web app I had was using happstack instead of yesod. As the demo app shows, heroku cedar can run happstack app. Moreover, it can run whatever executable that is runnable under heroku's cedar stack. Rest of this post shows couple notes about setting up this demo app.
The demo app is using following files:
- Web app executable file
- A Procfile to configure heroku cedar
- Other files required by web app (html, css, images, etc)
So compile the app, write configuration, add to git repository and push them to heroku.
The executable file need to be runnable in heroku's hosted environment. The OS used by cedar was Ubuntu Server 10.04 (Lucid Lynx), mentioned here. Compiled on linux x86_64 architecture. Luckily, it was not difficult for me to compile on linux x86_64. Haven't tried, but it may work with compiling under emulator. One more note for compiling: compile the app statically, or, make it runnable under Ubuntu 10.04 somehow. The actual option need to compile statically may vary on ghc version, linker, etc. In my case, with ghc 7.0.3, GNU ld (GNU Binutils) 220.127.116.1110627, linux 3.1.0-4-ARCH for x86_64, below option worked:
$ ghc --make -static -optl-pthread -optl-static main.hs
Procfile to specify what command to execute for which process
$ cat Procfile web: ./main serve -d state -s static -p +RTS -N
Pass whatever option used by the web app. For instance, specifying port from environment variable ``.
When uploading the app, need cedar to recognize the app somehow,
otherwise, heroku will reject the git commit push. We can use dummy
Gemfile to tell cedar that it's a ruby app, or
tell as a python app, or whatever.
After deploying the app, I found that Heroku's Cedar stack and configuration done by Procfile was extremely flexible, way far flexible than I imagined.