implementing infrastructure as code configmgtcamp 2017

45
INFRASTRUCTURE AS CODE @cfgmgmtcamp

Upload: kief-morris

Post on 10-Apr-2017

258 views

Category:

Software


1 download

TRANSCRIPT

Page 1: Implementing Infrastructure as Code ConfigMgtCamp 2017

INFRASTRUCTURE

AS CODE

@cfgmgmtcamp

Page 2: Implementing Infrastructure as Code ConfigMgtCamp 2017

[email protected] Practice Lead (UK)

DevOps, Continuous Delivery, Agile Ops

Twitter: @kiefBook: http://oreil.ly/1JKIBVeSite: http://infrastructure-as-code.com

February 2017

Page 3: Implementing Infrastructure as Code ConfigMgtCamp 2017

SPEED

Page 4: Implementing Infrastructure as Code ConfigMgtCamp 2017

RISK

Page 5: Implementing Infrastructure as Code ConfigMgtCamp 2017

FASTER IS SAFER

http://bit.ly/2cQQSOk

Page 6: Implementing Infrastructure as Code ConfigMgtCamp 2017

RAPID

RESPONSIBLE

Page 7: Implementing Infrastructure as Code ConfigMgtCamp 2017

INFRASTRUCTURE

AS CODEApplying tools and practices from software engineering to managing infrastructure.

Page 8: Implementing Infrastructure as Code ConfigMgtCamp 2017

DEFINE SYSTEMS AS CODE

System design is:▪ Reusable▪ Consistent▪ Visible▪ Versioned

Page 9: Implementing Infrastructure as Code ConfigMgtCamp 2017

DYNAMIC INFRASTRUCTURE PLATFORMS

Compute StorageNetwork

Page 10: Implementing Infrastructure as Code ConfigMgtCamp 2017

DYNAMIC INFRASTRUCTURE PLATFORMS

Cloud (IaaS)

Virtual

PhysicalCompute Storage

Network

Page 11: Implementing Infrastructure as Code ConfigMgtCamp 2017

PROGRAMMABLE,ON-DEMAND

API

Page 12: Implementing Infrastructure as Code ConfigMgtCamp 2017

Cloud and automation

AWESOME!

Page 13: Implementing Infrastructure as Code ConfigMgtCamp 2017

Oh, no!

SERVER SPRAWL!

Page 14: Implementing Infrastructure as Code ConfigMgtCamp 2017

CONFIGURATION DRIFT

Servers start out identical

But changes accumulate over time

Page 15: Implementing Infrastructure as Code ConfigMgtCamp 2017

AUTOMATION FEAR CYCLE

Page 16: Implementing Infrastructure as Code ConfigMgtCamp 2017

AUTOMATION LAGThe longer it’s been since an automated process has run in the same context …

… the more work is needed to run it again

Page 17: Implementing Infrastructure as Code ConfigMgtCamp 2017

Apply small changes frequentlyrather than large batches infrequently

Page 18: Implementing Infrastructure as Code ConfigMgtCamp 2017

CONTINUOUSLY SYNCHRONIZE

Page 19: Implementing Infrastructure as Code ConfigMgtCamp 2017

OR CONTINUOUSLY REBUILD

Page 20: Implementing Infrastructure as Code ConfigMgtCamp 2017

DEVOOPSHow can we avoid damage from automated mistakes?

Page 21: Implementing Infrastructure as Code ConfigMgtCamp 2017

AUTOMATICALLY TEST EVERY CHANGE

Page 22: Implementing Infrastructure as Code ConfigMgtCamp 2017

PROMOTE CHANGES

TEST

SIT

PROD

QA

Page 23: Implementing Infrastructure as Code ConfigMgtCamp 2017

BUILD COMPLIANCE INTO THE PIPELINE

Humans focus on the implementation of the

pipeline and audit trailsUse the pipeline to continuously validate operational requirements and compliance, and to implement controls

Page 24: Implementing Infrastructure as Code ConfigMgtCamp 2017

INFRASTRUCTUREDESIGN PATTERNSOrganizing code for dynamic infrastructure

Page 25: Implementing Infrastructure as Code ConfigMgtCamp 2017

One definition,multiple

environments

our-project/main.tf

staging

production

Page 26: Implementing Infrastructure as Code ConfigMgtCamp 2017

INFRASTRUCTURE DESIGN PRINCIPLEStructure your code to minimize risks for making (small, frequent) changes

Page 27: Implementing Infrastructure as Code ConfigMgtCamp 2017

our-project/staging/main.tf

staging

production

our-project/production/main.tf

One definition per environment

Page 28: Implementing Infrastructure as Code ConfigMgtCamp 2017

our-project/main.tf

staging

production

development

Single definition template,promoted across environments

Page 29: Implementing Infrastructure as Code ConfigMgtCamp 2017

How do we build and test this stuff?It runs sooooo sloooooow! L

Page 30: Implementing Infrastructure as Code ConfigMgtCamp 2017

Nginx Cookbook

ORGANIZE INFRASTRUCTURE INTO SEPARATELY TESTABLE PIECES

Tomcat Cookbook

JDK Cookbook

MyApp Vhost Cookbook

MyApp.war

Application Server

WebServer

Page 31: Implementing Infrastructure as Code ConfigMgtCamp 2017

FAN-IN PIPELINES

TEST TOMCAT

COOKBOOK

TEST MYAPP CODE

TEST JDK COOKBOOK

TEST APP SERVER

TEST MYAPP DEPLOYMENT

Test components individually

Cumulatively integrate and test components together

Page 32: Implementing Infrastructure as Code ConfigMgtCamp 2017

DESIGNING FOR CHANGECope with growth, evolving requirements, expanding teams

Page 33: Implementing Infrastructure as Code ConfigMgtCamp 2017

DESIGN TO ENABLE FREQUENT CHANGES

Split infrastructure according to the scope of typical

changes

Minimize the risk of changes by limiting

the blast radius

Keep infrastructure units loosely

coupled

Page 34: Implementing Infrastructure as Code ConfigMgtCamp 2017

ALIGN INFRASTRUCTURE DESIGN WITH ORGANIZATION STRUCTURE

Page 35: Implementing Infrastructure as Code ConfigMgtCamp 2017

WHERE SHOULD WE

SPLIT?

Page 36: Implementing Infrastructure as Code ConfigMgtCamp 2017

WHERE SHOULD WE

SPLIT?

Page 37: Implementing Infrastructure as Code ConfigMgtCamp 2017

Split infrastructure in

ways that reduce the friction for

making changes

Page 38: Implementing Infrastructure as Code ConfigMgtCamp 2017

SHARINGHow can teams share their stuff?

Page 39: Implementing Infrastructure as Code ConfigMgtCamp 2017

LIBRARY PATTERN FOR INFRATested server

imagesBUILD TEST

BUILD TEST PROD

BUILD TEST PROD

Server image pipeline

Application environment pipelines

Page 40: Implementing Infrastructure as Code ConfigMgtCamp 2017

DECOUPLED CHANGE PIPELINESApplication A with its environment

TESTBUILD

Application B

TESTBUILD

Application C

TESTBUILD

QA PROD

QA PROD

QA PROD

Page 41: Implementing Infrastructure as Code ConfigMgtCamp 2017

HANDLING DEPENDENCIES

TESTBUILD QA PROD

TESTBUILD QA PROD

Self-service test instances

Consumer Driven Contract

(CDC) Tests

Mocks,stubs, and

fakes

Page 42: Implementing Infrastructure as Code ConfigMgtCamp 2017

CYCLE TIMEMeasure and optimize the elapsed time from identifying a need to satisfying it

Page 43: Implementing Infrastructure as Code ConfigMgtCamp 2017

SOME ACTIVITIES TO MEASURERebuild (Recover)

New environment

Update existing environments

Introducing a new tech stack

Page 44: Implementing Infrastructure as Code ConfigMgtCamp 2017

SOME OTHER BOOKS

Page 45: Implementing Infrastructure as Code ConfigMgtCamp 2017

Book: http://oreil.ly/1JKIBVeSite: http://infrastructure-as-code.comTwitter: @kief

[email protected] Practice Lead (UK)

DevOps, Continuous Delivery, Agile Ops