file -> new project to deploy in 10 minutes with teamcity and octopus deploy

36
FILE -> NEW PROJECT TO DEPLOY IN 10 MINUTES WITH TEAMCITY AND OCTOPUS DEPLOY (and PowerShell) London/NDC London Tomas Jansson 06/12/2013

Upload: tomas-jansson

Post on 13-May-2015

1.334 views

Category:

Technology


1 download

DESCRIPTION

Introduction to Octopus Deploy and TeamCity and why you should use it.

TRANSCRIPT

Page 1: File -> new project to deploy in 10 minutes with TeamCity and Octopus Deploy

FILE -> NEW PROJECT TO DEPLOY IN 10 MINUTES

WITH TEAMCITY AND OCTOPUS DEPLOY

(and PowerShell)

London/NDC London

Tomas Jansson

06/12/2013

Page 2: File -> new project to deploy in 10 minutes with TeamCity and Octopus Deploy

Tomas JanssonManager & .NET Group Lead BEKK OsloNorwegian .NET User Group

@[email protected]/mastojblog.tomasjansson.com

Page 3: File -> new project to deploy in 10 minutes with TeamCity and Octopus Deploy

My story

Page 4: File -> new project to deploy in 10 minutes with TeamCity and Octopus Deploy

What I didn’t see

I didn’t know

http://www.thewallpapers.org/photo/23036/Meadow-And-Trees.jpg

Page 5: File -> new project to deploy in 10 minutes with TeamCity and Octopus Deploy

One day I did the deploy

http://1.bp.blogspot.com/-AuV-3M279Yw/TvFwqK2SJFI/AAAAAAAAPss/avHyNeySJwU/s1600/recipes+002.JPG

Page 6: File -> new project to deploy in 10 minutes with TeamCity and Octopus Deploy

But the result!

http://th05.deviantart.net/fs34/PRE/f/2008/294/9/5/Messy_kid_by_Hollie32.jpg

Page 8: File -> new project to deploy in 10 minutes with TeamCity and Octopus Deploy
Page 10: File -> new project to deploy in 10 minutes with TeamCity and Octopus Deploy

WHAT I WANT YOU TO EXPERIENCE TODAY

Some tips and tricks for Teamcity

Experience Octopusdeploy

Get to appreciate PowerShell

Page 11: File -> new project to deploy in 10 minutes with TeamCity and Octopus Deploy
Page 12: File -> new project to deploy in 10 minutes with TeamCity and Octopus Deploy

WHY CONTINUOUS DEPLOYMENT?

Shorter time between releases smaller impact

New features faster happier customers and improved learning

Bug impact

Features

Automated deploy more time for development and happier developers

Time

Page 13: File -> new project to deploy in 10 minutes with TeamCity and Octopus Deploy

WHY CONTINUOUS DEPLOYMENT?

Shorter time between releases smaller impact

New features faster happier customers and improved learning

Bug impact

Money

Automated deploy more time for development

Time

Page 14: File -> new project to deploy in 10 minutes with TeamCity and Octopus Deploy

WHERE SHOULD I START?

Visualize what is needed for you to make a complete deployment

Build

(5 min)

Test

(5 min)

Provision server

(1 hr)

Deploy

(20 min)

Then ask the following questions:

• How often do I do each step during a day/week/month?

• Which step can I improve?

My guess is; build, test, deploy and last provision of server

Page 15: File -> new project to deploy in 10 minutes with TeamCity and Octopus Deploy

WHAT CAN I DO?

Smaller solutions

Decouple projects

Minimize DB-test/test setup

Minimize network traffic

Optimize code

Parallel testing

Build

Test

Clear artifacts

Automated deploy

Repetitive

Deploy

Klikk - eller drag and drop - for å sette inn bilde (merk at runde bilder passer best).Klikk - eller drag and drop - for å sette inn bilde (merk at runde bilder passer best).Klikk - eller drag and drop - for å sette inn bilde (merk at runde bilder passer best).

Page 16: File -> new project to deploy in 10 minutes with TeamCity and Octopus Deploy

Klikk - eller drag and drop - for å sette inn bilde

The Goal

Repetitive

One artifact

Automated

Page 17: File -> new project to deploy in 10 minutes with TeamCity and Octopus Deploy

CONCEPTUAL SETUP

Developers

VCS Build server

Deployment manager

Artifact repository

Dev

Test

Prod

Page 18: File -> new project to deploy in 10 minutes with TeamCity and Octopus Deploy

THE GOAL

Page 19: File -> new project to deploy in 10 minutes with TeamCity and Octopus Deploy

Tools

http://api.ning.com/files/wi*oWNYzff-TE0NdSZQIetMjtPWOTyiTLnYIS91gI2PE-zRWP1h2dBj79yb-nK0AghzWRpShzOmdbE9LsAnGLqa1M*u8zGMs/Swiss_Giant.jpg

Page 20: File -> new project to deploy in 10 minutes with TeamCity and Octopus Deploy

TEAMCITY

Continuous integration engine

JetBrains

Free for small teams

Page 21: File -> new project to deploy in 10 minutes with TeamCity and Octopus Deploy

KEY FEATURES: TEAMCITY

Templating

Dependencies

Build templateDeploy

template

Project XProject XProject XBuild Project XProject XProject XProject XDeploy Project

X

Deploy Project X

Build Project X

You can start using conventions for build and

deploy

Page 22: File -> new project to deploy in 10 minutes with TeamCity and Octopus Deploy

OCTOPUS DEPLOY

Automated deployment for .NET (Windows)

• Created by Paul Stovell (@paulstovell)

• Targeting .NET

• Currently in v 2.0 public beta

Page 23: File -> new project to deploy in 10 minutes with TeamCity and Octopus Deploy

NUGET & OCTOPUS DEPLOY

Page 24: File -> new project to deploy in 10 minutes with TeamCity and Octopus Deploy

NUGET & OCTOPUS DEPLOY

Pull deploy from v 2.0!

Page 25: File -> new project to deploy in 10 minutes with TeamCity and Octopus Deploy

Octopus deploy is eating their own dog

food since v 2.0.

Web application is using the public REST

API.

http://petcountrysupplies.co.uk/Dog%20Shop%20images/Dog%20Food/Dog%20Food.jpg

Page 26: File -> new project to deploy in 10 minutes with TeamCity and Octopus Deploy

OCTOPUS DEPLOY PROCESS

Pre deploy

Deploy

Post deploy

• PreDeploy.ps1

• Check environment

• Configure environment

• Copy files needed for deploy

• Deploy.ps1

• Run transformations of config files

• Octopus does IIS setup

• PostDeploy.ps1

• Delete files

• Clean up

PowerShell is the key to great success!

Page 27: File -> new project to deploy in 10 minutes with TeamCity and Octopus Deploy

OCTOPUS CONCEPTS

An environment contains one or many machines

Adding a machine is done in one place instead of in every project

Defines where to deploy

Multiple machines can have the same role in one environment deploy to multiple machines at once

Environments

Roles

Page 28: File -> new project to deploy in 10 minutes with TeamCity and Octopus Deploy

OCTOPUS CONCEPTS

A collection of projects

Map environment to project groups

Great if you have multiple customers

Definition of what to deploy

One project can multiple deploy steps

A step can:

• Deploy a NuGet package

• Run a PowerShell script

• Send an email

• Require manual intervention

• Deploy to Windows Azure

• Upload files by FTP

Variables can be configured per environment, role, machine and/or step

Project groups

Project

Page 29: File -> new project to deploy in 10 minutes with TeamCity and Octopus Deploy

OCTOPUS CONCEPTS

A definition of a release

Has a version number

Contains specific packages (version can differ from release version)

An actual deploy of a release

Release package

Deploy

Page 30: File -> new project to deploy in 10 minutes with TeamCity and Octopus Deploy

PowerShell

Page 31: File -> new project to deploy in 10 minutes with TeamCity and Octopus Deploy

GETTINGS STARTED WITH PROGRAMMING IIS IN POWERSHELL

> Import-Module WebAdministration> $iisAppPoolsPath = "IIS:\AppPools\MyAppPool"> New-Item $iisAppPoolsPath

Name State Applications---- ----- ------------MyAppPool Started

> $iisSitesPath = "IIS:\Sites\MySite"> New-Item $iisSitesPath -bindings @{protocol="http";bindingInformation="*:8321:*"} -physicalPath "c:\tmp"

Name ID State Physical Path Bindings---- -- ----- ------------- --------MySite 5 Stopped c:\tmp http *:8321:*

> Set-ItemProperty $iisSitesPath -name applicationPool -value "MyAppPool"> Start-Website "MySite"

Page 32: File -> new project to deploy in 10 minutes with TeamCity and Octopus Deploy

BETA Demo!

http://www.mrwallpaper.com/wallpapers/despicable-me-hitman-minion-1920x1080.jpg

Page 33: File -> new project to deploy in 10 minutes with TeamCity and Octopus Deploy

SUMMARY

• Continuous deployment doesn’t have to be hard

• The right tools will help you a long way (TeamCity and Octopus deploy)

• Learn PowerShell, it will make your life easier

Page 34: File -> new project to deploy in 10 minutes with TeamCity and Octopus Deploy

RESOURCES

Blog post about the setup: http://tinyurl.com/PowerOctoTeam

Octopus Deploy: http://www.octopusdeploy.com

TeamCity: http://www.jetbrains.com/teamcity/

OctoWebSetup GitHub project: https://github.com/mastoj/OctoWebSetup

OctoWebSetup NuGet download: https://nuget.org/packages/OctoWebSetup/

Octopusdeploy automation script: https://gist.github.com/mastoj/7746853

Page 35: File -> new project to deploy in 10 minutes with TeamCity and Octopus Deploy

Questions?

Page 36: File -> new project to deploy in 10 minutes with TeamCity and Octopus Deploy

Thank you!

@TomasJansson