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

Chef OpsWorks

ProdOps
April 10, 2013

Chef OpsWorks

A new service from Amazon called OpsWorks sets a much simpler application management in the cloud.

Learn how to use OpsWorks to deploy your applications, customize the Chef cookbooks to better fit your needs, and re-use OpsWorks in a non-AWS environment.

The talk includes a short introduction to the Cloud, OpsCode Chef, a feature review of AWS OpsWorks, and finally an example of how OpsWorks can be customized in different ways by using attributes or even writing your own cookbooks.

Hebrew dubbing available at http://bit.ly/chef-opsworks-video

ProdOps

April 10, 2013
Tweet

More Decks by ProdOps

Other Decks in Technology

Transcript

  1. Chef &
    OpsWorks
    in the cloud

    View full-size slide

  2. Evgeny Zislis
    about.me/kesor

    View full-size slide

  3. Infrastructure in the Cloud
    IaaS vs. PaaS
    Chef
    AWS OpsWorks

    View full-size slide

  4. Peter
    A programmer
    works at Initech
    writes code for
    "The App"
    ... devops heroes

    View full-size slide

  5. PRISM.app
    a mobile app tracking movement and
    activity. for all humans in the world.

    View full-size slide

  6. Likes
    writing code
    design patterns
    the Integrated Development Environment aka. IDE
    Dislikes
    reading manual pages
    troubleshooting
    configuration files
    lifting heavy things
    managing services and packages
    software deployments
    ... devops heroes

    View full-size slide



  7. things developers say ...
    I don't do system related tasks,
    especially not in production.
    - Developer
    can someone
    else do it this
    time please?
    pretty please?

    View full-size slide



  8. more things developers say ...
    - The same Developer
    Give me full control, or else when things
    go wrong, I am powerless to fix it.
    just change me this wheel on my
    motorcycle five minutes before
    my jump, it will be okay ...

    View full-size slide

  9. Infrastructure
    http://www.flickr.com/photos/mrfrosted/278847814/

    View full-size slide

  10. Infrastructure,
    everyone needs one.
    http://www.flickr.com/photos/mrfrosted/278847814/
    server
    operating system
    database
    cache / shared memory
    network

    View full-size slide

  11. Bill
    ... devops heroes
    The Boss
    works at Initech
    Gov. Contracting
    wants "PRISM.app"
    deployed A.S.A.P

    View full-size slide

  12. I finished writing the code!
    Server room
    Servers
    Racks
    Labor
    Electricity & AC
    Configuration
    Deployment
    $150,000,000
    + 16 months
    ... devops heroes
    When can our
    customer
    start paying?
    Oh, we probably need
    a couple more things ...
    Oh, oh, and I almost forgot.
    Ahh, I'm also gonna need you
    to go ahead and come in on
    Sunday, too...

    View full-size slide

  13. Houston we have a
    problem.
    TPS report not found.

    View full-size slide

  14. ... devops heroes
    use the
    Cloud
    the what?
    who are you?
    I'm Joana, ... the fairy godmother, ... ahh,
    never mind me. Just use the Cloud Luke,
    err.. Peter.

    View full-size slide

  15. http://www.flickr.com/photos/21644167@N04/3897234326/
    The Cloud

    View full-size slide

  16. http://www.flickr.com/photos/21644167@N04/3897234326/
    The Cloud
    rapid provision api
    pay per use
    self maintained
    resilient & distributed
    diverse

    View full-size slide

  17. Cloud Jargon
    ... as a service
    IaaS
    Infrastructure
    PaaS
    Platform
    SaaS
    Software

    View full-size slide

  18. IaaS vs. PaaS
    complex
    painful
    do it yourself
    total freedom
    total freedom
    cheaper
    better performance
    simple
    comfortable
    someone else "did it"
    constraints
    conventions
    expensive
    so-so performance

    View full-size slide

  19. What would you
    choose?
    IaaS PaaS
    lets see examples ...

    View full-size slide

  20. Microsoft
    IaaS vs. PaaS
    Microsoft
    Windows Azure
    "Virtual Machines"
    Microsoft
    Windows Azure
    "Web Sites"
    everything works
    git push to deploy
    infrastructure pain
    custom deploys
    has ActiveDirectory!
    http://www.windowsazure.com/

    View full-size slide

  21. Google
    IaaS vs. PaaS
    Google
    "Compute Engine"
    Google
    "App Engine"
    custom APIs
    lots of limitations
    lots of abilities
    includes:
    Java, Go, PHP, Python
    and much much more...
    no longer beta!
    Google I/O release
    per-minute billing
    http://cloud.google.com/

    View full-size slide

  22. less control
    more comfort
    Amazon AWS
    IaaS vs. PaaS
    AWS
    EC2
    AWS
    BeanStalk
    almost full control
    no comfort
    http://aws.amazon.com/
    AWS
    OpsWorks
    AWS
    CloudFormation

    View full-size slide

  23. AWS Elastic BeanStalk

    View full-size slide

  24. git push deploy
    lots of magic
    easy scalability
    many partners
    expensive
    poor performance
    IaaS vs. PaaS
    Salesforce
    Heroku
    http://www.heroku.com/
    I dont like "magic", give me more
    control! You say its slow and
    expensive? ... no no, it will not do.

    View full-size slide

  25. worthy mention

    View full-size slide

  26. ... devops heroes
    I can't deploy to a "platform"
    We will use servers in the Cloud!
    Just tell me when
    customers start paying!

    View full-size slide

  27. what a programmer has to actually do to use
    Servers in the (AWS) Cloud
    - For each world region
    - Define architecture (app+db+cache+stuff)
    - Select instance types and OS images (AMI)
    - Proper security groups (firewalls)
    - Generate SSH keys
    - Install packages
    - Configure services
    - Deploy application
    - Have a nervous breakdown
    - Repeat from start for each server
    - Profit!

    View full-size slide

  28. ... devops heroes
    That is a lot of work.
    So many things can go wrong ...

    View full-size slide

  29. ... devops heroes
    How do I do the same thing a
    hundred times without
    making mistakes?
    Chef, or Puppet, or
    CFEngine, or ... so
    many options.

    View full-size slide

  30. Automation
    http://www.flickr.com/photos/torek/3788181603/
    infoq.com/presentations/Infrastructure-as-Code
    #!/bin/sh
    NODES="webserver database"
    for n in $NODES
    do
    ssh $n uptime
    done

    View full-size slide

  31. Approaches to Cloud automation
    Gold Image
    Image for every server type
    All software pre-installed
    Few moving parts
    Fast boot

    View full-size slide

  32. Approaches to Cloud automation
    Scripted
    One image to rule them all
    Smallest common denominator
    Acquires configuration on start
    Install & config. during boot to fit
    role
    All parts moving
    Slower boot
    Gold Image
    Image for every server type
    All software pre-installed
    Few moving parts
    Fast boot

    View full-size slide

  33. http://zeroturnaround.com/labs/rebel-labs-release-it-ops-devops-productivity-report-2013/

    View full-size slide

  34. http://zeroturnaround.com/labs/rebel-labs-release-it-ops-devops-productivity-report-2013/

    View full-size slide

  35. open source
    configures servers
    cookbooks & recipes
    ruby dsl

    View full-size slide

  36. $ sudo chef-solo -c solo.rb -j solo.json
    Starting Chef Client, version 11.4.0
    Compiling Cookbooks...
    Converging 3 resources
    Recipe: redis::default
    * package[redis-server] action upgrade (up to date)
    * service[redis-server] action nothing (up to date)
    * template[/etc/redis/redis.conf] action create (up to date)
    Chef Client finished, 0 resources updated

    View full-size slide

  37. running chef-solo
    $ chef-solo -c solo.rb -j solo.json
    ...
    solo.rb
    cookbook_path "cookbooks"
    solo.json
    {
    "redis": { "bind": "0.0.0.0" },
    "run_list": "recipe[redis]"
    }

    View full-size slide

  38. redis cookbook
    cookbooks/redis/recipes/default.rb
    package "redis-server" do
    action :upgrade
    end
    service "redis-server" do
    action :nothing
    supports status: true, restart: true
    end
    template "/etc/redis/redis.conf" do
    source "redis.conf.erb"
    owner "root"
    mode "0644"
    variables({ bind: node[:redis][:bind] })
    notifies :restart, "service[redis-server]"
    end
    1. cookbook/redis/attributes/default.rb
    2. solo.json

    View full-size slide

  39. redis cookbook
    cookbooks/redis/attributes/default.rb
    default[:redis][:bind] = "127.0.0.1"
    cookbooks/redis/templates/default/redis.conf.erb
    ...
    # If you want you can bind a single interface, if the bind option is not
    # specified all the interfaces will listen for incoming connections.
    bind <%= @bind %>
    ...

    View full-size slide

  40. $ sudo chef-solo -c solo.rb -j solo.json
    Starting Chef Client, version 11.4.0
    Compiling Cookbooks...
    Converging 3 resources
    Recipe: redis::default
    * package[redis-server] action upgrade
    - upgrade package redis-server from uninstalled to 2:2.2.12-1build1
    * service[redis-server] action nothing (up to date)
    * template[/etc/redis/redis.conf] action create (up to date)
    Chef Client finished, 1 resources updated

    View full-size slide

  41. $ sudo chef-solo -c solo.rb -j solo.json
    Starting Chef Client, version 11.4.0
    Compiling Cookbooks...
    Converging 3 resources
    Recipe: redis::default
    * package[redis-server] action upgrade (up to date)
    * service[redis-server] action nothing (up to date)
    * template[/etc/redis/redis.conf] action create
    - update template[/etc/redis/redis.conf] from 81b4f1 to 8a6cec
    --- /etc/redis/redis.conf 2011-07-27 17:26:50.000000000 +0000
    +++ /tmp/chef-rendered-template20130406-2537-f8vlv6 2013-04-06 ...
    @@ -27,7 +27,7 @@
    # If you want you can bind a single interface, if the bind option is not
    # specified all the interfaces will listen for incoming connections.
    #
    -bind 127.0.0.1
    +bind 0.0.0.0
    # Specify the path for the unix socket that will be used to listen for
    # incoming connections. There is no default, so Redis will not listen
    * service[redis-server] action restart
    - restart service service[redis-server]
    Chef Client finished, 2 resources updated

    View full-size slide

  42. ... devops heroes
    Chef is great!
    But I need to automate
    servers to scale.
    I have some pretty
    graphs for you ...

    View full-size slide

  43. requests
    # of servers
    CPU aggregate
    http://techblog.netflix.com/2012/01/auto-scaling-in-amazon-cloud.html

    View full-size slide

  44. Scalarium AWS OpsWorks
    February 2013 - AWS OpsWorks: Flexible Application Management in the Cloud

    View full-size slide

  45. I had 'em stacks o' hay o' tha' bed ground when I was a little button,
    me Ma used ta' make me old Missouri featherbed with it.
    Stack - Layer - Instance - App

    View full-size slide

  46. Stack - Layer - Instance - App
    ● Install dependencies
    ● Update dependencies.
    ● Update cookbooks
    ● Execute recipes

    View full-size slide

  47. Stack - Layer - Instance - App

    View full-size slide

  48. Stack - Layer - Instance - App

    View full-size slide

  49. Stack - Layer - Instance - App
    Ganglia

    View full-size slide

  50. Chef recipes
    ○ available on GitHub as open-source
    ○ setup per different lifecycle events
    Stack - Layer - Instance - App

    View full-size slide

  51. Stack - Layer - Instance - App

    View full-size slide

  52. CloudWatch
    how many instances I have at the moment?

    View full-size slide

  53. Stack - Layer - Instance - App
    Metrics Dashboard

    View full-size slide

  54. Stack - Layer - Instance - App
    Auto-terminate!

    View full-size slide

  55. Stack - Layer - Instance - App

    View full-size slide

  56. Stack - Layer - Instance - App

    View full-size slide

  57. Stack - Layer - Instance - App

    View full-size slide

  58. Stack - Layer - Instance - App

    View full-size slide

  59. Stack - Layer - Instance - App

    View full-size slide

  60. Stack - Layer - Instance - App

    View full-size slide

  61. Stack - Layer - Instance - App

    View full-size slide

  62. More environments with a click!
    ... havin' a hat wi' three
    pointy corners.
    Development & Staging & Production
    Stack - Layer - Instance - App

    View full-size slide

  63. ... devops heroes
    Boss! We're done!
    It all works on its own.
    Show me the
    money!

    View full-size slide

  64. Infrastructure in the Cloud
    IaaS vs. PaaS
    Chef
    AWS OpsWorks

    View full-size slide

  65. Devops Israel
    www.devops.co.il

    View full-size slide

  66. http://www.flickr.com/photos/drachmann/327122302/

    View full-size slide

  67. take these slides offline
    bit.ly/chef-opsworks
    http://minifigures.lego.com/
    Cheerleaders are spastic!
    They stretch like elastic!

    View full-size slide

  68. http://www.jedi.be/blog/2010/11/27/from-dev-ops-to-devops-amazing-the-difference-one-character-makes/
    http://www.codinghorror.com/blog/2010/08/vampires-programmers-versus-werewolves-sysadmins.html
    Vampire
    Programmers
    Werewolf
    SysAdmins
    more about the battle of dev and ops

    View full-size slide