• Like
  • Save
What is Chef and how we use it at tripsta
Upcoming SlideShare
Loading in...5
×
 

What is Chef and how we use it at tripsta

on

  • 1,953 views

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!

Statistics

Views

Total Views
1,953
Views on SlideShare
1,944
Embed Views
9

Actions

Likes
1
Downloads
23
Comments
2

2 Embeds 9

http://www.linkedin.com 7
https://www.linkedin.com 2

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel

12 of 2

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    What is Chef and how we use it at tripsta What is Chef and how we use it at tripsta Presentation Transcript

    • What is Chef....and how we use it at
    • Who am I? Giedrius Rimkus LithuanianPHP Developer at tripsta Ruby enthusiast Basketball lover @giedriusr
    • Ill be talking about.. Sentiments Pain Solution
    • Back in 2009..
    • Infrastructure Application
    • Infrastructure Application
    • Infrastructure Application Application Database
    • Infrastructure Application Application Application Database
    • Infrastructure Application Application Application Application Database Application
    • Infrastructure Application Application Application Application Database Application API API LB LB
    • Complexity
    • Pain○ Long installation process○ Hard maintenance○ Scaling issues○ Constantly increased load and usage of resources (no load balancer)
    • Solution
    • CLUSTER
    • WTH IS CLUSTER?
    • What is a Cluster?Its a group of linked computers, workingtogether closely thus in many respects forminga single computer.
    • 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.
    • HOW TO BUILD IT?
    • OR
    • What is Chef? What problem does it solve?Chef is an open-source systems integrationframework built specifically for automatingthe cloud / system configuration. 
    • Chef typesChef Solo Chef client and Chef server Hosted Chef Private Chef
    • Chef Solo....is an open source standalone version of Chefthat runs locally on your node, detached froma Chef server.
    • Chef Client and Chef ServerChef-client connects to a Chef Server to be told what todo on the node.
    • Hosted ChefAs with Chef-Server, Chef-client connects to Hosted Chefto be told what to do on the local node.
    • Private Chef....is for Enterprises who want the power, flexibility,availability, and performance of Hosted Chef, but requirethat information never leave their private networks.
    • Why its an issue?Infrastructure changes all the time.Different operating systemsDifferent hardware from different vendors.
    • 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.
    • Some goodies I like about Chef"Manage your servers by writing code,not by running commands." Chef is idempotent Built on top of Ruby  
    • Chef Server Architecture
    • Architecture visualization
    • Basic structure of ChefEnvironmentsNodesCookbooksRecipesFiles / TemplatesAttributesData BagsSearch
    • 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?
    • Modeling yourinfrastructure
    • 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.
    • RolesA role means grouping similar features ofsimilar nodes.
    • Run listA list of recipes that a node will run.
    • Configuring Nodes
    • 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.
    • RecipesRecipes are the files where you write yourresources (code).
    • Another examplechef/cookbooks/git/recipes/default.rbpackage "git-core"# apt-get install git-core# yum install git-core# etc..
    • Another exampledirectory "/home/new_folder" do mode 0755 owner "someuser" group "www" action :createend
    • 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.
    • 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.
    • ResourcesHave a typeHave a nameHave parametersTake action to put the resource in thedeclared state
    • Type
    • Name
    • Parameters
    • Action
    • ProvidersThe provider is the platform-specificimplementation of the thing a resourceabstracts. On Red Hat or CentOS - yumDebian and Ubuntu - apt package manager willbe used
    • SearchSearch is built by the Chef Server, and allowyou to query arbitrary data about yourinfrastructure
    • 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.
    • EnvironmentsProvides a mechanism for managing differentarchitectural segmented spaces such asproduction, staging, development, andtesting, etc with one Chef setup.
    • Chef Workflow
    • Everyday Chef Workflow for developers
    • Developer makes changes to Chef recipes, roles, etc.
    • Developer pushes changes to origin Chef repository
    • Developer uses Knife to push new code to the Chef Server
    • Developer uses Knife to tell Chef-clients to update themselves
    • Chef-client on Chef nodes contact the Chef Server
    • Chef-client pulls latest code from the Chef Server
    • Chef-client on the node updates the system
    • Practical example
    • Update authorized_keys$ cat cookbooks/bootstrap/files/default/authorized_keys$ echo ssh-rsa dev4-public-key >> !$
    • Committing and pushing $ git diffgit add .git commit -m adding new public keygit push
    • Updating Chef Serverbundle exec knife cookbook upload bootstrapcap configure:allorssh root@127.0.0.1$ chef-client
    • How Chef helped us?
    • 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
    • Clear separation between serverswith roles: FrontendBackendApplicationMemcachedDatabaseother..
    • 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?
    • Parts I didnt cover- Setting up and running chef-server / chef-client- Shef- Knife plugins- Chef + capistrano- All the rest Chef goodies
    • Chef Alternatives● Puppet● Sprinkle● Rubber● Sunzi
    • Great resourceshttps://github.com/opscode/cookbookshttp://wiki.opscode.com/display/chef/Homehttp://railscasts.com/episodes/339-chef-solo-basicshttps://github.com/ctshryock/capistrano-chef
    • Thank You