Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Bebox – Convention over configuration for puppe...

Jairo Diaz
September 08, 2014

Bebox – Convention over configuration for puppet repositories

Bebox helps automating the provisioning of environments in which Ruby on Rails applications run, making easy to create new server setups every time.
Bebox’s main concern is the structure. It is generally a good idea to have conventions about how different source code files are placed and named and be able to use this to reduce the details required to understand a project while also providing automation in key places. These conventions may include things like: how to write puppet modules, how to integrate them into the projects, a directory structure for the projects, how to have a replicated “development/test” environment into virtual machines, etc.

Jairo Diaz

September 08, 2014
Tweet

More Decks by Jairo Diaz

Other Decks in Programming

Transcript

  1. Bebox   Conven'on  over  Configura'on  for  Puppet   Jairo  Diaz

      @codescrum       London  Ruby  User  Group   Sep  2014   Jairo  Diaz  -­‐  @codescrum  
  2. Problem  Context   Deployment  Repository   (Puppet  codebase)    

      Applica'on  Code  base   (Ruby  on  Rails  code  base)   Local  /  Vagrant  /  Development   Environment   Staging  Environment   Produc'on  Environment   Jairo  Diaz  -­‐  @codescrum  
  3. Bebox  helps  to  organise  this  repos     Deployment  Repository

      (Puppet  codebase)       Applica'on  Code  base   (Ruby  on  Rails  code  base)   Local  /  Vagrant  /  Development   Environment   Staging  Environment   Produc'on  Environment   Bebox   Generator   Jairo  Diaz  -­‐  @codescrum  
  4. Project:  Simple-­‐App   Environment:  Vagrant   Node:  node1-­‐dev    

      Bebox  Basic  Concepts   Step  0   Step  1   Step  2   Step  3   Environment:  Staging   Node:  node1-­‐stg       Step  0   Step  1   Step  2   Step  3   Environment:  Produc'on   Node:  node1-­‐prod       Step  0   Step  1   Step  2   Step  3   Jairo  Diaz  -­‐  @codescrum  
  5. Bebox  Commands  (1)   •  Install  with:     – gem

     install  bebox   •  Create  new  project  with:     – bebox  new  PROJECT_NAME   •  Create  nodes  with:   – bebox  node  new    -­‐-­‐environment=vagrant   •  Prepare  nodes  with:   – bebox  prepare   Jairo  Diaz  -­‐  @codescrum  
  6. Puppet  Roles  and  Profiles  Pa[ern   Roles:  Business  Logic  

    Example:   Database  server   Profiles:  Implementa'on   Example:   Accounts  Server   Examples:   PostgreSQL  or   MySQL   Components:  Resource  modeling   Resources   Hiera:   Data   Example:   Ubuntu  packages       Examples:   Db  passwords,   Dns  names   Jairo  Diaz  -­‐  @codescrum  
  7. Bebox  Node  Configura'on  Steps     Step  0   • 

    Add  ‘Puppet’  User     Step  1   •  Add  more  Users     Step  2   •  Add  the  Services     Step  3   •  Add  Security   Jairo  Diaz  -­‐  @codescrum  
  8. Bebox  Commands  (2)   •  Create  profiles  &  roles  with:

      – bebox  profile  new   – bebox    role  new   •  Link  nodes  -­‐>  roles  -­‐>  profiles  with:   – bebox  role  add_profile   – bebox  node  set_role   – bebox  role  list_profiles   •  Provision  nodes  execu'ng  all  the  steps  with:   – bebox  apply  -­‐-­‐all     Jairo  Diaz  -­‐  @codescrum  
  9. Built  with   •  Git-­‐Like  Interface  Command  Line  Parser  

    – h[p://github.com/davetron5000/gli     •  Capistrano   – h[p://github.com/capistrano/capistrano     •  Vagrant   – h[p://github.com/mitchellh/vagrant     •  Puppet   – h[p://github.com/puppetlabs/puppet     Jairo  Diaz  -­‐  @codescrum  
  10. Examples   •  Example  Deployment  Repositor   –  Video  tutorial:

      h[p://www.youtube.com/watch?v=mioeMsuKJr4     –  h[p://github.com/codescrum/bebox-­‐sample-­‐puppet-­‐ generated-­‐repo   •  Example  Applica'on   –  h[p://github.com/codescrum/sample-­‐rails-­‐app-­‐for-­‐ bebox   •  Bebox  gem  source  code   –  h[p://github.com/codescrum/bebox     Jairo  Diaz  -­‐  @codescrum