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

Infrastructure as Ruby code

Infrastructure as Ruby code

RubyConf Argentina 2012

3840e176063720782879c0d45433420a?s=128

Augusto Becciu

October 20, 2012
Tweet

Transcript

  1. Infrastructure as Ruby Code Augusto Becciu

  2. Who am I? • @abecciu {github, twitter} • Hacker •

    Startups guy • Cur: CTO at • Prev: Dev / Ops Engineer at
  3. Who are you?

  4. Traditional Sysadmin • Manual (mostly) • Lack of process •

    Bunch of shell and perl scripts • Fear of change • Monolithic architectures • Durable bare metal hardware • Vertical scalability
  5. None
  6. The Cloud Computing Evolution • Service Oriented Architectures • Horizontal

    Scalability • Transition to virtualized ephemeral resources • Instant provisioning • OMG APIs !!!
  7. Infrastructure as code Apply software engineering practices to systems administration

    and operation.
  8. Infrastructure as code • Automation • Repeatability • Agility •

    Scalability Apply software engineering practices to systems administration and operation.
  9. “Enable the reconstruction of the business from nothing but a

    source code repository, an application data backup, and bare metal resources” Jesse Robins describes the goal brilliantly:
  10. Hello Chef • Configuration management • Systems integration • Idempotence

    • Declarative and imperative • Ruby everywhere
  11. None
  12. Let’s deploy RubyConfAR’s website!

  13. We need to... • Install packages • Create directories •

    Create users • Get the code • Install gems • Run migrations • Run the app server
  14. None
  15. None
  16. None
  17. None
  18. None
  19. None
  20. None
  21. Recipe

  22. Attributes

  23. Recipe

  24. None
  25. None
  26. None
  27. None
  28. None
  29. None
  30. Syntax Check $ knife cookbook test rubyconfar

  31. Static Analysis $ gem install foodcritic $ foodcritic rubyconfar http://acrmp.github.com/foodcritic/

  32. Unit Testing $ gem install rspec $ gem install chefspec

    $ rspec --color rubyconfar https://github.com/acrmp/chefspec https://github.com/acrmp/chefspec
  33. Unit Testing

  34. Integration Testing $ gem install minitest-chef-handler https://github.com/calavera/minitest-chef-handler https://github.com/btm/minitest-handler-cookbook

  35. Integration Testing

  36. Acceptance Testing $ gem install cucumber-nagios $ cucumber-nagios-gen project rubyconfar

    $ cd rubyconfar $ ./bin/cucumber-nagios features/ http://auxesis.github.com/cucumber-nagios/
  37. Acceptance Testing

  38. None
  39. Cloud Provisioning

  40. Vagrant http://vagrantup.com/

  41. Vagrant

  42. Vagrant $ vagrant box add precise64 http://files.vagrantup.com/precise64.box $ vagrant up

    $ vagrant provision $ vagrant destroy
  43. $ gem install knife-ec2 $ knife ec2 server create -I

    ami-2e845d33 -f t1.micro -r ‘recipe[rubyconfar]’ $ knife ec2 server delete instance_id
  44. The Ruby cloud services library http://fog.io

  45. None
  46. Automate ALL the things!

  47. Build your own awesome tools, it’s easy! + + gli

    Net::SSH + http://net-ssh.rubyforge.org/ http://davetron5000.github.com/gli/
  48. Thanks! is hiring! http://restorando.com/joinus