java about me
play

& Java About me Hendrik Ebbers Lead of development at SIC GmbH - PowerPoint PPT Presentation

Lightweight and reproducible environments with Vagrant & Puppet & Java About me Hendrik Ebbers Lead of development at SIC GmbH in Dortmund, Germany Lead of JUG Dortmund @hendrikEbbers www.guigarage.com


  1. Lightweight and reproducible environments with Vagrant & Puppet & Java

  2. About me •Hendrik Ebbers •Lead of development at SIC GmbH in Dortmund, Germany •Lead of JUG Dortmund @hendrikEbbers www.guigarage.com hendrik.ebbers@web.de

  3. Content •Vagrant •Puppet •Java Vagrant-Binding API

  4. Vagrant

  5. Vagrant Vagrant manage lifecycle •configure virtual machines by script e •create new instances on the fly t a e r c •manage the VM lifecycle VM

  6. 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 e h i n m a c a l r t u e v i t h t a r t s

  7. Vagrant •build on top of VirtualBox •written in Ruby access by shell & Ruby

  8. Vagrant Ubuntu Lucid 32- & 64-bit •provides 2 template boxes by default •simple config-files it´s just Ruby Vagrant::Config.run do |config| config.vm.box = "lucid32" end s e e g r e a t V a g r a n t d o c u m e n t a t i o n •easy ssh connection, shared folder, etc.

  9. Puppet

  10. Puppet •configure your machines (nodes) by script •install and configure software & services

  11. Puppet class apache { exec { 'apt-get update': command => '/usr/bin/apt-get update' } package { "apache2": Apache2 is installed ensure => present, } & started on node service { "apache2": ensure => running, require => Package["apache2"], } } include apache

  12. Puppet •package individual components in modules •many online documentations & books out there

  13. Vagrant & Puppet

  14. Vagrant & Puppet •define your VM with Vagrant & configure it with Puppet •Puppet is pre-installed on Vagrant boxes

  15. Vagrant & Puppet V a g r a n t f i l e Vagrant::Config.run do |config| config.vm.box = "lucid32" config.vm.provision :puppet do |puppet| puppet.manifests_path = "manifests" puppet.manifest_file = "my_manifest.pp" end end i p t s c r e t u p p o P h t p a t

  16. Vagrant- Binding e g a n a m & e r u g i f n o c a v a J n i s M V

  17. Vagrant-Binding •Java Wrapper around Vagrant •create & start VMs at runtime •only VirtualBox is required

  18. Vagrant-Binding •Builder APIs •JUnit support •Puppet support

  19. Builder API VagrantVmConfig vmConfig = new VagrantVmConfigBuilder() � � � � .withLucid32Box() builder API for VM � � � � .withName("myLittleVm") � � � � .withHostOnlyIp("192.168.50.4") � � � � .build(); a l s o b u i l d e r A P I a v a i l a b l e VagrantEnvironment environment = ...; manage VM lifecycle environment.up(); � � � environment.getVm(0).createConnection().execute("touch /tmp1"); i o n e c t o n n h c s s environment.destroy();

  20. JUnit support what if host not @Test reachable? public void testJdbc() { dbHandler = new MySql(ip, db, user, pwd); what if table dbHandler.createMyTable(); already exists? dbHandler.insertRow(); assertEquals(1, dbHandler.getRowCount()); p a r a l l e l p dbHandler.close(); r o c e s s e s ? }

  21. JUnit support JUnit annotation e y c l f e c M l i e V n a g m a @Rule public VagrantTestRule testRule = new VagrantTestRule(createConfig()); public static VagrantConfiguration createConfig() { //Configure VM with MySQL-Server & static ip } use builder API for VM specification create VM start VM run UnitTest destroy VM

  22. Vagrant-Binding fork me on github https://github.com/guigarage/vagrant-binding

  23. Thanks for watching @hendrikEbbers www.guigarage.com hendrik.ebbers@web.de

Recommend


More recommend