SlideShare une entreprise Scribd logo
1  sur  23
Télécharger pour lire hors ligne
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
                           hendrik.ebbers@web.de
Content

•Vagrant
•Puppet
•Java Vagrant-Binding API
Vagrant
Vagrant
                                         Vagrant




                                                     manage lifecycle
•configure virtual machines by script




                                       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
                          by shel l & Ruby
                   access
Vagrant                                  Ubuntu
                                         32- & 64
                                                 Lucid
                                                  -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.
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
   }
   service { "apache2":             & started on node
     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                        path to Puppet script
Vagrant-
Binding
           ure &  manage
    config
       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();        mana ge VM lifecycle
! ! !
environment.getVm(0).createConnection().execute("touch /tmp1");

environment.destroy();                  ssh connection
JUnit support
@Test                            wh at if host not
public void testJdbc() {         reachable?

    dbHandler = new MySql(ip, db, user, pwd);

    dbHandler.createMyTable();      what if table
                                    already exists?
    dbHandler.insertRow();

    assertEquals(1, dbHandler.getRowCount());

    dbHandler.close();              parallel proces
                                                    ses?
}
JUnit support
             JUnit annotation             manage VM lifecycle
@Rule
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
Vagrant-Binding
                             fork me
                                     on github




  https://github.com/guigarage/vagrant-binding
Thanks
   for
watching
         @hendrikEbbers
       www.guigarage.com
   hendrik.ebbers@web.de

Contenu connexe

Tendances

Vagrant are you still develop in a non-virtual environment-
Vagrant  are you still develop in a non-virtual environment-Vagrant  are you still develop in a non-virtual environment-
Vagrant are you still develop in a non-virtual environment-
Anatoly Bubenkov
 
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
Christopher Bumgardner
 

Tendances (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)
 
An Introduction to Vagrant and Docker
An Introduction to Vagrant and DockerAn Introduction to Vagrant and Docker
An Introduction to Vagrant and Docker
 
Vagrant 101 Workshop
Vagrant 101 WorkshopVagrant 101 Workshop
Vagrant 101 Workshop
 
Docker. Micro services for lazy developers
Docker. Micro services for lazy developersDocker. Micro services for lazy developers
Docker. Micro services for lazy developers
 
Vagrant + Ansible + Docker
Vagrant + Ansible + DockerVagrant + Ansible + Docker
Vagrant + Ansible + Docker
 
Vagrant For DevOps
Vagrant For DevOpsVagrant For DevOps
Vagrant For DevOps
 
Vagrant for Virtualized Development
Vagrant for Virtualized DevelopmentVagrant for Virtualized Development
Vagrant for Virtualized Development
 
Create your very own Development Environment with Vagrant and Packer
Create your very own Development Environment with Vagrant and PackerCreate your very own Development Environment with Vagrant and Packer
Create your very own Development Environment with Vagrant and Packer
 
Vagrant vs Docker
Vagrant vs DockerVagrant vs Docker
Vagrant vs Docker
 
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
 
Intro to vagrant
Intro to vagrantIntro to vagrant
Intro to vagrant
 
Vagrant are you still develop in a non-virtual environment-
Vagrant  are you still develop in a non-virtual environment-Vagrant  are you still develop in a non-virtual environment-
Vagrant are you still develop in a non-virtual environment-
 
vert.x 3.1 - be reactive on the JVM but not only in Java
vert.x 3.1 - be reactive on the JVM but not only in Javavert.x 3.1 - be reactive on the JVM but not only in Java
vert.x 3.1 - be reactive on the JVM but not only in Java
 
Minicurso de Vagrant
Minicurso de VagrantMinicurso de Vagrant
Minicurso de Vagrant
 
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
 
Building (localized) Vagrant boxes with Packer
Building (localized) Vagrant boxes with PackerBuilding (localized) Vagrant boxes with Packer
Building (localized) Vagrant boxes with Packer
 
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
 
Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)
 
Vagrant
VagrantVagrant
Vagrant
 
Lightweight Virtualization with Linux Containers and Docker | YaC 2013
Lightweight Virtualization with Linux Containers and Docker | YaC 2013Lightweight Virtualization with Linux Containers and Docker | YaC 2013
Lightweight Virtualization with Linux Containers and Docker | YaC 2013
 

En vedette

Vagrant Binding JayDay 2013
Vagrant Binding JayDay 2013Vagrant Binding JayDay 2013
Vagrant Binding JayDay 2013
Hendrik Ebbers
 

En vedette (13)

webcomponents (Jfokus 2015)
webcomponents (Jfokus 2015)webcomponents (Jfokus 2015)
webcomponents (Jfokus 2015)
 
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)
 
Vagrant Binding JayDay 2013
Vagrant Binding JayDay 2013Vagrant Binding JayDay 2013
Vagrant Binding JayDay 2013
 
Extreme Gui Makeover
Extreme Gui MakeoverExtreme Gui Makeover
Extreme Gui Makeover
 
Jgrid
JgridJgrid
Jgrid
 
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
 

Similaire à Lightweight and reproducible environments with vagrant and Puppet

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
 
Automate your Development Environment with Vagrant & Chef
Automate your Development Environment with Vagrant & ChefAutomate your Development Environment with Vagrant & Chef
Automate your Development Environment with Vagrant & Chef
Michael Lihs
 
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
Coen Jacobs
 
Avoiding surprises with Chef and Vagrant
Avoiding surprises with Chef and VagrantAvoiding surprises with Chef and Vagrant
Avoiding surprises with Chef and Vagrant
andygale
 

Similaire à Lightweight and reproducible environments with vagrant and Puppet (20)

Using Vagrant
Using VagrantUsing Vagrant
Using Vagrant
 
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
 
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 ...
 
Vagrant & Docker
Vagrant & DockerVagrant & Docker
Vagrant & Docker
 
Using Vagrant, Puppet, Testing & Hadoop
Using Vagrant, Puppet, Testing & HadoopUsing Vagrant, Puppet, Testing & Hadoop
Using Vagrant, Puppet, Testing & Hadoop
 
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & Hadoop
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & HadoopPuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & Hadoop
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & Hadoop
 
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & Hadoop
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & HadoopPuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & Hadoop
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & Hadoop
 
NetDevOps Developer Environments with Vagrant @ SCALE16x
NetDevOps Developer Environments with Vagrant @ SCALE16xNetDevOps Developer Environments with Vagrant @ SCALE16x
NetDevOps Developer Environments with Vagrant @ SCALE16x
 
Vagrant - Version control your dev environment
Vagrant - Version control your dev environmentVagrant - Version control your dev environment
Vagrant - Version control your dev environment
 
Automate your Development Environment with Vagrant & Chef
Automate your Development Environment with Vagrant & ChefAutomate your Development Environment with Vagrant & Chef
Automate your Development Environment with Vagrant & Chef
 
Puppet and Vagrant in development
Puppet and Vagrant in developmentPuppet and Vagrant in development
Puppet and Vagrant in development
 
Vagrant 의 활용
Vagrant 의 활용Vagrant 의 활용
Vagrant 의 활용
 
Tech Talk - Vagrant
Tech Talk - VagrantTech Talk - Vagrant
Tech Talk - Vagrant
 
Vagrantfordevops
VagrantfordevopsVagrantfordevops
Vagrantfordevops
 
About docker in GDG Seoul
About docker in GDG SeoulAbout docker in GDG Seoul
About docker in GDG Seoul
 
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
 
Deploy High Availability Kubernetes with Kubespray
Deploy High Availability Kubernetes with KubesprayDeploy High Availability Kubernetes with Kubespray
Deploy High Availability Kubernetes with Kubespray
 
Create Development and Production Environments with Vagrant
Create Development and Production Environments with VagrantCreate Development and Production Environments with Vagrant
Create Development and Production Environments with Vagrant
 
Avoiding surprises with Chef and Vagrant
Avoiding surprises with Chef and VagrantAvoiding surprises with Chef and Vagrant
Avoiding surprises with Chef and Vagrant
 

Plus de Hendrik Ebbers

Plus de 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 and reproducible environments with vagrant and Puppet

  • 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
  • 5. Vagrant Vagrant manage lifecycle •configure virtual machines by script create •create new instances on the fly •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 start the virtual machine
  • 7. Vagrant •build on top of VirtualBox •written in Ruby by shel l & Ruby access
  • 8. Vagrant Ubuntu 32- & 64 Lucid -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.
  • 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": ensure => present, Ap ache2 is installed } service { "apache2": & started on node ensure => running, require => Package["apache2"], } } include apache
  • 12. Puppet •package individual components in modules •many online documentations & books out there
  • 14. Vagrant & Puppet •define your VM with Vagrant & configure it with Puppet •Puppet is pre-installed on Vagrant boxes
  • 15. 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 path to Puppet script
  • 16. Vagrant- Binding ure & manage config VMs in Java
  • 17. Vagrant-Binding •Java Wrapper around Vagrant •create & start VMs at runtime •only VirtualBox is required
  • 19. 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(); mana ge VM lifecycle ! ! ! environment.getVm(0).createConnection().execute("touch /tmp1"); environment.destroy(); ssh connection
  • 20. JUnit support @Test wh at if host not public void testJdbc() { reachable? dbHandler = new MySql(ip, db, user, pwd); dbHandler.createMyTable(); what if table already exists? dbHandler.insertRow(); assertEquals(1, dbHandler.getRowCount()); dbHandler.close(); parallel proces ses? }
  • 21. JUnit support JUnit annotation manage VM lifecycle @Rule 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
  • 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