With msbuild and msdeployContinuous DeploymentDelivery -----------
AbstractIf you are deploying your software manually, you are doing it wrong. If you deploying once a month, you are doing it wrong. If you as a developer are deploying from Visual Studio by clicking "Publish", you are doing it wrong. If a bug-fix takes you 1 hour but your customer needs to wait a week until he gets it, you are doing it wrong. Manual deployments are NOT fun. There is a nice way on how to automate the deployment with TFS 2010, msbuild and msdeploy.
http://twitter.com/#!/DEVOPS_BORAT/status/76767436543758336
Continous DeploymentDeploy continously...After each change...To a certain env...Continous DeliveryBe production ready...through dev cycle...release any time...
Peter GfaderAustralia (my fun)Italy (my country)German (my language)blog.gfader.com (my findings)@peitor (my conversations)www.SSW.com.au (my company)
Deployment AgendaPainGoalsHow ToStart from scratchExisting SystemBest Practices
How do you deploy?
How do you deploy?Web App
Client App
SharePoint
CRM...Manual
Publish from VS
Xcopy
Deploy.docx
Deploy.ps
Pain
"Only Bob knows how to deploy ... And he is on holidays..."
http://twitter.com/#!/DEVOPS_BORAT/status/55321627000455168
Manual deployments are error proneDeployment Instructions.docx
Manual deployments take hours instead of minutes or secondsDeployment Instructions.docx
Manual deployments take hours instead of minutes or secondsLong feedback cycle We want fail fastDeployment Instructions.docx
Deployments late in the development processcause stress on the "deployment day"
Hard!Configuration Existing dataUpdatesStarting/StopExternal dependencies
Manual != fun
http://twitter.com/#!/DEVOPS_BORAT/status/62745218931359744
Goals
Deliver business value faster
Deliver business value fasterYou spent an hour on a bug fix, but customers will not see it for months
http://twitter.com/#!/DEVOPS_BORAT/status/82255123526598656
Fail fast and early in the development process
Fail fast and early in the development processOn the "Go Live Day" you realize: Production hardware is missing an important feature
Release small increments
Release small incrementsDeploying often, less number of defects
Start from scratchhttp://continuousdelivery.com/2010/02/continuous-delivery/
This is the hard part, but some rules of thumbHow To
How ToStart from Scratch Existing Environment
Start from scratch
Start from scratch1. Setup Continous Integration
Start from scratch1. Setup Continous IntegrationCI toolsTFSTeamCityCruiseControl.NET
Start from scratch1. Setup Continous IntegrationCI toolsBuild automationmsBuildnAntnRakeFinalBuilder
Start from scratch2. Have automated tests
Start from scratch2. Have automated testsUnitIntegrationSmokeAcceptanceStresstestBVTWTF?
3. Setup packaging software
3. Setup packaging software
3. Setup packaging software
3. Setup packaging softwareResult
Install of package    ----------- - ---
4. Configuration
4. ConfigurationXML Transforms vsXML Parametrization
1. Web transformsApplied on every deployment
Part of VS2010 (no UI)
XML transform engine is wrapped in msBuild1. Web transformsEverything that is not environment specific1. Web transformsEverything that is not environment specific
E.g.Remove all dev settingsDebug options..
2. Web parameterizationApplied on every deployment
Run through msDeploy2. Web parameterization2 partsDeclare parametersSet parameters
Additional Configuration settings
Declare Parameters
Set Parameters
Set Parameters
4. Target environments
Run
Run
Existing EnvironmentDeployment Instructions.docx
Existing EnvironmentDocument your manual deployment processSoftware artefactsConfiguration artefactsTarget environment(s)
http://twitter.com/#!/DEVOPS_BORAT/status/54693053142798336
Existing Environment2. Improve in baby stepsIdentify your most expensive manual stepAutomate thatRinse and repeat
Existing EnvironmentEveryone should work together
Deployment @AuctionsPlus   On a napkin
Automated DeploymentWed night @Sydney .NET UG
Best practices
http://twitter.com/#!/DEVOPS_BORAT/status/65880152705470464
Deploy earlyDeployment is never easy, so try to deploy as soon as possible to remove all roadblocks
http://twitter.com/#!/DEVOPS_BORAT/status/61213294949707776
Have a rollback plan
Have a DashboardLatest Builds?Environment, version?Everything healthy?
Have a guinea pigAB testing
Have a clone of your production environment
Have everything under source control
Have everything under source controlDeployment artefacts.bat.ps
Log failed and successful builds
Only let the PO deploy to Production
AutomateAutomateAutomateAutomateAutomateAutomateAutomateAutomateAutomate

Continuous Delivery with TFS msbuild msdeploy

Editor's Notes

  • #2 Continuous Delivery with TFS, msbuild and msdeployFeel free to copy and use.Drop me a note before though: peter@gfader.com http://blog.gfader.com/
  • #4 If you are at the stage where you actually have to think about deployment, that is a Success!There are heaps of projects that didn't get so far .... and I was working on some...
  • #6 Continuous Delivery"Keeping systems production-ready throughout development, so that they can be released to users at any time"  Continuous Deployment"Deploy continuously to a certain environment"
  • #9 From VS: PublishDocx
  • #10 From VS: PublishDocx
  • #19 Deployment is hard, because of configuration and starting/stopping of external dependencies (web-servers, DBs, queues, external services, …)(web-servers, DBs, queues, external services, …)
  • #26 Small feedback cycle
  • #27 Small feedback cycle
  • #28 Less number of defects
  • #29 Less number of defects
  • #30 Goal of tests: Is application production-ready?
  • #33 I have VS2010 + TFS as build server + a website hosted on DiscountASPhttp://twitter-fish.com/http://twitter-fish.com/Latest/
  • #34 Devs check in code to Version control, The automated CI system monitors changes in source control and gets changes. Build and runs all tests. Results are posted back on a portalCI tools are the triggers that listen to various “events’ in the network (a check-in to source control, for example could be a trigger. You can configure these tools to do a few simple things when an event happens. One of those things can be to invoke one of the tools in the previous list. Some of the CI tools, though, include a few simple built in build atomation power (such as built in MSBuild support, or running tests)
  • #35 Devs check in code to Version control, The automated CI system monitors changes in source control and gets changes. Build and runs all tests. Results are posted back on a portalCI tools are the triggers that listen to various “events’ in the network (a check-in to source control, for example could be a trigger. You can configure these tools to do a few simple things when an event happens. One of those things can be to invoke one of the tools in the previous list. Some of the CI tools, though, include a few simple built in build atomation power (such as built in MSBuild support, or running tests)
  • #36 Devs check in code to Version control, The automated CI system monitors changes in source control and gets changes. Build and runs all tests. Results are posted back on a portalCI tools are the triggers that listen to various “events’ in the network (a check-in to source control, for example could be a trigger. You can configure these tools to do a few simple things when an event happens. One of those things can be to invoke one of the tools in the previous list. Some of the CI tools, though, include a few simple built in build atomation power (such as built in MSBuild support, or running tests)
  • #41 In your Build definitionGo to “Process” -> “Advanced” -> “MSBuild arguments” and enter:a.    /p:DeployOnBuild=Trueb.    /p:DeployTarget=MsDeployPublish/p:Configuration=Release/p:CreatePackageOnPublish=True /p:DeployIisAppPath=[TwitterFish]/p:MsDeployServiceUrl=https://[DiscountAspSERVER]:8172/msdeploy.axd/p:AllowUntrustedCertificate=True
  • #43 Or use VS2010http://kb.discountasp.net/KB/a792/how-do-i-deploy-visual-studio-2010-web-application.aspx
  • #49 Tell MSDEPLOY this is a config setting
  • #50 Tell MSDEPLOY this is a config setting
  • #59 Identifysoftware artefactsconfiguration artefactstarget environment(s)
  • #62 (Dev's, Ops, DBAs)
  • #73 Deployment is never easy, so try to deploy as soon as possible to remove all roadblocksJuval Löwy encourages the build master to deploy after a couple of days after the project start.
  • #75 Even with automated tests and UAT there can always slip through a broken release...
  • #77 Which version of your software is installed in which environment
  • #80 Deploy to a staging environment, once 100% happy deploy to productionNew Zealand is Facebook guinea pig
  • #81 Have a clone of your production environment where you deploy and test your software
  • #82 Deployment artefacts. Trace changes, have history, evolution of code
  • #83 Deployment artefacts. Trace changes, have history, evolution of code
  • #86 Authorization
  • #90 http://twitter.com/#!/DEVOPS_BORAT/status/65880152705470464
  • #96 http://twitter.com/#!/DEVOPS_BORAT/status/65880152705470464