views:

4061

answers:

9

My team is currently trying to automate the deployment of our .Net and PHP web applications. We want to streamline deployments, and to avoid the hassle and many of the headaches caused by doing it manually.

We require a solution that will enable us to:

  • Compile the application
  • Version the application with the SVN version number
  • Backup the existing site
  • Deploy to a web farm

All our apps are source controlled using SVN and our .Net apps use CruiseControl. We have been trying to use MSBuild and NAnt deployment scripts with limited success. We have also used Capistrano in the past, but wish to avoid using Ruby if possible.

Are there any other deployment tools out there that would help us?

A: 

Fabric. Seems small, simple, procedural. Written in Python, since Ruby is a no-no (why?).

Jordi Bunster
Are you suggesting this as a build automation tool? I get that SSH is great for secure transmissions, but how does this make deployment easier?
BozoJoe
A: 

Check out Setup Factory (from indigo rose). It's pretty robust in what it can do. It uses the Windows installer API. It can probably do what you need.

Kevin
+2  A: 

I have used Visual Build Pro for years, It's quite slick and easy to use and has many standard operations (like the ones you mentioned) built in.

jeremcc
big thumbs up for Kinook's Visual Build Pro
BozoJoe
A: 

I use Puppet, Makefiles to build RPMs and Bamboo to do this for me. My system doesn't directly apply, and I'm not to familiar with the Windows world, but there are some transferable patterns.

My make setup allows me to build RPM's for everything (php libs, php websites, perl modules, C apps, etc) that make up my app. This can be called manually, or through Bamboo. I transfer these RPM's into a yum repo and puppet handles making sure the latest (or correct) versions of software are installed in the cluster.

Could you automate building software packages into MSI's? I think Puppet can manage installation of software packages and versions in Windows.

Gary Richardson
+11  A: 

Thank you all for your kind suggestions. We checked them all out, but after careful consideration we decided to roll our own with a combination of CruiseControl, NAnt, MSBuild and MSDeploy.

This article has some great information: Integrating MSBuild with CruiseControl.NET

Here's roughly how our solution works:

  • Developers build the 'debug' version of the app and run unit tests, then check in to SVN.
  • CruiseControl sees the updates and calls our build script...
    • Runs any new migrations on the build database
    • Replaces the config files with the build server config
    • Builds the 'debug' configuration of the app
    • Runs all unit and integration tests
    • Builds the 'deploy' configuration of the app
      • Versions the DLLs with the current major/minor version and SVN revision, e.g. 1.2.0.423
      • Moves this new build to a 'release' folder on our build server
      • Removes unneeded files
    • Updates IIS on the build server if required

Then when we have verified everything is ready to go up to live/staging we run another script to:

  • Run migrations on live/staging server
  • MSDeploy: archive current live/staging site
  • MSDeploy: sync site from build to live/staging

It wasn't pretty getting to this stage, but it's mostly working like a charm now :D

I'm going to try and keep this answer updated as we make changes to our process, as there seem to be several similar questions on SA now.

Sam Wessel
What are your migrations written in? Straight SQL? Also how do you handle configuration files?
Craig Tyler
We currently use Ruby migrations. The build script calls rake and everything is taken care of. However, we're moving all our practices into alt.net, so it's likely we'll be changing this soon.As for config files, Cruise Control replaces the dev config with its own build config before compiling
Sam Wessel
I'm assuming that when you version the DLL's your checking in/out your AssemblyInfo files. How do you configure CruiseControl to ignore the SVC checkin of AssemblyInfo files? I'm looking at a similar solution and I'm worried that this would cause an infinite build loop.
rie819
+1  A: 

Rather than using xcopy we managed to use the -source:dirpath command with UNC addresses to the servers with msdeploy. The key was the ignoreAcls=true and removing calls to username and password in the msdeploy string:

msdeploy -verb:sync -source:dirpath=\\build\e$\app -dest:dirpath=\\live\d$\app,ignoreAcls=true

The example deploys the site from our build server's E drive to the D drive on our live server. There are some security considerations with exposing shares or this level of disk access on a live server. We're currently looking into using a limited access shared folder.

We then pipe this output to a log file which is then moved to the backup archive for reference. The log file records which files were moved and when.Continuing the example above with the output pipe command:

... > E:\archive\msdeploy.log
Paul Shannon
+1  A: 

I use msdeploy for this. It works perfect.

About Ant; for the .NET platform we have NAnt and you can use it in combination with MSDeploy; you have the possibility to call MSDeploy from your Nant-script.

Edited: Just to make things clear; you can do everything with msdeploy. Using Nant is not a requirement.

Sander Pham
You can also use MSBuild which is what Microsoft wants you to use instead of NAnt. With the various contrib task libraries it's quite nice.
Rob
I'm not using Nant either, but it was just meant as a suggestion in case really wants to keep using Nant!
Sander Pham
A: 

The only reason Nant should exist is so that you have a framework similar to Ant in which we can write Tasks using the .NET set of languages. If you don't want to get a pure .NET developer to write custom Tasks, I can't see any reason you can't use Ant. Just because you write your application in a .NET language, doesn't mean you have to use a .NET build tool.

pdr
A: 

No one mentioned Final Builder http://www.finalbuilder.com. Its on par with Visual build Pro. Good GUI for creating automated build deployment harnesses

BozoJoe