Requirements 101: Have an automated deployment
If you don't have an automated deployment, it generally means that you are in a bad position. By automated, I mean that you should be able to push a new version out by double clicking something. If you can't get automated deployment script in under an hour, you most certainly have a problem.
Sometimes, the problem is with the process, you don't have the facilities to do an automated deployment because parts of the deployment is sitting in people's head (oh, you need to configure IIS to use Xyz with the new version), in other cases, it isn't there simply because people haven't tried.
Yet, automated deployment is one of those things that you can create in isolation, without getting commitment or support from the rest of the team. This is usually the first thing that I do in any project with existing codebase that I come to.
It is also a good way of taking care of problems in the process. If you have a hard time deploying because you database change management process is broken, you need to fix that before you can get an automatic deployment ready.
Also, notice that I am explicitly talking about automated deployment, not about having a build script. One of the requirements for automated deployment is a build script, but that is just one of them.
I don't care that you can or can't build the software, I care that you can deploy this successfully. And yes, this include doing things like deploying to several machines, stopping and starting services, updating the database schema and applying any data migration processes, and even doing rolling update, if this is a requirement.
Remember, automated.
And I'll leave you with just one final thought: Prayer should not be part of the steps in the deployment process.
Comments
What kind of tool are you guys using to make automated deployment possible?
outside of nant, I've never had a good deployment automation system. that's something I've always wanted. I wouldn't really consider a nant script a good automated deployment system, personally.
We use TFSDeployer and it works quite ok (you need to be on TFS of cource)
http://www.codeplex.com/tfsdeployer
Capistrano is a god send for deployments.
I'd be interested in some references for achieving this (without TFS). I definitely fall into the never tried it category.
Josh,
csc.exe can produce a really flexible build script
Josh and others, I'm interested in why you wouldn't consider nant a good tool for automated deployment.
+1 for Capistrano. For Mono at least :)
I'm not sure what it's Windows story is, if it even has one.
Excellent points, especially about how this can be started in isolation. Deployment processes are something that can suffer from death by committee.
Oren, what would you personally use to deploy a simple "ASP.Net"-type project? Considering that there are dev/qa/prod environments, single SQL box per environment, and a few web servers? Would you roll the deployment script from scratch in C#?
depending on the ops environment.
Ideally, I would be able to do it by simple build script, something like:
-build
-create file app_offline.htm on srv1
-remove app_ofline from srv1
etc.
At Ingenio we're using a bunch of batch files, VBScript and XML to do automated deployment of dozens of services, web sites, scheduled tasks, COM+ apps, reports, and other stuff across the web farm.
The hitch is that the system is getting long in the tooth (7-8 years old) and is a bit flaky. And yet... there still does not appear to be a decent commercial or open source tool that can handle stuff like this.
Capistrano seems fine for Rails apps on *ix... but there's not much out there for Windows.
I don't mind building a new tool but I wish I didn't have to for stuff like this which ought to fulfill a fairly universal need anyways. (Of course the devil is in the details and the assumptions you make up-front...)
Yes, but how do you actually "push changes to srv1"? (The deployment script code is not running on srv1, and still needs to check for and create IIS virtual folders, install services, etc). Plus, IT nazis would want the exact same build to be installed first on QA and then on prod boxes. Yet somehow a bunch of parameters need to be different between QA and prod, some of which (like production passwords) they won't even let you check into SVN... I'm not saying that this can't be done, of course. But creating a fool-proof solution that works every time without prayer is not quite trivial, especially if you are starting from scratch (as in C#/BCL)
We use a combination of msbuild, robocopy, SqlCompare API and Powershell 2. Msbuild and robocopy's uses are obvious. SqlCompareAPI we use to execute schema upgrades. Powershell 2 mainly for it's remoting abillity such as encrypting web.config and other config files.
Most of these tasks are msbuild tasks or custom scripts. I find it all a bit messy and tedious to put together, plus PS2 remoting is only supported on Vista and Win2008 at the moment.
I would love to see some better guidance and/or frameworks to help us out in this space...
Rhino.Deployment has a certain ring to it.. :)
I just finishing an automated deployment at work.
We use the following comination of tools/ solutions: Subversion, Draco.NET, NAnt, MSBUILD, Wix3, DBScript, SQL Examiner.
The coolest part of the whole automated deployement and the hardest part is deployment of databases. We use only Micrtosoft SQL Server 2005 database at work.
First I use open source tool DBScript to get the whole database in separate scripts in Subversion. Then I made a simple tool to make a MDF from those scripts (HINT: create an empty mdf file with SQL Express and attach this file through SQL express and execute the scripts one by one to fill the structure of the new mdf file)
This simple tool is executed in the NAnt build script. Then during deployment I use the commandline tools of SQL Examiner to generate a diff sql script between the mdf file and the target database. And this diff script is executed by the same tool against the target database and voila database updated.
The only thing I have difficulties with is the whole WIX3 part. Its hard to find good documentation for it.
And mine was a response to your original tools matter post. :D
http://ferventcoder.com/archive/2008/09/07/tools-matter-automated-builds--automated-deployments.aspx
Comment preview