ideal deployment in .net world
DESCRIPTION
Presented on XP Days Kyiv 17.12.2011TRANSCRIPT
Ideal
Dima Pasko
DeploymentIn .NET World
Windows Phone
About Me
Windows Phone
Introduction
Windows Phone
Human beings make mistakes
Windows Phone
We aren’t as accurate every time
Windows Phone
Click to add picture
Machines don’t have this problem
Windows Phone
They do the same thing every time
Click to add picture
They do the same thing every time
What Do You Need?
New Code New Configuration New Database Schema New Static Files
A Lot To Remember
Did you remember to upload ALL new files? Did you remember to update your DB? Did you remember to correct your config? Did you remember set permissions?
Even Worse
Did you clear your caches? Did you delete that old file/plugin? In the upload process, was your configuration overwritten? Did you upload ALL the changed files? Do you have several environments?
Windows Phone
Solution
Automation!
Build scripts! We are programmers after all…
What Is Automation? Automated deployment means a single command
Locks your live site Uploads changed files Clears caches and temporary files Updates the database schema Runs other cron tasks Unlocks your live site … Profit
Why Do We Automate?
Deployment is tricky Repetition degrades quality
She sells sea shells by the sea shore
When Is Automation Used?
All the time! Staging Live
Probably best to use it on your test/dev box too!
Windows Phone
Basics
Terms
Package(build) Solution != package
Environment(settings) Deployment
Rollout Go Live
Principles
One-click deployment Process Everything fails Rollback
Steps
Configuration Management Deployment Logic
Database Migration
Windows Phone
Configuration Management
Xml Configuration
XML, XPath, XSLT NConfig
https://github.com/Yegoroff/NConfig
Web.Config Transformation
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<appSettings><add key="article" value=“test"
xdt:Transform="Insert"/></appSettings>
</configuration>
Windows Phone
Demo
Windows Phone
Deployment Logic
Power Shell
PSakeTask default -Depends Build
Task Build -Depends Init,Clean,Compile{ "build"}
Task Compile -Depends Clean, Init { "compile"}
Task Clean -Depends Init { "clean"}
Task Init { "init"}%
https://github.com/psake/psake/
DropKick ~ deploy fluently
https://github.com/chucknorris/dropkick
MSDeploy
Windows Phone
Demo
Windows Phone
DB Versioning
Visual Studio Database Project
Migrator.NETusing Migrator.Framework;using System.Data;
namespace DBMigration{ [Migration(20080401110402)] public class CreateUserTable_001 : Migration { public void Up() { Database.CreateTable("User", new Column("UserId", DbType.Int32, ColumnProperties.PrimaryKeyWithIdentity), new Column("Username", DbType.AnsiString, 25) ); }
public void Down() { Database.RemoveTable("User"); } }}
http://code.google.com/p/migratordotnet/
Windows Phone
Demo
Windows Phone
Release Management
Release Management
Build Master http://inedo.com/
Octopus Deploy http://octopusdeploy.com/
Thought Works Studio – Go http://www.thoughtworks-studios.com/
Windows Phone
One more thing
App Harbor
Azure done right git push appharbor master
thanks to• Maxim Tihobrazov• Mike Chaliy• Anatoliy Kolesnick• Anton Vnogradenko• Ivan Korneliuk• Aleksander Yegoroff• Andrey Kashcha• Andrey Kotenko• Andrey Kozhyn
31337
Questions?
@[email protected]://dotband.com