2. About me
•Hendrik Ebbers
•Lead of JUG Dortmund
•Senior Java Architect at
GmbH in Dortmund, Germany
•DataFX, ControlsFX,AquaFX,
MarvinFX,Vagrant-Binding @hendrikEbbers
www.guigarage.com
hendrik.ebbers@web.de
Let´s talk about this one...
23. Vagrant
•configure virtual machines by script
•create new instances on the fly
•manage theVM lifecycle
Vagrant
VM
create
managelifecycle
http://www.vagrantup.com
24. $ 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
start the virtual
machine
26. 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
see great Vagrant
documentation
27. Vagrant 1.1.x
•Released this spring
•PlugIn API
•New Providers
Vagrant::Config.run do |config|
config.vm.box = "lucid32"
end
Vagrant.configure("1")
„1“ for Vagrant 1.0.x
„2“ for Vagrant 1.1.x
28. Provider & Provisioner
•PlugIn API for Providers
•Virtual Box,AWS,VMWare Fusion
•PlugIn API for Provisioners
•Shell, Puppet, Chef,Ansible
35. Vagrant & Puppet
•define yourVM withVagrant & configure it
with Puppet
•Puppet is pre-installed onVagrant boxes
Vagrant defines
the box
Puppet defines
the content
36. 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
path to Puppet
script
Vagrantfile
39. Chef
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = "my_cookbooks"
chef.add_recipe "apache2"
chef.json = { :apache => { :site_enabled => true } } end
end
path to
cookbooks
use this recipe
configure
48. JUnit support
@Test
public void testJdbc() {
MySql dbHandler = new MySql(ip, db, user, pwd);
dbHandler.createMyTable();
dbHandler.insertRow();
assertEquals(1, dbHandler.getRowCount());
dbHandler.clearAndClose();
}
what if table already
exists?
what if host not reachable?
parallel
processes?
49. JUnit support
@Rule
public VagrantTestRule testRule =
new VagrantTestRule(createConfig());
public static VagrantConfiguration createConfig() {
//Configure VM with MySQL-Server & static ip
}
@Test public void testJdbc() {...}
create VM start VM run UnitTest destroy VM
default JUnit annotation
manage VM lifecycle
use builder API for VM
specification use the VM
51. QA Portal
•Manage all test machines withVagrant &
Puppet
•Manage lifecycle with Java
Super App Nightly Build with MySQL
Default installation of the App with MySQL DB Server
Super App Nightly Build with Oracle DB
Default installation of the App with Oracle DB Server
Super App Nightly Build without Database
Use this to check the default Errors in UI at startup
state: down
state: running
started by: John
state: down
Mockup
52. Workflow example
Create VM-
Definition
Upload to
portal
Add Link to
Jenkins-Job
User starts
QA
Create &
configure VM
use
Trigger Jenkins
build
use
feedback
Test the
nightly build
let´s find
some bugs
deploy the
nightly
destroy VM
in portal
just a click
in the portal
62. Veewee
$ bundle exec veewee vbox templates | grep -i ubuntu
$ bundle exec veewee vbox define 'mybuntubox'
'ubuntu-12.10-server-amd64'
$ bundle exec veewee vbox build 'mybuntubox'
list all ubuntu
templates
define new VM
for Virtual Box
build VM for
Virtual Box
63. Veewee
$ bundle exec veewee vbox export 'myubuntubox'
$ vagrant box add 'myubuntubox' 'myubuntubox.box'
Vagrant.configure("2") do |config|
config.vm.box = "myubuntubox"
end
Export VM instance
as box
add box to
Vagrant
use VM template
in Vagrantfile
65. Vagrant-Binding 2.0
•Support of Vagrant 1.1.x
•Virtual Box and AWS Provider API
•Veewee wrapper
•Better Chef and Puppet API
•Basic Java / Groovy Provisioner API