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

Ruby Toolbox for DevOps

Richard Lee
December 08, 2012

Ruby Toolbox for DevOps

Presented at RubyConf Taiwan 2012.

Richard Lee

December 08, 2012
Tweet

More Decks by Richard Lee

Other Decks in Technology

Transcript

  1. Ruby Toolbox for
    DevOps
    Richard Lee (@dlakty)

    View Slide

  2. self.intro do |richard|

    View Slide

  3. 6.years.ago

    View Slide

  4. 5.years.ago

    View Slide

  5. 2.years.ago

    View Slide

  6. 2.years.ago

    View Slide

  7. 1.year.ago

    View Slide

  8. end

    View Slide

  9. View Slide

  10. Huh? A Recipe Sharing
    Website?

    View Slide

  11. Huh? A Recipe Sharing
    Website?
    Social Network

    View Slide

  12. Website
    Operation
    API
    Mobile
    Products

    View Slide

  13. Website
    Recipe Content Management
    Social Features
    Q&A for Cook

    View Slide

  14. Website
    Operation

    View Slide

  15. Operation
    Server Infrastructure
    Monitoring
    Analysis

    View Slide

  16. Website
    Operation
    Mobile
    Products

    View Slide

  17. Mobile
    Products
    iPhone / iPad
    Android
    Mobile Web!
    > 50% Traffic!

    View Slide

  18. Website
    Operation
    API
    Mobile
    Products

    View Slide

  19. API
    RESTFul JSON API
    Multi Device Authentication
    Push Notification

    View Slide

  20. Website
    Operation
    API
    Mobile
    Products

    View Slide

  21. DevOps

    View Slide

  22. What?

    View Slide

  23. Website
    Operation
    API
    Mobile
    Products
    Developer

    View Slide

  24. Website
    Operation
    API
    Mobile
    Products
    Operator

    View Slide

  25. Website
    Operation
    API
    Mobile
    Products
    DevOp

    View Slide

  26. DevOps
    Learning tools /
    techniques of
    Helps Your Startup

    View Slide

  27. Development
    Continuous Integration
    Server Provisioning
    Deployment
    Monitoring
    polydice.workflow do |w|

    View Slide

  28. Code Actually nothing special here.
    Current stack:
    Rails 3.2
    Ruby 1.9.3
    RSpec
    Redis
    MySQL
    memcached

    View Slide

  29. Continuous Integration

    View Slide

  30. Continuous
    Testing
    Document generation
    Code quality testing
    Deploy
    and more!

    View Slide

  31. So, give me a Ruby CI Server!

    View Slide

  32. Travis CI is not currently a good fit
    for closed in-house installations

    View Slide

  33. Do you really know
    what a CI server usually do?

    View Slide

  34. Continuous
    Testing
    Document generation
    Code quality testing
    Deploy
    and more!
    Not black magic
    Write your rake tasks!

    View Slide

  35. CI Server
    Received push hooks
    Run some scripts
    Send notifications & Show reports

    View Slide

  36. Jenkins Everywhere

    View Slide

  37. Janky for Help!
    A Sinatra app as JSON bridge
    Built on Jenkins
    Controlled by Hubot
    Designed for / by GitHub

    View Slide

  38. View Slide

  39. View Slide

  40. Tips: Your every project
    needs a scripts folder

    View Slide

  41. scripts/
    bootstrap
    cibuild

    View Slide

  42. Sever Provisioning

    View Slide

  43. chef + vargrant = awesome!

    View Slide

  44. Why this is important?
    I can do that manually!

    View Slide

  45. View Slide

  46. Save your time for
    fixing up problems.

    View Slide

  47. Machines in Chef
    Client
    Node
    API client for provisioning and management.
    Your any controlled servers.

    View Slide

  48. Objects in Chef
    Cookbook
    Data bag
    Certain steps to install / configure resources
    on nodes
    Data storages for cookbook to configure
    resources. (Encrypted / Unencrypted)

    View Slide

  49. Our
    Cookbook
    For
    Capistrano

    View Slide

  50. Role
    The bridge between cookbooks & node.
    Define a run list for node.
    Some example:
    Web role’s run list :[“nginx”, “rails”]
    Database role’s run list :[“mysql”]

    View Slide

  51. Our
    Base
    Role

    View Slide

  52. Provisioning EC2

    View Slide

  53. Why ?

    View Slide

  54. Chef v.s. Puppet
    Basically the same thing / idea
    Puppet uses customized DSL for cookbook
    Chef just uses Ruby

    View Slide

  55. Vagrant
    VirtualBox VM from command line
    Integration with Chef / Puppet

    View Slide

  56. Vagrantfile
    Configure which roles to run.
    Then,
    > vagrant up

    View Slide

  57. Deployment

    View Slide

  58. We use
    No surprise, right?

    View Slide

  59. Lots of tweaks
    Git-based deployment
    Speed up
    Campfire notification

    View Slide

  60. Git-based deployment

    View Slide

  61. Campfire notification

    View Slide

  62. Lots of details.
    Ask me if you’re interested.

    View Slide

  63. Monitoring

    View Slide

  64. Unit test => Developer
    Monitoring => Operator

    View Slide

  65. god
    lograge

    View Slide

  66. god
    Process monitoring
    Restart process for certain conditions
    Really important for unicorn
    Integrated with Capistrano

    View Slide

  67. Super easy
    Configuration

    View Slide

  68. lograge
    Turn your multiline logs into one line
    Dec 08 13:18:11 web1 rails: method=GET path=/recipes/14628 format=html
    controller=recipes action=show status=200.00 duration=296.24 view=177.28
    db=96.89 redis=1.38 tire=0.00 ip=111.250.xxx.xxx referer=http://icook.tw/
    recipes/fulltext_search?query=%E7%B3%96%E9%86%8B%E6%8E%92%E9%AA%A8
    Good for grep & analysis

    View Slide

  69. lograge custom options
    Add as much things for monitoring as
    possible!

    View Slide

  70. Conclusion

    View Slide

  71. Ruby is expressive.

    View Slide

  72. Tons of DSLs for solving
    different problems.

    View Slide

  73. Make developers happy.

    View Slide

  74. Make operators happy.

    View Slide

  75. Make your customers happy.
    boss
    investors

    View Slide

  76. View Slide

  77. Email: [email protected]
    Twitter & GitHub & App.net: @dlackty
    Thank You!
    We’re hiring!

    View Slide

  78. Q & A?

    View Slide