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

Vagrant w/ Japanese Subtitle in 2013

Vagrant w/ Japanese Subtitle in 2013

Yohei Yasukawa

August 10, 2013
Tweet

More Decks by Yohei Yasukawa

Other Decks in Technology

Transcript

  1. Vagrant Living in the Future

  2. I’m Mitchell Hashimoto Also known as @mitchellh ॳΊ·ͯ͠ɼϛγΣϧɾϋγϞτͰ͢ Twitter Ͱ͸

    @mitchellh Ͱ׆ಈ͍ͯ͠·͢
  3. I build tools http://hashicorp.com HASHI COPR ͱ͍͏ձࣾΛ্ཱͪ͛ ͦ͜Ͱ৭ʑͳπʔϧΛ։ൃ͍ͯ͠·͢

  4. Vagrant http://www.vagrantup.com Vagrant ͸ HASHI CORP Ͱ ։ൃ͍ͯ͠Δπʔϧͷ̍ͭͰ͢

  5. Packer http://www.packer.io ଞʹ΋ɼPacker ͱ͍͏ɼ̍ͭͷઃఆϑΝΠϧ͔Βෳ਺ͷ؀ڥͰಈ͘ ΠϝʔδϑΝΠϧ࡞੒πʔϧ΋։ൃ͍ͯ͠·͢

  6. http://vagrantup.com ࠓճ͸ɼVagrant ͱ͍͏πʔϧʹ͍͓ͭͯ࿩͠͠·͢

  7. A tool for creating, managing, and distributing portable development environments.

    Vagrant ͱ͸ɼ࠶ݱՄೳͳ։ൃ؀ڥΛ؆୯ʹ ߏஙɾ؅ཧɾ഑෍͢ΔͨΊͷπʔϧͰ͢
  8. $ vagrant init precise32 \ http://files.vagrantup.com/precise32.box ... $ vagrant up

    ... $ vagrant ssh vagrant@precise64:~$ echo hello hello Zero to VM in Seconds Vagrant Λ࢖͏ͱɼ΄Μͷ਺ίϚϯυͰ ։ൃ༻ͷԾ૝ϚγϯΛ্ཱͪ͛Δ͜ͱ͕Ͱ͖·͢
  9. Solves a lot of problems. ͜ΕʹΑΓɼଟ͘ͷ໰୊͕ղܾͰ͖·͢

  10. High-Level Use Cases ࠓ೔͸ɼͦͷதͰ΋ ࠷΋Α͘࢖ΘΕΔϢʔεέʔεΛ͝঺հ͠·͢

  11. Consistent development environments. Vagrant ͷಛ௕ͷ̍ͭ͸ Ұ؏ੑͷ͋Δ։ൃ؀ڥΛߏஙͰ͖Δ͜ͱͰ͢

  12. “You’re hired! Get the site up and running on that

    new laptop.” ʮ܅Λ࠾༻͢ΔΑʂ͊͞ɼ͜ͷ৽͍͠ϥοϓτοϓͰ؀ڥߏஙΛͯ͠ ϩʔΧϧ؀ڥͰ΢ΣϒαΠτΛ্ཱͪ͛ͯ͘Εͨ·͑ɽʯ ͜Μͳͱ͖ɼ͋ͳͨͳΒͲ͏͠·͔͢ʁ
  13. Scenario 1: Setup Script యܕతͳγφϦΦ (1/3): ηοτΞοϓεΫϦϓτͰ؀ڥߏங

  14. facebook_killer → ./setup.sh Installing some server... Installing some software... Configuring

    it all... Successful sacrifice made to deity. ྫ͑͹ɼ͜Μͳײ͡ͷεΫϦϓτͰ͢
  15. Problems ͔͠͠ɼ͜Εʹ͸େ͖ͳ໰୊͕൐͍·͢

  16. Your Mac is not what is running in production. ʮ͋ͳͨͷ

    Mac ͸ϓϩμΫγϣϯ؀ڥͰ͸ͳ͍ʯ ͱ͍͏໰୊Ͱ͢
  17. Unlikely that all the software you need will work the

    same on your machine. શͯͷιϑτ΢ΣΞ͕ ͋ͳͨͱಉ͡؀ڥͰಈ͍͍ͯΔΘ͚Ͱ͸ͳ͍ͷͰ͢
  18. Requires special maintenance. ͕ͨͬͯ͠ɼಈ࡞؀ڥͷҧ͍ΛຒΊΔͨΊͷ ಛผͳमਖ਼Λ͢Δඞཁ͕͋Γ·͢

  19. What if people want to work in Windows? Linux? ྫ͑͹ɼWindows

    Ͱಈ͔͍ͨ͠৔߹͸ʁ ͋Δ͍͸ɼLinux Ͱಈ͔͍ͨ͠৔߹͸Ͳ͏ͳΔͰ͠ΐ͏͔ʁ
  20. Scenario 2: The Über README యܕతͳγφϦΦ (2/3): ਌੾͗͢ΔREADME

  21. PROBLEMS!

  22. PROBLEMS!

  23. PROBLEMS!

  24. PROBLEMS!

  25. PROBLEMS!

  26. PROBLEMS!

  27. PROBLEMS!

  28. PROBLEMS!

  29. Problems ͜Εʹ΋େ͖ͳ໰୊͕͋Γ·͢

  30. Extremely prone to user error ·ͣɼώϡʔϚϯΤϥʔΛ๷͙͜ͱ͸Ͱ͖·ͤΜ

  31. Heavy maintenance ·ͨɼREADME ͷϝϯςφϯε΋؆୯Ͱ͸͋Γ·ͤΜ

  32. Time consuming ඇৗʹଟ͘ͷ࣌ؒΛඅ΍͢͜ͱʹͳΓ·͢

  33. Platform-specific. Again. ֤؀ڥʹରԠ͠Α͏ͱ͢Δͱɼ͞Βʹ໘౗ͳ͜ͱʹͳΓ·͢

  34. Scenario 3: Good luck. Have fun. యܕతͳγφϦΦ (3/3): ͏·͘ಈ͔͘Ͳ͏͔͸ӡ࣍ୈʂ

  35. facebook_killer → ruby main.rb Failed to connect to MySQL at

    localhost:3306 ࣮ߦͯ͠Έ͚ͨͲɼʮMySQL ͕ແ͍ʯͱౖΒΕͨ (#ƅДƅ)
  36. Install MySQL MySQL ΛΠϯετʔϧͯ͠ɼ࠶౓࣮ߦͯ͠Έ·͢

  37. facebook_killer → ruby main.rb Failed to connect to Redis at

    localhost:6379! ࠓ౓͸ Redis ͕ແ͔ͬͨΑ ʘ(^o^)ʗ
  38. Install Redis Redis ΛΠϯετʔϧͯ͠ɼ࠶౓࣮ߦͯ͠Έ·͢

  39. facebook_killer → ruby main.rb Missing ImageMagick extensions! ImageMagick ͕ʢry

  40. Install ImageMagick (starting to hate yourself) ImageMagick ΛΠϯετʔϧͯ͠ɼ࠶౓࣮ߦͯ͠Έ·͢ (͜͜ΒลͰετϨε͕Ϛοϋʣ

  41. facebook_killer → ruby main.rb Site running on localhost:3000. ŝŦᴸᴸƅ+.ʋ(≧˜≦)ů.+ƅᴸᴸ ŕ

    !!!
  42. ˑ-ʋ(*´∀ʆ)ീ(´∀ʆ*)ϊŘŚŖŘ

  43. None
  44. None
  45. Problems ͜͏͍ͬͨ໰୊ɼ͋Γ·ͤΜ͔ʁ

  46. Vagrant = Consistency Vagrant ʹ͸Ұ؏ੑ͕͋ΔͷͰ ͜͏͍ͬͨ໰୊ΛશͯղܾͰ͖·͢

  47. Iterative ops development . ଞʹ΋ɼVagrant ʹ͸ ൓෮తͳ։ൃΛαϙʔτ͢Δػೳ͕͋Γ·͢

  48. Before: 1. Work on ops scripts 2. Spin up server

    3. Test 4. Repeat ྫ͑͹ɼ1) ίʔυΛॻ͖ɼ2) αʔόΛىಈͤ͞ɼ 3) ςετ͢Δɼͱ͍͏ૢ࡞Λ܁Γฦ͍ͯͨ͠ͱ͠·͠ΐ͏
  49. Best case: 5 minutes? Worst case: 30+ minutes ͔͜͠͠ΕͰ͸ɼྑͯ͘΋̑෼͸͔͔ΔͰ͠ΐ͏͠ɼ ·ͨɼѱ͍৔߹Ͱ͸̏̌෼Ҏ্͔͔ΔͰ͠ΐ͏

  50. Imagine waiting 30 minutes until you could see the effects

    of your code change. ίʔυΛมߋͯ͠΋ɼͦͷ݁ՌΛ֬ೝ͢ΔͨΊʹ ̏̌෼΋଴ͨ͞ΕΔΑ͏ͳঢ়گΛߟ͑ͯΈ͍ͯͩ͘͞
  51. Productivity Failure ͦΕ͸ɼਂࠁͳੜ࢈ੑͷܽ೗ͱݴ͑ΔͰ͠ΐ͏

  52. Vagrant = Iterative Vagrant Ͱ͸͜͏͍ͬͨ൓෮తͳ։ൃΛαϙʔτ͍ͯ͠ΔͷͰ ͜ͷΑ͏ͳ໰୊΋ղܾͰ͖·͢

  53. Dev, Test, Prod. All the same ops scripts on the

    same OS. ·ͨɼVagrant Ͱ͸ɼ։ൃ/ςετ/ຊ൪؀ڥʹରͯ͠ ͦΕͧΕಉ͡ૢ࡞Λಉ͡OSͰ࣮ߦ͢Δ͜ͱ͕Ͱ͖·͢
  54. “But it worked on my machine!” ʮͰ΋ɼ๻ͷ؀ڥͰ͸ಈ͍ͨΑʂʯ ͜ΜͳίϝϯτΛݟ͔͚ͨ͜ͱ͸͋Γ·ͤΜ͔ʁ

  55. Subtle differences from the artisanal developer workstation ops cause pain.

    ৬ਓܳతʹ࠷దԽ͞Εͨ։ൃ؀ڥ͸, ͦͷ؀ڥΛ࠶ݱ͢ΔͨΊͷίετΛੜΈ·͢
  56. Vagrant isolates the workstation and encourages reusability. ͜ͷͨΊɼVagrant Ͱ͸։ൃ؀ڥΛಠཱͤ͞ ࠶ར༻ੜͷߴ͍։ൃ؀ڥΛαϙʔτ͍ͯ͠·͢

  57. Ops does what they do best for the entire organization.

    ݁Ռͱͯ͠ɼ։ൃ؀ڥΛ࠷దԽͤͯ͞΋ શͯͷ؀ڥͰͦͷԸܙΛ͏͚Δ͜ͱ͕Ͱ͖·͢
  58. Vagrant = Isolation ͕ͨͬͯ͠ɼVagrant ͱ͸ಠཱͨ͠։ൃ؀ڥͰ͋Δͱ͍͑·͢

  59. Disposable machines on your local machine. Vagrant ͷ࠷ޙͷಛ௕͸ ؾܰʹ؀ڥΛࣺͯΒΕΔ͜ͱͰ͢

  60. Play with compiler flags, tricky dependencies, etc. ίϯύΠϥͷ࠷దԽΦϓγϣϯ΍ɼෳࡶʹґଘ͢ΔϥΠϒϥϦͳͲΛ, ؾܰʹࢼͯ͠ΈΔ͜ͱ͕Ͱ͖·͢

  61. If you mess up, just create another machine. ΋్͠தͰାখ࿏ʹೖͬͯ͠·ͬͯ΋, ·ͨ؀ڥΛੜ੒͢Δ͚ͩͰࡁΈ·͢

  62. Vagrant = Safe Experimentation Vagrant ͸ɼ͜ͷΑ͏ͳ ؾܰʹτϥΠˍΤϥʔΛ܁ΓฦͤΔ؀ڥΛఏڙ͠·͢

  63. Battle proven. ·ͨɼVagrant ʹ͸, ࣮ફͰԿ౓΋࢖ΘΕଓ͚ͨͱ͍͏࣮੷͕͋Γ·͢

  64. Mature, stable, proven. Development since Jan 2010. Used by thousands

    of companies. 2010೥1݄͔Β։ൃ͕ελʔτ͠ɼطʹे෼ʹ҆ఆ͍ͯ͠·͢ ·ͨɼଟ͘ͷஶ໊ͳاۀͰ΋࣮ࡍʹ࢖ΘΕ͍ͯ·͢
  65. None
  66. I mean, it must be doing something right, right? ͜ΕΒͷஶ໊ͳاۀͰ࣮ࡍʹ࢖ΘΕ͍ͯΔͱ͍͏͜ͱ͸,

    ͖ͬͱ Vagrant ʹ͸Ձ஋͕͋Δͱݴ͑ΔͰ͠ΐ͏
  67. Create and Manage Virtualized Development Environments Mitchell Hashimoto Vagrant Up

    and Running http://oreilly.com/go/vagrant ͪͳΈʹɼΦϥΠϦʔ͔Β΋ Vagrant ͷຊ͕ग़൛͞Ε͍ͯ·͢
  68. Tao of Vagrant The Power is in the Workflow Vagrant

    Ͱܝ͍͛ͯΔେ͖ͳ໨ඪ͸ ʮ࠷ߴͷ։ൃϑϩʔʯΛఏڙ͢Δ͜ͱͰ͢
  69. http://mitchellh.com/the-tao-of-vagrant “The Tao of Vagrant” ͱ͍͏ϒϩάهࣄΛॻ͍ͨͷͰ ৄ͘͠஌Γ͍ͨํ͸ɼੋඇͪ͜ΒΛಡΜͰΈ͍ͯͩ͘͞

  70. High-level workflow and goals of Vagrant. Ͱ͸ɼVagrant ͕ߟ͑Δʮ࠷ߴͷ։ൃϑϩʔʯʹ͍ͭͯ ̎ͭͷ؍఺͔Βઆ໌͍͖ͯ͠·͢

  71. Developers ̍ͭ໨ͷ؍఺͸ɼ։ൃऀʹͱͬͯͷʮ࠷ߴͷ։ൃϑϩʔʯͰ͢

  72. Developers 1. Check out any project. 2. “vagrant up” 3.

    Done. Vagrant ͕޿͘ීٴ͢Ε͹ɼͦΕ͕ͲΜͳϓϩδΣΫτͰ͋Ε 1) μ΢ϯϩʔυ͠ɼ2) `vagrant up`ͱ࣮ߦ͢Δ͚ͩͰಈ͔ͤΔΑ͏ʹͳΓ·͢
  73. Developers Continue to work in your own browsers, editors, and

    other tools. ݁Ռͱͯ͠ɼ։ൃऀ͸։ൃ؀ڥʹറΒΕΔ͜ͱແ͘, ͓޷Έͷϒϥ΢β΍ΤσΟλͳͲΛ࢖͑ΔΑ͏ʹͳΓ·͢
  74. Developers The existence of Vagrant is transparent and unimportant. Vagrant

    is just the workhorse that creates consistent and stable development environments. Vagrant ͸ɼۭؾͷΑ͏ͳଘࡏʹͳΔ͜ͱΛ໨ࢦ͍ͯ͠·͢. ͨͩͻͨ͢ΒʹҰ؏ੑͱ҆ఆੑͷ͋Δ։ൃ؀ڥΛ௥ڀ͠·͢.
  75. Systems Operations ΋͏̍ͭͷ؍఺͸ɼγεςϜ؅ཧऀʹͱͬͯͷʮ࠷ߴͷ։ൃϑϩʔʯͰ͢

  76. Systems Operations 1. “vagrant up” 2. Complete sandbox to test

    ops scripts. γεςϜ؅ཧऀ͸ɼͨͩ `vagrant up`ͱ࣮ߦ͢Δ͚ͩͰ, ࣗ༝ʹςετͰ͖Δ؀ڥΛखʹೖΕΔ͜ͱ͕Ͱ͖·͢
  77. Systems Operations Automation developed used for both production and development.

    ͦͯ͠ɼ৽ͨʹՃ͑ͨมߋ͸ɼࣗಈԽ͞Ε, ։ൃ؀ڥʹ΋ຊ൪؀ڥʹ΋ద༻Ͱ͖ΔΑ͏ʹͳΓ·͢
  78. Systems Operations With every vagrant up, developers get a fully

    provisioned environment using the same scripts as production. ͜ͷͨΊɼ։ൃऀ͸ `vagrant up` ͱ࣮ߦ͢Δ౓ʹ มߋ͕Ճ͑ΒΕͨ৽ͨͳ؀ڥΛखʹೖΕΔ͜ͱ͕Ͱ͖·͢
  79. Clean up with vagrant destroy, vagrant suspend, or vagrant halt.

    ·ͨɼ΋͠։ൃ్தͰ։ൃ؀ڥʹ৽͍͠มߋ͕Ճ͑ΒΕͯ΋, `vagrant [destroy|suspend|halt]` ͱ࣮ߦ͢Ε͹؆୯ʹ։ൃ؀ڥΛࣺͯΒΕ·͢
  80. vagrant up will get you up and running at any

    moment. ͦͷޙɼ`vagrant up` ͱ࣮ߦ͢Δ͚ͩͰ, ͍ͭͰ΋৽͍͠։ൃ؀ڥΛखʹೖΕΔ͜ͱ͕Ͱ͖·͢
  81. Knowledge transfers to every project that uses Vagrant. ݴ͍׵͑ΔͱɼVagrant Λ࢖͍ͬͯΔશͯͷϓϩδΣΫτ͸

    ֤ϓϩδΣΫτͰಘͨ஌ݟΛڞ༗Ͱ͖Δͱݴ͑·͢
  82. Vagrant is a general purpose tool. Use it in a

    way that works best for you. Vagrant ͸ʮ։ൃϑϩʔʯͱ͍͏ڞ௨ͷ՝୊Λղܾ͢ΔͨΊͷπʔϧͰ͢ ੋඇɼ͋ͳͨʹͱͬͯ࠷ߴͷ։ൃ؀ڥΛखʹೖΕ͍ͯͩ͘͞
  83. Basic Features A rundown. ࣍ʹɼVagrant ͕ఏڙ͢Δجຊతͳػೳʹ͍ͭͯղઆ͠·͢

  84. Three main components: Boxes, Vagrantfile, `vagrant` command-line Vagrant ͸࣍ͷ̏ͭͷཁૉʹΑͬͯߏ੒͞Ε͍ͯ·͢ Boxes

    ͱ Vagrantfileɼͦͯ͠`vagrant` ίϚϯυ Ͱ͢
  85. Boxes: Template from which machines are created. Contains pre-installed OS.

    Boxes ͱ͸ੜ੒͞ΕΔ؀ڥͷςϯϓϨʔτͰ, ࣄલʹΠϯετʔϧ͞Εͨ OS ͳͲؚ͕·Ε͍ͯ·͢
  86. Vagrantfile: Per-project configuration file describing how to configure the machine.

    Vagrantfile ͱ͸ϓϩδΣΫτຖͷઃఆϑΝΠϧͷ͜ͱͰ, ͲͷΑ͏ʹ؀ڥΛߏ੒͢Δ͔͕ॻ͔Ε͍ͯ·͢
  87. `vagrant`: Command-line tool. Complete lifecycle management of the development environment.

    `vagrant` ͱ͸୺຤Ͱ࣮ߦ͢ΔίϚϯυͷ͜ͱͰ, ։ൃ؀ڥʹରͯ͠ԿΒ͔ͷૢ࡞͢Δͱ͖ʹ࢖͍·͢
  88. Synced Folders ·ͨɼઌ΄Ͳͷ̏ͭͷཁૉͷଞʹ΋ɼ৭ʑͳػೳΛఏڙ͍ͯ͠·͢ ͦͷ̍ͭ͸ɼSynced Folders ͱ͍͏ػೳͰ͢

  89. Configures host/guest to share files with each other. Synced Folders

    ͱ͸, ϗετ/ήετؒͰϑΥϧμΛڞ༗͢ΔͨΊͷػೳͰ͢
  90. Allows developers to continue using their own editors in an

    OS they’re comfortable with. ͜ͷػೳʹΑΓɼྫ͑͹, ։ൃऀ͸޷͖ͳΤσΟλΛ࢖͏͜ͱ͕Ͱ͖ΔΑ͏ʹͳΓ·͢
  91. Networking ·ͨɼNetworking ͱ͍͏ػೳ΋͋Γ·͢

  92. Configures network access to services on the guest from the

    host and vice versa. Networking ͱ͸ωοτϫʔΫߏ੒Λௐ੔͢ΔػೳͰ, ϗετ/ήετؒͰࣗ༝ʹωοτϫʔΫΛڞ༗͢Δ͜ͱ͕Ͱ͖·͢
  93. Enables developers to use browsers, remote debuggers, etc. that they’re

    used to. ݁Ռͱͯ͠ɼ։ൃऀ͸, ͍ͭ΋࢖͍ͬͯΔϒϥ΢β/σόοΨΛͦͷ··࢖͏͜ͱ͕Ͱ͖·͢
  94. Provisioning ࣗಈԽͷͨΊͷ Provisioning ͱ͍͏ػೳ΋͋Γ·͢

  95. Use shell scripts, Chef, Puppet, CFEngine, etc. to automatically install

    and configure software. Provisioning ͸ɼγΣϧεΫϦϓτ΍ Chef, Puppet, CFEngine ͳͲΛ࢖ͬͯ, ιϑτ΢ΣΞΛࣗಈతʹΠϯετʔϧͨ͠Γௐ੔ͨ͠Γ͢ΔػೳͰ͢
  96. Complete automation, reusable components from production. ؀ڥߏஙΛ׬શʹࣗಈԽ͢Δ͜ͱʹΑΓ, ϓϩμΫγϣϯ؀ڥͰ࢖͏֤ཁૉͷ࠶ར༻ੑ͕ߴ·Γ·͢

  97. Bonus: Solves an ops problem while encouraging devs to learn

    what goes on under the hood. ͪͳΈʹɼ͜ͷ Provisioning ػೳ͸, ΤϯδχΞ͕։ൃ؀ڥΛֶश͢ΔΩοΧέʹ΋ͳΔΑ͏Ͱ͢
  98. Multi-machine ࠷ޙʹ Multi-machine ͱ͍͏ػೳʹ͍ͭͯ঺հ͠·͢

  99. Model distributed systems using Vagrant. Vagrant manages an entire cluster.

    Multi-machine ͸ɼVagrant Λ࢖ͬͨ෼ࢄγεςϜΛϞσϧԽ͢ΔػೳͰ, ͜ΕʹΑΓɼVagrant Ͱඇৗʹେ͖ͳΫϥελΛ؅ཧ͢Δ͜ͱ͕Ͱ͖·͢
  100. More accurately model production. ΑΓਖ਼֬ʹ͸ɼϓϩμΫγϣϯ؀ڥΛϞσϧԽ͢ΔͨΊͷػೳͰ͢

  101. These were 1.0 features. Proven, important. A strong foundation. ͜͜·ͰͰ঺հͨ͠΋ͷ͸ɼVagrant

    1.0 ͔Βఏڙ͞Ε͍ͯͨػೳͰ, े෼ʹख़੒͞ΕͨɼVagrant ͷج൫ͱͳΔॏཁͳػೳͰ͢
  102. Vagrant A brief history. ͜͜Ͱɼͪΐͬͱ͚ͩ Vagrant ͷྺ࢙ʹ͍ͭͯ঺հ͠·͢

  103. 2010: Vagrant 0.1 Vagrant 0.1 It worked, it was okay,

    but it was pretty bare. - VirtualBox: create/destroy - Provision with Chef solo - Only worked on Mac OS X and with Ubuntu VMs. Vagrant 0.1 ͸ɼ͏·͘ಈ͔͢͜ͱ͸Ͱ͖·͕ͨ͠ɼ͍ͭ͘΋ͷ੍ݶ͕͋Γ·ͨ͠. ྫ͑͹VirtulBox͸࡞੒/࡟আͷΈɼ Provision͸Chef soloͷΈɼOS X/Ubuntu ͷΈɼͳͲͰ͢
  104. 2012: Vagrant 1.0 Vagrant 1.0. Solid. Does its job well.

    Dependable. Stable. VirtualBox only, but supports Chef, Puppet, and shell scripts. Guest VMs can be any Linux. Vagrant 1.0 ͔Β͸ɼ͍͔ͭ͘ͷ੍ݶ͸·ͩ͋Δ΋ͷͷɼඇৗʹ҆ఆ͖ͯ͠·ͨ͠. ྫ͑͹ɼϗετ͸ VirtualBox ͷΈରԠͰ͕ͨ͠ɼChef ΍ PuppetɼγΣϧεΫϦϓτͳͲ΋ ࢖͑ΔΑ͏ʹͳΓɼ·ͨɼήετVMʹ͸͋ΒΏΔ Linux ͕࢖͑ΔΑ͏ʹͳΓ·ͨ͠.
  105. 2013: Vagrant 1.1+ Vagrant 1.1+: The Future Works with any

    provider, not just VirtualBox. Works _really_ well on Windows. Will work well with any guest, not just Linux. And... lots more TBA. ͦͯ͠ɼࠓ೥ެ։͞Εͨ Vagrant 1.1 Ҏ߱Ͱ͸ɼVirtualBox Ҏ֎ʹ΋ରԠͰ͖Α͏ʹͳΓ, ·ͨɼWindows ؀ڥͰ΋े෼ʹΑ͘ಈ͔ͤΔΑ͏ʹͳΓ·ͨ͠ɽ ࠓޙ͸ɼήετԾ૝؀ڥʹ Linux Ҏ֎΋࢖͑ΔΑ͏ʹ͢Δ༧ఆʹͳ͍ͬͯ·͢.
  106. Vagrant 1.1+ Welcome to the Future ͜ͷΑ͏ʹൃల͠ଓ͚͍ͯΔ Vagrant Ͱ͕͢, Vagrant

    1.1 Ҏ߱Ͱಋೖ͞ΕΔ(͞Εͨ)ػೳʹ͍ͭͯ΋͝঺հ͠·͢ ʢ༁஫: ݱࡏͷ࠷৽൛͸ Vagrant 1.2.2ʣ
  107. The same Vagrant you know and love, but oh so

    much better. Vagrant 1.1 Ҏ߱ʹͳͬͯ΋ɼࠓ·Ͱͱಉ͡Α͏ʹ࢖͏͜ͱ͕Ͱ͖·͢ ͔͠͠ɼVagrant 1.1 Ҏ߱Ͱ͸ɼࠓ·Ͱʹͳ͍վળ͕Ճ͑ΒΕ͍ͯ͘༧ఆͰ͢
  108. The path to Vagrant 2.0 It won’t be easy, but

    damn it’ll be good. Vagrant 2.0 ·Ͱͷ۩ମతͳܭըʹ͍ͭͯઆ໌͠·͢ ؆୯ͳಓͰ͸͋Γ·ͤΜ͕ɼVagrant ΛΑΓྑ͍πʔϧʹਐԽͤ͞ΔͨΊͷಓͷΓͰ͢
  109. Backwards Compatible* Just “vagrant up” your 1.0.x Vagrantfiles. * Plugins

    from 1.0.x aren’t backwards compatible. ·ͣɼVagrant ͷޙํޓ׵ੑΛอͪ·͢ɽ1.0ܥͷ vagrantfile ΋`vagrant up`Ͱ࣮ߦͰ͖·͢
  110. Vagrant 1.1/1.2: Providers ·ͨɼVagrant 1.1/1.2 Ͱ͸ɼVirtualBox Ҏ֎ͷϓϩόΠμʹ΋ରԠ͢Δ༧ఆͰ͢

  111. Vagrant 1.3+: Automated Box Building Vagrant 1.3 Ҏ߱Ͱ͸ɼBox ͷߏஙΛࣗಈԽ͢Δ࢓૊ΈΛऔΓೖΕ·͢

  112. Vagrant 1.3+: Mac/Windows Guests Ճ͑ͯɼVagrant 1.3 Ҏ߱Ͱ͸ɼMac ΍ Windows ΋ήετͰಈ͘Α͏ʹ͢Δ༧ఆͰ͢

  113. Multi-Provider What does it mean? Why? Vagrant Ͱ͸ɼෳ਺ͷϓϩόΠμʹ΋ରԠ͍͖ͯ͠·͢ ʮϓϩόΠμͱ͸Կ͔?ʯ, ʮԿނඞཁͳͷ͔?ʯʹ͍ͭͯઆ໌͠·͢

  114. ϓϩόΠμͱ͸ɼVagrant ্ͷ؀ڥ༻ʹϦιʔεΛ؅ཧ (*)ͯ͘͠ΕΔ΋ͷͰ͢ * ͨͩ͠ɼωοτϫʔΫ΍هԱྖҬͷηοτΞοϓ͸ඞཁͰ͢. A provider manages compute resources*

    for Vagrant machines. * But also sets up networking and some basic storage too.
  115. Vagrant 1.0: VirtualBox was the only “provider” Vagrant 1.0 Ͱ͸ɼϓϩόΠμͷબ୒͸Ͱ͖ͣɼඞͣ

    VirtualBox Λ࢖͏ඞཁ͕͋Γ·ͨ͠
  116. Vagrant 1.1+: VirtualBox, VMware, AWS, RackSpace, LXC, your toaster. Vagrant

    1.1 ͔Β͸ɼVirtualBox ͚ͩͰͳ͘, VMWare ΍ AWS, RackSpace, LXC ͳͲʹ΋ରԠͰ͖ΔΑ͏ʹͳΓ·ͨ͠
  117. Why? People actually ask me this once in awhile. ͳͥෳ਺ͷϓϩόΠμʹରԠͤͨ͞ͷͰ͠ΐ͏͔ʁ

    Α࣭͘໰͞ΕΔͷͰɼ͜͜Ͱճ౴͓͖ͯ͠·͢
  118. VirtualBox isn’t great for every situation. ୺తʹݴ͏ͱɼVirtualBox ͸ɼ͋ΒΏΔঢ়گʹରͯ͠࠷ߴͷπʔϧͰ͸ͳ͍͔ΒͰ͢

  119. Multiple providers enable Vagrant to do new and awesome things.

    ෳ਺ͷϓϩόΠμʹରԠ͢Δ͜ͱͰɼͲΜͳঢ়گͰ͋ͬͯ΋ ʮ࠷ߴͷ։ൃϑϩʔʯΛఏڙͰ͖ΔΑ͏ʹͳΓ·͢
  120. People love Vagrant for the workflow. Not for VirtualBox. ࢲୡͷϢʔβ͸ɼ࠷ߴͷ։ൃϑϩʔΛಘΔͨΊʹ

    Vagrant Λ࢖͍ͬͯΔͷͰ͋ͬͯ, VirtualBox ΛಘΔͨΊʹ࢖͍ͬͯΔͷͰ͸͋Γ·ͤΜ
  121. Other providers let you have that workflow in an environment

    that works best for you. ࣮ࡍɼଞͷϓϩόΠμʹ΋ରԠͰ͖ͨ͜ͱʹΑΓ, ͲΜͳঢ়گͰ͋ͬͯ΋࠷ߴͷ։ൃϑϩʔ͕ఏڙͰ͖ΔΑ͏ʹͳΓ·ͨ͠
  122. New use cases... Vagrant where Vagrant has never gone before.

    Vagrant ͸ɼ͞ΒͳΔະ஌ͷྖҬʹ଍Λ౿ΈೖΕ͍͖ͯ·͢ গ͚ͩ͠ɼVagrant ͕ఏڙ͢Δະདྷͷ؀ڥΛ঺հ͠·͠ΐ͏
  123. Continuous Integration AWS, LXC, etc. Fantastic. ̍ͭ͸ɼAWS ΍ LXC ͳͲɼͲΜͳ؀ڥͰ΋࣮ߦͰ͖ΔܧଓతΠϯςάϨʔγϣϯͰ͢

  124. Develop locally. Test remotely. Work in VirtualBox. Test in AWS

    (more prod-like). ϩʔΧϧ؀ڥͰ։ൃ͠ɼϦϞʔτ؀ڥͰςετͰ͖ΔΑ͏ʹͳΓ·͢ ྫ͑͹ʮVirtualBox ্Ͱ։ൃ͠ɼAWS ্Ͱςετ͢Δʯͱ͍ͬͨ։ൃϑϩʔͰ͢
  125. Deploys “vagrant up” an app for staging/production. ·ͨɼσϓϩΠ΋؆ܿʹͳΓɼͨͩ `vagrant up`

    ͱ࣮ߦ͢Δ͚ͩͰ, εςʔδϯά؀ڥ΍ϓϩμΫγϣϯ؀ڥʹσϓϩΠͰ͖ΔΑ͏ʹͳΓ·͢
  126. Vagrant in Vagrant VMware outside. LXC inside. Etcetera. Vagrant ࣗମΛ

    Vagrant Ͱಈ͔͢͜ͱ΋Ͱ͖ΔΑ͏ʹͳΔͰ͠ΐ͏ ྫ͑͹ɼVMware ͷ֎΍ɼLXC ͷதͰ Vagrant Λಈ͔͢ɼͳͲͰ͢
  127. Corporate Environments Maximize that VMware investment. ֤؀ڥ͕ڠௐͯ͠ಈ࡞͢Δ͜ͱ΋Ͱ͖ΔΑ͏ʹͳΔͰ͠ΐ͏ ͜Ε͸ɼ݁Ռͱͯ͠ VMware ͷ౤ࢿޮՌΛߴΊΔ͜ͱʹ΋ܨ͕Γ·͢

  128. Keep Dreamin’ This is all just the beginning. ͜ΕΒ͸ Vagrant

    ͕ఏڙ͢Δະདྷͷ΄ΜͷҰ෦Ͱ͢ Vagrant ͸͜Ε͔Β΋ເΛ௥͍ଓ͚͍͖ͯ·͢
  129. Multi-Provider How do I use it? ෳ਺ͷϓϩόΠμʹରԠͨ͠ Vagrant Ͱ͕͢, Ϣʔβ͸ɼ۩ମతʹͲ͏࢖͏ͷ͔ʹ͍ͭͯ͝঺հ͠·͢

  130. vagrant up --provider=foo Where foo is “vmware_fusion”, “aws”, etc. Ϣʔβ͸

    `vagrant up --provider foo` Ͱɼ೚ҙͷϓϩόΠμΛࢦఆ͢Δ͜ͱ͕Ͱ͖·͢ foo ʹ͸ɼྫ͑͹ “vmware_fusion” ΍ “aws” ͱ͍ͬͨΦϓγϣϯΛࢦఆͰ͖·͢
  131. Same Vagrantfile, multiple providers. Pretty magical once you see it.

    ݁Ռͱͯ͠ɼಉ͡ Vagrantfile Λෳ਺ͷϓϩόΠμʹద༻ͤ͞Δ͜ͱ͕Ͱ͖·͢ ࣮ࡍʹ࣮ߦͯ͠ΈΔͱɼ·ΔͰຐ๏ͷΑ͏ʹݟ͑Δͱࢥ͍·͢
  132. Vagrant.configure(“2”) do |config| config.vm.box = “precise64” end A Vagrantfile ۩ମྫΛݟ͍͖ͯ·͠ΐ͏ɽ্هͷ

    Vagrantfile ͸, box ʹอଘ͢ΔΠϝʔδϑΝΠϧ໊ (“precise64”)Λࢦఆͨ͠΋ͷͰ͢
  133. $ vagrant box add precise64 \ http://files.vagrantup.com/precise64.box ... $ vagrant

    box add precise64 \ http://files.vagrantup.com/precise64_vmware_fusion.box ... Some Boxes `vagrant box add` Λ࣮ߦ͠ɼઌ΄Ͳઃఆͨ͠ box ʹ VirtualBox/VMware ༻ͷΠϝʔδϑΝΠϧΛμ΢ϯϩʔυ͠·͢
  134. $ vagrant up --provider=virtualbox ... OR $ vagrant up --provider=vmware_fusion

    ... Up in VirtualBox or VMware ࠷ޙʹɼ--provider ͰϓϩόΠμΛࢦఆͯ͠ `vagrant up`͢Δ͚ͩͰ׬ྃͰ͢ ͳ͓ɼσϑΥϧτͰ͸ VirtualBox ͕ىಈ͢ΔΑ͏ʹͳ͍ͬͯ·͢
  135. It’s that easy. Seriously. There isn’t a catch. Ͷɼ؆୯Ͱ͠ΐʁ ޼ົͳϫφͱ͔͡Όͳ͍͔Βɼ҆৺͍ͯͩ͘͠͞.

  136. Best effort. Not every provider can satisfy every Vagrant abstraction,

    but it won’t fail if it can’t. Example: AWS networking doesn’t map well to Vagrant networking. Vagrant + AWS will just ignore networking configurations. Not error. It’ll make a “best effort” to work. ͨͩɼϕετΤϑΥʔτͰఏڙͯ͠ΔͷͰɼϓϩόΠμ͕׬શʹରԠ͠ͳ͍͜ͱ΋͋Γ·͢ ྫ͑͹ AWS Ͱ͸ɼVagrant ʹΑͬͯந৅Խ͞ΕͨωοτϫʔΫߏ੒Λແࢹͯ͠͠·͍·͢
  137. Boxes They’re now tied to providers. ࣍ʹɼෳ਺ͷϓϩόΠμʹରͯ͠ Boxes Λ࢖͏ྫΛ঺հ͠·͢ ݱࡏɼBoxes

    ͸֤ϓϩόΠμʹରͯ͠ॻ͚ΔΑ͏ʹͳ͍ͬͯ·͢
  138. Template for a machine. Base image for VirtualBox, AMI/metadata for

    AWS, etc. Boxes ͸ɼ؀ڥΛߏங͢ΔͨΊͷςϯϓϨʔτͳͷͰ, ྫ͑͹ɼVirtualBox Ͱಈ͘ΠϝʔδϑΝΠϧΛ࡞ΔΑ͏ʹ, AWS Ͱಈ͘ΠϝʔδϑΝΠϧͳͲ΋࡞Ε·͢.
  139. $ vagrant box list centos (virtualbox) precise64 (aws) precise64 (virtualbox)

    precise64 (vmware_fusion) Tied to a Provider ্ه͸ɼ֤ϓϩόΠμʹରͯ͠ box Λ࡞ͬͨ৔߹ͷྫͰ͢
  140. You need a box for each provider. This process is

    manual, for now. ݱঢ়Ͱ͸ɼ֤ϓϩόΠμʹରͯ͠खಈͰ box Λ࡞੒͢Δඞཁ͕͋Γ·͢
  141. VirtualBox: OVF export VMware: VMX export LXC: rootfs tarball AWS:

    Metadata (AMI info) What’s in a box? It varies by provider. Actually, anything can be in a box. The provider is responsible for reading and verifying structure. ֤ϓϩόΠμʹରԠ͢ΔͨΊɼBox ͸৭ʑͳϑΥʔϚοτʹରԠ͍ͯ͠·͢ ྫ͑͹ VirtualBox ͸ OVFɼVMware ͸ VMXɼAWS ʹ͸ AMI ϑΝΠϧͱ͍ͬͨ۩߹Ͱ͢
  142. Provider-Specific Config The full power of the provider, if you

    need it. Abstractions are nice, but sometimes you want to take advantage of specific properties of a provider. For example, AWS can do things VMware can’t, and vice versa. Provider-specific config lets you do that. ෳ਺ͷϓϩόΠμʹରԠ͢ΔͨΊɼϓϩόΠμຖʹઃఆΛՃ͑ΒΕΔΑ͏ʹͳΓ·ͨ͠ ͜ΕʹΑΓɼ֤ϓϩόΠμͰ࠷ߴͷύϑΥʔϚϯε͕ൃشͰ͖ΔΑ͏ʹௐ੔Ͱ͖·͢
  143. Vagrant.configure(“2”) do |config| config.vm.box = “precise64” config.vm.provider “virtualbox” do |v|

    v.customize [“modifyvm”, :id, “--memory”, “2048”] end config.vm.provider “vmware_fusion” do |v| v.vmx[“memsize”] = “2048” end end Example: Setting Memory ྫ͑͹ɼVirtualBox ͱ VMware Ͱ͸̎MB෼ͷϝϞϦΛ࢖͏, ͱ͍ͬͨײ͡ͰઃఆͰ͖·͢
  144. Vagrant.configure(“2”) do |config| config.vm.box = “precise64” config.vm.provider “virtualbox” do |v|

    v.customize [“modifyvm”, :id, “--memory”, “2048”] end config.vm.provider “vmware_fusion” do |v| v.vmx[“memsize”] = “2048” end end Example: Setting Memory ԫ৭͘ϋΠϥΠτ͞Ε͍ͯΔՕॴ͕ɼ VirtualBox ͷઃఆͰ͢
  145. Vagrant.configure(“2”) do |config| config.vm.box = “precise64” config.vm.provider “virtualbox” do |v|

    v.customize [“modifyvm”, :id, “--memory”, “2048”] end config.vm.provider “vmware_fusion” do |v| v.vmx[“memsize”] = “2048” end end Example: Setting Memory ͦͯͪ͜͠Β͕ VMware ͷઃఆʹͳΓ·͢
  146. Portable Even if the user doesn’t have that provider installed,

    the Vagrantfile will still work. ͜ͷΑ͏ͳϓϩόΠμຖͷઃఆʹ͸Ҡ২ੑ͕͋Γ·͢ ҰํͰɼ΋͠Ϣʔβ͕ͦͷϓϩόΠμΛΠϯετʔϧ͍ͯ͠ͳͯ͘΋, Vagrantfile ͕ͪΌΜͱಈ͘Α͏ʹͳ͍ͬͯ·͢
  147. Clear Purpose It makes it clear that that configuration applies

    ONLY to specific providers. ઃఆϑΝΠϧʹॻ͔Εͨ಺༰͸ɼରԠͨ͠ϓϩόΠμʹͷΈద༻͞ΕΔͨΊ, ͲͷϓϩόΠμʹରͯ͠Ͳ͏ઃఆ͍ͯ͠Δͷ͔͕໌֬ʹͳΓ·͢
  148. Power A place to expose full capabilities of underlying providers.

    ϓϩόΠμຖʹ͏·͘ઃఆΛॻ͘͜ͱ͕Ͱ͖Ε͹, ֤ϓϩόΠμΛ࠷େݶ༗ޮ׆༻Ͱ͖ΔͰ͠ΐ͏
  149. Totally Optional Just use a normal Vagrantfile if you don’t

    care. This is for power users. ࠷ޙʹɼࠓճ৽ͨʹ঺հͨ͠ػೳ͸ɼඞਢͷػೳͰ͸͋Γ·ͤΜ. ΋ͪΖΜɼࠓ·Ͱͱಉ͡Α͏ʹ Vagrantfile Λ࢖͏͜ͱ΋Ͱ͖·͢. ͜ͷػೳʹΑΓɼϔϏʔϢʔβͷཁ๬ʹ΋Ԡ͑ΒΕΔΑ͏ʹͳͬͨɼͱ͍͏͜ͱͰ͢.
  150. That’s it. Same powerful workflow, clean abstractions, uncompromised flexibility. Vagrant

    ͸ࠓޙ΋े෼ͳந৅ԽʹྭΈɼॊೈੑʹଥڠͤͣ, ࠷ߴͷ։ൃϑϩʔΛఏڙ͠ଓ͚·͢.
  151. Conclusion ࠓ೔ͷ࿩Λɼ؆୯ʹ·ͱΊ·͢

  152. Use Vagrant Vagrant Λ࢖͍·͠ΐ͏

  153. Packer http://www.packer.io HASHI COPR ͕ఏڙ͍ͯ͠Δ Packer ͱ͍͏πʔϧʹ͍ͭͯ΋ ؆୯ʹ͝঺հ͍ͤͯͩ͘͞͞

  154. Automatically create machine images. Packer ͸ɼ؀ڥͷΠϝʔδϑΝΠϧΛࣗಈతʹੜ੒͢ΔͨΊͷπʔϧͰ͢

  155. Very useful on its own, without Vagrant. ΋ͪΖΜ Vagrant ͱͷ૬ੑ΋ྑ͍Ͱ͕͢,

    Packer ୯ମͰ΋ಈ͔͢͜ͱ͕Ͱ͖·͢
  156. For Vagrant: Automatically create Vagrant boxes. ·ͨɼVagrant ͱҰॹʹ࢖͏ͱ, Vagrant ͷ

    boxes ΛࣗಈͰੜ੒ͯ͘͠Ε·͢
  157. Can dramatically speed up “vagrant up” time if box is

    pre-provisioned. ݁Ռͱͯ͠ɼࣄલʹ box ͕ఔΑ͘४උ͞Ε͍ͯΕ͹, `vagrant up` ͷ࣮ߦ࣌ؒΛܶతʹॖΊΔ͜ͱ͕Ͱ͖·͢
  158. New, released June 2013. Lots of people using already. Packer

    ͸ 2013೥6݄ʹϦϦʔε͞Εɼطʹଟ͘ͷਓୡ͕࢖͍ͬͯ·͢
  159. Check it out! http://www.packer.io ੋඇ্هͷαΠτʹ๚ΕͯΈ͍ͯͩ͘͞ʂ

  160. Thank you. http://vagrantup.com by http://oreilly.com/go/vagrant ͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ (༁: @yasulab )