Skip the Excuse with Vagrant Ohio LinuxFest 2015
Outline 1 2 3 4
Agenda 1 2 3 4
JVM and Big Data Developer Stylophile Coffee aficionado joseph@josephbeard.net @jbeard6 http://josephbeard.net
Agenda 1 2 3 4
Vagrant A tool for creating, managing, and distributing portable development environments.
Agenda 1 2 3 4
$ vagrant init hashicorp/precise64 A Vagrantfile has been placed in this directory. You are now ready to vagrant up your first virtual environment! Please read the comments in the Vagrantfile as well as documentation on vagrantup.com for more information on using Vagrant. $ ls Vagrantfile $ cat Vagrantfile
$ vagrant init hashicorp/precise64 A Vagrantfile has been placed in this directory. You are now ready to vagrant up your first virtual environment! Please read the comments in the Vagrantfile as well as documentation on vagrantup.com for more information on using Vagrant. $ ls Vagrantfile $ cat Vagrantfile
$ vagrant init hashicorp/precise64 A Vagrantfile has been placed in this directory. You are now ready to vagrant up your first virtual environment! Please read the comments in the Vagrantfile as well as documentation on vagrantup.com for more information on using Vagrant. $ ls Vagrantfile $ cat Vagrantfile
$ vagrant init hashicorp/precise64 A Vagrantfile has been placed in this directory. You are now ready to vagrant up your first virtual environment! Please read the comments in the Vagrantfile as well as documentation on vagrantup.com for more information on using Vagrant. $ ls Vagrantfile $ cat Vagrantfile
$ vagrant up Bringing machine default up with vmware_workstation provider... ==> default: Box hashicorp/precise64 could not be found. default: Attempting to find and install... default: Box Provider: vmware_desktop, vmware_fusion, vmware_workstation default: Box Version: >= 0 ==> default: Loading metadata for box hashicorp/precise64 default: URL: https://atlas.hashicorp.com/hashicorp/precise64 ==> default: Adding box hashicorp/precise64 (v1.1.0) default: Downloading: https://vagrantcloud.com/hashicorp/boxes/... ==> default: Successfully added box hashicorp/precise64 (v1.1.0)! ==> default: Cloning VMware VM: hashicorp/precise64. default: This can take some time... ==> default: Checking if box hashicorp/precise64 is up to date... ==> default: Verifying vmnet devices are healthy... ==> default: Preparing network adapters... ==> default: Starting the VMware VM...
$ vagrant up Bringing machine default up with vmware_workstation provider... ==> default: Box hashicorp/precise64 could not be found. default: Attempting to find and install... default: Box Provider: vmware_desktop, vmware_fusion, vmware_workstation default: Box Version: >= 0 ==> default: Loading metadata for box hashicorp/precise64 default: URL: https://atlas.hashicorp.com/hashicorp/precise64 ==> default: Adding box hashicorp/precise64 (v1.1.0) default: Downloading: https://vagrantcloud.com/hashicorp/boxes/... ==> default: Successfully added box hashicorp/precise64 (v1.1.0)! ==> default: Cloning VMware VM: hashicorp/precise64. default: This can take some time... ==> default: Checking if box hashicorp/precise64 is up to date... ==> default: Verifying vmnet devices are healthy... ==> default: Preparing network adapters... ==> default: Starting the VMware VM...
$ vagrant up Bringing machine default up with vmware_workstation provider... ==> default: Box hashicorp/precise64 could not be found. default: Attempting to find and install... default: Box Provider: vmware_desktop, vmware_fusion, vmware_workstation default: Box Version: >= 0 ==> default: Loading metadata for box hashicorp/precise64 default: URL: https://atlas.hashicorp.com/hashicorp/precise64 ==> default: Adding box hashicorp/precise64 (v1.1.0) default: Downloading: https://vagrantcloud.com/hashicorp/boxes/... ==> default: Successfully added box hashicorp/precise64 (v1.1.0)! ==> default: Cloning VMware VM: hashicorp/precise64. default: This can take some time... ==> default: Checking if box hashicorp/precise64 is up to date... ==> default: Verifying vmnet devices are healthy... ==> default: Preparing network adapters... ==> default: Starting the VMware VM...
$ vagrant up Bringing machine default up with vmware_workstation provider... ==> default: Box hashicorp/precise64 could not be found. default: Attempting to find and install... default: Box Provider: vmware_desktop, vmware_fusion, vmware_workstation default: Box Version: >= 0 ==> default: Loading metadata for box hashicorp/precise64 default: URL: https://atlas.hashicorp.com/hashicorp/precise64 ==> default: Adding box hashicorp/precise64 (v1.1.0) default: Downloading: https://vagrantcloud.com/hashicorp/boxes/... ==> default: Successfully added box hashicorp/precise64 (v1.1.0)! ==> default: Cloning VMware VM: hashicorp/precise64. default: This can take some time... ==> default: Checking if box hashicorp/precise64 is up to date... ==> default: Verifying vmnet devices are healthy... ==> default: Preparing network adapters... ==> default: Starting the VMware VM...
==> default: Waiting for machine to boot. This may take a few minutes... default: SSH address: 172.16.69.128:22 default: SSH username: vagrant default: SSH auth method: private key default: default: Vagrant insecure key detected. Vagrant will automatically replace default: this with a newly generated keypair for better security. default: default: Inserting generated public key within guest... default: Removing insecure key from the guest if it s present... default: Key inserted! Disconnecting and reconnecting using new SSH key... ==> default: Machine booted and ready! ==> default: Forwarding ports... default: -- 22 => 2222 ==> default: Configuring network adapters within the VM... ==> default: Waiting for HGFS kernel module to load... ==> default: Enabling and configuring shared folders... default: -- /home/joseph/projects/vagrant-demos/simple-demo: /vagrant $
==> default: Waiting for machine to boot. This may take a few minutes... default: SSH address: 172.16.69.128:22 default: SSH username: vagrant default: SSH auth method: private key default: default: Vagrant insecure key detected. Vagrant will automatically replace default: this with a newly generated keypair for better security. default: default: Inserting generated public key within guest... default: Removing insecure key from the guest if it s present... default: Key inserted! Disconnecting and reconnecting using new SSH key... ==> default: Machine booted and ready! ==> default: Forwarding ports... default: -- 22 => 2222 ==> default: Configuring network adapters within the VM... ==> default: Waiting for HGFS kernel module to load... ==> default: Enabling and configuring shared folders... default: -- /home/joseph/projects/vagrant-demos/simple-demo: /vagrant $
==> default: Waiting for machine to boot. This may take a few minutes... default: SSH address: 172.16.69.128:22 default: SSH username: vagrant default: SSH auth method: private key default: default: Vagrant insecure key detected. Vagrant will automatically replace default: this with a newly generated keypair for better security. default: default: Inserting generated public key within guest... default: Removing insecure key from the guest if it s present... default: Key inserted! Disconnecting and reconnecting using new SSH key... ==> default: Machine booted and ready! ==> default: Forwarding ports... default: -- 22 => 2222 ==> default: Configuring network adapters within the VM... ==> default: Waiting for HGFS kernel module to load... ==> default: Enabling and configuring shared folders... default: -- /home/joseph/projects/vagrant-demos/simple-demo: /vagrant $
Host $ lsb_release -d Description: Fedora release 22 (Twenty Two) Guest $ vagrant ssh Welcome to Ubuntu 12.04.1 LTS (GNU/Linux 3.2.0-29-virtual x86_64) * Documentation: https://help.ubuntu.com/ Last login: Thu Jan 31 13:48:53 2013 vagrant@precise64:~$ ls /vagrant Vagrantfile vagrant@precise64:~$ logout Connection to 172.16.69.128 closed.
Host $ lsb_release -d Description: Fedora release 22 (Twenty Two) Guest $ vagrant ssh Welcome to Ubuntu 12.04.1 LTS (GNU/Linux 3.2.0-29-virtual x86_64) * Documentation: https://help.ubuntu.com/ Last login: Thu Jan 31 13:48:53 2013 vagrant@precise64:~$ ls /vagrant Vagrantfile vagrant@precise64:~$ logout Connection to 172.16.69.128 closed.
Host $ lsb_release -d Description: Fedora release 22 (Twenty Two) Guest $ vagrant ssh Welcome to Ubuntu 12.04.1 LTS (GNU/Linux 3.2.0-29-virtual x86_64) * Documentation: https://help.ubuntu.com/ Last login: Thu Jan 31 13:48:53 2013 vagrant@precise64:~$ ls /vagrant Vagrantfile vagrant@precise64:~$ logout Connection to 172.16.69.128 closed.
Host $ lsb_release -d Description: Fedora release 22 (Twenty Two) Guest $ vagrant ssh Welcome to Ubuntu 12.04.1 LTS (GNU/Linux 3.2.0-29-virtual x86_64) * Documentation: https://help.ubuntu.com/ Last login: Thu Jan 31 13:48:53 2013 vagrant@precise64:~$ ls /vagrant Vagrantfile vagrant@precise64:~$ logout Connection to 172.16.69.128 closed.
$ vagrant halt ==> default: Attempting graceful shutdown of VM... $ vagrant status Current machine states: default not running (vmware_workstation) The VM is powered off. To restart the VM, run vagrant up $
$ vagrant halt ==> default: Attempting graceful shutdown of VM... $ vagrant status Current machine states: default not running (vmware_workstation) The VM is powered off. To restart the VM, run vagrant up $
$ vagrant halt ==> default: Attempting graceful shutdown of VM... $ vagrant status Current machine states: default not running (vmware_workstation) The VM is powered off. To restart the VM, run vagrant up $
$ vagrant up Bringing machine default up with vmware_workstation provider...... ==> default: Machine already provisioned. Run vagrant provision or use ==> default: the --provision flag to force provisioning. ==> default: Provisioners marked to run always will still run. $ $ vagrant destroy default: Are you sure you want to destroy the default VM? [y/n] y ==> default: Stopping the VMware VM... ==> default: Deleting the VM... $
$ vagrant up Bringing machine default up with vmware_workstation provider...... ==> default: Machine already provisioned. Run vagrant provision or use ==> default: the --provision flag to force provisioning. ==> default: Provisioners marked to run always will still run. $ $ vagrant destroy default: Are you sure you want to destroy the default VM? [y/n] y ==> default: Stopping the VMware VM... ==> default: Deleting the VM... $
$ vagrant up Bringing machine default up with vmware_workstation provider...... ==> default: Machine already provisioned. Run vagrant provision or use ==> default: the --provision flag to force provisioning. ==> default: Provisioners marked to run always will still run. $ $ vagrant destroy default: Are you sure you want to destroy the default VM? [y/n] y ==> default: Stopping the VMware VM... ==> default: Deleting the VM... $
$ vagrant up Bringing machine default up with vmware_workstation provider...... ==> default: Machine already provisioned. Run vagrant provision or use ==> default: the --provision flag to force provisioning. ==> default: Provisioners marked to run always will still run. $ $ vagrant destroy default: Are you sure you want to destroy the default VM? [y/n] y ==> default: Stopping the VMware VM... ==> default: Deleting the VM... $
Agenda 1 2 3 4
Agenda 1 2 3 4
Working on The original motivation Conflicting dependencies
Agenda 1 2 3 4
Bootstrapping a Developer How long does it take? Snowflakes READMEs / Wiki Setup scripts Good luck! Knowledge transfers to other projects and companies
Bootstrapping a Developer How long does it take? Snowflakes READMEs / Wiki Setup scripts Good luck! Knowledge transfers to other projects and companies
Bootstrapping a Developer How long does it take? Snowflakes READMEs / Wiki Setup scripts Good luck! Knowledge transfers to other projects and companies
Bootstrapping a Developer How long does it take? Snowflakes READMEs / Wiki Setup scripts Good luck! Knowledge transfers to other projects and companies
Bootstrapping a Developer How long does it take? Snowflakes READMEs / Wiki Setup scripts Good luck! Knowledge transfers to other projects and companies
Bootstrapping a Developer How long does it take? Snowflakes READMEs / Wiki Setup scripts Good luck! Knowledge transfers to other projects and companies
Agenda 1 2 3 4
Test a Change The test environment Coordinate with others What change broke it? vagrant share Continuous Integration
Test a Change The test environment Coordinate with others What change broke it? vagrant share Continuous Integration
Test a Change The test environment Coordinate with others What change broke it? vagrant share Continuous Integration
Test a Change The test environment Coordinate with others What change broke it? vagrant share Continuous Integration
Test a Change The test environment Coordinate with others What change broke it? vagrant share Continuous Integration
Agenda 1 2 3 4
Dependencies Provisioning Shell scripts Puppet Chef Ansible Salt CFEngine... Spot problems early! Operations can test provisioning Developers use same provisioning as production
Dependencies Provisioning Shell scripts Puppet Chef Ansible Salt CFEngine... Spot problems early! Operations can test provisioning Developers use same provisioning as production
Dependencies Custom Boxes Packer Same image as production! Amazon EC 2 OpenStack Xen ESXi
Dependencies Custom Boxes Packer Same image as production! Amazon EC 2 OpenStack Xen ESXi
Service Distribution Multiple machines Private networks
Agenda 1 2 3 4
Agenda 1 2 3 4
How to 1 Install VirtualBox 2 Install Vagrant 3 Locate a box
Resources https://vagrantup.com https://vagrantcloud.com https://www.virtualbox.org https://github.com/jbeard6 http://www.colug.net