Search code examples
deploymentmsbuildcontinuous-integrationrakepsake

How would you deploy this .net stack?


I have a .net app which has an MVC3 front end and 2 windows services.

It all depends on 2 RavenDB installations which can either be ran as windows services or IIS - I'm not bothered here.

The services are built using TopShelf and testing is done with straight NUnint. I use Github as my repo.

Ideally on each successful 'Release' build I'd like a build, test, wipe directories and RavenDb data dirs and then deploy (web and services) and then start the processes to run finishing off on a console app i'm building which can run in a default set of data.

How would you manage the deployment here? I have no CI server yet. I have a completely fresh server that I can do as I please with. I haven't done CI/CD for a long time and I suspect the weapons have changed.

Should I be looking at MSBuild/NAnt? PSake, Rake? Team City?

How would you manage the post build processes?


Solution

  • I've been using Jenkins with psake and it's working very well. To be honest psake does most of the work, with Jenkins simply pulling down the source and then invoking my psake script, but as Nick Nieslanik says you can easily have Jenkins call MSBuild/NUnit/etc directly if you like.

    Jenkins

    From a peruse of Jenkins vs. CruiseControl(.NET) threads on StackOverflow, the general consensus appeared to be to go with Jenkins. Having not really tried CruiseControl I can't vouch for that, but I will say that Jenkins is very good. I found Jenkins easy to set up. I had a quick peek at CruiseControl.NET and found Jenkins easier to get started. I haven't looked at TeamCity at all so can't speak to that.

    Jenkins has a nice plugin system, and a lot of plugins, including one for Powershell which makes it easy to call through to a psake script.

    Psake

    So far I think psake is awesome. It's based on rake syntax, but is a wee bit more native to Windows than rake. As it's sitting on top of powershell, you can leverage a lot of the handy Windows admin functionality that comes with that. For example, see this post for a great example of setting up and tearing down IIS app pools and sites direct from your psake tasks. I think that's great, and I'm not sure how you'd go about doing that in MSBuild, Nant, or rake. Basic file system operations are also it's bread and butter -- seems better than having a bunch of angle brackets just to copy some files somewhere.

    As for MSBuild and Nant, I think they're both pretty powerful, but editing XML files for this kind of thing just feels painful. Powershell is a proper scripting language with deep Windows integration. psake is a DSL for building and other tasks on top of that. It's a good combo.

    That said, for actually building, I just farm that out to msbuild from within psake and call it on the solution/project files I want to build. psake has a built in command for calling msbuild and specifying which version to use, etc. (Truth be told the most pain so far is from msbuild borking up on solution files that build just fine in Visual Studio.)

    As you're working with RavenDB, you might be interested to know that they're using psake for building RavenDB (and Rhino-ESB).

    For some good psake tips in general, see this post.


    Long story short, personally I'd recommend Jenkins and psake. That combo will integrate nicely with git, msbuild, NUnit, IIS, and probably even windows services.