SlideShare uma empresa Scribd logo
1 de 44
Vagrant for Developers
Presenter
- Technology Architect at Accenture
- 10+ years Enterprise Java Developmentg
- Areas of work:
- Open Source activist
- DevOps evangelist
- Technical and OO Trainer
- Cloud and PaaS development
http://www.linkedin.com/in/antonskranga
Motivation
Basic Vagrant Usage
Provisioning with Cookbooks
Base Images Creation
Agenda
Motivation
Basic Vagrant Usage
Provisioning with Cookbooks
Base Images Creation
Agenda
How do you manage your Dev Env?
Low or no automation at all
Long error-prone install guides
Painful maintenance or recovery
Painful rollback
No team collaboration
Host everything natviely
Master Image contains:
- All software installed
- All configuration
Hosted typically in project File Server
Often maintained by one Person
No team collaboration
Master Image
Master Image: Problems
Hard to distribute in big teams
Maintenance process is manual
Hard to maintain in parallel
Cannot use Version Control System
Just Enough Operating System
- Written declaratively
(just enough ruby DSL)
- Repeatable
- OS agnostic
- Source control
- Help from Community
- Testable
JEOS
Naked OS Configuration
V for Vagrant
www.vagrantup.com Off Site
www.vagrantbox.es VM Images
https://github.com/opscode/bento VM Images from Chef
Useful Links:
Vagrant
- Vagrant will mange VM for you
- Can create whole stack of VMs
- Describe VM resources in Configuration
- Can put configuration in Source Control
- Easy to distribute and update
Motivation
Basic Vagrant Usage
Provisioning with Cookbooks
Base Images Creation
Agenda
Quick start
shell
$ vagrant up
Vagrantfile
Vagrant.configure "2" do |config|
config.vm.box = "vagrant-1"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
end
Quick start v2
shell
$ vagrant box add NAME http://files.vagrantup.com/precise64.box
$ vagrant init
# modify Vagrantfile until you happy
$ vagrant up
Most useful commands
shell
$ vagrant ssh # Connect to VM
$ vagrant reload # Connect to VM
$ vagrant halt # Stop VM
$ vagrant destroy # delete VM
$ vagrant package # Create snapshot (.box file)
Modifying scripts
Vagrantfile
Vagrant.configure "2" do |config|
config.vm.box = "vagrant-1"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
end
Modifying scripts
Vagrantfile
Vagrant.configure "2" do |config|
config.vm.box = "vagrant-1"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.hostname = “vmhost"
end
Modifying scripts
Vagrantfile
Vagrant.configure "2" do |config|
config.vm.box = "vagrant-1"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.hostname = “vmhost"
config.vm.network :forwarded_port, guest: 80, host: 1080
end
Modifying scripts
Vagrantfile
Vagrant.configure "2" do |config|
config.vm.box = "vagrant-1"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.hostname = “vmhost"
config.vm.network :forwarded_port, guest: 80, host: 1080
config.vm.synced_folder “webapp/", "/var/www"
end
Modifying scripts
Vagrantfile
Vagrant.configure "2" do |config|
config.vm.box = "vagrant-1"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.hostname = “vmhost"
config.vm.network :forwarded_port, guest: 80, host: 1080
config.vm.synced_folder “webapp/", "/var/www“
config.vm.provider "virtualbox" do |v|
v.customize ["modifyvm", :id, "--memory", 1024]
end
end
Demo
Vagrantfile
Vagrant.configure "2" do |config|
config.vm.define :ubuntu1204 do |ubuntu1204|
ubuntu1204.vm.box = "example4-ubuntu-12.10"
ubuntu1204.vm.box_url = "http://files.vagrantup..."
ubuntu1204.vm.hostname = "example4-ubuntu-1210"
ubuntu1204.vm.network :forwarded_port, guest: 80, host: 1080
ubuntu1204.vm.network :private_network, ip: "34.33.33.10"
end
config.vm.define :ubuntu1310 do |ubuntu1310|
ubuntu1310.vm.box = "example4-ubuntu-13.10"
ubuntu1310.vm.box_url = "http://files.vagrantup..."
ubuntu1310.vm.hostname = "example4-ubuntu-1310"
ubuntu1204.vm.network :forwarded_port, guest: 80, host: 2080
ubuntu1204.vm.network :private_network, ip: "34.33.33.11"
end
config.vm.provider "virtualbox" do |v|
v.customize ["modifyvm", :id, "--memory", 1024]
end
end
Motivation
Basic Vagrant Usage
Provisioning with Cookbooks
Base Images Creation
Agenda
- You declare what software you want
- Chef will provision it for you
- Over 1300 cookbooks
Chef
Before you start
shell
# install Chef plugin
$ vagrant plugin install vagrant-omnibus
# install Berkshelf plugin
$ vagrant plugin install vagrant-berkshelf
# Kind of apt-cache for Vagrant
$ vagrant plugin install vagrant-cachier
Update configuration
Vagrantfile
Vagrant.configure "2" do |config|
config.vm.box = "vagrant-5"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.hostname = “localhost"
config.vm.network :forwarded_port, guest: 80, host: 1080
config.vm.synced_folder “webapp/", "/var/www“
config.omnibus.chef_version = :latest
config.berkshelf.enabled = true
config.cache.auto_detect = true
end
Update configuration
Vagrantfile
Vagrant.configure "2" do |config|
config.vm.box = "vagrant-5"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.hostname = “localhost"
config.vm.network :forwarded_port, guest: 80, host: 1080
config.vm.synced_folder “webapp/", "/var/www“
config.omnibus.chef_version = :latest
config.berkshelf.enabled = true
config.cache.auto_detect = true
config.vm.provision :chef_solo do |chef|
chef.add_recipe “apache2“
end
end
Create berkshelf configuration
Berksfile
site :opscode
metadata
cookbook "apache2"
Provisioning commands
shell
# to provision for first time just enough
$ vagrant up
# to restart VM
$ vagrant reload --provision
# to provision without restart
$ vagrant provision
Demo
Create berkshelf configuration
Berksfile
site :opscode
metadata
cookbook 'apt'
cookbook 'git'
cookbook 'tomcat', git: "https://github.com/opscode-cookbooks/tomcat.git"
cookbook 'maven'
cookbook 'mongodb'
# cookbook 'mycookbook', :path => "cookbooks/mycookbook"
Vagrantfile
Vagrant.configure "2" do |config|
config.vm.box = "vagrant-5"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.hostname = “localhost"
config.vm.network :forwarded_port, guest: 8080, host: 1080
config.omnibus.chef_version = :latest
config.berkshelf.enabled = true
config.cache.auto_detect = true
config.vm.provision :chef_solo do |chef|
chef.add_recipe "mongodb::10gen_repo"
chef.add_recipe "apt"
chef.add_recipe "git"
chef.add_recipe "maven"
chef.add_recipe "mongodb"
chef.add_recipe "tomcat"
end
end
Vagrantfile
Vagrant.configure "2" do |config|
config.vm.box = "vagrant-5"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.hostname = “localhost"
config.vm.network :forwarded_port, guest: 8080, host: 1080
...
config.vm.provision :chef_solo do |chef|
chef.add_recipe "mongodb::10gen_repo"
chef.add_recipe "apt"
chef.add_recipe "git"
chef.add_recipe "maven"
chef.add_recipe "mongodb"
chef.add_recipe "tomcat"
chef.json = {
"java" => {
"jdk_version" => "7",
"install_flavor" => "openjdk"
}
}
end
end
Vagrantfile
Vagrant.configure "2" do |config|
config.vm.box = "vagrant-5"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.hostname = “localhost"
config.vm.network :forwarded_port, guest: 8080, host: 1080
...
config.vm.provision :chef_solo do |chef|
chef.add_recipe "mongodb::10gen_repo"
chef.add_recipe "apt"
chef.add_recipe "git"
chef.add_recipe "maven"
chef.add_recipe "mongodb"
chef.add_recipe "tomcat"
chef.json = {
"java" => {
"jdk_version" => "7",
"install_flavor" => "oracle",
"accept_oracle_download_terms" => true
}
}
end
end
Motivation
Basic Vagrant Usage
Provisioning with Cookbooks
Base Images Creation
Agenda
Motivation
Custom project specifics
OS-level patching
Produce Stemcells
(preinstalled images)
True Infra-as-code
Tools we need
“Packer is a tool for creating identical
machine images for multiple platforms…”
- Off Site: packer.io
- Written in Go
- Must be installed to ~/pakcer
“Bento is set of Packer templates for
building Vagrant baseboxes”
- Off Site: opscode.github.io/bento/
- Maintained by Chef
Shell
$ git clone https://github.com/opscode/bento.git
$ cd bento/packer
bento/packer $ packer build ubuntu-13.10-amd64.json
Quick start with Packer
Shell
$ git clone https://github.com/opscode/bento.git
$ cd bento/packer
bento/packer $ packer build ubuntu-13.10-amd64.json
Quick start with Packer
Shell
bento/packer $ packer build 
-only=virtualbox-iso 
ubuntu-13.10-amd64.json
Little bit more tuning
Shell
bento/packer $ packer build 
-only=virtualbox 
-var-file=variables.json
ubuntu-13.10-amd64.json
Little bit more tuning
variables.json
{
"chef_version": "latest",
"mirror": "../builds/iso/"
}
Demo
Thank You!

Mais conteúdo relacionado

Mais procurados

Ansible introduction - XX Betabeers Galicia
Ansible introduction - XX Betabeers GaliciaAnsible introduction - XX Betabeers Galicia
Ansible introduction - XX Betabeers GaliciaJuan Diego Pereiro Arean
 
Continuous Infrastructure: Modern Puppet for the Jenkins Project - PuppetConf...
Continuous Infrastructure: Modern Puppet for the Jenkins Project - PuppetConf...Continuous Infrastructure: Modern Puppet for the Jenkins Project - PuppetConf...
Continuous Infrastructure: Modern Puppet for the Jenkins Project - PuppetConf...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 DevelopmentCarlos Perez
 
Server(less) Swift at SwiftCloudWorkshop 3
Server(less) Swift at SwiftCloudWorkshop 3Server(less) Swift at SwiftCloudWorkshop 3
Server(less) Swift at SwiftCloudWorkshop 3kognate
 
Ansible Introduction
Ansible Introduction Ansible Introduction
Ansible Introduction Robert Reiz
 
Deploying Symfony | symfony.cat
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.catPablo Godel
 
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.
 
Infrastructure = Code
Infrastructure = CodeInfrastructure = Code
Infrastructure = CodeGeorg Sorst
 
Infrastructure = code - 1 year later
Infrastructure = code - 1 year laterInfrastructure = code - 1 year later
Infrastructure = code - 1 year laterChristian Ortner
 
Docker Docker Docker Chef
Docker Docker Docker ChefDocker Docker Docker Chef
Docker Docker Docker ChefSean OMeara
 
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...Carlos Sanchez
 
jbang: Unleash the power of Java for shell scripting
jbang: Unleash the power of Java for shell scriptingjbang: Unleash the power of Java for shell scripting
jbang: Unleash the power of Java for shell scriptingRed Hat Developers
 
Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))Michele Orselli
 
London Community Summit - Habitat 2016
London Community Summit - Habitat 2016London Community Summit - Habitat 2016
London Community Summit - Habitat 2016Sarah Richards
 
Python virtualenv & pip in 90 minutes
Python virtualenv & pip in 90 minutesPython virtualenv & pip in 90 minutes
Python virtualenv & pip in 90 minutesLarry Cai
 
Deploying an application with Chef and Docker
Deploying an application with Chef and DockerDeploying an application with Chef and Docker
Deploying an application with Chef and DockerDaniel Ku
 
Docker for (Java) Developers
Docker for (Java) DevelopersDocker for (Java) Developers
Docker for (Java) DevelopersRafael Benevides
 
Docker and Puppet for Continuous Integration
Docker and Puppet for Continuous IntegrationDocker and Puppet for Continuous Integration
Docker and Puppet for Continuous IntegrationGiacomo Vacca
 
Orchestration? You Don't Need Orchestration. What You Want is Choreography.
Orchestration? You Don't Need Orchestration. What You Want is Choreography.Orchestration? You Don't Need Orchestration. What You Want is Choreography.
Orchestration? You Don't Need Orchestration. What You Want is Choreography.Julian Dunn
 

Mais procurados (20)

Ansible introduction - XX Betabeers Galicia
Ansible introduction - XX Betabeers GaliciaAnsible introduction - XX Betabeers Galicia
Ansible introduction - XX Betabeers Galicia
 
Continuous Infrastructure: Modern Puppet for the Jenkins Project - PuppetConf...
Continuous Infrastructure: Modern Puppet for the Jenkins Project - PuppetConf...Continuous Infrastructure: Modern Puppet for the Jenkins Project - PuppetConf...
Continuous Infrastructure: Modern Puppet for the Jenkins Project - PuppetConf...
 
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
 
Server(less) Swift at SwiftCloudWorkshop 3
Server(less) Swift at SwiftCloudWorkshop 3Server(less) Swift at SwiftCloudWorkshop 3
Server(less) Swift at SwiftCloudWorkshop 3
 
Ansible Introduction
Ansible Introduction Ansible Introduction
Ansible Introduction
 
Deploying Symfony | symfony.cat
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.cat
 
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
 
Infrastructure = Code
Infrastructure = CodeInfrastructure = Code
Infrastructure = Code
 
Infrastructure = code - 1 year later
Infrastructure = code - 1 year laterInfrastructure = code - 1 year later
Infrastructure = code - 1 year later
 
Docker Docker Docker Chef
Docker Docker Docker ChefDocker Docker Docker Chef
Docker Docker Docker Chef
 
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
 
jbang: Unleash the power of Java for shell scripting
jbang: Unleash the power of Java for shell scriptingjbang: Unleash the power of Java for shell scripting
jbang: Unleash the power of Java for shell scripting
 
Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))
 
London Community Summit - Habitat 2016
London Community Summit - Habitat 2016London Community Summit - Habitat 2016
London Community Summit - Habitat 2016
 
Ansible - A 'crowd' introduction
Ansible - A 'crowd' introductionAnsible - A 'crowd' introduction
Ansible - A 'crowd' introduction
 
Python virtualenv & pip in 90 minutes
Python virtualenv & pip in 90 minutesPython virtualenv & pip in 90 minutes
Python virtualenv & pip in 90 minutes
 
Deploying an application with Chef and Docker
Deploying an application with Chef and DockerDeploying an application with Chef and Docker
Deploying an application with Chef and Docker
 
Docker for (Java) Developers
Docker for (Java) DevelopersDocker for (Java) Developers
Docker for (Java) Developers
 
Docker and Puppet for Continuous Integration
Docker and Puppet for Continuous IntegrationDocker and Puppet for Continuous Integration
Docker and Puppet for Continuous Integration
 
Orchestration? You Don't Need Orchestration. What You Want is Choreography.
Orchestration? You Don't Need Orchestration. What You Want is Choreography.Orchestration? You Don't Need Orchestration. What You Want is Choreography.
Orchestration? You Don't Need Orchestration. What You Want is Choreography.
 

Destaque

Riga dev day: Lambda architecture at AWS
Riga dev day: Lambda architecture at AWSRiga dev day: Lambda architecture at AWS
Riga dev day: Lambda architecture at AWSAntons Kranga
 
DevOps Days Tel Aviv - Serverless Architecture
DevOps Days Tel Aviv - Serverless ArchitectureDevOps Days Tel Aviv - Serverless Architecture
DevOps Days Tel Aviv - Serverless ArchitectureAntons Kranga
 
DevTernity - DevOps with smell
DevTernity - DevOps with smellDevTernity - DevOps with smell
DevTernity - DevOps with smellAntons Kranga
 
Antons Kranga Building Agile Infrastructures
Antons Kranga   Building Agile InfrastructuresAntons Kranga   Building Agile Infrastructures
Antons Kranga Building Agile InfrastructuresAntons Kranga
 
JavaDay Lviv: Serverless Archtiectures
JavaDay Lviv: Serverless ArchtiecturesJavaDay Lviv: Serverless Archtiectures
JavaDay Lviv: Serverless ArchtiecturesAntons Kranga
 
OpenSlava Infrastructure Automation Patterns
OpenSlava   Infrastructure Automation PatternsOpenSlava   Infrastructure Automation Patterns
OpenSlava Infrastructure Automation PatternsAntons Kranga
 
DevOps Hackathon: Session 3 - Test Driven Infrastructure
DevOps Hackathon: Session 3 - Test Driven InfrastructureDevOps Hackathon: Session 3 - Test Driven Infrastructure
DevOps Hackathon: Session 3 - Test Driven InfrastructureAntons Kranga
 
OpenSlava 2014 - CloudFoundry inside-out
OpenSlava 2014 - CloudFoundry inside-outOpenSlava 2014 - CloudFoundry inside-out
OpenSlava 2014 - CloudFoundry inside-outAntons Kranga
 
Dev ops with smell v1.2
Dev ops with smell v1.2Dev ops with smell v1.2
Dev ops with smell v1.2Antons Kranga
 

Destaque (10)

Riga dev day: Lambda architecture at AWS
Riga dev day: Lambda architecture at AWSRiga dev day: Lambda architecture at AWS
Riga dev day: Lambda architecture at AWS
 
DevOps Days Tel Aviv - Serverless Architecture
DevOps Days Tel Aviv - Serverless ArchitectureDevOps Days Tel Aviv - Serverless Architecture
DevOps Days Tel Aviv - Serverless Architecture
 
Robert kiyosaki pdf
Robert kiyosaki pdfRobert kiyosaki pdf
Robert kiyosaki pdf
 
DevTernity - DevOps with smell
DevTernity - DevOps with smellDevTernity - DevOps with smell
DevTernity - DevOps with smell
 
Antons Kranga Building Agile Infrastructures
Antons Kranga   Building Agile InfrastructuresAntons Kranga   Building Agile Infrastructures
Antons Kranga Building Agile Infrastructures
 
JavaDay Lviv: Serverless Archtiectures
JavaDay Lviv: Serverless ArchtiecturesJavaDay Lviv: Serverless Archtiectures
JavaDay Lviv: Serverless Archtiectures
 
OpenSlava Infrastructure Automation Patterns
OpenSlava   Infrastructure Automation PatternsOpenSlava   Infrastructure Automation Patterns
OpenSlava Infrastructure Automation Patterns
 
DevOps Hackathon: Session 3 - Test Driven Infrastructure
DevOps Hackathon: Session 3 - Test Driven InfrastructureDevOps Hackathon: Session 3 - Test Driven Infrastructure
DevOps Hackathon: Session 3 - Test Driven Infrastructure
 
OpenSlava 2014 - CloudFoundry inside-out
OpenSlava 2014 - CloudFoundry inside-outOpenSlava 2014 - CloudFoundry inside-out
OpenSlava 2014 - CloudFoundry inside-out
 
Dev ops with smell v1.2
Dev ops with smell v1.2Dev ops with smell v1.2
Dev ops with smell v1.2
 

Semelhante a Vagrant introduction for Developers

Continuous Delivery: The Next Frontier
Continuous Delivery: The Next FrontierContinuous Delivery: The Next Frontier
Continuous Delivery: The Next FrontierCarlos Sanchez
 
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 VagrantBrian Hogan
 
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013Carlos Sanchez
 
Minicurso de Vagrant
Minicurso de VagrantMinicurso de Vagrant
Minicurso de VagrantLeandro Nunes
 
Using Vagrant
Using VagrantUsing Vagrant
Using Vagrantandygale
 
Vagrant and Configuration Management
Vagrant and Configuration ManagementVagrant and Configuration Management
Vagrant and Configuration ManagementGareth Rushgrove
 
Railsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshareRailsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slidesharetomcopeland
 
Open stack and_vagrant-os-meetup-2015
Open stack and_vagrant-os-meetup-2015Open stack and_vagrant-os-meetup-2015
Open stack and_vagrant-os-meetup-2015yfauser
 
Vagrant WordCamp Hamilton
Vagrant  WordCamp HamiltonVagrant  WordCamp Hamilton
Vagrant WordCamp HamiltonPaul Bearne
 
Professional deployment
Professional deploymentProfessional deployment
Professional deploymentIvelina Dimova
 
Vagrant - Version control your dev environment
Vagrant - Version control your dev environmentVagrant - Version control your dev environment
Vagrant - Version control your dev environmentbocribbz
 
Vagrant for real
Vagrant for realVagrant for real
Vagrant for realCodemotion
 
From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012Carlos Sanchez
 
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
 
Puppet and Vagrant in development
Puppet and Vagrant in developmentPuppet and Vagrant in development
Puppet and Vagrant in developmentAdam Culp
 
From Dev to DevOps - FOSDEM 2012
From Dev to DevOps - FOSDEM 2012From Dev to DevOps - FOSDEM 2012
From Dev to DevOps - FOSDEM 2012Carlos Sanchez
 

Semelhante a Vagrant introduction for Developers (20)

Continuous Delivery: The Next Frontier
Continuous Delivery: The Next FrontierContinuous Delivery: The Next Frontier
Continuous Delivery: The Next Frontier
 
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
 
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
 
Intro to vagrant
Intro to vagrantIntro to vagrant
Intro to vagrant
 
Cooking with Chef
Cooking with ChefCooking with Chef
Cooking with Chef
 
Minicurso de Vagrant
Minicurso de VagrantMinicurso de Vagrant
Minicurso de Vagrant
 
Using Vagrant
Using VagrantUsing Vagrant
Using Vagrant
 
Vagrant and Configuration Management
Vagrant and Configuration ManagementVagrant and Configuration Management
Vagrant and Configuration Management
 
Railsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshareRailsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshare
 
Open stack and_vagrant-os-meetup-2015
Open stack and_vagrant-os-meetup-2015Open stack and_vagrant-os-meetup-2015
Open stack and_vagrant-os-meetup-2015
 
Vagrant WordCamp Hamilton
Vagrant  WordCamp HamiltonVagrant  WordCamp Hamilton
Vagrant WordCamp Hamilton
 
Professional deployment
Professional deploymentProfessional deployment
Professional deployment
 
Vagrant - Version control your dev environment
Vagrant - Version control your dev environmentVagrant - Version control your dev environment
Vagrant - Version control your dev environment
 
Vagrant for real
Vagrant for realVagrant for real
Vagrant for real
 
From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012
 
Vagrant For DevOps
Vagrant For DevOpsVagrant For DevOps
Vagrant For DevOps
 
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
 
Vagrant
Vagrant Vagrant
Vagrant
 
Puppet and Vagrant in development
Puppet and Vagrant in developmentPuppet and Vagrant in development
Puppet and Vagrant in development
 
From Dev to DevOps - FOSDEM 2012
From Dev to DevOps - FOSDEM 2012From Dev to DevOps - FOSDEM 2012
From Dev to DevOps - FOSDEM 2012
 

Último

Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 

Último (20)

Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 

Vagrant introduction for Developers

  • 2. Presenter - Technology Architect at Accenture - 10+ years Enterprise Java Developmentg - Areas of work: - Open Source activist - DevOps evangelist - Technical and OO Trainer - Cloud and PaaS development http://www.linkedin.com/in/antonskranga
  • 3. Motivation Basic Vagrant Usage Provisioning with Cookbooks Base Images Creation Agenda
  • 4. Motivation Basic Vagrant Usage Provisioning with Cookbooks Base Images Creation Agenda
  • 5. How do you manage your Dev Env?
  • 6. Low or no automation at all Long error-prone install guides Painful maintenance or recovery Painful rollback No team collaboration Host everything natviely
  • 7. Master Image contains: - All software installed - All configuration Hosted typically in project File Server Often maintained by one Person No team collaboration Master Image
  • 8. Master Image: Problems Hard to distribute in big teams Maintenance process is manual Hard to maintain in parallel Cannot use Version Control System
  • 10. - Written declaratively (just enough ruby DSL) - Repeatable - OS agnostic - Source control - Help from Community - Testable JEOS Naked OS Configuration
  • 11. V for Vagrant www.vagrantup.com Off Site www.vagrantbox.es VM Images https://github.com/opscode/bento VM Images from Chef Useful Links:
  • 12. Vagrant - Vagrant will mange VM for you - Can create whole stack of VMs - Describe VM resources in Configuration - Can put configuration in Source Control - Easy to distribute and update
  • 13. Motivation Basic Vagrant Usage Provisioning with Cookbooks Base Images Creation Agenda
  • 14. Quick start shell $ vagrant up Vagrantfile Vagrant.configure "2" do |config| config.vm.box = "vagrant-1" config.vm.box_url = "http://files.vagrantup.com/precise64.box" end
  • 15. Quick start v2 shell $ vagrant box add NAME http://files.vagrantup.com/precise64.box $ vagrant init # modify Vagrantfile until you happy $ vagrant up
  • 16. Most useful commands shell $ vagrant ssh # Connect to VM $ vagrant reload # Connect to VM $ vagrant halt # Stop VM $ vagrant destroy # delete VM $ vagrant package # Create snapshot (.box file)
  • 17. Modifying scripts Vagrantfile Vagrant.configure "2" do |config| config.vm.box = "vagrant-1" config.vm.box_url = "http://files.vagrantup.com/precise64.box" end
  • 18. Modifying scripts Vagrantfile Vagrant.configure "2" do |config| config.vm.box = "vagrant-1" config.vm.box_url = "http://files.vagrantup.com/precise64.box" config.vm.hostname = “vmhost" end
  • 19. Modifying scripts Vagrantfile Vagrant.configure "2" do |config| config.vm.box = "vagrant-1" config.vm.box_url = "http://files.vagrantup.com/precise64.box" config.vm.hostname = “vmhost" config.vm.network :forwarded_port, guest: 80, host: 1080 end
  • 20. Modifying scripts Vagrantfile Vagrant.configure "2" do |config| config.vm.box = "vagrant-1" config.vm.box_url = "http://files.vagrantup.com/precise64.box" config.vm.hostname = “vmhost" config.vm.network :forwarded_port, guest: 80, host: 1080 config.vm.synced_folder “webapp/", "/var/www" end
  • 21. Modifying scripts Vagrantfile Vagrant.configure "2" do |config| config.vm.box = "vagrant-1" config.vm.box_url = "http://files.vagrantup.com/precise64.box" config.vm.hostname = “vmhost" config.vm.network :forwarded_port, guest: 80, host: 1080 config.vm.synced_folder “webapp/", "/var/www“ config.vm.provider "virtualbox" do |v| v.customize ["modifyvm", :id, "--memory", 1024] end end
  • 22. Demo
  • 23. Vagrantfile Vagrant.configure "2" do |config| config.vm.define :ubuntu1204 do |ubuntu1204| ubuntu1204.vm.box = "example4-ubuntu-12.10" ubuntu1204.vm.box_url = "http://files.vagrantup..." ubuntu1204.vm.hostname = "example4-ubuntu-1210" ubuntu1204.vm.network :forwarded_port, guest: 80, host: 1080 ubuntu1204.vm.network :private_network, ip: "34.33.33.10" end config.vm.define :ubuntu1310 do |ubuntu1310| ubuntu1310.vm.box = "example4-ubuntu-13.10" ubuntu1310.vm.box_url = "http://files.vagrantup..." ubuntu1310.vm.hostname = "example4-ubuntu-1310" ubuntu1204.vm.network :forwarded_port, guest: 80, host: 2080 ubuntu1204.vm.network :private_network, ip: "34.33.33.11" end config.vm.provider "virtualbox" do |v| v.customize ["modifyvm", :id, "--memory", 1024] end end
  • 24. Motivation Basic Vagrant Usage Provisioning with Cookbooks Base Images Creation Agenda
  • 25. - You declare what software you want - Chef will provision it for you - Over 1300 cookbooks Chef
  • 26. Before you start shell # install Chef plugin $ vagrant plugin install vagrant-omnibus # install Berkshelf plugin $ vagrant plugin install vagrant-berkshelf # Kind of apt-cache for Vagrant $ vagrant plugin install vagrant-cachier
  • 27. Update configuration Vagrantfile Vagrant.configure "2" do |config| config.vm.box = "vagrant-5" config.vm.box_url = "http://files.vagrantup.com/precise64.box" config.vm.hostname = “localhost" config.vm.network :forwarded_port, guest: 80, host: 1080 config.vm.synced_folder “webapp/", "/var/www“ config.omnibus.chef_version = :latest config.berkshelf.enabled = true config.cache.auto_detect = true end
  • 28. Update configuration Vagrantfile Vagrant.configure "2" do |config| config.vm.box = "vagrant-5" config.vm.box_url = "http://files.vagrantup.com/precise64.box" config.vm.hostname = “localhost" config.vm.network :forwarded_port, guest: 80, host: 1080 config.vm.synced_folder “webapp/", "/var/www“ config.omnibus.chef_version = :latest config.berkshelf.enabled = true config.cache.auto_detect = true config.vm.provision :chef_solo do |chef| chef.add_recipe “apache2“ end end
  • 29. Create berkshelf configuration Berksfile site :opscode metadata cookbook "apache2"
  • 30. Provisioning commands shell # to provision for first time just enough $ vagrant up # to restart VM $ vagrant reload --provision # to provision without restart $ vagrant provision
  • 31. Demo
  • 32. Create berkshelf configuration Berksfile site :opscode metadata cookbook 'apt' cookbook 'git' cookbook 'tomcat', git: "https://github.com/opscode-cookbooks/tomcat.git" cookbook 'maven' cookbook 'mongodb' # cookbook 'mycookbook', :path => "cookbooks/mycookbook"
  • 33. Vagrantfile Vagrant.configure "2" do |config| config.vm.box = "vagrant-5" config.vm.box_url = "http://files.vagrantup.com/precise64.box" config.vm.hostname = “localhost" config.vm.network :forwarded_port, guest: 8080, host: 1080 config.omnibus.chef_version = :latest config.berkshelf.enabled = true config.cache.auto_detect = true config.vm.provision :chef_solo do |chef| chef.add_recipe "mongodb::10gen_repo" chef.add_recipe "apt" chef.add_recipe "git" chef.add_recipe "maven" chef.add_recipe "mongodb" chef.add_recipe "tomcat" end end
  • 34. Vagrantfile Vagrant.configure "2" do |config| config.vm.box = "vagrant-5" config.vm.box_url = "http://files.vagrantup.com/precise64.box" config.vm.hostname = “localhost" config.vm.network :forwarded_port, guest: 8080, host: 1080 ... config.vm.provision :chef_solo do |chef| chef.add_recipe "mongodb::10gen_repo" chef.add_recipe "apt" chef.add_recipe "git" chef.add_recipe "maven" chef.add_recipe "mongodb" chef.add_recipe "tomcat" chef.json = { "java" => { "jdk_version" => "7", "install_flavor" => "openjdk" } } end end
  • 35. Vagrantfile Vagrant.configure "2" do |config| config.vm.box = "vagrant-5" config.vm.box_url = "http://files.vagrantup.com/precise64.box" config.vm.hostname = “localhost" config.vm.network :forwarded_port, guest: 8080, host: 1080 ... config.vm.provision :chef_solo do |chef| chef.add_recipe "mongodb::10gen_repo" chef.add_recipe "apt" chef.add_recipe "git" chef.add_recipe "maven" chef.add_recipe "mongodb" chef.add_recipe "tomcat" chef.json = { "java" => { "jdk_version" => "7", "install_flavor" => "oracle", "accept_oracle_download_terms" => true } } end end
  • 36. Motivation Basic Vagrant Usage Provisioning with Cookbooks Base Images Creation Agenda
  • 37. Motivation Custom project specifics OS-level patching Produce Stemcells (preinstalled images) True Infra-as-code
  • 38. Tools we need “Packer is a tool for creating identical machine images for multiple platforms…” - Off Site: packer.io - Written in Go - Must be installed to ~/pakcer “Bento is set of Packer templates for building Vagrant baseboxes” - Off Site: opscode.github.io/bento/ - Maintained by Chef
  • 39. Shell $ git clone https://github.com/opscode/bento.git $ cd bento/packer bento/packer $ packer build ubuntu-13.10-amd64.json Quick start with Packer
  • 40. Shell $ git clone https://github.com/opscode/bento.git $ cd bento/packer bento/packer $ packer build ubuntu-13.10-amd64.json Quick start with Packer
  • 41. Shell bento/packer $ packer build -only=virtualbox-iso ubuntu-13.10-amd64.json Little bit more tuning
  • 42. Shell bento/packer $ packer build -only=virtualbox -var-file=variables.json ubuntu-13.10-amd64.json Little bit more tuning variables.json { "chef_version": "latest", "mirror": "../builds/iso/" }
  • 43. Demo