Your SlideShare is downloading. ×
What is Chef and how we use it at tripsta
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.

Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

What is Chef and how we use it at tripsta


Published on

Short intro what is Chef and how we used in our company: tripsta!

Short intro what is Chef and how we used in our company: tripsta!

Published in: Technology, Self Improvement
No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

No notes for slide


  • 1. What is Chef....and how we use it at
  • 2. Who am I? Giedrius Rimkus LithuanianPHP Developer at tripsta Ruby enthusiast Basketball lover @giedriusr
  • 3. Ill be talking about.. Sentiments Pain Solution
  • 4. Back in 2009..
  • 5. Infrastructure Application
  • 6. Infrastructure Application
  • 7. Infrastructure Application Application Database
  • 8. Infrastructure Application Application Application Database
  • 9. Infrastructure Application Application Application Application Database Application
  • 10. Infrastructure Application Application Application Application Database Application API API LB LB
  • 11. Complexity
  • 12. Pain○ Long installation process○ Hard maintenance○ Scaling issues○ Constantly increased load and usage of resources (no load balancer)
  • 13. Solution
  • 14. CLUSTER
  • 16. What is a Cluster?Its a group of linked computers, workingtogether closely thus in many respects forminga single computer.
  • 17. Cluster categoriesHigh-availability (HA) clustersHigh-availability clusters (also known as failover cluster) are implementedprimarily for the purpose of improving the availability of services that thecluster provides. Load-balancing clustersLoad-balancing is when multiple computers are linked together to sharecomputational workload or function as a single virtual computer. Logically,from the user side, they are multiple machines, but function as a singlevirtual machine. Compute clustersSomes times called as a “Grid computing”. Basically used for calculating hugestats, etc.
  • 18. HOW TO BUILD IT?
  • 19. OR
  • 20. What is Chef? What problem does it solve?Chef is an open-source systems integrationframework built specifically for automatingthe cloud / system configuration. 
  • 21. Chef typesChef Solo Chef client and Chef server Hosted Chef Private Chef
  • 22. Chef an open source standalone version of Chefthat runs locally on your node, detached froma Chef server.
  • 23. Chef Client and Chef ServerChef-client connects to a Chef Server to be told what todo on the node.
  • 24. Hosted ChefAs with Chef-Server, Chef-client connects to Hosted Chefto be told what to do on the local node.
  • 25. Private for Enterprises who want the power, flexibility,availability, and performance of Hosted Chef, but requirethat information never leave their private networks.
  • 26. Why its an issue?Infrastructure changes all the time.Different operating systemsDifferent hardware from different vendors.
  • 27. What exactly can you do with Chef?● Install Operating Systems on new servers. ● Install application software on servers. ● Have new software automatically configure itself to match your environment. ● Share recipes (and obtain recipes from) other people to install and configure software.
  • 28. Some goodies I like about Chef"Manage your servers by writing code,not by running commands." Chef is idempotent Built on top of Ruby  
  • 29. Chef Server Architecture
  • 30. Architecture visualization
  • 31. Basic structure of ChefEnvironmentsNodesCookbooksRecipesFiles / TemplatesAttributesData BagsSearch
  • 32. What is what?What is recipe?What is cookbook?What is resource?What is node?What is chef-client?What is knife?What is data bag?What is template?
  • 33. Modeling yourinfrastructure
  • 34. NodesA node is a host that runs the Chef client. Theprimary features of a node, from Chefs pointof view, are its attributes and its run list.Nodes are the thing that Recipes and Roles areapplied to.
  • 35. RolesA role means grouping similar features ofsimilar nodes.
  • 36. Run listA list of recipes that a node will run.
  • 37. Configuring Nodes
  • 38. CookbooksA cookbook is a collection of recipe, resourcedefinition, attribute, library, cookbook fileand template files that chef uses to configurea system. Cookbooks are typically groupedaround configuring a single package or service. The MySQL cookbook, for example, containsrecipes for both client and server.
  • 39. RecipesRecipes are the files where you write yourresources (code).
  • 40. Another examplechef/cookbooks/git/recipes/default.rbpackage "git-core"# apt-get install git-core# yum install git-core# etc..
  • 41. Another exampledirectory "/home/new_folder" do mode 0755 owner "someuser" group "www" action :createend
  • 42. MetadataCookbooks often rely on other cookbooks forpre-requisite functionality. In order for theserver to know which cookbooks to ship to aclient, a cookbook that depends on anotherone needs to express that dependencysomewhere. That "somewhere" is in cookbookmetadata.
  • 43. ResourcesA resource is usually a cross platformabstraction of the thing youre configuring onthe host. Chefs resources are mostly just containers fordata, with some basic validation functionality.
  • 44. ResourcesHave a typeHave a nameHave parametersTake action to put the resource in thedeclared state
  • 45. Type
  • 46. Name
  • 47. Parameters
  • 48. Action
  • 49. ProvidersThe provider is the platform-specificimplementation of the thing a resourceabstracts. On Red Hat or CentOS - yumDebian and Ubuntu - apt package manager willbe used
  • 50. SearchSearch is built by the Chef Server, and allowyou to query arbitrary data about yourinfrastructure
  • 51. Data BagsData Bags store nested key–value data on thechef server. Data Bag data are searchable, andcan also be loaded directly by name in arecipe. Data Bags are global for your chef-server installation–you can think of them asattributes for your whole infrastructure.
  • 52. EnvironmentsProvides a mechanism for managing differentarchitectural segmented spaces such asproduction, staging, development, andtesting, etc with one Chef setup.
  • 53. Chef Workflow
  • 54. Everyday Chef Workflow for developers
  • 55. Developer makes changes to Chef recipes, roles, etc.
  • 56. Developer pushes changes to origin Chef repository
  • 57. Developer uses Knife to push new code to the Chef Server
  • 58. Developer uses Knife to tell Chef-clients to update themselves
  • 59. Chef-client on Chef nodes contact the Chef Server
  • 60. Chef-client pulls latest code from the Chef Server
  • 61. Chef-client on the node updates the system
  • 62. Practical example
  • 63. Update authorized_keys$ cat cookbooks/bootstrap/files/default/authorized_keys$ echo ssh-rsa dev4-public-key >> !$
  • 64. Committing and pushing $ git diffgit add .git commit -m adding new public keygit push
  • 65. Updating Chef Serverbundle exec knife cookbook upload bootstrapcap configure:allorssh root@$ chef-client
  • 66. How Chef helped us?
  • 67. We dont care that much aboutInfrastructure changes all the time Scalability, because..- adding new nodes is painless- its fast (takes minutes or hours, not days or weeks)- there is no need in buying more machines with everynew website
  • 68. Clear separation between serverswith roles: FrontendBackendApplicationMemcachedDatabaseother..
  • 69. Chef requirementsChef-client is supported on the following platforms ● Ubuntu (10.04, 10.10, 11.04, 11.10) ● Debian (5.0, 6.0) ● RHEL & CentOS (5.x, 6.x) ● Fedora 10+ ● Mac OS X (10.4, 10.5, 10.6, 10.7) ● Windows 7 ● Windows Server 2003 R2, 2008 R2 RubyRuby 1.8.7, 1.9.1 or 1.9.2 with SSL bindings is required. RubyGemsVersion 1.3.7 or greater. On Ubuntu and Debian Rubygems should be installedfrom source Git?
  • 70. Parts I didnt cover- Setting up and running chef-server / chef-client- Shef- Knife plugins- Chef + capistrano- All the rest Chef goodies
  • 71. Chef Alternatives● Puppet● Sprinkle● Rubber● Sunzi
  • 72. Great resources
  • 73. Thank You