Continuous Delivery with TFS msbuild msdeploy

95
With msbuild and msdeploy Continuous Deployment Deliv ery ----- ----- -

Transcript of Continuous Delivery with TFS msbuild msdeploy

Page 1: Continuous Delivery with TFS msbuild msdeploy

With msbui ld and msdeploy

Continuous DeploymentDeliv

ery -----------

Page 2: Continuous Delivery with TFS msbuild msdeploy

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.

Page 3: Continuous Delivery with TFS msbuild msdeploy
Page 4: Continuous Delivery with TFS msbuild msdeploy

http://twitter.com/#!/DEVOPS_BORAT/status/76767436543758336

Page 5: Continuous Delivery with TFS msbuild msdeploy

Continous Deployment

Deploy continously...

After each change...

To a certain env...

Continous Delivery

Be production ready...

through dev cycle...

release any time...

Page 6: Continuous Delivery with TFS msbuild msdeploy

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)

Page 7: Continuous Delivery with TFS msbuild msdeploy

Deployment Agenda

1. Pain

2. Goals

3. How To1. Start from scratch

2. Existing System

4. Best Practices

Page 8: Continuous Delivery with TFS msbuild msdeploy

How do you deploy?

Page 9: Continuous Delivery with TFS msbuild msdeploy

How do you deploy?

• Web App• Client App• SharePoint• CRM

...

• Manual• Publish from VS• Xcopy• Deploy.docx• Deploy.ps

Page 10: Continuous Delivery with TFS msbuild msdeploy
Page 11: Continuous Delivery with TFS msbuild msdeploy

Pain

Page 12: Continuous Delivery with TFS msbuild msdeploy

"Only Bob knows how to deploy

... And he is on holidays..."

Page 13: Continuous Delivery with TFS msbuild msdeploy

http://twitter.com/#!/DEVOPS_BORAT/status/55321627000455168

Page 14: Continuous Delivery with TFS msbuild msdeploy

Manual deployments

are error prone

Microsoft Word Document

Deployment Instructions.docx

Page 15: Continuous Delivery with TFS msbuild msdeploy

Manual deployments

take hours instead of minutes or seconds

Microsoft Word Document

Deployment Instructions.docx

Page 16: Continuous Delivery with TFS msbuild msdeploy

Manual deployments

take hours instead of minutes or seconds

Long feedback cycle We want fail fast

Microsoft Word Document

Deployment Instructions.docx

Page 17: Continuous Delivery with TFS msbuild msdeploy

Deployments late in the development process

cause stress on the "deployment day"

Page 18: Continuous Delivery with TFS msbuild msdeploy

Hard!

1. Configuration

2. Existing data

3. Updates

4. Starting/Stop

5. External dependencies

Page 19: Continuous Delivery with TFS msbuild msdeploy

Manual != fun

Page 20: Continuous Delivery with TFS msbuild msdeploy

http://twitter.com/#!/DEVOPS_BORAT/status/62745218931359744

Page 21: Continuous Delivery with TFS msbuild msdeploy

Goals

Page 22: Continuous Delivery with TFS msbuild msdeploy

Deliver business value faster

Page 23: Continuous Delivery with TFS msbuild msdeploy

Deliver business value faster

You spent an hour on a bug fix, but customers will not see it for months

Page 24: Continuous Delivery with TFS msbuild msdeploy

http://twitter.com/#!/DEVOPS_BORAT/status/82255123526598656

Page 25: Continuous Delivery with TFS msbuild msdeploy

Fail fast and early in the development process

Page 26: Continuous Delivery with TFS msbuild msdeploy

Fail fast and early in the development process

On the "Go Live Day" you realize: Production hardware is missing an important feature

Page 27: Continuous Delivery with TFS msbuild msdeploy

Release small increments

Page 28: Continuous Delivery with TFS msbuild msdeploy

Release small increments

Deploying often, less number of defects

Page 29: Continuous Delivery with TFS msbuild msdeploy

Start from scratch

http://continuousdelivery.com/2010/02/continuous-delivery/

Page 30: Continuous Delivery with TFS msbuild msdeploy

T h i s i s t h e h a r d p a r t , b u t s o m e r u l e s o f t h u m b

How To

Page 31: Continuous Delivery with TFS msbuild msdeploy

How To

1. Start from Scratch

2. Existing Environment

Page 32: Continuous Delivery with TFS msbuild msdeploy

Start from scratch

Page 33: Continuous Delivery with TFS msbuild msdeploy

Start from scratch

1. Setup Continous Integration

Page 34: Continuous Delivery with TFS msbuild msdeploy

Start from scratch

1. Setup Continous Integration

1. CI tools• TFS• TeamCity • CruiseControl.NET

Page 35: Continuous Delivery with TFS msbuild msdeploy

Start from scratch

1. Setup Continous Integration1. CI tools

2. Build automation• msBuild• nAnt• nRake• FinalBuilder

Page 36: Continuous Delivery with TFS msbuild msdeploy

Start from scratch

2. Have automated tests

Page 37: Continuous Delivery with TFS msbuild msdeploy

Start from scratch

2. Have automated tests1. Unit

2. Integration

3. Smoke

4. Acceptance

5. Stresstest

6. BVT

7. WTF?

Page 38: Continuous Delivery with TFS msbuild msdeploy

3. Setup packaging software

Page 39: Continuous Delivery with TFS msbuild msdeploy

3. Setup packaging software

Page 40: Continuous Delivery with TFS msbuild msdeploy

3. Setup packaging software

Page 41: Continuous Delivery with TFS msbuild msdeploy

3. Setup packaging software

Result

Page 42: Continuous Delivery with TFS msbuild msdeploy

Install of package ----------- - ---

Page 43: Continuous Delivery with TFS msbuild msdeploy

4. Configuration

Page 44: Continuous Delivery with TFS msbuild msdeploy

4. Configuration

1. XML Transforms vs

2. XML Parametrization

Page 45: Continuous Delivery with TFS msbuild msdeploy

1. Web transforms

• Applied on every deployment• Part of VS2010 (no UI)• XML transform engine is

wrapped in msBuild

Page 46: Continuous Delivery with TFS msbuild msdeploy

1. Web transforms

• Everything that is not environment specific

Page 47: Continuous Delivery with TFS msbuild msdeploy

1. Web transforms

• Everything that is not environment specific

• E.g.Remove all dev settings• Debug options• ..

Page 48: Continuous Delivery with TFS msbuild msdeploy

2. Web parameterization

• Applied on every deployment• Run through msDeploy

Page 49: Continuous Delivery with TFS msbuild msdeploy

2. Web parameterization

2 parts1. Declare parameters

2. Set parameters

Page 50: Continuous Delivery with TFS msbuild msdeploy

Additional Configuration settings

Page 51: Continuous Delivery with TFS msbuild msdeploy

Declare Parameters

Page 52: Continuous Delivery with TFS msbuild msdeploy

Set Parameters

Page 53: Continuous Delivery with TFS msbuild msdeploy

Set Parameters

Page 54: Continuous Delivery with TFS msbuild msdeploy

4. Target environments

Page 55: Continuous Delivery with TFS msbuild msdeploy

Run

Page 56: Continuous Delivery with TFS msbuild msdeploy

Run

Page 57: Continuous Delivery with TFS msbuild msdeploy

Existing Environment

Deployment Instructions.docx

Page 58: Continuous Delivery with TFS msbuild msdeploy

Existing Environment

1. Document your manual deployment process• Software artefacts• Configuration artefacts• Target environment(s)

Page 59: Continuous Delivery with TFS msbuild msdeploy

http://twitter.com/#!/DEVOPS_BORAT/status/54693053142798336

Page 60: Continuous Delivery with TFS msbuild msdeploy

Existing Environment

2. Improve in baby steps1. Identify your most expensive

manual step

2. Automate that

3. Rinse and repeat

Page 61: Continuous Delivery with TFS msbuild msdeploy

Existing Environment

Everyone should work together

Page 62: Continuous Delivery with TFS msbuild msdeploy

Deployment @AuctionsPlus

On a napkin

Page 63: Continuous Delivery with TFS msbuild msdeploy
Page 64: Continuous Delivery with TFS msbuild msdeploy
Page 65: Continuous Delivery with TFS msbuild msdeploy
Page 66: Continuous Delivery with TFS msbuild msdeploy
Page 67: Continuous Delivery with TFS msbuild msdeploy

Automated Deployment

Wed night @Sydney .NET UG

Page 68: Continuous Delivery with TFS msbuild msdeploy
Page 69: Continuous Delivery with TFS msbuild msdeploy
Page 70: Continuous Delivery with TFS msbuild msdeploy

Best practices

Page 71: Continuous Delivery with TFS msbuild msdeploy

http://twitter.com/#!/DEVOPS_BORAT/status/65880152705470464

Page 72: Continuous Delivery with TFS msbuild msdeploy

Deploy early

Deployment is never easy, so try to deploy as soon as possible to remove all roadblocks

Page 73: Continuous Delivery with TFS msbuild msdeploy

http://twitter.com/#!/DEVOPS_BORAT/status/61213294949707776

Page 74: Continuous Delivery with TFS msbuild msdeploy

Have a rollback plan

Page 75: Continuous Delivery with TFS msbuild msdeploy
Page 76: Continuous Delivery with TFS msbuild msdeploy

Have a Dashboard

• Latest Builds?• Environment, version?• Everything healthy?

Page 77: Continuous Delivery with TFS msbuild msdeploy
Page 78: Continuous Delivery with TFS msbuild msdeploy
Page 79: Continuous Delivery with TFS msbuild msdeploy

Have a guinea pig

AB testing

Page 80: Continuous Delivery with TFS msbuild msdeploy

Have a clone of your production environment

Page 81: Continuous Delivery with TFS msbuild msdeploy

Have everything under source control

Page 82: Continuous Delivery with TFS msbuild msdeploy

Have everything under source control

Deployment artefacts

1. .bat

2. .ps

Page 83: Continuous Delivery with TFS msbuild msdeploy

Log failed and successful builds

Page 84: Continuous Delivery with TFS msbuild msdeploy
Page 85: Continuous Delivery with TFS msbuild msdeploy

Only let the PO deploy to Production

Page 86: Continuous Delivery with TFS msbuild msdeploy
Page 87: Continuous Delivery with TFS msbuild msdeploy

Automate

Automate

Automate

AutomateAutomateAutomateAutomateAutomate

Automate

Page 88: Continuous Delivery with TFS msbuild msdeploy
Page 90: Continuous Delivery with TFS msbuild msdeploy

Deployment Agenda

1. Pain

2. Goals

3. How To1. Start from scratch

2. Existing System

4. Best Practices

Page 91: Continuous Delivery with TFS msbuild msdeploy

References

Do you automate your deployment process? (aka Continuous Deployment)

http://blog.gfader.com/2010/12/do-you-automate-your-deployment-process.html

Page 95: Continuous Delivery with TFS msbuild msdeploy

Slides and all details

http://blog.gfader.com

Thank you!