1. new in this version
  2. build a web 2.0 app in happstack
  3. why happstack is cool
  4. getting started with happstack
  5. prerequisites
  6. cabal install me
  7. first shot at happstack
  8. url handling
  9. basic HTML inclusion
  10. templates
  11. stringtemplate basics
  12. debugging
  13. form data: get and post
  14. form data: file uploads
  15. cookies
  16. introduction to macid
  17. first steps with macid
  18. scaling with multimaster
  19. using macid safely
  20. macid dummy data
  21. changing the data model
  22. macid stress test
  23. limitations of macid
  24. foreign characters
  25. IxSets
  26. cron jobs
  27. thanks
  28. appendix (floundering in ghci)

Start Happstack Automatically At Boot Time

What happens if your Happstack deployment server experiences a power outage?

The way I deal with this issue with a public-facing Happstack application is to have a cron job that runs every minute, that will start the happs application if it isn't running.

thartman@thartman-laptop:~/happs-tutorial>crontab -l
* * * * * /home/thartman/happs-tutorial/happs-tutorial.cron.sh

thartman@thartman-laptop:~/happs-tutorial>cat happs-tutorial.cron.sh
# this is a workaround to a problem that my happs app dies for reasons described at
# http://code.google.com/p/happs/issues/detail?id=40
# generate the executable first by running runServer.sh
# then add this file to your crontab so you have something like
# thartman@thartman-laptop:~>crontab -l
# * * * * * /home/thartman/happs-tutorial/happs-tutorial.cron.sh

if [ -z "`pgrep happs-tutorial`" ];
then cd ~/happs-tutorial
./happs-tutorial >happs-tutorial.cron.out 2>happs-tutorial.cron.err
fi