puppetizing multitier architecture - puppetconf 2014

47
2014 presented by Puppetizing Multi-Tier Architecture Reid Vandewiele Solutions Engineer | Puppet Labs

Upload: puppet-labs

Post on 22-Jun-2015

793 views

Category:

Technology


0 download

DESCRIPTION

Puppetizing Multitier Architecture - Reid Vandewiele, Puppet Labs

TRANSCRIPT

Page 1: Puppetizing Multitier Architecture - PuppetConf 2014

2014

presented by

Puppetizing Multi-Tier Architecture Reid Vandewiele Solutions Engineer | Puppet Labs

Page 2: Puppetizing Multitier Architecture - PuppetConf 2014
Page 3: Puppetizing Multitier Architecture - PuppetConf 2014
Page 4: Puppetizing Multitier Architecture - PuppetConf 2014

Monolithic Install Split Install

Page 5: Puppetizing Multitier Architecture - PuppetConf 2014

Monolithic Install Split Install

Page 6: Puppetizing Multitier Architecture - PuppetConf 2014
Page 7: Puppetizing Multitier Architecture - PuppetConf 2014
Page 8: Puppetizing Multitier Architecture - PuppetConf 2014

•  Introduction

Multi-Tier Challenges •  How to Define •  How to Classify •  How to Deploy

Agenda

Page 9: Puppetizing Multitier Architecture - PuppetConf 2014

Multi-Tier Challenges •  How to Define •  How to Classify •  How to Deploy

Page 10: Puppetizing Multitier Architecture - PuppetConf 2014
Page 11: Puppetizing Multitier Architecture - PuppetConf 2014
Page 12: Puppetizing Multitier Architecture - PuppetConf 2014
Page 13: Puppetizing Multitier Architecture - PuppetConf 2014
Page 14: Puppetizing Multitier Architecture - PuppetConf 2014
Page 15: Puppetizing Multitier Architecture - PuppetConf 2014

Profiles  

Page 16: Puppetizing Multitier Architecture - PuppetConf 2014
Page 17: Puppetizing Multitier Architecture - PuppetConf 2014
Page 18: Puppetizing Multitier Architecture - PuppetConf 2014
Page 19: Puppetizing Multitier Architecture - PuppetConf 2014
Page 20: Puppetizing Multitier Architecture - PuppetConf 2014
Page 21: Puppetizing Multitier Architecture - PuppetConf 2014

class  puppet_enterprise  (      $interface,      ...  )  {            ##  REPRESENT  THIS      #      #          #        #        #        #        #        #        #        #      }  

Page 22: Puppetizing Multitier Architecture - PuppetConf 2014
Page 23: Puppetizing Multitier Architecture - PuppetConf 2014
Page 24: Puppetizing Multitier Architecture - PuppetConf 2014

Application Classes class  pe  (      $puppetdb_port  =  8081,      ...  )  {  }                                                                    class  pe::puppet_master  (                                      $puppetdb_port  =  $pe::puppetdb_host,                                      ...                                  )  inherits  pe  {  ...  }    

                           class  pe::puppetdb  (                                  $puppetdb_port  =  $pe::puppetdb_host,                                  ...                              )  inherits  pe  {  ...  }  

Page 25: Puppetizing Multitier Architecture - PuppetConf 2014

Application Class class  pe  (      $puppet_master_host                  =  undef,      $puppet_master_port                  =  undef,          $puppet_console_host                =  undef,      $puppet_console_port                =  undef,          $puppetdb_database_host          =  undef,      $puppetdb_database_port          =  undef,      $puppetdb_database_name          =  undef,      $puppetdb_database_username  =  undef,      $puppetdb_database_password  =  undef,      ...  )  {  ...  

Page 26: Puppetizing Multitier Architecture - PuppetConf 2014

Application Component Profile class  pe::puppet_master  (      $certificate_authority_host    =  $pe::certificate_authority_host,      $certificate_authority_port    =  $pe::certificate_authority_port,      $certificate_authority_proxy  =  true,          $puppetdb_host                              =  $pe::puppetdb_host,      $puppetdb_port                              =  $pe::puppetdb_port,          $console_host                                =  $pe::puppet_console_host,      $console_port                                =  $pe::puppet_console_port          $reports                                          =  undef,      $node_terminus                              =  undef,  )  inherits  pe  {  ...  

Page 27: Puppetizing Multitier Architecture - PuppetConf 2014

•  Model the Application

•  Dynamism / Elasticity

Accomplished

Not Yet Accomplished

Page 28: Puppetizing Multitier Architecture - PuppetConf 2014

?

Page 29: Puppetizing Multitier Architecture - PuppetConf 2014

Pool_member  <<|  filter  |>>      pool_member  {  'master_1':  }  pool_member  {  'master_2':  }  

@@pool_member  {  'master_1':  }  

@@pool_member{  'master_2':  }  

storeconfigs

Page 30: Puppetizing Multitier Architecture - PuppetConf 2014

storeconfigs

class  pe::load_balancer  (      ...  )  inherits  pe  {        Pool_member  <<|  filter  |>>        ...    }  

class  pe::puppet_master  (      ...  )  inherits  pe  {        @@pool_member  {  $::ipaddress:  }        ...    }  

Page 31: Puppetizing Multitier Architecture - PuppetConf 2014
Page 32: Puppetizing Multitier Architecture - PuppetConf 2014

clientcert=www1

app_pubkey=

ensure keypair!

clientcert=www1

app_pubkey=abc12

3

ensure keypair!

Page 33: Puppetizing Multitier Architecture - PuppetConf 2014

Multi-Tier Challenges •  How to Define •  How to Classify •  How to Deploy

Page 34: Puppetizing Multitier Architecture - PuppetConf 2014

A  collec+on  of  "things"  (objects  or  numbers,  etc).    Each  member  is  called  an  element  of  the  set.    There  should  be  only  one  of  each  member  (all  members  are  unique).  

Set  

Page 35: Puppetizing Multitier Architecture - PuppetConf 2014

Evaluation Order Matters

class  {  'pe':  instance_id  =>  'central';  }  class  {  'pe::puppet_master':  }    

class  {  'pe::puppet_master':  }  class  {  'pe':  instance_id  =>  'central';  }    

•  Works

•  Breaks

Page 36: Puppetizing Multitier Architecture - PuppetConf 2014

Hiera -­‐-­‐-­‐  :hierarchy:      -­‐  "clientcert/%{clientcert}"      -­‐  "app_instance/%{app_instance}"      -­‐  "env_tier/%{env_tier}"      -­‐  global      :backends:      -­‐  yaml      :yaml:      :datadir:  "/etc/puppetlabs/puppet/environments/%{environment}/data"  

Page 37: Puppetizing Multitier Architecture - PuppetConf 2014

Hiera All  Managed  Nodes  

env_tier=development   env_tier=production  

appid=prod1   appid=prod2  appid=dev1   appid=dev2  

Page 38: Puppetizing Multitier Architecture - PuppetConf 2014

Application Class class  pe  (      $puppet_master_host                  =  undef,      $puppet_master_port                  =  undef,          $puppet_console_host                =  undef,      $puppet_console_port                =  undef,          $puppetdb_database_host          =  undef,      $puppetdb_database_port          =  undef,      $puppetdb_database_name          =  undef,      $puppetdb_database_username  =  undef,      $puppetdb_database_password  =  undef,      ...  )  {  ...  

Page 39: Puppetizing Multitier Architecture - PuppetConf 2014

Application Class class  pe  (      $puppet_master_host                  =  $::puppet_master_host  ,      $puppet_master_port                  =  $::puppet_master_port  ,          $puppet_console_host                =  $::puppet_console_host,      $puppet_console_port                =  $::puppet_console_port  ,          $puppetdb_database_host          =  $::puppetdb_database_host,      $puppetdb_database_port          =  $::puppetdb_database_port,      $puppetdb_database_name          =  $::puppetdb_database_name,      $puppetdb_database_username  =  $::puppetdb_database_username,      $puppetdb_database_password  =  $::puppetdb_database_password,      ...  )  {  ...  

Page 40: Puppetizing Multitier Architecture - PuppetConf 2014

Multi-Tier Challenges •  How to Define •  How to Classify •  How to Deploy

Page 41: Puppetizing Multitier Architecture - PuppetConf 2014
Page 42: Puppetizing Multitier Architecture - PuppetConf 2014

2 1

Run Puppet!

Run Puppet!

Page 43: Puppetizing Multitier Architecture - PuppetConf 2014

Run Puppet!

Run Puppet!

Run Puppet!

Run Puppet!

1 2 3 4

Page 44: Puppetizing Multitier Architecture - PuppetConf 2014

Multi-Tier Challenges •  How to Define •  How to Classify •  How to Deploy

Puppetizing Multi-Tier Architecture

Page 45: Puppetizing Multitier Architecture - PuppetConf 2014

Anchors class  pe  (      ...  )  {        #  ANCHORS      #  When  building  a  complex  multi-­‐tier  model,  it  is  not  known  up  front  which      #  profiles  will  be  deployed  to  a  given  node.  However,  some  profiles  when      #  deployed  together  have  dependencies  which  must  be  expressed.  For  example,      #  the  CA  must  be  set  up  and  configured  before  certificates  can  be  requested.      #  Therefore  the  CA  must  be  configured  before  any  certificate-­‐requiring      #  service.  Since  the  profiles  cannot  express  those  dependencies  directly      #  against  each  other,  since  they  may  or  may  not  exist  in  a  given  node's      #  catalog,  we  instead  have  them  express  dependencies  against  common  anchors.          anchor  {  'barrier:  pe  certificate_authority':  }  -­‐>      anchor  {  'barrier:  pe  puppetdb_database':          }  -­‐>      anchor  {  'barrier:  pe  puppetdb':                            }  -­‐>      ...    

Page 46: Puppetizing Multitier Architecture - PuppetConf 2014

•  Model the app as a class –  Most important consideration is the interface

•  Assign parameters to app, not just nodes –  Complementary to the assignment of classes to nodes

•  Take central control of Puppet run schedule –  Or else account for eventual consistency

Puppetizing Multi-Tier Architecture

Page 47: Puppetizing Multitier Architecture - PuppetConf 2014

Questions?