STRESS FREE DEPLOYMENTS WITH OCTOPUS DEPLOY PRESENTED BY
STRESS FREE DEPLOYMENTS WITH OCTOPUS DEPLOY PRESENTED BY ANDY SCHWAM
ANDY SCHWAM • Microsoft MVP Since 2010 • Visual Studio and Development Technologies • ASPInsider • Manager of Custom Application Development @ Global Indemnity • I like to code! • I like Dev. Ops! • I don’t like dealing with problems
WWW. TECHBASH. COM
OCTOPUS DEPLOY • From Octopus. Deploy. com: • “Octopus is a friendly deployment automation tool for. NET developers. ” • “Octopus works with your build server to enable reliable, secure, automated releases of ASP. NET applications and Windows Services into test, staging and production environments, whether they are in the cloud or on-premises. ” • “You already have a source control server and a build server. Octopus doesn't replace them; it takes over where they finish off. Build/CI servers are great at compiling code and running tests. Octopus is great at taking the built artifacts, and configuring and distributing them to all the machines and environments that they need to run in. ” • Yes, they have a free version
WHAT OCTOPUS DOES/DOESN'T TO Doesn't Does • Build/Compile • Deploy • Test • Configure • Package • Retain • Add features to your application • Logs • Dashboard
WHY ARE AUTOMATED DEPLOYMENTS IMPORTANT? • Do you like dealing with problems after a deployment? • Adds a lot of stress • Time consuming • • We (humans, developers) make mistakes Less Error Prone Take Less Time Easier • Set up automation as soon as you create your new project.
DEPLOY ANYTHING- DEGREES OF “EASINESS” Ridiculously Easy Web Applications Very Easy Windows Services *in other words, do anything : ) Virtual Directories ? ? Power. Shell*
INSTALLATION • Install Octopus Deploy Server • Install Tentacles – deployment agents on target machines
PREPARATION • Here is what I did prior to this demo: • Created a VS Solution/Web Application • Added my solution to Source Control – TFS • Set up a Continuous Integration build in TFS • The build pushes packages into Octopus • NOTE: My Laptop = Octopus Server, all tentacles and “servers”
FIRST DEMO • Let’s see how easy it is to use Octopus • Create new Octopus Project
ENVIRONMENTS AND TARGETS Sys. Test QA UAT Production Systest 1 QA 1 UAT 1 Prod 1 UAT 2 Prod 3
MACHINE ROLES • Define the “usage” of a server. • Important because not every app goes to every server • External Web Apps • External Web Services • Internal Web Apps • Intranet • App. Server • We need to re-think our current roles
ENVIRONMENTS, TARGETS AND ROLES Sys. Test QA UAT Production Systest 1 QA 1 UAT 1 Prod 1 • Intranet • Public. Sites • Services • Intranet • Public. Sites • Services • Intranet UAT 2 Prod 2 • Intranet • Public. Sites • Services • Public. Sites • Services Prod 3 • Public. Sites • Services
RE-USE MACHINE Sys. Test QA 1 QA UAT Production QA 1 UAT 1 Prod 1 UAT 2 Prod 3
PROJECTS • Octopus Project != Visual Studio Project • A deployment process, which specifies the steps that need to happen in a given order during the deployment • Variables, which allow deployments to be parameterized across environments Process • Update Database • Deploy Backend Services • Deploy Web Application • Send Email Variables • DB Connection = "abc" (QA) • DB Connection = "xyz" (Prod)
DEMO • . config Files • Variables
VARIABLES • Scope • Environment • Role • Target • Step • Channel • Sensitive variables
CONFIGURATION FILES • Uses variables defined in Octopus • *. config: • app. Settings, application. Settings, connection strings automatically replaced • Others can be done too. • Config Transforms
LIFECYCLES FULL QA-PROD • Sys. Test • QA • Production • UAT • Production • Faux
SOME ADDITIONAL FEATURES • Scheduled Deployments • Email • Scripts
TFS BUILD INTEGRATION Publishing Packages to Octopus is easy too… Use TFS or some other Build system • Prior to TFS 2015: • Add Octo. Pack via Nuget to your app • Set MSBuild Args in your build configuration • TFS 2015/2017: • Add a Package Application step • Add a Push Packages to Octopus step
TRIGGER OCTOPACK FROM TFS < 2013
MORE FEATURES • Build Number Sync • Create Release Automatically • Deploy to Target Automatically • Retention Policy
DATABASE DEPLOYMENTS • Use DB UP • Create console app • Set db connection string • Add Nuget package: Db. Up • Update Program. cs • Add Deploy. ps 1
CHANNELS • Allows for deployment of same project using different Lifecycles • Version Rules to enforce usage of correct Channel • Normal releases • Hotfixes • Channel Scope can be used for Variables and Steps
DEMO - HOTFIXES • Create a Hotfix build • for Hotfix Branch • Use "-hotfix" for Package Step and Push Step • Create Hotfix Lifecycle • Channels: • Default pre-release tag: ^$ • Hotfix pre-release tag: hotfix
RUNNING SCRIPTS • Scripts in Packages • Pre. Deploy. <ext> • Post. Deploy. <ext> • Deploy. Failed. <ext> • Scripts in Package Steps • Standalone Scripts • Variables, Parameters, Logging, Output Variables
DEMO…
MORE • • • Step Templates Guided Failures Scheduled Deployments Automatic Release Creation Automatic Deployment Triggers Dashboard • Project Groups • Security – Teams, Roles, etc • Among other things…You can define who can deploy apps to each environment
THANKS • Any Questions? • andy@ingenuitynow. net • www. schwammysays. net • @schwammy
MORE • The following slides never made it into the presentation
DEPLOYMENT TARGETS • Listening Tentacle • Polling Tentacle (sometimes needed to work around firewall issues) • Offline Package Drop (machines that don’t run Tentacle) • SSH Connection (for Linux) • Cloud Region (deploy to Azure)
PACKAGES • Only binaries and files needed at runtime are included – no source code • Nu. Get Packages • Use Octo. Pack or VSTS extension • Octopus 3. 3 supports Zip Packages • Octopus 3. 5 supports Docker Images
RELEASES AND DEPLOYMENTS • A release is a snapshot of the process and variables. • Releases are deployed to Environments
DEPLOYMENT - PROJECT • Define the Steps for the deployment • Web Deploy • Update Database • Run a script • Send Email • Manual Intervention • Steps can be scoped to environment, machine, etc.
ACCESS TO PRODUCTION • Custom Security Roles • Developers can’t deploy to Production • Sys Admins can deploy to Production • Developers can create variables for Production • Sys Admins mark variables sensitive
- Slides: 38