Chef + AWS + CodeIgniter        @_kennyk_
Me•   Co-authored Sparks•   Reactor Engineer•   Former Yahoo, Freelancing w/ Mozilla•   Closet Ops guy
Deployment Before• Collection of bash scripts• Not all installed software is known• Homebrew tools (Yahoo’s Taxi, Pogo, Et...
Now•   Capistrano•   Rubber•   Puppet•   Chef•   .. and a bunch more
Why Chef?• Integration with AWS and Rackspace• Extremely flexible• Platform-agnostic  – And linux-variant agnostic• Code s...
Any Downsides?• So flexible, so open-ended, big learning curve• 30-40 hours before you feel comfortable  – According to me...
But just imagine …• Your server stops taking requests• You don’t know why• You can  – Run one command that provisions a ne...
Uh yea, so what about        Heroku/Pagoda/PHP Fog?• Just my opinion• When they go down, so do you• You trust Heroku to ma...
Pre-reqs• You know a little something about AWS• You’re comfortable with the command line
Demo
By the Way• You can’t learn what you really need to know  in a 45 minute talk• In ruby  – Can still use it without knowing...
Chef Terms (the basics)•   Cookbooks•   Recipes•   Knife•   Roles•   Attributes•   Environments•   Data bags
Cookbooks• A module for installing and configuring a  software package  – PHP  – Apache2  – New Relic monitoring  – Your w...
Recipes• A component of each cookbook  – For Apache2     • mod_rewrite     • mod_php5     •…• Each cookbook has a default ...
Resources• Build in tools/building blocks for writing  recipes  – Need a symlink? Got that  – Need an apt package? Got tha...
Attributes• Cascading configuration settings that are used  by recipes  – What port does Apache listen on?  – What user do...
Roles (rolls)• Categories for your servers/nodes• In sophisticated setups  – Database server role  – Webapp role  – Load b...
Environments• Just a container/construct for different env  settings• Each node is assigned an environment on  creation• C...
Data bags• More settings, usually used for sensitive  settings  – Database passwords  – API keys  –…  – Settings which are...
Actual node• Has environment• Has run_list  – Usually set once on node creation  – Recipes  – Roles• Has chef-client insta...
Knife•   Command line tool to rule your world•   See what your nodes are up to•   Search, run remote commands•   Deploy at...
Hosted Chef• OpsCode is the central repository for your  configuration• Diagram next slide
Pushing settings•   knife cookbook upload [cookbook]•   knife role from file roles/webapp.json•   knife data bag from file...
More demo• Download a community cookbook• Execute in paralell
Thanks!• @_kennyk_• codefury.net• https://github.com/katzgrau/chef-ec2-  codeigniter-quickstart
Chef + AWS + CodeIgniter
Upcoming SlideShare
Loading in …5
×

Chef + AWS + CodeIgniter

1,636 views
1,461 views

Published on

0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,636
On SlideShare
0
From Embeds
0
Number of Embeds
64
Actions
Shares
0
Downloads
17
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

Chef + AWS + CodeIgniter

  1. 1. Chef + AWS + CodeIgniter @_kennyk_
  2. 2. Me• Co-authored Sparks• Reactor Engineer• Former Yahoo, Freelancing w/ Mozilla• Closet Ops guy
  3. 3. Deployment Before• Collection of bash scripts• Not all installed software is known• Homebrew tools (Yahoo’s Taxi, Pogo, Etsy’s Deployinator)• Didn’t integrate well with infrastructure – Provision new boxes? Probably not• Terrifying to edit once the guy who wrote it is gone
  4. 4. Now• Capistrano• Rubber• Puppet• Chef• .. and a bunch more
  5. 5. Why Chef?• Integration with AWS and Rackspace• Extremely flexible• Platform-agnostic – And linux-variant agnostic• Code sharing in the community• Very popular• Back by OpsCode, founded by former Amazon Ops guys
  6. 6. Any Downsides?• So flexible, so open-ended, big learning curve• 30-40 hours before you feel comfortable – According to me• You’ll rely on mostly blog posts to get your specific stack running – Or presentations like this
  7. 7. But just imagine …• Your server stops taking requests• You don’t know why• You can – Run one command that provisions a new box in AWS with your full stack and configuration – Run commands on all of your nodes at once
  8. 8. Uh yea, so what about Heroku/Pagoda/PHP Fog?• Just my opinion• When they go down, so do you• You trust Heroku to manage infrastructure intelligently with a black box• But sometimes they don’t, apparently – Heroku, June xx, whoops• Don’t be someone else’s bitch
  9. 9. Pre-reqs• You know a little something about AWS• You’re comfortable with the command line
  10. 10. Demo
  11. 11. By the Way• You can’t learn what you really need to know in a 45 minute talk• In ruby – Can still use it without knowing much
  12. 12. Chef Terms (the basics)• Cookbooks• Recipes• Knife• Roles• Attributes• Environments• Data bags
  13. 13. Cookbooks• A module for installing and configuring a software package – PHP – Apache2 – New Relic monitoring – Your webapp –…• A cookbook contains at least one recipe
  14. 14. Recipes• A component of each cookbook – For Apache2 • mod_rewrite • mod_php5 •…• Each cookbook has a default recipe
  15. 15. Resources• Build in tools/building blocks for writing recipes – Need a symlink? Got that – Need an apt package? Got that• http://wiki.opscode.com/display/chef/Resour ces
  16. 16. Attributes• Cascading configuration settings that are used by recipes – What port does Apache listen on? – What user does this process run as?• You can make anything a setting• Set them at the – Cookbook level (defaults) – Environment level (dev, staging, prod, w/e) – Any role level
  17. 17. Roles (rolls)• Categories for your servers/nodes• In sophisticated setups – Database server role – Webapp role – Load balancer role – Utility box role• A single server can play multiple roles – In dev, maybe one box plays all roles to save $
  18. 18. Environments• Just a container/construct for different env settings• Each node is assigned an environment on creation• Can be changed
  19. 19. Data bags• More settings, usually used for sensitive settings – Database passwords – API keys –… – Settings which aren’t strictly associated with a role or environment type• Can be encrypted
  20. 20. Actual node• Has environment• Has run_list – Usually set once on node creation – Recipes – Roles• Has chef-client installed – Pulls settings – Figures out what’s needed – Installs
  21. 21. Knife• Command line tool to rule your world• See what your nodes are up to• Search, run remote commands• Deploy at scale – 14,000 adserving nodes?• Executes in parallel
  22. 22. Hosted Chef• OpsCode is the central repository for your configuration• Diagram next slide
  23. 23. Pushing settings• knife cookbook upload [cookbook]• knife role from file roles/webapp.json• knife data bag from file webapp [path]• knife environment from file [path]
  24. 24. More demo• Download a community cookbook• Execute in paralell
  25. 25. Thanks!• @_kennyk_• codefury.net• https://github.com/katzgrau/chef-ec2- codeigniter-quickstart

×