views:

221

answers:

6

I have an application consisting of an ASP.NET web application, a couple of Windows services, and a SQL Server 2005 database. This application is replicated at several sites, so that each site has a server containing all parts (web app, services, & DB). Currently the process for deploying updates is this:

Database

  1. Script database changes (using Generate Scripts in Management Studio).
  2. Connect to a site's DB in Management Studio.
  3. Run SQL script on site's DB.
  4. Repeat 2 & 3 for each site.

Web Application

  1. Use Publish in Visual Studio.
  2. Delete web.config from published copy.
  3. Zip web application files.
  4. Copy zip file to a site.
  5. Remote desktop into that site to unzip files.
  6. Manually modify web.config when necessary.
  7. Repeat 4-6 for each site.

Windows Services

  1. Build project in Visual Studio.
  2. Zip rebuilt binaries.
  3. Copy zip file to a site.
  4. Remote desktop into that site.
  5. Stop the service.
  6. Uninstall the old version.
  7. Install the new version.
  8. Manually modify the .config when necessary.
  9. Start the service.
  10. Repeat 3-9 for each site.

Currently there are 3 sites and deployments are annoying but manageable, however within the year we will most likely have 10 or 11 sites and having to deploy updates this way would make me suicidal.

So, I am looking for suggestions on how to automate this process. I have started looking into learning MSBuild for merging configurations and copying files out to my servers, but I'm not sure how far it will take me. Thanks.

A: 

Automate and script as much as you can, even the FTP part. Use ant/nant and batch files to do the repetitive stuff for you. If possible provide undo scripts for when things get bad. I update production code within 3 seconds in linux boxes (with a scripted process: backups, delta sql scripts, release code, restart servers) but on windows I'm not sure how neatly you could do that.

cherouvim
+3  A: 

Take any script language you are comfortable with (looks like even .bat would work for you) and get PsTools

You can then use psexec and psservice to control processes and services remotely. You'll still have to write the scripts yourself but you won't have to login remotely (eg. to unzip and copy the files) and what works for one server will work for 10.

chris
Thanks, I had never heard of PsTools and it looks like it will really come in handy.
CodeMonkey1
A: 

Ok, so I don't have a full answer, but why do you uninstall the services. You can just stop them and replace the files. I do this all the time. But I would like to see the answer you get as I have this same issue.

Jojo
A: 

You could use deployment projects and web deployment projects in Visual Studio to create .MSI files to do the installations. You could even prompt for some of the information that might differ between the sites.

Also, take a look at the IIS Web Deployment tool. It's just recently gone RC1.

John Saunders
+1  A: 

MSBUILD can pretty much do all you need. But it sounds like you would need some custom tasks to do it completely automated. But it is possible with a little effort.

MSBUILD is actually already apart of your project. It is the project file itself. It basically is XML behind everything. And in this XML there are PreBuild and PostBuild events that get fired and you can essential do copy, paste commands and the like.

Also you might be interested in Web Deployment projects that allow you to have multiple web.config files for each enviroment you are building to.

For more advanced scenarios you can create your own custom tasks that integrate with MSBUILD's events. You can even use conditions with these tasks. The reference below talks all about it.

For more info on MSBUILD, go to http://msdn.microsoft.com/en-us/library/0k6kkbsd.aspx

irperez