Continuous deployment

93
Continuous Deployment ASP.net style @Ben_Hall [email protected] http://www.flickr.com/photos/iboy_daniel/92896276/sizes/l/in/ photostream/

Transcript of Continuous deployment

Continuous Deployment ASP.net style

@[email protected]

http://www.flickr.com/photos/iboy_daniel/92896276/sizes/l/in/photostream/

London\Cambridge (UK) based C# MVPLove Open Source ProjectsCo-founder of Meerkatalyst

Co-Author of Testing ASP.net

Web Applicationshttp://www.testingaspnet.com

Agenda

• Myths• Reality of life• Culture • Tooling• First steps

Reducing risk and increasing opportunity by releasing changes as they happen

Let’s deploy 4 weeks worth of changes at once!

Opps… I wonder what went wrong

http://www.flickr.com/photos/mayhem/292141287/sizes/o/in/photostream/

If it hurts, do it more often

Continuous Deployment

• Committed: 40 lines added80 lines deleted

• Push changes to live• Automated monitoring systems• Users start to see benefits

Make releases a non-event

http://www.flickr.com/photos/violla/5110156999/sizes/l/in/photostream/

MYTHS

git push <PaaS> production

Cowboy driven development

http://www.flickr.com/photos/esteemedhelga/3850944786/

Pushing untested changes

Throw it over the wall

http://www.flickr.com/photos/vizzzual-dot-com/2226095398/

It wouldn’t work for us

REALITY

How long would it take your organisation to deploy a change that involved just one single

line of code?

Mary PoppendieckLean Software Development

http://www.agilejourneyman.com/2011/01/continoues-delivery.html

“Our highest priority is to satisfy the customer through early and continuous

delivery of valuable software.”

Agile Manifesto

http://agilemanifesto.org/principles.html

“Continuous deployment doesn’t mean our product changes 30 times a day, it

means we can be responsive”

Pascal-Louis PerezWealthfront\kaChing

http://www.manualdastartup.com.br/blog/quotes-da-sllconf-2011/

All the cool startups are doing it

Asset Management by Mutual Funds in US. Highly regulated.$2,000,000/dayNo Ops, No QA

http://www.slideshare.net/pascallouis/sll-conf-continuous-deployment

Waste

http://www.flickr.com/photos/hape_gera/5260530549/

Feedback

Reduce risk

http://www.flickr.com/photos/ianz/2594572474/

Improve team morale

Culture or Tooling?

CULTURE

“High” Test Coverage

High != line coverageHigh == confidence of changes

No Blame

http://www.flickr.com/photos/cyberslayer/2535502341/

Trust

http://www.flickr.com/photos/sephiroty/317320551/

Desire to reduce risk

Willingness to experiment

Dark launches and gate keepers

http://www.flickr.com/photos/krymzon/102096279/sizes/z/in/photostream/

Nasa style Go \ No-Go

http://www.flickr.com/photos/28634332@N05/4053997535/

Feature switches

http://www.flickr.com/photos/maxabxarata/535048895/

Data Driven Companies

CEOs, Managers and marketing LOVE data!

Design for system failure

http://www.flickr.com/photos/thekrankis/3377123568/sizes/l/in/photostream/

Five whys

Everything needs to be automated

Fix it via a scriptWrite a script to detect and automate in

the future

TOOLINGSounds great?! But how?

CODE FOCUSED TOOLS

Git

Why does git make CD easier?

TeamCity

Branch in code

Feature switches

If (cfg.enable_unicorn_polo) { // Do something new / cool}else { // Do something boring}

public override void OnActionExecuting(ActionExecutingContext filterContext) { bool featuredOn = FeatureSwitchService.GetStatus(_featureName);

if(!featureOn) filterContext.Result = new ContentResult { Content = null };}

MSDeploy, Dolphin Deploy, AppHarbor

All you really need is Meerkatalyst

Database Migrations

Databases are always difficult

Stop the line for DB?

Migrations in code?

Forward \ Backwards compatible

INFRASTRUCTURE

Chef / Knife

It works on Windows!

Installing .Net via MSI

msiFile = “C:\installers\net_framework.msi”execute “Install .Net” do

command “msiexec /qn /i #{msiFile}”end

Load Balancers

Round robin deployments

Deploy to just one

listen webfarm 0.0.0.0:80 mode http stats enable server web001 192.168.0.102:80 check server web002 192.168.0.103:80 check

https://gist.github.com/354469

http://haproxy.1wt.eu/img/haproxy-stats.png

10% deployment

Manage in code via feature switches

Facebook style deployments

Design for failure

Identify single point of failure

Load balancers \ Data centres

“The Cloud”

Front end \ cache serversMessage Queues

Database Master \ Slave

Auto discovery

MONITORING

Cloudkick

Monitor your servers

Zabbix and windows perf counters

Zabbix Example

Ask the application

Health checks

Image of a dashboard removed.

Sorry.

Application level monitoring

A\B Testing

Website OptimizerPerformable

KissMetrics \ MixPanel

Data is king. The winner is the one with most data.

Dashboard – BIG DASHBOARDShttp://www.flickr.com/photos/mogwai_83/3022261893/

kaChing dashboard

http://eng.wealthfront.com/2010/05/deployment-infrastructure-for.html

Flickr dashboard

Immune System

Without this, continuous deployment can be hard and dangerous.

MEERKATALYST

Images of application removed.

Sorry.

Sign up at http://www.meerkatalyst.com

Do you need high test coverage?

Lean, MVP, proving concept

Tests around key areas. Monitoring to ensure nothing is missed.

FIRST STEPS TO CONTINUOUS DEPLOYMENT

SUMMARY

1) Automate Deployment

Dolphin Deploy \ WebDeploy \ MSBuild

2) Monitor System

User, Application, System

3) Feature switches

Hide

4) Do it

Start with staging...

Thank you

More information• http://about.digg.com/blog/continuous-deployment-code-review-and-pre-tested-

commits-digg4

• http://radar.oreilly.com/2009/03/continuous-deployment-5-eas.html

• http://www.startuplessonslearned.com/2009/06/why-continuous-deployment.html

• http://blog.stelligent.com/integrate-button/2011/03/list-of-software-tools-for-continuous-delivery-in-the-cloud.html

• http://eng.wealthfront.com/2011/02/continuous-deployment-for-data-not-just.html

• http://techcrunch.com/2011/05/30/facebook-source-code/

• http://www.justin.tv/startuplessonslearned/b/286511488