Continuous Delivery with TFS msbuild msdeploy

  • 11,013 views
Uploaded on

If you are deploying your software manually, you are doing it wrong. …

If 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. See a good way on how to automate the deployment with TFS 2010, msbuild and msdeploy.

More in: Education , Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
No Downloads

Views

Total Views
11,013
On Slideshare
0
From Embeds
0
Number of Embeds
2

Actions

Shares
Downloads
188
Comments
1
Likes
7

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide
  • 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/
  • 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...
  • 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"
  • From VS: PublishDocx
  • From VS: PublishDocx
  • Deployment is hard, because of configuration and starting/stopping of external dependencies (web-servers, DBs, queues, external services, …)(web-servers, DBs, queues, external services, …)
  • Small feedback cycle
  • Small feedback cycle
  • Less number of defects
  • Less number of defects
  • Goal of tests: Is application production-ready?
  • I have VS2010 + TFS as build server + a website hosted on DiscountASPhttp://twitter-fish.com/http://twitter-fish.com/Latest/
  • 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)
  • 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)
  • 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)
  • 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
  • Or use VS2010http://kb.discountasp.net/KB/a792/how-do-i-deploy-visual-studio-2010-web-application.aspx
  • Tell MSDEPLOY this is a config setting
  • Tell MSDEPLOY this is a config setting
  • Identifysoftware artefactsconfiguration artefactstarget environment(s)
  • (Dev's, Ops, DBAs)
  • 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.
  • Even with automated tests and UAT there can always slip through a broken release...
  • Which version of your software is installed in which environment
  • Deploy to a staging environment, once 100% happy deploy to productionNew Zealand is Facebook guinea pig
  • Have a clone of your production environment where you deploy and test your software
  • Deployment artefacts. Trace changes, have history, evolution of code
  • Deployment artefacts. Trace changes, have history, evolution of code
  • Authorization
  • http://twitter.com/#!/DEVOPS_BORAT/status/65880152705470464
  • http://twitter.com/#!/DEVOPS_BORAT/status/65880152705470464

Transcript

  • 1. With msbuild and msdeploy
    Continuous Deployment
    Delivery
    -----------
  • 2. Abstract
    If 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.
  • 3.
  • 4. http://twitter.com/#!/DEVOPS_BORAT/status/76767436543758336
  • 5. Continous Deployment
    Deploy continously...
    After each change...
    To a certain env...
    Continous Delivery
    Be production ready...
    through dev cycle...
    release any time...
  • 6. Peter Gfader
    Australia (my fun)
    Italy (my country)
    German (my language)
    blog.gfader.com (my findings)
    @peitor (my conversations)
    www.SSW.com.au (my company)
  • 7. Deployment Agenda
    Pain
    Goals
    How To
    Start from scratch
    Existing System
    Best Practices
  • 8. How do you deploy?
  • 9. How do you deploy?
    ...
  • 17. Pain
  • 18. "Only Bob knows how to deploy
    ... And he is on holidays..."
  • 19. http://twitter.com/#!/DEVOPS_BORAT/status/55321627000455168
  • 20. Manual deployments
    are error prone
    Deployment Instructions.docx
  • 21. Manual deployments
    take hours instead of minutes or seconds
    Deployment Instructions.docx
  • 22. Manual deployments
    take hours instead of minutes or seconds
    Long feedback cycle 
    We want fail fast
    Deployment Instructions.docx
  • 23. Deployments late in the development process
    cause stress on the "deployment day"
  • 24. Hard!
    Configuration
    Existing data
    Updates
    Starting/Stop
    External dependencies
  • 25. Manual != fun
  • 26. http://twitter.com/#!/DEVOPS_BORAT/status/62745218931359744
  • 27. Goals
  • 28. Deliver business value faster
  • 29. Deliver business value faster
    You spent an hour on a bug fix, but customers will not see it for months
  • 30. http://twitter.com/#!/DEVOPS_BORAT/status/82255123526598656
  • 31. Fail fast and early in the development process
  • 32. Fail fast and early in the development process
    On the "Go Live Day" you realize: Production hardware is missing an important feature
  • 33. Release small increments
  • 34. Release small increments
    Deploying often, less number of defects
  • 35. Start from scratch
    http://continuousdelivery.com/2010/02/continuous-delivery/
  • 36. This is the hard part, but some rules of thumb
    How To
  • 37. How To
    Start from Scratch
    Existing Environment
  • 38. Start from scratch
  • 39. Start from scratch
    1. Setup Continous Integration
  • 40. Start from scratch
    1. Setup Continous Integration
    CI tools
    TFS
    TeamCity
    CruiseControl.NET
  • 41. Start from scratch
    1. Setup Continous Integration
    CI tools
    Build automation
    msBuild
    nAnt
    nRake
    FinalBuilder
  • 42. Start from scratch
    2. Have automated tests
  • 43. Start from scratch
    2. Have automated tests
    Unit
    Integration
    Smoke
    Acceptance
    Stresstest
    BVT
    WTF?
  • 44. 3. Setup packaging software
  • 45. 3. Setup packaging software
  • 46. 3. Setup packaging software
  • 47. 3. Setup packaging software
    Result
  • 48. Install of package
    ----------- - ---
  • 49. 4. Configuration
  • 50. 4. Configuration
    XML Transforms vs
    XML Parametrization
  • 51. 1. Web transforms
    • Applied on every deployment
    • 52. Part of VS2010 (no UI)
    • 53. XML transform engine is wrapped in msBuild
  • 1. Web transforms
    • Everything that is not environment specific
  • 1. Web transforms
    • Everything that is not environment specific
    • 54. E.g.Remove all dev settings
    Debug options
    ..
  • 55. 2. Web parameterization
    • Applied on every deployment
    • 56. Run through msDeploy
  • 2. Web parameterization
    2 parts
    Declare parameters
    Set parameters
  • 57. Additional Configuration settings
  • 58. Declare Parameters
  • 59. Set Parameters
  • 60. Set Parameters
  • 61. 4. Target environments
  • 62. Run
  • 63. Run
  • 64. Existing Environment
    Deployment Instructions.docx
  • 65. Existing Environment
    Document your manual deployment process
    Software artefacts
    Configuration artefacts
    Target environment(s)
  • 66. http://twitter.com/#!/DEVOPS_BORAT/status/54693053142798336
  • 67. Existing Environment
    2. Improve in baby steps
    Identify your most expensive manual step
    Automate that
    Rinse and repeat
  • 68. Existing Environment
    Everyone should work together
  • 69. Deployment @AuctionsPlus
    On a napkin
  • 70.
  • 71.
  • 72.
  • 73.
  • 74. Automated Deployment
    Wed night @Sydney .NET UG
  • 75.
  • 76.
  • 77. Best practices
  • 78. http://twitter.com/#!/DEVOPS_BORAT/status/65880152705470464
  • 79. Deploy early
    Deployment is never easy, so try to deploy as soon as possible to remove all roadblocks
  • 80. http://twitter.com/#!/DEVOPS_BORAT/status/61213294949707776
  • 81. Have a rollback plan
  • 82.
  • 83. Have a Dashboard
    Latest Builds?
    Environment, version?
    Everything healthy?
  • 84.
  • 85.
  • 86. Have a guinea pig
    AB testing
  • 87. Have a clone of your production environment
  • 88. Have everything under source control
  • 89. Have everything under source control
    Deployment artefacts
    .bat
    .ps
  • 90. Log failed and successful builds
  • 91.
  • 92. Only let the PO deploy to Production
  • 93.
  • 94. Automate
    Automate
    Automate
    Automate
    Automate
    Automate
    Automate
    Automate
    Automate
  • 95.
  • 96. Thank you!
    http://twitter.com/DEVOPS_BORAThttp://twitter.com/peitor
  • 97. Deployment Agenda
    Pain
    Goals
    How To
    Start from scratch
    Existing System
    Best Practices
  • 98. References
    Do you automate your deployment process? (aka Continuous Deployment)
    http://blog.gfader.com/2010/12/do-you-automate-your-deployment-process.html
  • 99. References
    Automating Deployment with Microsoft Web Deploy
    http://weblogs.asp.net/scottgu/archive/2010/09/13/automating-deployment-with-microsoft-web-deploy.aspx
    Team Build + Web Deployment + Web Deploy + VS 2010 = Goodness
    http://vishaljoshi.blogspot.com/2010/11/team-build-web-deployment-web-deploy-vs.html
  • 100. References
    Web Deployment Made Awesome - Scott Hanselman Video
    http://www.hanselman.com/blog/WebDeploymentMadeAwesomeIfYoureUsingXCopyYoureDoingItWrong.aspx
    Troy Hunt - Blog Series
    http://www.troyhunt.com/2010/11/you-deploying-it-wrong-teamcity.html
    Web.Config Transformation
    http://blogs.msdn.com/b/webdevtools/archive/2009/05/04/web-deployment-web-config-transformation.aspx
    Web.config Parameters
    http://msdn.microsoft.com/en-us/library/ff398068.aspx
  • 101. References
    Releasing features @Flickr
    http://code.flickr.com/blog/2009/12/02/flipping-out/
    18 questions - Choosing a CI tool
    http://weblogs.asp.net/rosherove/archive/2010/01/21/18-questions-to-ask-yourself-when-choosing-continuous-integration-and-build-automation-tools.aspx
    Jez Humble's work blog
    http://continuousdelivery.com/
    Web Deploy 2.0
    http://blogs.iis.net/msdeploy/archive/2011/04/05/announcing-web-deploy-2-0-refresh.aspx
  • 102. Thank you!
    Slides and all detailshttp://blog.gfader.com