$30 off During Our Annual Pro Sale. View Details »

Chef: Why you should automate your web infrastructure by Kate Heddleston

PyCon 2013
March 17, 2013

Chef: Why you should automate your web infrastructure by Kate Heddleston

PyCon 2013

March 17, 2013
Tweet

More Decks by PyCon 2013

Other Decks in Technology

Transcript

  1. Chef: Why you should
    automate your web
    infrastructure.

    View Slide

  2. Hi I'm Kate Heddleston
    @heddle317
    [email protected]
    https://github.com/heddle317/django-chef-application

    View Slide

  3. Here's what I'm going to talk to you
    about.
    ● Why you should automate your web
    infrastructure.
    ● What is Chef?
    ● How to use Chef to set-up a python/Django
    project.

    View Slide

  4. A Programmer's Better Best Friend

    View Slide

  5. Why you should automate your web
    infrastructure.
    ● All of your configuration information is in one
    place (and that place isn't someone's head)
    ● You can spin up perfectly configured servers
    instantly!
    ● You can change things in one place and
    have them propagate through your entire
    system
    ● You can create dev and test environments
    that are exact replicas of production.

    View Slide

  6. View Slide

  7. LB
    FE
    AS
    AS
    DB
    slave
    sentry
    nagios
    graph
    FE
    FE

    View Slide

  8. View Slide

  9. FE
    AS
    DB
    FE
    AS
    DB

    View Slide

  10. PostgreSQL
    Celery
    NginX
    Rabbit
    MQ
    Python

    View Slide

  11. What is Chef?
    "Reality-based automation for the cloud."
    "Infrastructure as code."
    "A global view of your system as opposed to a
    local one."

    View Slide

  12. Terminology

    View Slide

  13. Chef Server
    ● central storage for all your chef configuraions
    ● stores all your git repo stuff as structured data in json
    ● uses couchDB for storage and querying
    ● Hosted Chef free for up to 5 nodes - then you should
    host it yourself
    Chef Server

    View Slide

  14. Knife
    Command line tool to interface between your local code
    repo and your Chef Server

    View Slide

  15. Nodes
    servers in your system
    LB
    FE FE
    FE

    View Slide

  16. Roles
    ● A nice way of abstracting what a node does and what
    should be installed on it. I.e. a webserver role vs. a
    database role
    ● run_list of installations
    ● Can talk about other machines in your infrastructure by
    their role; open up firewalls to front-end servers
    ● You can query roles

    View Slide

  17. Cookbooks
    ● The base unit of configuration, so you would have a
    cookbook for nginx, postgres, gunicorn, etc.

    View Slide

  18. Recipes
    ● ruby programs that get run when installing that
    cookbook

    View Slide

  19. Chef Server

    View Slide

  20. Chef Server
    Hosting Provider
    knife
    knife
    plugin

    View Slide

  21. View Slide

  22. knife cookbook site download nginx
    ohai
    postgresql
    gunicorn
    git
    python
    screen

    View Slide

  23. View Slide

  24. Chef Server
    knife cookbook upload django-application

    View Slide

  25. View Slide

  26. Chef Server
    knife role from file webserver.json

    View Slide

  27. What exactly happens when I run this
    command?
    knife rackspace server create -r 'role[webserver]' -N
    chef.myserver.org -S chef.myserver.org -f 3 -I 125

    View Slide

  28. Hosting
    Provider
    chef-client
    knife
    rackspace...
    chef bootstrap

    View Slide

  29. Go see console output!

    View Slide

  30. ● You really, really, really, really should use
    something for server configuration
    ● Getting started with your Django server
    ○ https://github.com/heddle317/django-chef-application
    To sum it all up...

    View Slide

  31. Other tools like Chef
    ● Heroku
    ○ "Like having two full-time dev ops people on your
    team."
    ● Puppet
    ○ http://bitfieldconsulting.com/puppet-vs-chef
    ● Salt
    ○ this one is in python, but it's new

    View Slide

  32. No developers were harmed in the
    making of this presentation...
    John Lynn
    Robert MacCloy
    Adam DePue
    Hearsay Social

    View Slide

  33. Links to particularly interesting
    articles I found while making this
    presentation
    ● http://version2beta.com/articles/dev-
    environments-with-vagrant-chef-and-git/
    ● http://devopsanywhere.blogspot.
    com/2011/10/puppet-vs-chef-fight.html
    ● http://en.wikipedia.
    org/wiki/Comparison_of_open_source_confi
    guration_management_software

    View Slide

  34. Questions?
    You can also find me in the hallways
    OR
    At the Hearsay Social beer bash:
    6-8pm at David's
    5151 Stars and Stripes Dr.

    View Slide