Upload
thibaud-gravrand
View
226
Download
10
Tags:
Embed Size (px)
Citation preview
Smarter Deployments withOctopus Deploy
Thibaud Gravrand
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
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 ?
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
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 !!
Octopus Deploy
• Developed by Paul Stovell since 2011
• Dedicated solution for Windows Platforms
• Heavily relies on nuget package software
Architecture
• Nuget Repository• Built-in or external
• Central Server• Relies on RavenDB
• Tentacles (slaves)
How does it work ?Broken down in 7 Steps
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
Asymetric Setup
BackEndBackEnd
FrontEndFrontEnd
DEV
BackEndBackEnd
FrontEndFrontEnd
PROD
BackEndBackEnd BackEndBackEnd
FrontEndFrontEndFrontEndFrontEnd
BackEndBackEnd
FrontEndFrontEnd
UAT
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
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
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
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
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
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
Example of Release Content
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
Deployment against Environments
BackEndBackEnd
FrontEndFrontEnd
DEV
BackEndBackEnd
FrontEndFrontEnd
PROD
BackEndBackEnd BackEndBackEnd
FrontEndFrontEndFrontEndFrontEnd
BackEndBackEnd
FrontEndFrontEnd
UAT
Deployment Patterns
• Rolling deployments
• Canary deployments
• Blue-green deployments
• Isolated Octopus Deploy servers
How to integrate into your buildpipeline ?
How to integrate into your build pipeline ?
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
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
Features - Last but not least
• Full Audit Log
• Strong REST API
• Nuget Repository
• Retention Policies
• Permission Model
• Lifecycle Management
• Azure Deployments
• Scheduled Deployments
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
Roadmap
• Linux Deployments through SSH
• Remote Delta Compression
• Offline Deployment
• Replace RavenDB with SQL Server
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.
Thank you !