SlideShare una empresa de Scribd logo
1 de 39
Automatic Deployment
Ivan Antsipau
Minsk .NET Meetup #2
Process
•
•
•
•
•
•
•

Build correct version of source code
Change configuration
Stop the application(s)
Deploy (copy files)
Backup DB(s)
Update DB(s)
Start the application(s)
Automatic Deployment on Microsoft .Net stack

2
Automatic Deployment
• “Web Deployment: If You're Using XCopy, You're Doing
It Wrong”
– SCOTT HANSELMAN (HTTP://GOO.GL/MHWJ77)

• Mooney’s Law Of Guaranteed Failure:
– In the software business, every manual process will suffer at
least a 10% failure rate, no matter how smart the person
executing the process. No amount of documentation or
formalization will truly fix this, the only resolution is
automation.
– (http://goo.gl/nuoVzM)
Automatic Deployment on Microsoft .Net stack

3
Manual Deployment Drawbacks
• A lot of time:
– Can’t run integration tests
– Cant’ execute often (no visibility for managers
and stake-holders)
– Can’t execute when business decides to

• Error-prone:

0.25h

CI executes
Daily Build

Automatic Deployment on Microsoft .Net stack

Cost to fix the issue

– Didn’t you deploy the Service? – Which
service?!
– Manual updates of the configuration.

4h

Issue Detection time
Manual QA

4
Components
• MSBuild (The Microsoft Build Engine)
– Build and package

• Web Deploy:
– Move to target server

• CI Server: Atlassian Bamboo, TFS, TeamCity, etc
– Trigger the process, report the results

Automatic Deployment on Microsoft .Net stack

5
Manage Configuration
• Differ by Environments (server name, etc)
• Differ by Build configuration (Debug vs Release)
• We want:
– Changes to be automated
– Differences to be versioned

Automatic Deployment on Microsoft .Net stack

6
Manage Configuration: transformations

Automatic Deployment on Microsoft .Net stack

7
Preview Transformation

Automatic Deployment on Microsoft .Net stack

8
Transformations (easy xslt)

• Locator (can be omitted):
– how to find

• Transform:
– what to do

“The Transform attribute specifies what you
want to do to the elements that
the Locator attribute finds.” MSDN
(http://goo.gl/7J4Mz9)

Automatic Deployment on Microsoft .Net stack

9
Locators
•

Match
–
–

•

Condition
–
–

•

Locator="Match(comma-delimited list of one or more attribute names)“
<add name="AWLT" connectionString="newstring" providerName="newprovider" xdt:Transform="Replace"
xdt:Locator="Match(name)" />
Locator="Condition(XPath expression)” (XPath appended to the current element's XPath expression)
<add name="AWLT" connectionString="newstring" providerName="newprovider" xdt:Transform="Replace"
xdt:Locator="Condition(@name='oldname'or @providerName='oldprovider')" />

Xpath
–
–

Locator="XPath(XPath expression)“(XPath IS NOT appended to the current element's XPath expression)
<add name="AWLT" connectionString="newstring" providerName="newprovider" xdt:Transform="Replace"
xdt:Locator="XPath(configuration/connectionStrings[@name='AWLT'
or @providerName='System.Data.SqlClient'])"
/>

Automatic Deployment on Microsoft .Net stack

10
Transforms
• Replace
<connectionStrings xdt:Transform="Replace">
<add name="SqlServer" connectionString=“str1;" />
<add name="Entities" connectionString=“str2;" />
</connectionStrings>

•
•
•
•
•
•

Insert
InsertBefore
InsertAfter
Remove
RemoveAll
RemoveAttriburtes
–

<compilation xdt:Transform="RemoveAttributes(debug)" />

• SetAttributes
More at MSDN (http://goo.gl/7J4Mz9)
Automatic Deployment on Microsoft .Net stack

11
Publish Profile
• Corresponds to target Environment (server)
– Where to publish
– How to publish
– How to transform

Automatic Deployment on Microsoft .Net stack

12
Publish Profile Settings

Automatic Deployment on Microsoft .Net stack

13
Profile is a Versioned XML File

Automatic Deployment on Microsoft .Net stack

14
Profile-Specific Config Transformations
• Connections strings
• External services addresses
• Other environment-specific settings

Automatic Deployment on Microsoft .Net stack

15
Profile-Specific Config Transformations

Automatic Deployment on Microsoft .Net stack

16
Chained Transformations
Original web.config
file

Configurationspecific

Publish profile –
specific

(Web.release.config)

(Web.staging.config)

Automatic Deployment on Microsoft .Net stack

17
Web Deploy (msdeploy)
• The right way to deploy to IIS.
• IIS extension:
– Install via MS Web Platform Installer

• Command-line tool:
– Comes with VS or installed separately

• Bad news: scary syntax
• Good news: VS team has prepared msbuild wrappers
Automatic Deployment on Microsoft .Net stack

18
Features
• Non-admin deployments (delegation)
• Deploy over https (secure)
• Powerful:
–
–
–
–
–
–
–
–

Copy files
Remove extra files
Skip rules
Take site offline/online
Run executable remotely
Install libs into GAC
Auto back up
Etc

In House

Azure

Web Platform Installer
(3-clicks)

Pre-installed:
(download publish profile)

• More at TechNet (http://goo.gl/1aM0uu) and IIS.net
(http://goo.gl/hnoMVR)
Automatic Deployment on Microsoft .Net stack

19
Command-line vs MSBuild wrappers

Msbuild.exe Web.csproj /p:DeployOnBuild=true /p:Configuration=Release
/p:PublishProfile=staging /p:VisualStudioVersion=11.0
/p:Password=p0ssw0rd

Automatic Deployment on Microsoft .Net stack

20
Web Deploy Settings in Publish Profile

Automatic Deployment on Microsoft .Net stack

21
Command-line run
Msbuild.exe Web.csproj /p:DeployOnBuild=true /p:Configuration=Release
/p:PublishProfile=staging /p:VisualStudioVersion=11.0
/p:Password=p0ssw0rd

Automatic Deployment on Microsoft .Net stack

22
Run From CI

Msbuild.exe Web.csproj /p:DeployOnBuild=true /p:Configuration=Release
/p:PublishProfile=staging /p:VisualStudioVersion=11.0 stack
Automatic Deployment on Microsoft .Net
/p:Password=p0ssw0rd

23
Update Database
• Migrations:
– Run on AppStart
– Run before/after deployment

• Database project:
– Run before/after deployment
– Has publish profiles

Automatic Deployment on Microsoft .Net stack

24
Database Project

Automatic Deployment on Microsoft .Net stack

25
Command-line publishing

Msbuild.exe /p:VisualStudioVersion=11.0 /t:Rebuild;Publish
/p:SqlPublishProfilePath=Database.staging.publish.xml Automatic Deployment on Microsoft .Net stack

26
Process
Build correct version of source code
Change configuration
• Stop the application(s)
Deploy (copy files), skip uploaded files
• Backup DB(s)
Update DB(s)
• Start the application(s)
Automatic Deployment on Microsoft .Net stack

27
Tips and Tricks: version
•
•

MSBuild Community Tasks (https://github.com/loresoft/msbuildtasks)
NuGet package available
Task

Description

Add

Add numbers

AddTnsName

Defines a database host within the Oracle TNSNAMES.ORA file.

AppPoolController

Allows control for an application pool on a local or remote machine with IIS installed. The default is to control the application
pool on the local machine. If connecting to a remote machine, you can specify the and for the task to run under.

Xslt

A task to merge and transform a set of xml files.

XslTransform

XslTransform task for Sandcastle.

AssemblyInfo

Generates an AssemblyInfo files

Attrib

Changes the attributes of files and/or directories on Microsoft .Net stack
Automatic Deployment

28
Usage

Automatic Deployment on Microsoft .Net stack

29
Output Version

Automatic Deployment on Microsoft .Net stack

30
Customize Web Deploy
• ProjectName.Wpp.targets – imported for any web
project before build
– Web.csproj -> Web.Wpp.targets

Automatic Deployment on Microsoft .Net stack

31
Ignore user-generated files

Automatic Deployment on Microsoft .Net stack

32
Set ACL Permissions
• Use .wpp.targets (see
http://sedodream.com/2011/11/08/settingfolderpermis
sionsonwebpublish.aspx ).

Automatic Deployment on Microsoft .Net stack

33
App_offline.htm
• Takes down the application
• Serve static app_offline.htm to notify users

Automatic Deployment on Microsoft .Net stack

34
App_offline.htm
•
•
•
•
•
•
•

Store as app_offline.template.htm
Rename to app_offline.htm before deployment
Update db, do other stuff
Skip on deployment (do not delete)
Rename to app_offline.template.htm when done
See details at http://goo.gl/qbGrKA
Alternatively: use AppOffline rule (http://goo.gl/tC0qxz)

Automatic Deployment on Microsoft .Net stack

35
Complex scenarios
• Using MSBuild to:
– Prepare
– Build
– Update Configuration
– Execute Deployment
– Etc

• Regex-based transformations for multiple similar
environments (QA1-QA10, Test1-Test10).
Automatic Deployment on Microsoft .Net stack

36
Thanks for Your Attention
ivan.antsipau@gmail.com
https://www.facebook.com/Ivan.Antsipau
Links
• App_offline
http://sedodream.com/2012/01/08/HowToTakeYourWebAppOffli
neDuringPublishing.aspx
• VS2010 Guide http://www.troyhunt.com/2010/11/youdeploying-it-wrong-teamcity.html
• VS2012 Deployment Guide
http://www.asp.net/mvc/tutorials/deployment/visual-studioweb-deployment/introduction
• http://stackoverflow.com/questions/tagged/webdeploy
• http://stackoverflow.com/questions/tagged/msdeploy
• http://blog.richardszalay.com/tag/msdeploy/
Automatic Deployment on Microsoft .Net stack

38
Links
• http://msbuildbook.com/ (examples on github)
• MSDN http://msdn.microsoft.com/enus/library/0k6kkbsd.aspx
• Sayed Ibrahim Hashimi http://sedodream.com/
, @SayedIHashimi
• http://www.msbuildexplorer.com/
• http://stackoverflow.com/questions/tagged/ms
build
• http://msdn.microsoft.com/enus/library/ms171483.aspx incremental build
Automatic Deployment on Microsoft .Net stack

39

Más contenido relacionado

La actualidad más candente

Spring boot Introduction
Spring boot IntroductionSpring boot Introduction
Spring boot IntroductionJeevesh Pandey
 
Boost Development With Java EE7 On EAP7 (Demitris Andreadis)
Boost Development With Java EE7 On EAP7 (Demitris Andreadis)Boost Development With Java EE7 On EAP7 (Demitris Andreadis)
Boost Development With Java EE7 On EAP7 (Demitris Andreadis)Red Hat Developers
 
Taming the Cloud Database with Apache jclouds, ApacheCon Europe 2014
Taming the Cloud Database with Apache jclouds, ApacheCon Europe 2014Taming the Cloud Database with Apache jclouds, ApacheCon Europe 2014
Taming the Cloud Database with Apache jclouds, ApacheCon Europe 2014zshoylev
 
Eddystone Beacons - Physical Web - Giving a URL to All Objects
Eddystone Beacons - Physical Web - Giving a URL to All ObjectsEddystone Beacons - Physical Web - Giving a URL to All Objects
Eddystone Beacons - Physical Web - Giving a URL to All ObjectsJeff Prestes
 
An introduction to maven gradle and sbt
An introduction to maven gradle and sbtAn introduction to maven gradle and sbt
An introduction to maven gradle and sbtFabio Fumarola
 
Run alone: a standalone application attempt by Gabriel Sor
Run alone: a standalone application attempt by Gabriel SorRun alone: a standalone application attempt by Gabriel Sor
Run alone: a standalone application attempt by Gabriel SorFAST
 
手把手教你如何串接 Log 到各種網路服務
手把手教你如何串接 Log 到各種網路服務手把手教你如何串接 Log 到各種網路服務
手把手教你如何串接 Log 到各種網路服務Mu Chun Wang
 
Grails Plugin Best Practices
Grails Plugin Best PracticesGrails Plugin Best Practices
Grails Plugin Best PracticesBurt Beckwith
 
Building Grails Plugins - Tips And Tricks
Building Grails Plugins - Tips And TricksBuilding Grails Plugins - Tips And Tricks
Building Grails Plugins - Tips And TricksMike Hugo
 
REST APIs with Spring
REST APIs with SpringREST APIs with Spring
REST APIs with SpringJoshua Long
 
modern module development - Ken Barber 2012 Edinburgh Puppet Camp
modern module development - Ken Barber 2012 Edinburgh Puppet Campmodern module development - Ken Barber 2012 Edinburgh Puppet Camp
modern module development - Ken Barber 2012 Edinburgh Puppet CampPuppet
 
Deploying to azure web sites
Deploying to azure web sitesDeploying to azure web sites
Deploying to azure web sitesGiant Penguin
 
20151010 my sq-landjavav2a
20151010 my sq-landjavav2a20151010 my sq-landjavav2a
20151010 my sq-landjavav2aIvan Ma
 
Using ActiveObjects in Atlassian Plugins
Using ActiveObjects in Atlassian PluginsUsing ActiveObjects in Atlassian Plugins
Using ActiveObjects in Atlassian PluginsAtlassian
 
Arquillian Constellation
Arquillian ConstellationArquillian Constellation
Arquillian ConstellationAlex Soto
 
My "Perfect" Toolchain Setup for Grails Projects
My "Perfect" Toolchain Setup for Grails ProjectsMy "Perfect" Toolchain Setup for Grails Projects
My "Perfect" Toolchain Setup for Grails ProjectsGR8Conf
 

La actualidad más candente (20)

Spring boot Introduction
Spring boot IntroductionSpring boot Introduction
Spring boot Introduction
 
Play framework
Play frameworkPlay framework
Play framework
 
Boost Development With Java EE7 On EAP7 (Demitris Andreadis)
Boost Development With Java EE7 On EAP7 (Demitris Andreadis)Boost Development With Java EE7 On EAP7 (Demitris Andreadis)
Boost Development With Java EE7 On EAP7 (Demitris Andreadis)
 
Taming the Cloud Database with Apache jclouds, ApacheCon Europe 2014
Taming the Cloud Database with Apache jclouds, ApacheCon Europe 2014Taming the Cloud Database with Apache jclouds, ApacheCon Europe 2014
Taming the Cloud Database with Apache jclouds, ApacheCon Europe 2014
 
Eddystone Beacons - Physical Web - Giving a URL to All Objects
Eddystone Beacons - Physical Web - Giving a URL to All ObjectsEddystone Beacons - Physical Web - Giving a URL to All Objects
Eddystone Beacons - Physical Web - Giving a URL to All Objects
 
An introduction to maven gradle and sbt
An introduction to maven gradle and sbtAn introduction to maven gradle and sbt
An introduction to maven gradle and sbt
 
Run alone: a standalone application attempt by Gabriel Sor
Run alone: a standalone application attempt by Gabriel SorRun alone: a standalone application attempt by Gabriel Sor
Run alone: a standalone application attempt by Gabriel Sor
 
手把手教你如何串接 Log 到各種網路服務
手把手教你如何串接 Log 到各種網路服務手把手教你如何串接 Log 到各種網路服務
手把手教你如何串接 Log 到各種網路服務
 
Pantheon basics
Pantheon basicsPantheon basics
Pantheon basics
 
Grails Plugin Best Practices
Grails Plugin Best PracticesGrails Plugin Best Practices
Grails Plugin Best Practices
 
Building Grails Plugins - Tips And Tricks
Building Grails Plugins - Tips And TricksBuilding Grails Plugins - Tips And Tricks
Building Grails Plugins - Tips And Tricks
 
REST APIs with Spring
REST APIs with SpringREST APIs with Spring
REST APIs with Spring
 
modern module development - Ken Barber 2012 Edinburgh Puppet Camp
modern module development - Ken Barber 2012 Edinburgh Puppet Campmodern module development - Ken Barber 2012 Edinburgh Puppet Camp
modern module development - Ken Barber 2012 Edinburgh Puppet Camp
 
Deploying to azure web sites
Deploying to azure web sitesDeploying to azure web sites
Deploying to azure web sites
 
20151010 my sq-landjavav2a
20151010 my sq-landjavav2a20151010 my sq-landjavav2a
20151010 my sq-landjavav2a
 
Using ActiveObjects in Atlassian Plugins
Using ActiveObjects in Atlassian PluginsUsing ActiveObjects in Atlassian Plugins
Using ActiveObjects in Atlassian Plugins
 
Arquillian Constellation
Arquillian ConstellationArquillian Constellation
Arquillian Constellation
 
Serverless Java on Kubernetes
Serverless Java on KubernetesServerless Java on Kubernetes
Serverless Java on Kubernetes
 
TibcoBW6.0
TibcoBW6.0TibcoBW6.0
TibcoBW6.0
 
My "Perfect" Toolchain Setup for Grails Projects
My "Perfect" Toolchain Setup for Grails ProjectsMy "Perfect" Toolchain Setup for Grails Projects
My "Perfect" Toolchain Setup for Grails Projects
 

Similar a Automatic deployment on .NET web stack (Minsk .NET meetup 12.02.14)

(ARC402) Deployment Automation: From Developers' Keyboards to End Users' Scre...
(ARC402) Deployment Automation: From Developers' Keyboards to End Users' Scre...(ARC402) Deployment Automation: From Developers' Keyboards to End Users' Scre...
(ARC402) Deployment Automation: From Developers' Keyboards to End Users' Scre...Amazon Web Services
 
Django deployment with PaaS
Django deployment with PaaSDjango deployment with PaaS
Django deployment with PaaSAppsembler
 
Tips for Developing and Testing IBM HATS Applications
Tips for Developing and Testing IBM HATS ApplicationsTips for Developing and Testing IBM HATS Applications
Tips for Developing and Testing IBM HATS ApplicationsStrongback Consulting
 
Ideal Deployment In .NET World
Ideal Deployment In .NET WorldIdeal Deployment In .NET World
Ideal Deployment In .NET WorldDima Pasko
 
Continuous Deployment: The Dirty Details
Continuous Deployment: The Dirty DetailsContinuous Deployment: The Dirty Details
Continuous Deployment: The Dirty DetailsMike Brittain
 
Webinar: Agile Network Deployment
Webinar: Agile Network DeploymentWebinar: Agile Network Deployment
Webinar: Agile Network DeploymentVasudhaSridharan
 
Hyper-V: Best Practices
Hyper-V: Best PracticesHyper-V: Best Practices
Hyper-V: Best PracticesTomica Kaniski
 
Саша Белецкий "Continuous Delivery в продуктовой разработке"
Саша Белецкий "Continuous Delivery в продуктовой разработке"Саша Белецкий "Continuous Delivery в продуктовой разработке"
Саша Белецкий "Continuous Delivery в продуктовой разработке"Agile Base Camp
 
Learn Electron for Web Developers
Learn Electron for Web DevelopersLearn Electron for Web Developers
Learn Electron for Web DevelopersKyle Cearley
 
Deploying windows containers with kubernetes
Deploying windows containers with kubernetesDeploying windows containers with kubernetes
Deploying windows containers with kubernetesBen Hall
 
Datasheet weblogicpluginforrd
Datasheet weblogicpluginforrdDatasheet weblogicpluginforrd
Datasheet weblogicpluginforrdMidVision
 
PowerShell-and-DSC-Enables-DSCDevOps-1.pptx
PowerShell-and-DSC-Enables-DSCDevOps-1.pptxPowerShell-and-DSC-Enables-DSCDevOps-1.pptx
PowerShell-and-DSC-Enables-DSCDevOps-1.pptxprabhatthunuguntla
 
OutSystems: A more efficient way to build apps!
OutSystems: A more efficient way to build apps!OutSystems: A more efficient way to build apps!
OutSystems: A more efficient way to build apps!Russ Fustino
 
Boris Stoyanov - Troubleshooting the Virtual Router - Run and Get Diagnostics
Boris Stoyanov - Troubleshooting the Virtual Router - Run and Get DiagnosticsBoris Stoyanov - Troubleshooting the Virtual Router - Run and Get Diagnostics
Boris Stoyanov - Troubleshooting the Virtual Router - Run and Get DiagnosticsShapeBlue
 
Expanding your impact with programmability in the data center
Expanding your impact with programmability in the data centerExpanding your impact with programmability in the data center
Expanding your impact with programmability in the data centerCisco Canada
 
(WEB301) Operational Web Log Analysis | AWS re:Invent 2014
(WEB301) Operational Web Log Analysis | AWS re:Invent 2014(WEB301) Operational Web Log Analysis | AWS re:Invent 2014
(WEB301) Operational Web Log Analysis | AWS re:Invent 2014Amazon Web Services
 

Similar a Automatic deployment on .NET web stack (Minsk .NET meetup 12.02.14) (20)

IIS Web Ecosystem
IIS Web EcosystemIIS Web Ecosystem
IIS Web Ecosystem
 
(ARC402) Deployment Automation: From Developers' Keyboards to End Users' Scre...
(ARC402) Deployment Automation: From Developers' Keyboards to End Users' Scre...(ARC402) Deployment Automation: From Developers' Keyboards to End Users' Scre...
(ARC402) Deployment Automation: From Developers' Keyboards to End Users' Scre...
 
Build Automation 101
Build Automation 101Build Automation 101
Build Automation 101
 
Django deployment with PaaS
Django deployment with PaaSDjango deployment with PaaS
Django deployment with PaaS
 
Tips for Developing and Testing IBM HATS Applications
Tips for Developing and Testing IBM HATS ApplicationsTips for Developing and Testing IBM HATS Applications
Tips for Developing and Testing IBM HATS Applications
 
Ideal Deployment In .NET World
Ideal Deployment In .NET WorldIdeal Deployment In .NET World
Ideal Deployment In .NET World
 
Continuous Deployment: The Dirty Details
Continuous Deployment: The Dirty DetailsContinuous Deployment: The Dirty Details
Continuous Deployment: The Dirty Details
 
Webinar: Agile Network Deployment
Webinar: Agile Network DeploymentWebinar: Agile Network Deployment
Webinar: Agile Network Deployment
 
Hyper-V: Best Practices
Hyper-V: Best PracticesHyper-V: Best Practices
Hyper-V: Best Practices
 
Саша Белецкий "Continuous Delivery в продуктовой разработке"
Саша Белецкий "Continuous Delivery в продуктовой разработке"Саша Белецкий "Continuous Delivery в продуктовой разработке"
Саша Белецкий "Continuous Delivery в продуктовой разработке"
 
ESIGate dev meeting #4 21-11-2013
ESIGate dev meeting #4 21-11-2013ESIGate dev meeting #4 21-11-2013
ESIGate dev meeting #4 21-11-2013
 
Learn Electron for Web Developers
Learn Electron for Web DevelopersLearn Electron for Web Developers
Learn Electron for Web Developers
 
Deploying windows containers with kubernetes
Deploying windows containers with kubernetesDeploying windows containers with kubernetes
Deploying windows containers with kubernetes
 
Datasheet weblogicpluginforrd
Datasheet weblogicpluginforrdDatasheet weblogicpluginforrd
Datasheet weblogicpluginforrd
 
PowerShell-and-DSC-Enables-DSCDevOps-1.pptx
PowerShell-and-DSC-Enables-DSCDevOps-1.pptxPowerShell-and-DSC-Enables-DSCDevOps-1.pptx
PowerShell-and-DSC-Enables-DSCDevOps-1.pptx
 
Secure your site
Secure your siteSecure your site
Secure your site
 
OutSystems: A more efficient way to build apps!
OutSystems: A more efficient way to build apps!OutSystems: A more efficient way to build apps!
OutSystems: A more efficient way to build apps!
 
Boris Stoyanov - Troubleshooting the Virtual Router - Run and Get Diagnostics
Boris Stoyanov - Troubleshooting the Virtual Router - Run and Get DiagnosticsBoris Stoyanov - Troubleshooting the Virtual Router - Run and Get Diagnostics
Boris Stoyanov - Troubleshooting the Virtual Router - Run and Get Diagnostics
 
Expanding your impact with programmability in the data center
Expanding your impact with programmability in the data centerExpanding your impact with programmability in the data center
Expanding your impact with programmability in the data center
 
(WEB301) Operational Web Log Analysis | AWS re:Invent 2014
(WEB301) Operational Web Log Analysis | AWS re:Invent 2014(WEB301) Operational Web Log Analysis | AWS re:Invent 2014
(WEB301) Operational Web Log Analysis | AWS re:Invent 2014
 

Último

CALL ON ➥8923113531 🔝Call Girls Aliganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Aliganj Lucknow best sexual serviceCALL ON ➥8923113531 🔝Call Girls Aliganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Aliganj Lucknow best sexual serviceanilsa9823
 
Breath, Brain & Beyond_A Holistic Approach to Peak Performance.pdf
Breath, Brain & Beyond_A Holistic Approach to Peak Performance.pdfBreath, Brain & Beyond_A Holistic Approach to Peak Performance.pdf
Breath, Brain & Beyond_A Holistic Approach to Peak Performance.pdfJess Walker
 
Call Girls Anjuna beach Mariott Resort ₰8588052666
Call Girls Anjuna beach Mariott Resort ₰8588052666Call Girls Anjuna beach Mariott Resort ₰8588052666
Call Girls Anjuna beach Mariott Resort ₰8588052666nishakur201
 
8377087607 Full Enjoy @24/7-CLEAN-Call Girls In Chhatarpur,
8377087607 Full Enjoy @24/7-CLEAN-Call Girls In Chhatarpur,8377087607 Full Enjoy @24/7-CLEAN-Call Girls In Chhatarpur,
8377087607 Full Enjoy @24/7-CLEAN-Call Girls In Chhatarpur,dollysharma2066
 
Understanding Relationship Anarchy: A Guide to Liberating Love | CIO Women Ma...
Understanding Relationship Anarchy: A Guide to Liberating Love | CIO Women Ma...Understanding Relationship Anarchy: A Guide to Liberating Love | CIO Women Ma...
Understanding Relationship Anarchy: A Guide to Liberating Love | CIO Women Ma...CIOWomenMagazine
 
Lilac Illustrated Social Psychology Presentation.pptx
Lilac Illustrated Social Psychology Presentation.pptxLilac Illustrated Social Psychology Presentation.pptx
Lilac Illustrated Social Psychology Presentation.pptxABMWeaklings
 
办理西悉尼大学毕业证成绩单、制作假文凭
办理西悉尼大学毕业证成绩单、制作假文凭办理西悉尼大学毕业证成绩单、制作假文凭
办理西悉尼大学毕业证成绩单、制作假文凭o8wvnojp
 
The Selfspace Journal Preview by Mindbrush
The Selfspace Journal Preview by MindbrushThe Selfspace Journal Preview by Mindbrush
The Selfspace Journal Preview by MindbrushShivain97
 
Top Rated Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
Cheap Rate ➥8448380779 ▻Call Girls In Mg Road Gurgaon
Cheap Rate ➥8448380779 ▻Call Girls In Mg Road GurgaonCheap Rate ➥8448380779 ▻Call Girls In Mg Road Gurgaon
Cheap Rate ➥8448380779 ▻Call Girls In Mg Road GurgaonDelhi Call girls
 
Call Girls in Kalyan Vihar Delhi 💯 Call Us 🔝8264348440🔝
Call Girls in Kalyan Vihar Delhi 💯 Call Us 🔝8264348440🔝Call Girls in Kalyan Vihar Delhi 💯 Call Us 🔝8264348440🔝
Call Girls in Kalyan Vihar Delhi 💯 Call Us 🔝8264348440🔝soniya singh
 
call girls in candolim beach 9870370636] NORTH GOA ..
call girls in candolim beach 9870370636] NORTH GOA ..call girls in candolim beach 9870370636] NORTH GOA ..
call girls in candolim beach 9870370636] NORTH GOA ..nishakur201
 
REFLECTIONS Newsletter Jan-Jul 2024.pdf.pdf
REFLECTIONS Newsletter Jan-Jul 2024.pdf.pdfREFLECTIONS Newsletter Jan-Jul 2024.pdf.pdf
REFLECTIONS Newsletter Jan-Jul 2024.pdf.pdfssusere8ea60
 
办理国外毕业证学位证《原版美国montana文凭》蒙大拿州立大学毕业证制作成绩单修改
办理国外毕业证学位证《原版美国montana文凭》蒙大拿州立大学毕业证制作成绩单修改办理国外毕业证学位证《原版美国montana文凭》蒙大拿州立大学毕业证制作成绩单修改
办理国外毕业证学位证《原版美国montana文凭》蒙大拿州立大学毕业证制作成绩单修改atducpo
 
Call Girls In Andheri East Call US Pooja📞 9892124323 Book Hot And
Call Girls In Andheri East Call US Pooja📞 9892124323 Book Hot AndCall Girls In Andheri East Call US Pooja📞 9892124323 Book Hot And
Call Girls In Andheri East Call US Pooja📞 9892124323 Book Hot AndPooja Nehwal
 
CALL ON ➥8923113531 🔝Call Girls Rajajipuram Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Rajajipuram Lucknow best sexual serviceCALL ON ➥8923113531 🔝Call Girls Rajajipuram Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Rajajipuram Lucknow best sexual serviceanilsa9823
 
Dhule Call Girls #9907093804 Contact Number Escorts Service Dhule
Dhule Call Girls #9907093804 Contact Number Escorts Service DhuleDhule Call Girls #9907093804 Contact Number Escorts Service Dhule
Dhule Call Girls #9907093804 Contact Number Escorts Service Dhulesrsj9000
 
CALL ON ➥8923113531 🔝Call Girls Adil Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Adil Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Adil Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Adil Nagar Lucknow best Female serviceanilsa9823
 
文凭办理《原版美国USU学位证书》犹他州立大学毕业证制作成绩单修改
文凭办理《原版美国USU学位证书》犹他州立大学毕业证制作成绩单修改文凭办理《原版美国USU学位证书》犹他州立大学毕业证制作成绩单修改
文凭办理《原版美国USU学位证书》犹他州立大学毕业证制作成绩单修改atducpo
 

Último (20)

CALL ON ➥8923113531 🔝Call Girls Aliganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Aliganj Lucknow best sexual serviceCALL ON ➥8923113531 🔝Call Girls Aliganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Aliganj Lucknow best sexual service
 
Breath, Brain & Beyond_A Holistic Approach to Peak Performance.pdf
Breath, Brain & Beyond_A Holistic Approach to Peak Performance.pdfBreath, Brain & Beyond_A Holistic Approach to Peak Performance.pdf
Breath, Brain & Beyond_A Holistic Approach to Peak Performance.pdf
 
Call Girls Anjuna beach Mariott Resort ₰8588052666
Call Girls Anjuna beach Mariott Resort ₰8588052666Call Girls Anjuna beach Mariott Resort ₰8588052666
Call Girls Anjuna beach Mariott Resort ₰8588052666
 
8377087607 Full Enjoy @24/7-CLEAN-Call Girls In Chhatarpur,
8377087607 Full Enjoy @24/7-CLEAN-Call Girls In Chhatarpur,8377087607 Full Enjoy @24/7-CLEAN-Call Girls In Chhatarpur,
8377087607 Full Enjoy @24/7-CLEAN-Call Girls In Chhatarpur,
 
Understanding Relationship Anarchy: A Guide to Liberating Love | CIO Women Ma...
Understanding Relationship Anarchy: A Guide to Liberating Love | CIO Women Ma...Understanding Relationship Anarchy: A Guide to Liberating Love | CIO Women Ma...
Understanding Relationship Anarchy: A Guide to Liberating Love | CIO Women Ma...
 
Lilac Illustrated Social Psychology Presentation.pptx
Lilac Illustrated Social Psychology Presentation.pptxLilac Illustrated Social Psychology Presentation.pptx
Lilac Illustrated Social Psychology Presentation.pptx
 
办理西悉尼大学毕业证成绩单、制作假文凭
办理西悉尼大学毕业证成绩单、制作假文凭办理西悉尼大学毕业证成绩单、制作假文凭
办理西悉尼大学毕业证成绩单、制作假文凭
 
The Selfspace Journal Preview by Mindbrush
The Selfspace Journal Preview by MindbrushThe Selfspace Journal Preview by Mindbrush
The Selfspace Journal Preview by Mindbrush
 
Top Rated Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Cheap Rate ➥8448380779 ▻Call Girls In Mg Road Gurgaon
Cheap Rate ➥8448380779 ▻Call Girls In Mg Road GurgaonCheap Rate ➥8448380779 ▻Call Girls In Mg Road Gurgaon
Cheap Rate ➥8448380779 ▻Call Girls In Mg Road Gurgaon
 
Model Call Girl in Lado Sarai Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Lado Sarai Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Lado Sarai Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Lado Sarai Delhi reach out to us at 🔝9953056974🔝
 
Call Girls in Kalyan Vihar Delhi 💯 Call Us 🔝8264348440🔝
Call Girls in Kalyan Vihar Delhi 💯 Call Us 🔝8264348440🔝Call Girls in Kalyan Vihar Delhi 💯 Call Us 🔝8264348440🔝
Call Girls in Kalyan Vihar Delhi 💯 Call Us 🔝8264348440🔝
 
call girls in candolim beach 9870370636] NORTH GOA ..
call girls in candolim beach 9870370636] NORTH GOA ..call girls in candolim beach 9870370636] NORTH GOA ..
call girls in candolim beach 9870370636] NORTH GOA ..
 
REFLECTIONS Newsletter Jan-Jul 2024.pdf.pdf
REFLECTIONS Newsletter Jan-Jul 2024.pdf.pdfREFLECTIONS Newsletter Jan-Jul 2024.pdf.pdf
REFLECTIONS Newsletter Jan-Jul 2024.pdf.pdf
 
办理国外毕业证学位证《原版美国montana文凭》蒙大拿州立大学毕业证制作成绩单修改
办理国外毕业证学位证《原版美国montana文凭》蒙大拿州立大学毕业证制作成绩单修改办理国外毕业证学位证《原版美国montana文凭》蒙大拿州立大学毕业证制作成绩单修改
办理国外毕业证学位证《原版美国montana文凭》蒙大拿州立大学毕业证制作成绩单修改
 
Call Girls In Andheri East Call US Pooja📞 9892124323 Book Hot And
Call Girls In Andheri East Call US Pooja📞 9892124323 Book Hot AndCall Girls In Andheri East Call US Pooja📞 9892124323 Book Hot And
Call Girls In Andheri East Call US Pooja📞 9892124323 Book Hot And
 
CALL ON ➥8923113531 🔝Call Girls Rajajipuram Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Rajajipuram Lucknow best sexual serviceCALL ON ➥8923113531 🔝Call Girls Rajajipuram Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Rajajipuram Lucknow best sexual service
 
Dhule Call Girls #9907093804 Contact Number Escorts Service Dhule
Dhule Call Girls #9907093804 Contact Number Escorts Service DhuleDhule Call Girls #9907093804 Contact Number Escorts Service Dhule
Dhule Call Girls #9907093804 Contact Number Escorts Service Dhule
 
CALL ON ➥8923113531 🔝Call Girls Adil Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Adil Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Adil Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Adil Nagar Lucknow best Female service
 
文凭办理《原版美国USU学位证书》犹他州立大学毕业证制作成绩单修改
文凭办理《原版美国USU学位证书》犹他州立大学毕业证制作成绩单修改文凭办理《原版美国USU学位证书》犹他州立大学毕业证制作成绩单修改
文凭办理《原版美国USU学位证书》犹他州立大学毕业证制作成绩单修改
 

Automatic deployment on .NET web stack (Minsk .NET meetup 12.02.14)

  • 2. Process • • • • • • • Build correct version of source code Change configuration Stop the application(s) Deploy (copy files) Backup DB(s) Update DB(s) Start the application(s) Automatic Deployment on Microsoft .Net stack 2
  • 3. Automatic Deployment • “Web Deployment: If You're Using XCopy, You're Doing It Wrong” – SCOTT HANSELMAN (HTTP://GOO.GL/MHWJ77) • Mooney’s Law Of Guaranteed Failure: – In the software business, every manual process will suffer at least a 10% failure rate, no matter how smart the person executing the process. No amount of documentation or formalization will truly fix this, the only resolution is automation. – (http://goo.gl/nuoVzM) Automatic Deployment on Microsoft .Net stack 3
  • 4. Manual Deployment Drawbacks • A lot of time: – Can’t run integration tests – Cant’ execute often (no visibility for managers and stake-holders) – Can’t execute when business decides to • Error-prone: 0.25h CI executes Daily Build Automatic Deployment on Microsoft .Net stack Cost to fix the issue – Didn’t you deploy the Service? – Which service?! – Manual updates of the configuration. 4h Issue Detection time Manual QA 4
  • 5. Components • MSBuild (The Microsoft Build Engine) – Build and package • Web Deploy: – Move to target server • CI Server: Atlassian Bamboo, TFS, TeamCity, etc – Trigger the process, report the results Automatic Deployment on Microsoft .Net stack 5
  • 6. Manage Configuration • Differ by Environments (server name, etc) • Differ by Build configuration (Debug vs Release) • We want: – Changes to be automated – Differences to be versioned Automatic Deployment on Microsoft .Net stack 6
  • 7. Manage Configuration: transformations Automatic Deployment on Microsoft .Net stack 7
  • 9. Transformations (easy xslt) • Locator (can be omitted): – how to find • Transform: – what to do “The Transform attribute specifies what you want to do to the elements that the Locator attribute finds.” MSDN (http://goo.gl/7J4Mz9) Automatic Deployment on Microsoft .Net stack 9
  • 10. Locators • Match – – • Condition – – • Locator="Match(comma-delimited list of one or more attribute names)“ <add name="AWLT" connectionString="newstring" providerName="newprovider" xdt:Transform="Replace" xdt:Locator="Match(name)" /> Locator="Condition(XPath expression)” (XPath appended to the current element's XPath expression) <add name="AWLT" connectionString="newstring" providerName="newprovider" xdt:Transform="Replace" xdt:Locator="Condition(@name='oldname'or @providerName='oldprovider')" /> Xpath – – Locator="XPath(XPath expression)“(XPath IS NOT appended to the current element's XPath expression) <add name="AWLT" connectionString="newstring" providerName="newprovider" xdt:Transform="Replace" xdt:Locator="XPath(configuration/connectionStrings[@name='AWLT' or @providerName='System.Data.SqlClient'])" /> Automatic Deployment on Microsoft .Net stack 10
  • 11. Transforms • Replace <connectionStrings xdt:Transform="Replace"> <add name="SqlServer" connectionString=“str1;" /> <add name="Entities" connectionString=“str2;" /> </connectionStrings> • • • • • • Insert InsertBefore InsertAfter Remove RemoveAll RemoveAttriburtes – <compilation xdt:Transform="RemoveAttributes(debug)" /> • SetAttributes More at MSDN (http://goo.gl/7J4Mz9) Automatic Deployment on Microsoft .Net stack 11
  • 12. Publish Profile • Corresponds to target Environment (server) – Where to publish – How to publish – How to transform Automatic Deployment on Microsoft .Net stack 12
  • 13. Publish Profile Settings Automatic Deployment on Microsoft .Net stack 13
  • 14. Profile is a Versioned XML File Automatic Deployment on Microsoft .Net stack 14
  • 15. Profile-Specific Config Transformations • Connections strings • External services addresses • Other environment-specific settings Automatic Deployment on Microsoft .Net stack 15
  • 16. Profile-Specific Config Transformations Automatic Deployment on Microsoft .Net stack 16
  • 17. Chained Transformations Original web.config file Configurationspecific Publish profile – specific (Web.release.config) (Web.staging.config) Automatic Deployment on Microsoft .Net stack 17
  • 18. Web Deploy (msdeploy) • The right way to deploy to IIS. • IIS extension: – Install via MS Web Platform Installer • Command-line tool: – Comes with VS or installed separately • Bad news: scary syntax • Good news: VS team has prepared msbuild wrappers Automatic Deployment on Microsoft .Net stack 18
  • 19. Features • Non-admin deployments (delegation) • Deploy over https (secure) • Powerful: – – – – – – – – Copy files Remove extra files Skip rules Take site offline/online Run executable remotely Install libs into GAC Auto back up Etc In House Azure Web Platform Installer (3-clicks) Pre-installed: (download publish profile) • More at TechNet (http://goo.gl/1aM0uu) and IIS.net (http://goo.gl/hnoMVR) Automatic Deployment on Microsoft .Net stack 19
  • 20. Command-line vs MSBuild wrappers Msbuild.exe Web.csproj /p:DeployOnBuild=true /p:Configuration=Release /p:PublishProfile=staging /p:VisualStudioVersion=11.0 /p:Password=p0ssw0rd Automatic Deployment on Microsoft .Net stack 20
  • 21. Web Deploy Settings in Publish Profile Automatic Deployment on Microsoft .Net stack 21
  • 22. Command-line run Msbuild.exe Web.csproj /p:DeployOnBuild=true /p:Configuration=Release /p:PublishProfile=staging /p:VisualStudioVersion=11.0 /p:Password=p0ssw0rd Automatic Deployment on Microsoft .Net stack 22
  • 23. Run From CI Msbuild.exe Web.csproj /p:DeployOnBuild=true /p:Configuration=Release /p:PublishProfile=staging /p:VisualStudioVersion=11.0 stack Automatic Deployment on Microsoft .Net /p:Password=p0ssw0rd 23
  • 24. Update Database • Migrations: – Run on AppStart – Run before/after deployment • Database project: – Run before/after deployment – Has publish profiles Automatic Deployment on Microsoft .Net stack 24
  • 25. Database Project Automatic Deployment on Microsoft .Net stack 25
  • 26. Command-line publishing Msbuild.exe /p:VisualStudioVersion=11.0 /t:Rebuild;Publish /p:SqlPublishProfilePath=Database.staging.publish.xml Automatic Deployment on Microsoft .Net stack 26
  • 27. Process Build correct version of source code Change configuration • Stop the application(s) Deploy (copy files), skip uploaded files • Backup DB(s) Update DB(s) • Start the application(s) Automatic Deployment on Microsoft .Net stack 27
  • 28. Tips and Tricks: version • • MSBuild Community Tasks (https://github.com/loresoft/msbuildtasks) NuGet package available Task Description Add Add numbers AddTnsName Defines a database host within the Oracle TNSNAMES.ORA file. AppPoolController Allows control for an application pool on a local or remote machine with IIS installed. The default is to control the application pool on the local machine. If connecting to a remote machine, you can specify the and for the task to run under. Xslt A task to merge and transform a set of xml files. XslTransform XslTransform task for Sandcastle. AssemblyInfo Generates an AssemblyInfo files Attrib Changes the attributes of files and/or directories on Microsoft .Net stack Automatic Deployment 28
  • 29. Usage Automatic Deployment on Microsoft .Net stack 29
  • 30. Output Version Automatic Deployment on Microsoft .Net stack 30
  • 31. Customize Web Deploy • ProjectName.Wpp.targets – imported for any web project before build – Web.csproj -> Web.Wpp.targets Automatic Deployment on Microsoft .Net stack 31
  • 32. Ignore user-generated files Automatic Deployment on Microsoft .Net stack 32
  • 33. Set ACL Permissions • Use .wpp.targets (see http://sedodream.com/2011/11/08/settingfolderpermis sionsonwebpublish.aspx ). Automatic Deployment on Microsoft .Net stack 33
  • 34. App_offline.htm • Takes down the application • Serve static app_offline.htm to notify users Automatic Deployment on Microsoft .Net stack 34
  • 35. App_offline.htm • • • • • • • Store as app_offline.template.htm Rename to app_offline.htm before deployment Update db, do other stuff Skip on deployment (do not delete) Rename to app_offline.template.htm when done See details at http://goo.gl/qbGrKA Alternatively: use AppOffline rule (http://goo.gl/tC0qxz) Automatic Deployment on Microsoft .Net stack 35
  • 36. Complex scenarios • Using MSBuild to: – Prepare – Build – Update Configuration – Execute Deployment – Etc • Regex-based transformations for multiple similar environments (QA1-QA10, Test1-Test10). Automatic Deployment on Microsoft .Net stack 36
  • 37. Thanks for Your Attention ivan.antsipau@gmail.com https://www.facebook.com/Ivan.Antsipau
  • 38. Links • App_offline http://sedodream.com/2012/01/08/HowToTakeYourWebAppOffli neDuringPublishing.aspx • VS2010 Guide http://www.troyhunt.com/2010/11/youdeploying-it-wrong-teamcity.html • VS2012 Deployment Guide http://www.asp.net/mvc/tutorials/deployment/visual-studioweb-deployment/introduction • http://stackoverflow.com/questions/tagged/webdeploy • http://stackoverflow.com/questions/tagged/msdeploy • http://blog.richardszalay.com/tag/msdeploy/ Automatic Deployment on Microsoft .Net stack 38
  • 39. Links • http://msbuildbook.com/ (examples on github) • MSDN http://msdn.microsoft.com/enus/library/0k6kkbsd.aspx • Sayed Ibrahim Hashimi http://sedodream.com/ , @SayedIHashimi • http://www.msbuildexplorer.com/ • http://stackoverflow.com/questions/tagged/ms build • http://msdn.microsoft.com/enus/library/ms171483.aspx incremental build Automatic Deployment on Microsoft .Net stack 39