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

java about me
SMART_READER_LITE
LIVE PREVIEW

& 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


slide-1
SLIDE 1

Lightweight and reproducible environments with

Vagrant & Puppet

& Java

slide-2
SLIDE 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

slide-3
SLIDE 3

Content

  • Vagrant
  • Puppet
  • Java Vagrant-Binding API
slide-4
SLIDE 4

Vagrant

slide-5
SLIDE 5

Vagrant

  • configure virtual machines by script
  • create new instances on the fly
  • manage the VM lifecycle

Vagrant VM c r e a t e manage lifecycle

slide-6
SLIDE 6

$ vagrant box add lucid32 http:// files.vagrantup.com/lucid32.box $ vagrant init lucid32 $ vagrant up

Vagrant

add template VM to Vagrant creates VM configuration-script s t a r t t h e v i r t u a l m a c h i n e

slide-7
SLIDE 7

Vagrant

  • build on top of VirtualBox
  • written in Ruby

access by shell & Ruby

slide-8
SLIDE 8

Vagrant

  • provides 2 template boxes by default
  • simple config-files
  • easy ssh connection, shared folder, etc.

Vagrant::Config.run do |config| config.vm.box = "lucid32" end

Ubuntu Lucid 32- & 64-bit it´s just Ruby s e e g r e a t V a g r a n t d

  • c

u m e n t a t i

  • n
slide-9
SLIDE 9

Puppet

slide-10
SLIDE 10

Puppet

  • configure your machines (nodes) by script
  • install and configure software & services
slide-11
SLIDE 11

Puppet

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

slide-12
SLIDE 12

Puppet

  • package individual components in modules
  • many online documentations & books out

there

slide-13
SLIDE 13

Vagrant & Puppet

slide-14
SLIDE 14

Vagrant & Puppet

  • define your VM with Vagrant & configure it

with Puppet

  • Puppet is pre-installed on Vagrant boxes
slide-15
SLIDE 15

Vagrant & Puppet

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

p a t h t

  • P

u p p e t s c r i p t V a g r a n t f i l e

slide-16
SLIDE 16

Vagrant- Binding

c

  • n

f i g u r e & m a n a g e V M s i n J a v a

slide-17
SLIDE 17

Vagrant-Binding

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

Vagrant-Binding

  • Builder APIs
  • JUnit support
  • Puppet support
slide-19
SLIDE 19

Builder API

VagrantVmConfig vmConfig = new VagrantVmConfigBuilder() .withLucid32Box() .withName("myLittleVm") .withHostOnlyIp("192.168.50.4") .build(); VagrantEnvironment environment = ...; environment.up(); environment.getVm(0).createConnection().execute("touch /tmp1"); environment.destroy();

a l s

  • b

u i l d e r A P I a v a i l a b l e builder API for VM manage VM lifecycle s s h c

  • n

n e c t i

  • n
slide-20
SLIDE 20

JUnit support

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

  • c

e s s e s ?

slide-21
SLIDE 21

JUnit support

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

slide-22
SLIDE 22

Vagrant-Binding

https://github.com/guigarage/vagrant-binding

fork me on github

slide-23
SLIDE 23

Thanks for watching

@hendrikEbbers www.guigarage.com hendrik.ebbers@web.de