2

What's your experience with deploying Haskell code for production in Snap in a stable fashion?

If the compilation fails on the server then I would like to abort the deployment and if it succeeds then I would like it to turn of the snap-server and start the new version instead.

I know there are plenty of ways. Everything from rsync to git-hooks (git pull was a nightmare). But I would like to hear your experiences.

Jonas
  • 121,568
  • 97
  • 310
  • 388
Daniel O
  • 4,607
  • 6
  • 44
  • 52
  • Broad questions asking for list-like answers are generally discouraged here. It would be more constructive to focus on one framework and add more information about what requirements you have regarding platform, scaling, etc. – hammar Sep 24 '11 at 15:21
  • @hammar the edit obseleted answers, though. – alternative Sep 24 '11 at 17:23

2 Answers2

4

Where I work, we use Happstack and deploy on Ubuntu linux. We actually debianize the web app and all the dependencies, and then build them in the autobuilder.

To actually install on the server, we just run apt-get update && apt-get install webapp-production

The advantage of this system is that it makes it easy for all developers to develop against the same version of the dependencies. And you know that all the source code is checked in properly and can be rebuilt anywhere .. not just on one particular machine. Additionally, it provides a mechanism to make patches to libraries from hackage when needed.

The downside is that apt-get and cabal-install do not get along well. You either have to build everything via apt-get or do everything via cabal-install.

stepcut
  • 1,502
  • 8
  • 10
  • I'm currently using Happstack (best docs and stable). But the lack of news on the homepage scares the hell out of me. – Daniel O Sep 24 '11 at 16:59
  • 1
    @Daniel W -- if you follow the repo, you'll see that Happstack is still under active maintenance and development. The upload history on Hackages for packages such as `happstack-server` reveals the same thing. Happstack just devotes the least energy to promotion out of all the frameworks, and the work is generally much more incremental than "sexy." – sclv Sep 25 '11 at 02:45
  • Eek. Sorry about that. I will make some changes so that there are more ongoing updates about current development. – stepcut Sep 29 '11 at 03:18
  • How do you "debianize the web app and all the dependencies, and the build them in the autobuilder"? Sorry, but I am a newb in linux, to me it sounds like: http://abstrusegoose.com/474 – Andriy Drozdyuk Jun 27 '12 at 02:49
3

Here's what we do. First off, our servers are all the same version of ubuntu, as well as our development machines. We write code, test, etc. in whatever os we care to use and when we're ready to push we build on the devel machine(s). As long as that compiled cleanly, we stop (number of frontend servers)/2, rsync the resources directory and a new copy of the binary, and then use scripts start it back up. Then repeat for the other half.

In my opinion, I think you should question the logic of maintaining a full toolchain on your frontend server(s) when you can easily transfer just the binary and static assets - provided that the external libraries (database, image, etc) versions match the build environment. Heck, you could just use a virtualbox instance to do the final compile, again, so long as the release of the os and libraries match.

clintm
  • 1,259
  • 10
  • 23
  • This is the approach that I usually take. Sometimes I deploy my binary+static files with git. Yes, the git repo is huge since it has the binaries, but this makes it trivial to revert to last good setups in case of a problem. I also usually run my app from inside a shell script surrounded by a while(1) statement. That way, if it crashes in any way it gets automatically restarted. This also allows you to switch to a new version with a simple "git pull" and SIGHUP to the running binary. – mightybyte Sep 25 '11 at 14:24
  • Could you describe what kind of scripts one would need to start say, a Snap or happstack webapp? I have my snap app working on my local machine, but I am completely clueless how to go about starting it on the production server? I also posted a question about this, if you have some free time: http://stackoverflow.com/questions/11214167/how-to-run-snap-haskell-webapp-in-production – Andriy Drozdyuk Jun 27 '12 at 02:45