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

Hackademy Devops

ProdOps
November 08, 2013
360

Hackademy Devops

Fast intro to Devops culture, tools and understanding for the students of http://hackademy.500tech.com/.

ProdOps

November 08, 2013
Tweet

Transcript

  1. devops
    wtf is devops

    View Slide

  2. Infrastructure in the Cloud
    IaaS vs. PaaS
    Chef very short
    WTF is … Devops

    View Slide

  3. Hi!
    I am Peter, a developer.
    ... devops heroes
    ... devops heroes

    View Slide

  4. I like
    writing code
    design patterns
    the Integrated Development Environment aka. IDE
    I like less...
    reading manual pages
    troubleshooting servers
    configuration files
    lifting heavy things
    managing services and packages
    software deployments
    ... devops heroes

    View Slide



  5. 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 Slide



  6. more things developers say ...
    - The same Developer
    Give me full control, or else when things go
    wrong, I am powerless to fix it.
    Just changed motorcycle wheels.
    I’ll jump anyway, it will be okay ...

    View Slide

  7. Infrastructure
    flickr.com/photos/mrfrosted/278847814/

    View Slide

  8. Infrastructure
    flickr.com/photos/mrfrosted/278847814/
    server
    operating system
    database
    cache / shared memory
    network

    View Slide

  9. I finished writing the code!
    Server room
    Servers
    Racks
    Labor
    Electricity & AC
    Configuration
    Deployment
    $150,000,000
    + 16 months
    When can our
    customers 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...
    ... devops heroes

    View Slide

  10. Houston we have a
    problem.
    TPS report not found.
    ... devops heroes

    View Slide

  11. 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.
    ... devops heroes

    View Slide

  12. The Cloud
    flickr.com/photos/21644167@N04/3897234326/

    View Slide

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

    View Slide

  14. Web Application
    Architecture ... Cloud cloud
    ... the cloud

    View Slide

  15. Cloud Jargon
    ... as a service
    IaaS
    Infrastructure
    PaaS
    Platform
    SaaS
    Software
    ... the cloud

    View Slide

  16. 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
    ... the cloud

    View Slide

  17. What would you
    choose?
    IaaS PaaS
    lets see examples ...
    ... the cloud

    View Slide

  18. 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!
    windowsazure.com
    ... the cloud

    View Slide

  19. 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
    cloud.google.com
    ... the cloud

    View Slide

  20. less control
    more comfort
    Amazon AWS
    IaaS vs. PaaS
    AWS
    EC2
    AWS
    BeanStalk
    almost full control
    no comfort
    aws.amazon.com
    AWS
    OpsWorks
    AWS
    CloudFormation
    ... the cloud

    View Slide

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

    View Slide

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

    View Slide

  23. what someone 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 Slide

  24. awsofa.info

    View Slide

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

    View Slide

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

    View Slide

  27. Automation
    infoq.com/presentations/Infrastructure-as-Code
    #!/bin/sh
    NODES="webserver database"
    for n in $NODES
    do
    ssh $n complex-script.sh
    done

    View Slide

  28. zeroturnaround.com/labs/rebel-labs-release-it-ops-devops-productivity-report-2013

    View Slide

  29. View Slide

  30. open source
    configures servers
    cookbooks & recipes
    ruby dsl
    ... chef

    View Slide

  31. 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
    ... chef

    View Slide

  32. 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 %>
    ...
    template "/etc/redis/redis.conf" do
    ...
    variables({ bind: node[:redis][:bind] })
    end
    redis cookbook
    ... chef

    View Slide

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

    View Slide

  34. $ 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
    First run installs redis,
    creates configuration file.
    ... chef

    View Slide

  35. Second time, everything is already
    up to date.
    Idempotency!
    ƒ[ƒ(x)] ≡ ƒ(x)
    $ 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
    ... chef

    View Slide

  36. making a small change to JSON
    parameters passed to Chef run.
    running chef-solo
    solo.json
    {
    "redis": { "bind": "0.0.0.0" },
    "run_list": "recipe[redis]"
    }
    ... chef

    View Slide

  37. $ 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
    ... chef

    View Slide

  38. A single server is just not enough …
    how do I scale?
    I have some pretty graphs
    for you ...
    ... devops heroes

    View Slide

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

    View Slide

  40. WTF is ... Devops?

    View Slide

  41. CAMS
    Culture
    Automation
    Measurement
    Sharing
    wtf is ... devops
    opscode.com/blog/2010/07/16/what-devops-means-to-me/ by John Willis @botchagalupe

    View Slide

  42. ○ Interactions over processes and tools.
    ○ Continuous delivery of value.
    ○ Welcome changing requirements.
    ○ Provide an environment for motivated
    individuals to succeed.
    Culture
    wtf is ... devops
    parts from agilemanifesto.org

    View Slide

  43. “Between 12:00 AM and 11:59 PM on April 25, 2013,
    Quora released new versions of the site 46 times. This was a normal day for us.” - Quora
    engineering.quora.com/Continuous-Deployment-at-Quora
    “Deployment every 11.6s, 1,079 max in one hour.
    10,000 mean number of hosts per deployment, with 30,000 maximum” - Amazon.
    com
    youtube.com/watch?v=PW1lhU8n5So
    “On the Google Consumer Surveys team, 8 minutes after you
    commit code it's live in production.” - Google
    developers.google.com/live/shows/772717729
    “10+ deploys per day.” - John Allspaw, 2009
    youtube.com/watch?v=LdOe18KhtT4
    wtf is ... devops

    View Slide

  44. ● Minimize required manual work.
    ● Simplicity is essential.
    ● Working software over
    comprehensive documentation.
    ● Easiest thing to solve, often neglected.
    Automation
    wtf is ... devops

    View Slide

  45. View Slide

  46. ○ Measure everything as often as possible.
    ○ Metrics of performance, process and people.
    ○ Unprecedented real-time visibility.
    ○ Enable continuous improvement. (Kaizen)
    Measurement
    wtf is ... devops

    View Slide

  47. “... we also track really important stuff, like
    how much coffee is left in the kitchen” - Etsy
    codeascraft.com/2011/02/15/measure-anything-measure-everything
    end of
    2009 end of
    2012
    Etsy.com : Deploys per day
    Measure Everything
    wtf is ... devops

    View Slide

  48. Why do it?
    fast iterations ⇒ fast feedback loops
    Customer
    Business
    Release
    Feedback
    wtf is ... devops

    View Slide

  49. ○ Expand creativity and knowledge.
    ○ Feedback and learning for everyone.
    ○ Collaboration of diverse people on shared ideas.
    ○ Empowerment of teams and individuals.
    Sharing
    wtf is ... devops

    View Slide

  50. View Slide

  51. Deploy better systems at less cost
    in less time at lower risk.
    wtf is ... devops

    View Slide

  52. enable the business
    wtf is ... devops

    View Slide

  53. View Slide

  54. take these slides offline
    bit.ly/hackademy-devops
    minifigures.lego.com
    Cheerleaders are spastic!
    They stretch like elastic!

    View Slide