Diese Präsentation wurde erfolgreich gemeldet.
Wir verwenden Ihre LinkedIn Profilangaben und Informationen zu Ihren Aktivitäten, um Anzeigen zu personalisieren und Ihnen relevantere Inhalte anzuzeigen. Sie können Ihre Anzeigeneinstellungen jederzeit ändern.
Real sandboxing with theVagrant-Binding     API
About me•Hendrik Ebbers•Lead of development at SIC GmbH in Dortmund, Germany•Lead of JUG Dortmund•DataFX, JFXtras Contribu...
Content•Vagrant•Puppet•Vagrant-Binding API
Vagrant
Vagrant                                          Vagrant•configure virtual machines by script•create new instances on the fl...
Vagrant•build on top of VirtualBox•written in Ruby                    access by shell &                          Ruby
Vagrant                           add template VM to                                 Vagrant $ vagrant box add lucid32 htt...
Vagrant                            Ubuntu                                           Lucid                                 ...
Vagrant 1.1.x•Released 2 weeks ago•PlugIn API•New Providers (AWS, RackSpace, VMWare Fusion)                   „1“ for Vagr...
Puppet
Puppet•configure your machines (nodes) by script•install and configure software & services•https://puppetlabs.com
Puppet class apache {   exec { apt-get update:     command => /usr/bin/apt-get update   }   package { "apache2":     ensur...
Puppet•package individual components in modules•many online documentations & books out there
Vagrant  &Puppet
Vagrant & Puppet•define your VM with Vagrant & configure it with Puppet•Puppet is pre-installed on Vagrant boxes
Vagrant & Puppet                                         VagrantfileVagrant::Config.run do |config|  config.vm.box = "luci...
Vagrant-Binding            igure &  manage       conf          VM   s in Java
Vagrant-Binding•Java Wrapper around Vagrant•create & start VMs at runtime•only VirtualBox is required
Vagrant-Binding•Fluent Builder APIs•JUnit support•Puppet support
Builder APIVagrantVmConfig vmConfig = new VagrantVmConfigBuilder()! ! ! ! .withLucid32Box()! ! ! ! .withName("myLittleVm")...
JUnit support                                            st not reachable?@Testpublic void testJdbc() {         what if ho...
JUnit support@Rule      JUnit annotation          manage VM lifecyclepublic VagrantTestRule testRule =       new VagrantTe...
QA Portal with Vagrant•Manage all test machines with Vagrant & Puppet•Manage lifecycle with Java                          ...
Puppet Forge accessFile moduleFolder = new File("...");PuppetForgeClient client = new PuppetForgeClient();! !! !List<Puppe...
Vagrant-Binding                               fork me                                       on github    https://github.co...
Roadmap•Switch to Vagrant 1.1.x and JRuby 1.7.x•Remove VirtualBox as needed dependency (RackSpace & AWS support)•Chef supp...
Thanks   forwatching            @hendrikEbbers          www.guigarage.com      hendrik.ebbers@web.de
Nächste SlideShare
Wird geladen in …5
×

Devoxx UK 2013: Sandboxing with the Vagrant-Binding API

2.306 Aufrufe

Veröffentlicht am

Many developers are in need of complex test environments for different projects with customers. The ideal situation would be to have them running in a sandbox. With help of Vagrant and the vagrant-binding API it's possible to create VM based sandbox-environments "on the fly".
Anytime, anywhere and above all reproducible.
The Talk shows how fast you can create and configure a sandbox with the help of Vagrant and vagrant-binding even from within the Java runtime. Based on this different solutions for problems in QA and UnitTesting will be shown.

Veröffentlicht in: Technologie
  • Als Erste(r) kommentieren

  • Gehören Sie zu den Ersten, denen das gefällt!

Devoxx UK 2013: Sandboxing with the Vagrant-Binding API

  1. 1. Real sandboxing with theVagrant-Binding API
  2. 2. About me•Hendrik Ebbers•Lead of development at SIC GmbH in Dortmund, Germany•Lead of JUG Dortmund•DataFX, JFXtras Contributor @hendrikEbbers www.guigarage.com hendrik.ebbers@web.de
  3. 3. Content•Vagrant•Puppet•Vagrant-Binding API
  4. 4. Vagrant
  5. 5. Vagrant Vagrant•configure virtual machines by script•create new instances on the fly manage create•manage the VM lifecycle•http://www.vagrantup.com VM
  6. 6. Vagrant•build on top of VirtualBox•written in Ruby access by shell & Ruby
  7. 7. Vagrant add template VM to Vagrant $ vagrant box add lucid32 http:// files.vagrantup.com/lucid32.box $ vagrant init lucid32 creates VM configuration-script $ vagrant up start the virtual machine $ vagrant destroy
  8. 8. Vagrant Ubuntu Lucid 32- & 64 -bit•provides 2 template boxes by default•simple config-files Vagrant::Config.run do |config| config.vm.box = "lucid32" end see great Vagrant documentation•easy ssh connection, shared folder, etc.
  9. 9. Vagrant 1.1.x•Released 2 weeks ago•PlugIn API•New Providers (AWS, RackSpace, VMWare Fusion) „1“ for Vagrant 1.0.x „2“ for Vagrant 1.1.x Vagrant.configure("1") Vagrant::Config.run do |config| config.vm.box = "lucid32" end
  10. 10. Puppet
  11. 11. Puppet•configure your machines (nodes) by script•install and configure software & services•https://puppetlabs.com
  12. 12. Puppet class apache { exec { apt-get update: command => /usr/bin/apt-get update } package { "apache2": ensure => present, Ap ache2 is installed } & started on node service { "apache2": ensure => running, require => Package["apache2"], } } include apache
  13. 13. Puppet•package individual components in modules•many online documentations & books out there
  14. 14. Vagrant &Puppet
  15. 15. Vagrant & Puppet•define your VM with Vagrant & configure it with Puppet•Puppet is pre-installed on Vagrant boxes
  16. 16. Vagrant & Puppet VagrantfileVagrant::Config.run do |config| config.vm.box = "lucid32" config.vm.provision :puppet do |puppet| puppet.manifests_path = "manifests" puppet.manifest_file = "my_manifest.pp" endend ppet script path to Pu
  17. 17. Vagrant-Binding igure & manage conf VM s in Java
  18. 18. Vagrant-Binding•Java Wrapper around Vagrant•create & start VMs at runtime•only VirtualBox is required
  19. 19. Vagrant-Binding•Fluent Builder APIs•JUnit support•Puppet support
  20. 20. Builder APIVagrantVmConfig vmConfig = new VagrantVmConfigBuilder()! ! ! ! .withLucid32Box()! ! ! ! .withName("myLittleVm") builder API for VM! ! ! ! .withHostOnlyIp("192.168.50.4")! ! ! ! .build(); builder API availableVagrantEnvironment environment = ...;environment.up(); manage VM lifecycle! ! !environment.getVm(0).createConnection().execute("touch /tmp1");environment.destroy(); ssh connection
  21. 21. JUnit support st not reachable?@Testpublic void testJdbc() { what if ho dbHandler = new MySql(ip, db, user, pwd); dbHandler.createMyTable(); what if table already dbHandler.insertRow(); exists? assertEquals(1, dbHandler.getRowCount()); dbHandler.close(); parallel proces ses?}
  22. 22. JUnit support@Rule JUnit annotation manage VM lifecyclepublic VagrantTestRule testRule = new VagrantTestRule(createConfig());public static VagrantConfiguration createConfig() { //Configure VM with MySQL-Server & static ip} use builder API for VM spec ification create VM start VM run UnitTest destroy VM
  23. 23. QA Portal with Vagrant•Manage all test machines with Vagrant & Puppet•Manage lifecycle with Java state: down Super App Nightly Build with MySQL Default installation of the App with MySQL DB Server state: running Super App Nightly Build with Oracle DB started by: John Default installation of the App with Oracle DB Server state: down Super App Nightly Build without Database Use this to check the default Errors in UI at startup
  24. 24. Puppet Forge accessFile moduleFolder = new File("...");PuppetForgeClient client = new PuppetForgeClient();! !! !List<PuppetForgeModuleDescription> allDescriptions =! client.findModules("mongodb");! ! searchfor(PuppetForgeModuleDescription desc : allDescriptions) {! System.out.println("Installing " + desc.getFullName());! PuppetForgeModule module = client.findModule(desc);! client.installToModulesDir(moduleFolder, module);} m odule at install as runtime
  25. 25. Vagrant-Binding fork me on github https://github.com/guigarage/vagrant-binding
  26. 26. Roadmap•Switch to Vagrant 1.1.x and JRuby 1.7.x•Remove VirtualBox as needed dependency (RackSpace & AWS support)•Chef support
  27. 27. Thanks forwatching @hendrikEbbers www.guigarage.com hendrik.ebbers@web.de

×