SlideShare a Scribd company logo
1 of 47
Download to read offline
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
•DataFX, JFXtras Contributor
                                     @hendrikEbbers
                                   www.guigarage.com
                               hendrik.ebbers@web.de
Content

•Virtualization
•Vagrant
•Puppet
•Java Vagrant-Binding API
Virtualization
Evolution of VMs
                  achines
       Vir tual M




                            VM temp
Machines                            lates   automated VM
                                               creation
Antipattern by
   example
By only u sing VMs we can
rebuild any customer
system
For ea ch new customer
the b est matching VM is
copied. S o no initial setup
is needed!
Why  not deploy all linux
64bit customer
installat ions on one server
VM?
Because we  copy the VMs on
our Laptop s when we travel
to the Custo mer. And we only
need the system for one
Customer then.
So you   have a virtualized
                            r
Serve r for every Custome
                          rk
whe re all developers wo
on?
No only one de veloper works on
                              s
one VM.  If a developer start
                           e
workin g for a customer h
simp ly copies the VM of
another developer.
e rs
        l op
    e ve
D

           A

           B

           C

           D

           E
                                              Custom
                                                     ers
                      1   2   3   4   5   6
One month
  later...
Some
       one u
 Eclips        pdated
        e can'         our S
               t use         VN.
anymo                 it
      re
Oh, it took m
               e 15 minutes
to update Ec
             lipse and the
SVN plugin
And this was only the
  first of 50 VMs!!!
Automated VM creation
             Vagrant
                               Java



                       Virtu
                            alBox



    Puppet
                                      Chef
Vagrant
Vagrant

                                         Vagrant


•configure virtual machines by script




                                                     manage
                                       create
•create new instances on the fly
•manage the VM lifecycle
                                                VM
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


•build on top of VirtualBox
•written in Ruby
                    access by shell &
                          Ruby
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
                                      see great Vagrant
                                       documentation

•easy ssh connection, shared folder, etc.
Demo
Puppet
Puppet


•configure your machines (nodes) by script
•install and configure software & services
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
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
                                         Vagrantfile


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                               ppet script
                            path to Pu
Demo
Vagrant-
Binding
                  manage
    co nfigure &
        VMs   in Java
Vagrant-Binding


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


•Builder APIs
•JUnit support
•Puppet support
Builder API

VagrantVmConfig vmConfig = new VagrantVmConfigBuilder()
! ! ! ! .withLucid32Box()
! ! ! ! .withName("myLittleVm")              builder API for VM
! ! ! ! .withHostOnlyIp("192.168.50.4")
! ! ! ! .build();
                                               also builder API
VagrantEnvironment environment = ...;          available
environment.up();       manage VM lifecycle
! ! !
environment.getVm(0).createConnection().execute("touch /tmp1");

environment.destroy();                  ssh connection
Demo
JUnit support

                                            st not reachable?
@Test
public 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?
}
JUnit support

@Rule      JUnit annotation          manage VM lifecycle
public 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
Demo
Puppet Forge access
File moduleFolder = new File("...");


PuppetForgeClient client = new PuppetForgeClient();
! !
! !
List<PuppetForgeModuleDescription> allDescriptions =
! client.findModules("mongodb");      search
! !

for(PuppetForgeModuleDescription desc : allDescriptions) {
! System.out.println("Installing " + desc.getFullName());
! PuppetForgeModule module = client.findModule(desc);
! client.installToModulesDir(moduleFolder, module);
}
                                 module at
                      install as
                             runtime
Demo
Vagrant-Binding

                             fork me
                                     on github




  https://github.com/guigarage/vagrant-binding
Roadmap
 • Remove VirtualBox as dependency (VMWare
   & AWS support)

 • Chef support

 • Simpler management of Environments

 • Better Builder APIs

 • Create Vagrant boxes at runtime
Thanks
   for
watching
           @hendrikEbbers
         www.guigarage.com
     hendrik.ebbers@web.de

More Related Content

What's hot

Multi-provider Vagrant and Chef: AWS, VMware, and more
Multi-provider Vagrant and Chef: AWS, VMware, and moreMulti-provider Vagrant and Chef: AWS, VMware, and more
Multi-provider Vagrant and Chef: AWS, VMware, and moreChef Software, Inc.
 
Vagrant-Overview
Vagrant-OverviewVagrant-Overview
Vagrant-OverviewCrifkin
 
Vagrant + Ansible + Docker
Vagrant + Ansible + DockerVagrant + Ansible + Docker
Vagrant + Ansible + DockerVijay Selvaraj
 
Building (localized) Vagrant boxes with Packer
Building (localized) Vagrant boxes with PackerBuilding (localized) Vagrant boxes with Packer
Building (localized) Vagrant boxes with PackerCristovao G. Verstraeten
 
Vagrant for Virtualized Development
Vagrant for Virtualized DevelopmentVagrant for Virtualized Development
Vagrant for Virtualized DevelopmentAdam Culp
 
Puppet and Vagrant in development
Puppet and Vagrant in developmentPuppet and Vagrant in development
Puppet and Vagrant in developmentAdam Culp
 
Vagrant + Docker provider [+Puppet]
Vagrant + Docker provider [+Puppet]Vagrant + Docker provider [+Puppet]
Vagrant + Docker provider [+Puppet]Nicolas Poggi
 
It Works On My Machine: Vagrant for Software Development
It Works On My Machine: Vagrant for Software DevelopmentIt Works On My Machine: Vagrant for Software Development
It Works On My Machine: Vagrant for Software DevelopmentCarlos Perez
 
How To Set a Vagrant Development System
How To Set a Vagrant Development SystemHow To Set a Vagrant Development System
How To Set a Vagrant Development SystemPaul Bearne
 
Node.js, Vagrant, Chef, and Mathoid @ Benetech
Node.js, Vagrant, Chef, and Mathoid @ BenetechNode.js, Vagrant, Chef, and Mathoid @ Benetech
Node.js, Vagrant, Chef, and Mathoid @ BenetechChristopher Bumgardner
 
An Introduction to Vagrant and Docker
An Introduction to Vagrant and DockerAn Introduction to Vagrant and Docker
An Introduction to Vagrant and DockerScott Lowe
 
Vagrant vs Docker
Vagrant vs DockerVagrant vs Docker
Vagrant vs Dockerjchase50
 
Vagrant 101 Workshop
Vagrant 101 WorkshopVagrant 101 Workshop
Vagrant 101 WorkshopLiora Milbaum
 
Vagrant step-by-step guide for Beginners
Vagrant step-by-step guide for BeginnersVagrant step-by-step guide for Beginners
Vagrant step-by-step guide for BeginnersSagar Acharya
 
Vagrant crash course
Vagrant crash courseVagrant crash course
Vagrant crash courseMarcus Deglos
 
Running JavaScript Efficiently in a Java World
Running JavaScript Efficiently in a Java WorldRunning JavaScript Efficiently in a Java World
Running JavaScript Efficiently in a Java Worldirbull
 
Docker workshop
Docker workshopDocker workshop
Docker workshopEvans Ye
 

What's hot (20)

Multi-provider Vagrant and Chef: AWS, VMware, and more
Multi-provider Vagrant and Chef: AWS, VMware, and moreMulti-provider Vagrant and Chef: AWS, VMware, and more
Multi-provider Vagrant and Chef: AWS, VMware, and more
 
Vagrant presentation
Vagrant presentationVagrant presentation
Vagrant presentation
 
Vagrant-Overview
Vagrant-OverviewVagrant-Overview
Vagrant-Overview
 
Vagrant + Ansible + Docker
Vagrant + Ansible + DockerVagrant + Ansible + Docker
Vagrant + Ansible + Docker
 
Building (localized) Vagrant boxes with Packer
Building (localized) Vagrant boxes with PackerBuilding (localized) Vagrant boxes with Packer
Building (localized) Vagrant boxes with Packer
 
Vagrant for Virtualized Development
Vagrant for Virtualized DevelopmentVagrant for Virtualized Development
Vagrant for Virtualized Development
 
Puppet and Vagrant in development
Puppet and Vagrant in developmentPuppet and Vagrant in development
Puppet and Vagrant in development
 
Vagrant + Docker provider [+Puppet]
Vagrant + Docker provider [+Puppet]Vagrant + Docker provider [+Puppet]
Vagrant + Docker provider [+Puppet]
 
It Works On My Machine: Vagrant for Software Development
It Works On My Machine: Vagrant for Software DevelopmentIt Works On My Machine: Vagrant for Software Development
It Works On My Machine: Vagrant for Software Development
 
How To Set a Vagrant Development System
How To Set a Vagrant Development SystemHow To Set a Vagrant Development System
How To Set a Vagrant Development System
 
Node.js, Vagrant, Chef, and Mathoid @ Benetech
Node.js, Vagrant, Chef, and Mathoid @ BenetechNode.js, Vagrant, Chef, and Mathoid @ Benetech
Node.js, Vagrant, Chef, and Mathoid @ Benetech
 
An Introduction to Vagrant and Docker
An Introduction to Vagrant and DockerAn Introduction to Vagrant and Docker
An Introduction to Vagrant and Docker
 
Vagrant vs Docker
Vagrant vs DockerVagrant vs Docker
Vagrant vs Docker
 
Vagrant 101 Workshop
Vagrant 101 WorkshopVagrant 101 Workshop
Vagrant 101 Workshop
 
Vagrant For DevOps
Vagrant For DevOpsVagrant For DevOps
Vagrant For DevOps
 
Intro to vagrant
Intro to vagrantIntro to vagrant
Intro to vagrant
 
Vagrant step-by-step guide for Beginners
Vagrant step-by-step guide for BeginnersVagrant step-by-step guide for Beginners
Vagrant step-by-step guide for Beginners
 
Vagrant crash course
Vagrant crash courseVagrant crash course
Vagrant crash course
 
Running JavaScript Efficiently in a Java World
Running JavaScript Efficiently in a Java WorldRunning JavaScript Efficiently in a Java World
Running JavaScript Efficiently in a Java World
 
Docker workshop
Docker workshopDocker workshop
Docker workshop
 

Viewers also liked

Ipad research pw
Ipad research pwIpad research pw
Ipad research pwdafrak
 
Presentación de Daniel y Cristian. Les fêtes
Presentación de Daniel y Cristian. Les fêtesPresentación de Daniel y Cristian. Les fêtes
Presentación de Daniel y Cristian. Les fêtesm.carmen63
 
Monuments de Cieza
Monuments de CiezaMonuments de Cieza
Monuments de Ciezam.carmen63
 
Vagrant Binding JayDay 2013
Vagrant Binding JayDay 2013Vagrant Binding JayDay 2013
Vagrant Binding JayDay 2013Hendrik Ebbers
 
webcomponents (Jfokus 2015)
webcomponents (Jfokus 2015)webcomponents (Jfokus 2015)
webcomponents (Jfokus 2015)Hendrik Ebbers
 
Web Components & Polymer 1.0 (Webinale Berlin)
Web Components & Polymer 1.0 (Webinale Berlin)Web Components & Polymer 1.0 (Webinale Berlin)
Web Components & Polymer 1.0 (Webinale Berlin)Hendrik Ebbers
 
BUILDING MODERN WEB UIS WITH WEB COMPONENTS @ Devoxx
BUILDING MODERN WEB UIS WITH WEB COMPONENTS @ DevoxxBUILDING MODERN WEB UIS WITH WEB COMPONENTS @ Devoxx
BUILDING MODERN WEB UIS WITH WEB COMPONENTS @ DevoxxHendrik Ebbers
 
DataFX 8 (JavaOne 2014)
DataFX 8 (JavaOne 2014)DataFX 8 (JavaOne 2014)
DataFX 8 (JavaOne 2014)Hendrik Ebbers
 
JavaFX Enterprise (JavaOne 2014)
JavaFX Enterprise (JavaOne 2014)JavaFX Enterprise (JavaOne 2014)
JavaFX Enterprise (JavaOne 2014)Hendrik Ebbers
 
Feature driven development
Feature driven developmentFeature driven development
Feature driven developmentHendrik Ebbers
 
Test Driven Development with JavaFX
Test Driven Development with JavaFXTest Driven Development with JavaFX
Test Driven Development with JavaFXHendrik Ebbers
 
Learn BEM: CSS Naming Convention
Learn BEM: CSS Naming ConventionLearn BEM: CSS Naming Convention
Learn BEM: CSS Naming ConventionIn a Rocket
 
SEO: Getting Personal
SEO: Getting PersonalSEO: Getting Personal
SEO: Getting PersonalKirsty Hulse
 

Viewers also liked (20)

Ipad research pw
Ipad research pwIpad research pw
Ipad research pw
 
Presentación de Daniel y Cristian. Les fêtes
Presentación de Daniel y Cristian. Les fêtesPresentación de Daniel y Cristian. Les fêtes
Presentación de Daniel y Cristian. Les fêtes
 
D dent 2011
D dent 2011D dent 2011
D dent 2011
 
plasma
plasmaplasma
plasma
 
Monuments de Cieza
Monuments de CiezaMonuments de Cieza
Monuments de Cieza
 
Jgrid
JgridJgrid
Jgrid
 
Vagrant Binding JayDay 2013
Vagrant Binding JayDay 2013Vagrant Binding JayDay 2013
Vagrant Binding JayDay 2013
 
webcomponents (Jfokus 2015)
webcomponents (Jfokus 2015)webcomponents (Jfokus 2015)
webcomponents (Jfokus 2015)
 
Extreme Gui Makeover
Extreme Gui MakeoverExtreme Gui Makeover
Extreme Gui Makeover
 
Web Components & Polymer 1.0 (Webinale Berlin)
Web Components & Polymer 1.0 (Webinale Berlin)Web Components & Polymer 1.0 (Webinale Berlin)
Web Components & Polymer 1.0 (Webinale Berlin)
 
JavaFX Enterprise
JavaFX EnterpriseJavaFX Enterprise
JavaFX Enterprise
 
DataFX - JavaOne 2013
DataFX - JavaOne 2013DataFX - JavaOne 2013
DataFX - JavaOne 2013
 
Bonjour for Java
Bonjour for JavaBonjour for Java
Bonjour for Java
 
BUILDING MODERN WEB UIS WITH WEB COMPONENTS @ Devoxx
BUILDING MODERN WEB UIS WITH WEB COMPONENTS @ DevoxxBUILDING MODERN WEB UIS WITH WEB COMPONENTS @ Devoxx
BUILDING MODERN WEB UIS WITH WEB COMPONENTS @ Devoxx
 
DataFX 8 (JavaOne 2014)
DataFX 8 (JavaOne 2014)DataFX 8 (JavaOne 2014)
DataFX 8 (JavaOne 2014)
 
JavaFX Enterprise (JavaOne 2014)
JavaFX Enterprise (JavaOne 2014)JavaFX Enterprise (JavaOne 2014)
JavaFX Enterprise (JavaOne 2014)
 
Feature driven development
Feature driven developmentFeature driven development
Feature driven development
 
Test Driven Development with JavaFX
Test Driven Development with JavaFXTest Driven Development with JavaFX
Test Driven Development with JavaFX
 
Learn BEM: CSS Naming Convention
Learn BEM: CSS Naming ConventionLearn BEM: CSS Naming Convention
Learn BEM: CSS Naming Convention
 
SEO: Getting Personal
SEO: Getting PersonalSEO: Getting Personal
SEO: Getting Personal
 

Similar to Lightweight reproducible environments with Vagrant, Puppet & Java

Virtualization with Vagrant (ua.pycon 2011)
Virtualization with Vagrant (ua.pycon 2011)Virtualization with Vagrant (ua.pycon 2011)
Virtualization with Vagrant (ua.pycon 2011)Dmitry Guyvoronsky
 
Local development environment through virtualisation
Local development environment through virtualisationLocal development environment through virtualisation
Local development environment through virtualisationRadu Barbu
 
Virtualization for Developers
Virtualization for DevelopersVirtualization for Developers
Virtualization for DevelopersJohn Coggeshall
 
Using Vagrant
Using VagrantUsing Vagrant
Using Vagrantandygale
 
Deploy High Availability Kubernetes with Kubespray
Deploy High Availability Kubernetes with KubesprayDeploy High Availability Kubernetes with Kubespray
Deploy High Availability Kubernetes with KubesprayChe-Chia Chang
 
Harmonious Development: Standardizing The Deployment Process via Vagrant and ...
Harmonious Development: Standardizing The Deployment Process via Vagrant and ...Harmonious Development: Standardizing The Deployment Process via Vagrant and ...
Harmonious Development: Standardizing The Deployment Process via Vagrant and ...Acquia
 
Automated Infrastructure and Application Management
Automated Infrastructure and Application ManagementAutomated Infrastructure and Application Management
Automated Infrastructure and Application ManagementClark Everetts
 
Making Developers Productive with Vagrant, VirtualBox, and Docker
Making Developers Productive with Vagrant, VirtualBox, and DockerMaking Developers Productive with Vagrant, VirtualBox, and Docker
Making Developers Productive with Vagrant, VirtualBox, and DockerJohn Rofrano
 
Vagrant - Version control your dev environment
Vagrant - Version control your dev environmentVagrant - Version control your dev environment
Vagrant - Version control your dev environmentbocribbz
 
Powering Development and Testing Environments with Vagrant
Powering Development and Testing Environments with VagrantPowering Development and Testing Environments with Vagrant
Powering Development and Testing Environments with VagrantCoen Jacobs
 
Getting started with puppet and vagrant (1)
Getting started with puppet and vagrant (1)Getting started with puppet and vagrant (1)
Getting started with puppet and vagrant (1)Puppet
 
Avoiding surprises with Chef and Vagrant
Avoiding surprises with Chef and VagrantAvoiding surprises with Chef and Vagrant
Avoiding surprises with Chef and Vagrantandygale
 
Virtualization for Developers
Virtualization for DevelopersVirtualization for Developers
Virtualization for DevelopersJohn Coggeshall
 
Docker and Puppet for Continuous Integration
Docker and Puppet for Continuous IntegrationDocker and Puppet for Continuous Integration
Docker and Puppet for Continuous IntegrationGiacomo Vacca
 
Virtualization for Developers
Virtualization for DevelopersVirtualization for Developers
Virtualization for DevelopersJohn Coggeshall
 

Similar to Lightweight reproducible environments with Vagrant, Puppet & Java (20)

Virtualization with Vagrant (ua.pycon 2011)
Virtualization with Vagrant (ua.pycon 2011)Virtualization with Vagrant (ua.pycon 2011)
Virtualization with Vagrant (ua.pycon 2011)
 
Local development environment through virtualisation
Local development environment through virtualisationLocal development environment through virtualisation
Local development environment through virtualisation
 
Virtualization for Developers
Virtualization for DevelopersVirtualization for Developers
Virtualization for Developers
 
Using Vagrant
Using VagrantUsing Vagrant
Using Vagrant
 
Vagrant and chef
Vagrant and chefVagrant and chef
Vagrant and chef
 
Deploy High Availability Kubernetes with Kubespray
Deploy High Availability Kubernetes with KubesprayDeploy High Availability Kubernetes with Kubespray
Deploy High Availability Kubernetes with Kubespray
 
Harmonious Development: Standardizing The Deployment Process via Vagrant and ...
Harmonious Development: Standardizing The Deployment Process via Vagrant and ...Harmonious Development: Standardizing The Deployment Process via Vagrant and ...
Harmonious Development: Standardizing The Deployment Process via Vagrant and ...
 
Automated Infrastructure and Application Management
Automated Infrastructure and Application ManagementAutomated Infrastructure and Application Management
Automated Infrastructure and Application Management
 
Making Developers Productive with Vagrant, VirtualBox, and Docker
Making Developers Productive with Vagrant, VirtualBox, and DockerMaking Developers Productive with Vagrant, VirtualBox, and Docker
Making Developers Productive with Vagrant, VirtualBox, and Docker
 
Vagrant - Version control your dev environment
Vagrant - Version control your dev environmentVagrant - Version control your dev environment
Vagrant - Version control your dev environment
 
Powering Development and Testing Environments with Vagrant
Powering Development and Testing Environments with VagrantPowering Development and Testing Environments with Vagrant
Powering Development and Testing Environments with Vagrant
 
Getting started with puppet and vagrant (1)
Getting started with puppet and vagrant (1)Getting started with puppet and vagrant (1)
Getting started with puppet and vagrant (1)
 
Avoiding surprises with Chef and Vagrant
Avoiding surprises with Chef and VagrantAvoiding surprises with Chef and Vagrant
Avoiding surprises with Chef and Vagrant
 
Virtualization for Developers
Virtualization for DevelopersVirtualization for Developers
Virtualization for Developers
 
Vagrantfordevops
VagrantfordevopsVagrantfordevops
Vagrantfordevops
 
Docker and Puppet for Continuous Integration
Docker and Puppet for Continuous IntegrationDocker and Puppet for Continuous Integration
Docker and Puppet for Continuous Integration
 
Vagrant
VagrantVagrant
Vagrant
 
Vagrant Up in 5 Easy Steps
Vagrant Up in 5 Easy StepsVagrant Up in 5 Easy Steps
Vagrant Up in 5 Easy Steps
 
Tech Talk - Vagrant
Tech Talk - VagrantTech Talk - Vagrant
Tech Talk - Vagrant
 
Virtualization for Developers
Virtualization for DevelopersVirtualization for Developers
Virtualization for Developers
 

More from Hendrik Ebbers

Java APIs- The missing manual (concurrency)
Java APIs- The missing manual (concurrency)Java APIs- The missing manual (concurrency)
Java APIs- The missing manual (concurrency)Hendrik Ebbers
 
Beauty & the Beast - Java VS TypeScript
Beauty & the Beast - Java VS TypeScriptBeauty & the Beast - Java VS TypeScript
Beauty & the Beast - Java VS TypeScriptHendrik Ebbers
 
Java APIs - the missing manual
Java APIs - the missing manualJava APIs - the missing manual
Java APIs - the missing manualHendrik Ebbers
 
Multidevice Controls: A Different Approach to UX
Multidevice Controls: A Different Approach to UXMultidevice Controls: A Different Approach to UX
Multidevice Controls: A Different Approach to UXHendrik Ebbers
 
Java WebStart Is Dead: What Should We Do Now?
Java WebStart Is Dead: What Should We Do Now?Java WebStart Is Dead: What Should We Do Now?
Java WebStart Is Dead: What Should We Do Now?Hendrik Ebbers
 
Java ap is you should know
Java ap is you should knowJava ap is you should know
Java ap is you should knowHendrik Ebbers
 
JavaFX JumpStart @JavaOne 2016
JavaFX JumpStart @JavaOne 2016JavaFX JumpStart @JavaOne 2016
JavaFX JumpStart @JavaOne 2016Hendrik Ebbers
 

More from Hendrik Ebbers (9)

Java Desktop 2019
Java Desktop 2019Java Desktop 2019
Java Desktop 2019
 
Java APIs- The missing manual (concurrency)
Java APIs- The missing manual (concurrency)Java APIs- The missing manual (concurrency)
Java APIs- The missing manual (concurrency)
 
Beauty & the Beast - Java VS TypeScript
Beauty & the Beast - Java VS TypeScriptBeauty & the Beast - Java VS TypeScript
Beauty & the Beast - Java VS TypeScript
 
Java 11 OMG
Java 11 OMGJava 11 OMG
Java 11 OMG
 
Java APIs - the missing manual
Java APIs - the missing manualJava APIs - the missing manual
Java APIs - the missing manual
 
Multidevice Controls: A Different Approach to UX
Multidevice Controls: A Different Approach to UXMultidevice Controls: A Different Approach to UX
Multidevice Controls: A Different Approach to UX
 
Java WebStart Is Dead: What Should We Do Now?
Java WebStart Is Dead: What Should We Do Now?Java WebStart Is Dead: What Should We Do Now?
Java WebStart Is Dead: What Should We Do Now?
 
Java ap is you should know
Java ap is you should knowJava ap is you should know
Java ap is you should know
 
JavaFX JumpStart @JavaOne 2016
JavaFX JumpStart @JavaOne 2016JavaFX JumpStart @JavaOne 2016
JavaFX JumpStart @JavaOne 2016
 

Lightweight reproducible environments with Vagrant, Puppet & Java

  • 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 •DataFX, JFXtras Contributor @hendrikEbbers www.guigarage.com hendrik.ebbers@web.de
  • 5. Evolution of VMs achines Vir tual M VM temp Machines lates automated VM creation
  • 6. Antipattern by example
  • 7. By only u sing VMs we can rebuild any customer system
  • 8. For ea ch new customer the b est matching VM is copied. S o no initial setup is needed!
  • 9. Why not deploy all linux 64bit customer installat ions on one server VM?
  • 10. Because we copy the VMs on our Laptop s when we travel to the Custo mer. And we only need the system for one Customer then.
  • 11. So you have a virtualized r Serve r for every Custome rk whe re all developers wo on?
  • 12. No only one de veloper works on s one VM. If a developer start e workin g for a customer h simp ly copies the VM of another developer.
  • 13.
  • 14. e rs l op e ve D A B C D E Custom ers 1 2 3 4 5 6
  • 15. One month later...
  • 16. Some one u Eclips pdated e can' our S t use VN. anymo it re
  • 17. Oh, it took m e 15 minutes to update Ec lipse and the SVN plugin
  • 18. And this was only the first of 50 VMs!!!
  • 19.
  • 20. Automated VM creation Vagrant Java Virtu alBox Puppet Chef
  • 22. Vagrant Vagrant •configure virtual machines by script manage create •create new instances on the fly •manage the VM lifecycle VM
  • 23. 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
  • 24. Vagrant •build on top of VirtualBox •written in Ruby access by shell & Ruby
  • 25. 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 see great Vagrant documentation •easy ssh connection, shared folder, etc.
  • 26. Demo
  • 28. Puppet •configure your machines (nodes) by script •install and configure software & services
  • 29. 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
  • 30. Puppet •package individual components in modules •many online documentations & books out there
  • 32. Vagrant & Puppet •define your VM with Vagrant & configure it with Puppet •Puppet is pre-installed on Vagrant boxes
  • 33. Vagrant & Puppet Vagrantfile 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 ppet script path to Pu
  • 34. Demo
  • 35. Vagrant- Binding manage co nfigure & VMs in Java
  • 36. Vagrant-Binding •Java Wrapper around Vagrant •create & start VMs at runtime •only VirtualBox is required
  • 38. Builder API VagrantVmConfig vmConfig = new VagrantVmConfigBuilder() ! ! ! ! .withLucid32Box() ! ! ! ! .withName("myLittleVm") builder API for VM ! ! ! ! .withHostOnlyIp("192.168.50.4") ! ! ! ! .build(); also builder API VagrantEnvironment environment = ...; available environment.up(); manage VM lifecycle ! ! ! environment.getVm(0).createConnection().execute("touch /tmp1"); environment.destroy(); ssh connection
  • 39. Demo
  • 40. JUnit support st not reachable? @Test public 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? }
  • 41. JUnit support @Rule JUnit annotation manage VM lifecycle public 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
  • 42. Demo
  • 43. Puppet Forge access File moduleFolder = new File("..."); PuppetForgeClient client = new PuppetForgeClient(); ! ! ! ! List<PuppetForgeModuleDescription> allDescriptions = ! client.findModules("mongodb"); search ! ! for(PuppetForgeModuleDescription desc : allDescriptions) { ! System.out.println("Installing " + desc.getFullName()); ! PuppetForgeModule module = client.findModule(desc); ! client.installToModulesDir(moduleFolder, module); } module at install as runtime
  • 44. Demo
  • 45. Vagrant-Binding fork me on github https://github.com/guigarage/vagrant-binding
  • 46. Roadmap • Remove VirtualBox as dependency (VMWare & AWS support) • Chef support • Simpler management of Environments • Better Builder APIs • Create Vagrant boxes at runtime
  • 47. Thanks for watching @hendrikEbbers www.guigarage.com hendrik.ebbers@web.de