Using Vagrant for Rails development

11,279 views

Published on

This presentation is a basic introduction to using Vagrant for virtualized Rails development. It covers the basics of Vagrant, provisioning using puppet, and more advanced usage such as multi-vm configurations.

Published in: Technology
0 Comments
19 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
11,279
On SlideShare
0
From Embeds
0
Number of Embeds
9
Actions
Shares
0
Downloads
60
Comments
0
Likes
19
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • This is no fun. We don’t want to develop in a VM using vim....\n
  • We want access to our native environment\n
  • \n
  • Vagrant is technically a gem but as of v1.0 (March 2012) there are packages for OSX, Windows, Ubuntu, Debian, Redhat, etc.\n
  • \n
  • \n
  • * technically the VirtualBox VM isn’t created until the first “up”\n
  • * technically the VirtualBox VM isn’t created until the first “up”\n
  • * technically the VirtualBox VM isn’t created until the first “up”\n
  • * technically the VirtualBox VM isn’t created until the first “up”\n
  • * technically the VirtualBox VM isn’t created until the first “up”\n
  • * technically the VirtualBox VM isn’t created until the first “up”\n
  • * technically the VirtualBox VM isn’t created until the first “up”\n
  • Demo1 showing a box added to vagrant\nvagrant init lucid64\nvagrant up\nvagrant ssh\nvagrant status\n\n
  • But how do we get here?\n
  • Demo 2: basic Ruby app:\nvagrant up\nShow mounted filesystem\nstart rails\ncurl\n
  • \n
  • \n
  • Demo2 configured for port forwarding\nvagrant reload\nvagrant ssh\nstartup rails\nhit with local browser\n
  • We’re just getting warmed up.... (but my talk is almost over...)\n
  • We’re just getting warmed up.... (but my talk is almost over...)\n
  • We’re just getting warmed up.... (but my talk is almost over...)\n
  • We’re just getting warmed up.... (but my talk is almost over...)\n
  • We’re just getting warmed up.... (but my talk is almost over...)\n
  • We’re just getting warmed up.... (but my talk is almost over...)\n
  • We’re just getting warmed up.... (but my talk is almost over...)\n
  • We’re just getting warmed up.... (but my talk is almost over...)\n
  • We’re just getting warmed up.... (but my talk is almost over...)\n
  • We’re just getting warmed up.... (but my talk is almost over...)\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Demo 4:\nvagrant up\nvagrant ssh es1\ncd elastic....\n./bin/elasticsearch -f\n
  • \n
  • \n
  • \n
  • Using Vagrant for Rails development

    1. 1. Using Vagrant for RailsDevelopmentDan Pilonewww.element84.com Copyright 2012 Element 84, LLC 1
    2. 2. About UsElement 84, LLC Customer focused agile development and training End to end Web and Mobile development Customers include NASA, Raytheon, Fidelity Investments, Yacht.com, Spacefindr.com Copyright 2012 Element 84, LLC 2
    3. 3. About UsElement 84, LLC Customer focused agile development and training End to end Web and Mobile development Customers include NASA, Raytheon, Fidelity Investments, Yacht.com, Spacefindr.com Copyright 2012 Element 84, LLC 2
    4. 4. Client A ★Ruby 1.8.7 ★Rails 2.3 ★MySQL ★Redis ★ImageMagick ★EngineYardCopyright 2012 Element 84, LLC
    5. 5. Client B ★Ruby 1.9.3 ★Rails 3.0 ★MySQL 5.1 ★Passenger ★WebKit + QtCopyright 2012 Element 84, LLC
    6. 6. Client C ★JRuby 1.6 ★Rails 3.0-3.2 ★Oracle RAC ★ElasticSearch ★9 node HA+LBCopyright 2012 Element 84, LLC
    7. 7. Client C ★JRuby 1.6 ★Rails 3.0-3.2 ★Oracle RAC ★ElasticSearch ★9 node HA+LBCopyright 2012 Element 84, LLC
    8. 8. RVM + Bundler isn’t enough....Copyright 2012 Element 84, LLC
    9. 9. Copyright 2012 Element 84, LLC
    10. 10. Copyright 2012 Element 84, LLC
    11. 11. Copyright 2012 Element 84, LLC
    12. 12. Copyright 2012 Element 84, LLC
    13. 13. Vagrant! Uses VirtualBox to provide development VM environments Lets you CM your development environment with your code Provides transparent access from your dev box Copyright 2012 Element 84, LLC
    14. 14. Copyright 2012 Element 84, LLC
    15. 15. Copyright 2012 Element 84, LLC
    16. 16. Vagrant boxes are available for nearly every flavor of linux...Copyright 2012 Element 84, LLC
    17. 17. vagrant box add mybox http://mybox Copyright 2012 Element 84, LLC
    18. 18. vagrant box add mybox http://mybox vagrant init* Copyright 2012 Element 84, LLC * technically the VirtualBox VM isn’t created until the first “up”
    19. 19. vagrant box add mybox http://mybox vagrant init* vagrant up Copyright 2012 Element 84, LLC * technically the VirtualBox VM isn’t created until the first “up”
    20. 20. DemoCopyright 2012 Element 84, LLC
    21. 21. Copyright 2012 Element 84, LLC
    22. 22. /vagrantCopyright 2012 Element 84, LLC
    23. 23. /vagrant ??Copyright 2012 Element 84, LLC
    24. 24. Copyright 2012 Element 84, LLC
    25. 25. Copyright 2012 Element 84, LLC
    26. 26. DemoCopyright 2012 Element 84, LLC
    27. 27. vagrant box add mybox http://mybox Copyright 2012 Element 84, LLC
    28. 28. vagrant box add mybox http://mybox vagrant init* Copyright 2012 Element 84, LLC * technically the VirtualBox VM isn’t created until the first “up”
    29. 29. vagrant box add mybox http://mybox vagrant init* vagrant up Copyright 2012 Element 84, LLC * technically the VirtualBox VM isn’t created until the first “up”
    30. 30. vagrant box add mybox http://mybox vagrant init* vagrant up vagrant provision Copyright 2012 Element 84, LLC * technically the VirtualBox VM isn’t created until the first “up”
    31. 31. Copyright 2012 Element 84, LLC
    32. 32. Copyright 2012 Element 84, LLC
    33. 33. Copyright 2012 Element 84, LLC
    34. 34. Advanced Vagrant... Copyright 2012 Element 84, LLC
    35. 35. Making your own boxesCreate a basic Vagrant setupProvision and configure as desiredCreate a package specific VagrantfileRun vagrant packageProfit Distribute to teammates Copyright 2012 Element 84, LLC
    36. 36. Multi-VM ConfigurationUsed to simulate multi-tier systemsCan simulate nodefailure, load balancing,cluster connectivity,etc.Uses host-onlynetworking iPhone Overview - Copyright 2010 Element 84, LLC
    37. 37. Copyright 2012 Element 84, LLC
    38. 38. Crazy demo... maybe.Copyright 2012 Element 84, LLC
    39. 39. Possible issues Disk IO can be slow as the number of files grow due to VirtualBox issues. Use NFS in these situations. Memory usage can get tight as number and size of VMs grow. Buy more memory... Not really designed for performance testing Copyright 2012 Element 84, LLC
    40. 40. TipsDon’t forget to exclude .vagrant directory from CMUse real provisioning (e.g. Puppet, Chef, etc.) Seriously.Spend the time. Don’t cheat.Consider building a set of project specific boxes andusing those instead of having everyone reprovision frombase box.Vagrant has great Rake integration - consider using thisfor any repetitive tasks that have to be done inside theVM. Copyright 2012 Element 84, LLC
    41. 41. More informationMe: Dan Pilone (dan@element84.com, @danpilone)Vagrant: http://vagrantup.comPuppet: http://puppetlabs.com/ Copyright 2012 Element 84, LLC

    ×