29
Smarter Deployments with Octopus Deploy Thibaud Gravrand

Smarter deployments with octopus deploy

Embed Size (px)

Citation preview

Page 1: Smarter deployments with octopus deploy

Smarter Deployments withOctopus Deploy

Thibaud Gravrand

Page 2: Smarter deployments with octopus deploy

Thibaud Gravrand

• .Net Developer for 7 years

• R&D Manager for Netsize, a Gemalto Company

• http://fr.linkedin.com/in/tgravrand

• https://twitter.com/dolomitt

Page 3: Smarter deployments with octopus deploy

How did we deploy before ?

• Let’s go for a simple xcopy – why should I need more than that ?

• Some zips here and there

• Attempt of deployment from CI ?

Page 4: Smarter deployments with octopus deploy

But there are inconvenients

• I think my script will not work in production but let’s try !

• When did we release the last version ?

• I think we did not deliver the same version…

• I forgot one dll, I’ll just add it quickly without being noticed

Page 5: Smarter deployments with octopus deploy

Let’s write down how we like ourdeployments• Should be a repeatable process

• Should be fully automated

• Should support strong versioning

• Should tackle complex distributed deployments

• Should not forget what we did, who did it and when

• Should take care of development and production environments

• Should allow responsabilities split between teams

• Should be fast !!

Page 6: Smarter deployments with octopus deploy

Octopus Deploy

• Developed by Paul Stovell since 2011

• Dedicated solution for Windows Platforms

• Heavily relies on nuget package software

Page 7: Smarter deployments with octopus deploy

Architecture

• Nuget Repository• Built-in or external

• Central Server• Relies on RavenDB

• Tentacles (slaves)

Page 8: Smarter deployments with octopus deploy

How does it work ?Broken down in 7 Steps

Page 9: Smarter deployments with octopus deploy

Step 1 – Declare Environment

• Declare Machines

• Associate Environment and Role

• Typical Environments• DEV, INT, QA, STAGE, UAT, PREPROD, PROD

• Typical Roles• Front End, Back End FrontEndFrontEnd

BackEndBackEnd

Page 10: Smarter deployments with octopus deploy

Asymetric Setup

BackEndBackEnd

FrontEndFrontEnd

DEV

BackEndBackEnd

FrontEndFrontEnd

PROD

BackEndBackEnd BackEndBackEnd

FrontEndFrontEndFrontEndFrontEnd

BackEndBackEnd

FrontEndFrontEnd

UAT

Page 11: Smarter deployments with octopus deploy

Step 2 - Create Package of your application

• Simply add OctoPack Nuget Package to your projects

• Publish Package to Nuget Repository• Either built-in or external Nuget Repo

• Typically pushed from TeamCity, Jenkins and other CI

• Supported types of projects• Web Application• Windows Service• Windows Executable

Page 12: Smarter deployments with octopus deploy

Step 3 – Create Project in Octopus Deploy

• Describe your project quickly

• Define Versioning Policy• Arbitrary & Incremental

• From Main Nuget Package Version

• Define Deployment Policy• Copy missing or all packages to tentacles

Page 13: Smarter deployments with octopus deploy

Step 4 – Create Deployment Process

• Describe each step of deployment for your application / solution

• Heavily relies on Powershell 2.0

• Steps can be :• Setup IIS Site• Run executable• Run Powershell Script• Customize Configuration• Approval Flow (Email)

• Steps can be run in parallel

Page 14: Smarter deployments with octopus deploy

Step 5 – Define Variables

• Describe variables for each environment

• Variables are associated to scopes and will be evaluated at deploymenttime

• Configuration Files will be transformed according to variable values

• Scopes can be linked to :• Environment• Machine• Step number

Page 15: Smarter deployments with octopus deploy

Example of Variable Definitions

Variable Value Scope

DatabaseServer dev028db DEV

DatabaseServer qa028db QA

DatabaseServer Prod028db1 PROD;Machine1

DatabaseServer Prod028db2 PROD;Machine2

DNS dev.octopus.com DEV

DNS qa.octopus.com QA

DNS www1.octopus.com PROD;Machine1

DNS www2.octopus.com PROD;Machine2

Page 16: Smarter deployments with octopus deploy

Step 6 – Create Release

• Creating a release will make a snapshot of :• Variables

• Steps

• Powershell Scripts

• Package References

• Release can be based on several nupkg files

Page 17: Smarter deployments with octopus deploy

Example of Release Content

Page 18: Smarter deployments with octopus deploy

Step 7 – Deploy Release

• Choose a release

• Choose an environment

• Deploy !

• Each step is being executed sequentially

• Configuration Files are being transformed• Web.Config Transform Feature similar to Visual Studio

• Key Value Replacement

Page 19: Smarter deployments with octopus deploy

Deployment against Environments

BackEndBackEnd

FrontEndFrontEnd

DEV

BackEndBackEnd

FrontEndFrontEnd

PROD

BackEndBackEnd BackEndBackEnd

FrontEndFrontEndFrontEndFrontEnd

BackEndBackEnd

FrontEndFrontEnd

UAT

Page 20: Smarter deployments with octopus deploy

Deployment Patterns

• Rolling deployments

• Canary deployments

• Blue-green deployments

• Isolated Octopus Deploy servers

Page 21: Smarter deployments with octopus deploy

How to integrate into your buildpipeline ?

Page 22: Smarter deployments with octopus deploy

How to integrate into your build pipeline ?

Page 23: Smarter deployments with octopus deploy

Flavor of Continuous Delivery

Build Run Unit Tests Deploy to DEVRun Sanity

CheckPromote to

INT

Run Full Integration

TestsPromote to QA

Run ManualTests

Promote to PROD

Page 24: Smarter deployments with octopus deploy

Some drawbacks

• Manual Rollbacks

• One instance of a project on a tentacle client

• Packages limited to 10 megabytes

• Might be difficult to handle exotic configuration files

Page 25: Smarter deployments with octopus deploy

Features - Last but not least

• Full Audit Log

• Strong REST API

• Nuget Repository

• Retention Policies

• Permission Model

• Lifecycle Management

• Azure Deployments

• Scheduled Deployments

Page 26: Smarter deployments with octopus deploy

Advanced Scenarios

• Let’s talk to Nagios or OP/5 to tell them I’m updating some services

• Let’s deploy in PCI-DSS environments

Page 27: Smarter deployments with octopus deploy

Roadmap

• Linux Deployments through SSH

• Remote Delta Compression

• Offline Deployment

• Replace RavenDB with SQL Server

Page 28: Smarter deployments with octopus deploy

Resources

• https://demo.octopusdeploy.com/app

• DotNetRocks, episode 1002: Interview with Paul about OctopusDeploy.

• DotNetRocks, episode 966: Nick discusses structured logging, with an overview of Octopus at the start.

• Herding Code, episode 143: Paul Stack discusses continuousintegration, and mentions Octopus at 20:23. Scott talks about hisexperiences with Octopus.

Page 29: Smarter deployments with octopus deploy

Thank you !