Priming Your Teams For Microservice Deployment to the Cloud

69
Priming Your Teams for Microservice Deployment to the Cloud Matt Callanan linkedin.com/in/matthewcallanan @mcallana © 2015 Expedia, Inc. All rights reserved.

Transcript of Priming Your Teams For Microservice Deployment to the Cloud

Page 1: Priming Your Teams For Microservice Deployment to the Cloud

Priming  Your  Teams  for  Microservice  Deployment  to  the  Cloud

Matt  Callananlinkedin.com/in/matthewcallanan@mcallana

©  2015  Expedia,   Inc.  All  rights  reserved.

Page 2: Priming Your Teams For Microservice Deployment to the Cloud

How  Do  You  Create  A  Microservice  For  The  Cloud?

Page 3: Priming Your Teams For Microservice Deployment to the Cloud

Git Repo

Page 4: Priming Your Teams For Microservice Deployment to the Cloud

Working  Code  Base

Page 5: Priming Your Teams For Microservice Deployment to the Cloud

Basic  Test  Suite

Page 6: Priming Your Teams For Microservice Deployment to the Cloud

Immutable  Servers

Page 7: Priming Your Teams For Microservice Deployment to the Cloud

Infrastructure  As  Code

Page 8: Priming Your Teams For Microservice Deployment to the Cloud

Centralised Logging

Page 9: Priming Your Teams For Microservice Deployment to the Cloud

CentralisedMonitoring

Page 10: Priming Your Teams For Microservice Deployment to the Cloud

Chat  Notifications

Page 11: Priming Your Teams For Microservice Deployment to the Cloud

Load  Balancer

Page 12: Priming Your Teams For Microservice Deployment to the Cloud

CNAME

Page 13: Priming Your Teams For Microservice Deployment to the Cloud

Blue-­‐Green  Deploys

Page 14: Priming Your Teams For Microservice Deployment to the Cloud

Continuous  Delivery  Pipeline

Page 15: Priming Your Teams For Microservice Deployment to the Cloud

Phew!

Page 16: Priming Your Teams For Microservice Deployment to the Cloud

Opportunity  Cost:  Time  Value  of  Information

Page 17: Priming Your Teams For Microservice Deployment to the Cloud

“Primer”

Page 18: Priming Your Teams For Microservice Deployment to the Cloud

DevOps  Toolchain

Based on devops toolchain by dto solutions: http://www.slideshare.net/AnthonyShortland/dto-chefconf2012

Application

Infrastructure

Build Deploy

Source  Code  Repo

Artifact  Repo

Build  Console

Deployment  Console

Resource  Model

InfrastructureManager

Code

Config

Automation

Environment  Data

Automation

Config

Packages Images

Page 19: Priming Your Teams For Microservice Deployment to the Cloud

DevOps  Toolchain

Developer  Toolchain

Operations  Toolchain

Page 20: Priming Your Teams For Microservice Deployment to the Cloud

DevOps  Toolchain

Developer  Toolchain

Operations  Toolchain

Page 21: Priming Your Teams For Microservice Deployment to the Cloud

Dev  – Starting  from  Scratch

Single  page  app• Secured  with  LDAP• Choose:

– App  Name– Team  Name– Notifications  Email– HipChat Room– Technology

Build  triggers  remote  Jenkins  job• Benefits

– Easy  to  configure– Simple  API– Versioned  scripts– Centralised logs  /  results

Page 22: Priming Your Teams For Microservice Deployment to the Cloud

Dev  – App  Types

• dwsvc -­‐ Java  Dropwizard service• emr-­‐datapipeline -­‐ An  Elastic  MapReduce -­‐ Data  Pipeline  

service• spark-­‐streaming  -­‐ A  Spark  Streaming  App• expressjs -­‐ A  Node  application  that  uses  expressjs• php -­‐ A  PHP  application• python -­‐ A  Python   application• scalatra– Lightweight  Scala app  based  off  Sinatra• sinatra – Lightweight  Ruby  web  service  • springboot -­‐ A  SpringBoot service• storm-­‐topology  -­‐ A  storm  topology  service• ticker -­‐ A  Ticker  (trend  service)  application• webmvc-­‐ A  customer  facing  Brand  Expedia  Spring  MVC  

Web  application• grails -­‐ A  Groovy-­‐based  web  application  framework  for  JVM• AWS  Lambda  -­‐ Java  based  AWS  Lamda implementation

*each  app  type  has  it’s  own  GitHub repo  for  source,  issues,  etc

Page 23: Priming Your Teams For Microservice Deployment to the Cloud

Dev  – Generating  App  and  Pipeline

Jenkins  Job  – create-­‐new-­‐application• Creates  new  GitHub repo

Page 24: Priming Your Teams For Microservice Deployment to the Cloud

Dev  – Generating  App  and  Pipeline

Jenkins  Job  – create-­‐new-­‐application• Creates  new  GitHub repo

GitHub• Promote  open  source  model  for  teams• Use  pull  requests  as  mechanism  for  ensuring  

reviews  /  pairing• WebHooks for  devs to  tweak  workflows

Page 25: Priming Your Teams For Microservice Deployment to the Cloud

Dev  – Generating  App  and  Pipeline

Jenkins  Job  – create-­‐new-­‐application• Creates  new  GitHub repo• Copies  chosen  technology  template  and  

pushes  back  to  repo

Tech  Templates• Uses  latest  version  of  template• Replaces  app  names,  package  names,  etc

with  your  app  name• Simple  interface  – each  template  codebase  

has  clone.sh using  cp and  sed• Java-­‐based  templates  use  Maven  

Archetypes  to  generate  codebase• Easy  to  extend  and  fork

Page 26: Priming Your Teams For Microservice Deployment to the Cloud

Dev  – Generating  App  and  Pipeline

Jenkins  Job  – create-­‐new-­‐application• Creates  new  GitHub repo• Copies  chosen  technology  template  and  

pushes  back  to  repo• Generates  Continuous   Delivery  pipeline  in  

Jenkins

Jenkins• Generates  Jenkins  build  that  is  triggered  

by  commits  to  master  branch• Jenkins  config via  templated XML• Uses  standard  commands  for  target  

template  (mvn,  npm,  etc)• Uploads  zip  to  S3• Triggers  downstream  deploy  job  passing  

Git SHA

Page 27: Priming Your Teams For Microservice Deployment to the Cloud

Dev  – Generating  App  and  Pipeline

Jenkins  Job  – create-­‐new-­‐application• Creates  new  GitHub repo• Copies  chosen  technology  template  and  

pushes  back  to  repo• Generates  Continuous   Delivery  pipeline  in  

Jenkins• Sends  email  to  user  with  details  /  links

Page 28: Priming Your Teams For Microservice Deployment to the Cloud

DevOps  Toolchain

Developer  Toolchain

Operations  Toolchain

Page 29: Priming Your Teams For Microservice Deployment to the Cloud

DevOps  Toolchain

Developer  Toolchain

Operations  Toolchain

Page 30: Priming Your Teams For Microservice Deployment to the Cloud

Operations  Pipeline

• Immutable  Servers• Chef  Cookbooks• CloudFormation Templates• Deploy  to  immutable  servers  using  infrastructure  as  code  that  dev  and  ops  can  maintain

• Blue-­‐green  deploys• HipChat notifications  • Centralised logging  -­‐ Splunk• Centralisedmonitoring  -­‐ Hubble

Page 31: Priming Your Teams For Microservice Deployment to the Cloud

Chef  Cookbooks  and  Config

Page 32: Priming Your Teams For Microservice Deployment to the Cloud

Chef  Cookbooks  and  Config

roles/primer-­‐demo-­‐service.rb_______________________________________________________________________name "primer-demo-service"description "Webapp for primer-demo-service"run_list "recipe[s3curl]","recipe[primer-demo-service]"

override_attributes("java" => {

"jdk_name" => "jdk8_0_05",}

)

Page 33: Priming Your Teams For Microservice Deployment to the Cloud

Chef  Cookbooks  and  Config

cookbooks/primer-­‐demo-­‐service/recipes/default.rb_______________________________________________________________________

node.default[:springboot][:application_name] = 'primer-demo'node.default[:springboot][:role_name] = 'primer-demo-service'

include_recipe "expedia-platform::springboot"

Page 34: Priming Your Teams For Microservice Deployment to the Cloud

Chef  Cookbooks  and  Config

deployment_config/<env>/primer-­‐demo-­‐service/config.json{"instances":  {"min_count":  1,"max_count":  2,"auto_scale":  true,"zones":  {"us-­‐east-­‐1":  ["us-­‐east-­‐1d"],"us-­‐west-­‐2":  ["us-­‐west-­‐2c"]

},"destroy_old":  true,"removeOldFromElb":  true

},"app_type":  "springboot","app_port":  8080,"isactive_support":  {"enabled":  true,"file":  "/opt/primer-­‐demo-­‐service/active.txt"

},"source_repo":  ".../primer-­‐demo-­‐service.git","notify":  {"hipchat":  {"room":  "Demo  Room"},"email":  {"addresses":  ["[email protected]"]},"s3":  {"bucket":  "..."}

},"team":  "Exp-­‐Ops-­‐Wotif-­‐Tech-­‐Australia","prime_role":  "role-­‐prime-­‐web"

}

Page 35: Priming Your Teams For Microservice Deployment to the Cloud

Deploy  Build

Jenkins Chef  knife

AMI

Route53

ELBCloudFormation

ASG EC2  InstanceEC2  Instance

Page 36: Priming Your Teams For Microservice Deployment to the Cloud

Deployment  – Email  Notification

Page 37: Priming Your Teams For Microservice Deployment to the Cloud
Page 38: Priming Your Teams For Microservice Deployment to the Cloud

Blue-­‐Green  DeploysSafely  Releasing  Updates

Page 39: Priming Your Teams For Microservice Deployment to the Cloud

Separating  Deploy  &  Release

Deploy Test Release

Page 40: Priming Your Teams For Microservice Deployment to the Cloud

Blue  Green  Deploys  – Deploy

Page 41: Priming Your Teams For Microservice Deployment to the Cloud

Deploy

Page 42: Priming Your Teams For Microservice Deployment to the Cloud

Blue  Green  Deploys

Page 43: Priming Your Teams For Microservice Deployment to the Cloud

Release

Page 44: Priming Your Teams For Microservice Deployment to the Cloud

Blue  Green  Deploys  – Release

Page 45: Priming Your Teams For Microservice Deployment to the Cloud

Release  – Email  Notification

Page 46: Priming Your Teams For Microservice Deployment to the Cloud

HipChatNotifications

Page 47: Priming Your Teams For Microservice Deployment to the Cloud

Centralised Logging  – Splunk

Page 48: Priming Your Teams For Microservice Deployment to the Cloud

CentralisedMonitoring  &  Alerting

Page 49: Priming Your Teams For Microservice Deployment to the Cloud

Hubble  Dashboard

Page 50: Priming Your Teams For Microservice Deployment to the Cloud

Hubble  Dashboard  – Graphene

Page 51: Priming Your Teams For Microservice Deployment to the Cloud

Hopscotch  – Transparent  Traffic  Router

• Proxy  built  on  Nginx (similar  to  Netflix  Zuul)• expedia.com/xyz   -­‐>  xyz.expedia.com

• Faster  to  update  rules  than  Akamai  45min  turnaround• E.g.  Register  microservice  with  hopscotch  in  Singapore  (20%  of  traffic)  route  10%  of  

Singapore  traffic  to  cloud  app,  when  happy,  dial  up  to  100%,  then  roll  out  to  Europe  and  USA• Nice  way  to  move  traffic  out  of  data  centre into  AWS  with  no  customer  impact

Page 52: Priming Your Teams For Microservice Deployment to the Cloud

Primer  Cleanup

Page 53: Priming Your Teams For Microservice Deployment to the Cloud

Cleanup

• Deleting  project– Delete  Codebase  (Git repo),  Build

• Delete  Cloudformation stack• Delete  unused  cloudformation stacks  -­‐ ELB  request  count  1hr

Page 54: Priming Your Teams For Microservice Deployment to the Cloud

Cleanup  – Delete  the  Microservice

Page 55: Priming Your Teams For Microservice Deployment to the Cloud

Cleanup  – Email  Confirmation

Page 56: Priming Your Teams For Microservice Deployment to the Cloud

Cleanup  – Delete  Cloud  Formation  Stack

Page 57: Priming Your Teams For Microservice Deployment to the Cloud

Cleanup  – Auto  Deletion  of  Unused  Stack  in  Test  Environment

Page 58: Priming Your Teams For Microservice Deployment to the Cloud

Primer  2.0Docker on  Amazon  ECS

Page 59: Priming Your Teams For Microservice Deployment to the Cloud

DevOps  Toolchain  – Primer  2.0:  Docker on  Amazon  ECS

Inspired by devops toolchain by dto solutions: http://www.slideshare.net/AnthonyShortland/dto-chefconf2012

Application

Infrastructure

Build Deploy

Source  Code  Repo

Artifact  Repo

Build  Console

Deployment  Console

Resource  Model

InfrastructureManager

Code

Config

Automation

Environment  Data

Automation

Config

Packages Images

gzip AMI

git Jenkins JenkinsAmazon  S3 Chef CloudFormationDocker Registry

Docker image

JSON Amazon  ECS

Page 60: Priming Your Teams For Microservice Deployment to the Cloud

Primer  2.0  – Docker on  Amazon  ECS

• Using  Amazon  EC2  Container  Service  (ECS)• Deploy  Primer  applications  as  Docker containers  to  an  ECS  cluster• Deploys  take  7mins  (instead  of  30mins)• No  AMI  creation,  no  CloudFormation• Cost  Optimisation• Using  AWS  SDK:• Register  ECS  Container  Definition   -­‐>  Task  Definition  -­‐>  Service• Create  ELB• Create  CNAME

• Blue/Green  Deploys  with  Canary  service

Page 61: Priming Your Teams For Microservice Deployment to the Cloud

Primer  2.0  – Docker on  ECS

Test  Environment

Page 62: Priming Your Teams For Microservice Deployment to the Cloud

Primer  2.0  – Docker on  ECS

Production  Environment

Page 63: Priming Your Teams For Microservice Deployment to the Cloud

c3vis  – Open  Source

• c3vis:  “Cloud  Container  Cluster  Visualiser”• Visualises container  deploys  and  resource  utilization  on  Amazon  ECS  clusters

• Open  Source  Software  from  Expedia• github.com/ExpediaDotCom/c3vis

Page 64: Priming Your Teams For Microservice Deployment to the Cloud

Results

Page 65: Priming Your Teams For Microservice Deployment to the Cloud

Results

• 800  Primer  apps  and  growing• Culture  of  Experimentation– Freedom  of  choice– Keys  to  prod  – trust

• Enabling  Innovation– Open  Source  model   for  tool• visible• accessible• easy  to  contribute• “I  want  to  add  Grails  to  this  tool!”,  “Help  

yourself!”

• Lowering  Cost– Counters  the  cost  of  learning   legacy  

deployment  processes– Generate  microservice   without  thinking  

about  it

Page 66: Priming Your Teams For Microservice Deployment to the Cloud

Tips  &  TricksBuilding  Your  Own  “Primer”

Page 67: Priming Your Teams For Microservice Deployment to the Cloud

Tips  &  Tricks

• Don’t  “Lift  &  Shift”  your  monolith• Rethink  • Start  with  non-­‐critical  workflow  apps

• Don’t  need  to  start  heterogeneous  (i.e.  multiple  app  types)• Doesn't  need  to  be  in  the  cloud• Cloud  has  benefits  like  immutable   infrastructure,  scaling,  automation• But  can  do  the  same  thing  in  the  data  centre

• Small  interface• /isActive endpoint  for  LB  healthcheck• /buildInfo endpoint  for  version

• "Just  do  it"  attitude• Open  source  model  helped  spread  it  across  the  organisation

Page 68: Priming Your Teams For Microservice Deployment to the Cloud

Q  &  AThanks!

Any  Questions?

Matt  Callananlinkedin.com/in/matthewcallanan@mcallana

Page 69: Priming Your Teams For Microservice Deployment to the Cloud

Image  Attribution

Image

“Clock   Time  Lapse  Video  Download“  (https://youtu.be/NSuNpiW-­‐LwI)   by  LifeBloodMarketing is  licensed  under  “CC   Free  to  Use”

“Pipelines   descending  to  Inveruglas Power  Station”  (http://www.geograph.org.uk/photo/2214366) is  licensed  under  CC  BY  SA  2.0  (http://creativecommons.org/licenses/by-­‐sa/2.0/) /  Desaturated and  cropped from   original

“The  Future”  (https://flic.kr/p/26YCn1) by  Kristian  Bjornard is  licensed  under  CC  BY  SA  2.0  (https://creativecommons.org/licenses/by-­‐sa/2.0/)

“CTA  Loop   Junction”  (https://commons.wikimedia.org/wiki/File:CTA_loop_junction.jpg) by  Daniel  Schwen is  licensed  under  CC  BY  SA 3.0 (https://creativecommons.org/licenses/by-­‐sa/3.0/)

“Logging  operations  at  Millmoor Rig”  (http://bit.ly/1Nb20LS) by  Walter  Baxter is  licensed  under  CC  BY  SA  2.0  (https://creativecommons.org/licenses/by-­‐sa/2.0/)

“Traffic  Monitoring”  (https://commons.wikimedia.org/wiki/File:Traffic_Monitoring.JPG) by  Suryasuharman is  licensed  under  CC  BY  SA 3.0 (https://creativecommons.org/licenses/by-­‐sa/3.0/)

“DNS  logo”  (https://commons.wikimedia.org/wiki/File:DNS_logo.jpg) by  I  laramide I  is  licensed  under  CC  BY  SA 3.0 (https://creativecommons.org/licenses/by-­‐sa/3.0/)

“Light bulb  icon   tips”  (https://commons.wikimedia.org/wiki/File:Light_bulb_icon_tips.svg) by  YassineMrabet is  licensed  under  CC  BY  SA  4.0  (https://creativecommons.org/licenses/by-­‐sa/4.0/)

“Matrix-­‐code-­‐computer-­‐pc-­‐data”   (https://pixabay.com/en/matrix-­‐code-­‐computer-­‐pc-­‐data-­‐356024/)   by  Comfreak is  licensed  under   CC  ZERO (https://creativecommons.org/publicdomain/zero/1.0/)

“Sample-­‐color-­‐blue-­‐green”   (https://pixabay.com/en/sample-­‐color-­‐blue-­‐green-­‐rubber-­‐815141/ )   by  LyraBelacqua-­‐Sally is  licensed  under  CC  ZERO (https://creativecommons.org/publicdomain/zero/1.0/)

“Fashion-­‐wristwatch-­‐time”   (https://www.pexels.com/photo/fashion-­‐wristwatch-­‐time-­‐watch-­‐1252/) by  SplitShire.com is  licensed  under  CC  ZERO (https://creativecommons.org/publicdomain/zero/1.0/)

“Chat”   (https://openclipart.org/detail/129049/chat) by  Merlin2525 is  licensed  under  unlimited-­‐commercial-­‐use (https://openclipart.org/unlimited-­‐commercial-­‐use-­‐clipart)

“scales”   (https://openclipart.org/detail/24101/scales) by  scott_kirkwood is  licensed  under  unlimited-­‐commercial-­‐use (https://openclipart.org/unlimited-­‐commercial-­‐use-­‐clipart)

“Wooden   Bookcase”   (https://openclipart.org/detail/191463/wooden-­‐bookcase) by  sirgazil is  licensed  under  unlimited-­‐commercial-­‐use (https://openclipart.org/unlimited-­‐commercial-­‐use-­‐clipart)

“Compiz GIT  Repository”  (https://flic.kr/p/Ssras) by  -­‐=  Treviño  =-­‐ is  licensed  under  BY  NC   SA  2.0 (https://creativecommons.org/licenses/by-­‐nc-­‐sa/2.0)

“logs”   (https://flic.kr/p/9F8tjX) by  Rick  Payette is  licensed  under  CC  BY  NC ND  2.0  (https://creativecommons.org/licenses/by-­‐nc-­‐nd/2.0)

Docker logo  used  according  to  https://www.docker.com/brand-­‐guidelines