views:

793

answers:

7

I am looking for different techniques/tools you use to deploy an ASP.NET web application project (NOT ASP.NET web site) to production?

I am particularly interested of the workflow happening between the time your Continuous Integration Build server drops the binaries at some location and the time the first user request hits these binaries.

  1. Are you using some specific tools or just XCOPY? How is the application packaged (ZIP, MSI, ...)?

  2. When an application is deployed for the first time how do you setup the App Pool and Virtual Directory (do you create them manually or with some tool)?

  3. When a static resource changes (CSS, JS or image file) do you redeploy the whole application or only the modified resource? How about when an assembly/ASPX page changes?

  4. Do you keep track of all deployed versions for a given application and in case something goes wrong do you have procedures of restoring the application to a previous known working state?

Feel free to complete the previous list.


And here's what we use to deploy our ASP.NET applications:

  1. We add a Web Deployment Project to the solution and set it up to build the ASP.NET web application
  2. We add a Setup Project (NOT Web Setup Project) to the solution and set it to take the output of the Web Deployment Project
  3. We add a custom install action and in the OnInstall event we run a custom build .NET assembly that creates an App Pool and a Virtual Directory in IIS using System.DirectoryServices.DirectoryEntry (This task is performed only the first time an application is deployed). We support multiple Web Sites in IIS, Authentication for Virtual Directories and setting identities for App Pools.
  4. We add a custom task in TFS to build the Setup Project (TFS does not support Setup Projects so we had to use devenv.exe to build the MSI)
  5. The MSI is installed on the live server (if there's a previous version of the MSI it is first uninstalled)
A: 

web setup/install projects - so you can easily uninstall it if something goes wrong

Steven A. Lowe
+2  A: 

We have all of our code deployed in MSIs using Setup Factory. If something has to change we redeploy the entire solution. This sounds like overkill for a css file, but it absolutely keeps all environments in sync, and we know exactly what is in production (we deploy to all test and uat environments the same way).

Kevin
A: 

Smart Sync software.

DeletedAccount
A: 

Simple XCopy for ASP.NET. Zip it up, sftp to the server, extract into the right location. For the first deployment, manual set up of IIS

Tundey
+1  A: 

We do rolling deployment to the live servers, so we don't use installer projects; we have something more like CI:

  • "live" build-server builds from the approved source (not the "HEAD" of the repo)
  • (after it has taken a backup ;-p)
  • robocopy publishes to a staging server ("live", but not in the F5 cluster)
  • final validation done on the staging server, often with "hosts" hacks to emulate the entire thing as closely as possible
  • robocopy /L is used automatically to distribute a list of the changes in the next "push", to alert of any goofs
  • as part of a scheduled process, the cluster is cycled, deploying to the nodes in the cluster via robocopy (while they are out of the cluster)

robocopy automatically ensures that only changes are deployed.

Re the App Pool etc; I would love this to be automated (see this question), but at the moment it is manual. I really want to change that, though.

(it probably helps that we have our own data-centre and server-farm "on-site", so we don't have to cross many hurdles)

Marc Gravell
A: 

Answering your questions:

  1. XCopy
  2. Manually
  3. For static resources, we only deploy the changed resource.
    For DLL's we deploy the changed DLL and ASPX pages.
  4. Yes, and yes.

Keeping it nice and simple has saved us alot of headaches so far.

Bravax
A: 

I deploy mostly ASP.NET apps to Linux servers and redeploy everything for even the smallest change. Here is my standard workflow:

  • I use a source code repository (like Subversion)
  • On the server, I have a bash script that does the following:
    • Checks out the latest code
    • Does a build (creates the DLLs)
    • Filters the files down to the essentials (removes code files for example)
    • Backs up the database
    • Deploys the files to the web server in a directory named with the current date
    • Updates the database if a new schema is included in the deployment
    • Makes the new installation the default one so it will be served with the next hit

Checkout is done with the command-line version of Subversion and building is done with xbuild (msbuild work-alike from the Mono project). Most of the magic is done in ReleaseIt.

On my dev server I essentially have continuous integration but on the production side I actually SSH into the server and initiate the deployment manually by running the script. My script is cleverly called 'deploy' so that is what I type at the bash prompt. I am very creative. Not.

In production, I have to type 'deploy' twice: once to check-out, build, and deploy to a dated directory and once to make that directory the default instance. Since the directories are dated, I can revert to any previous deployment simply by typing 'deploy' from within the relevant directory.

Initial deployment takes a couple of minutes and reversion to a prior version takes a few seconds.

It has been a nice solution for me and relies only on the three command-line utilities (svn, xbuild, and releaseit), the DB client, SSH, and Bash.

I really need to update the copy of ReleaseIt on CodePlex sometime:

http://releaseit.codeplex.com/

Justin