SlideShare uma empresa Scribd logo
1 de 60
Baixar para ler offline
CONHECENDO 
VAGRANT
Leandro Nunes 
http://leandronunes.com 
@leandrosnunes
O QUE É 
NECESSÁRIO 
PARA INICIAR UM 
PROJETO?
TODOS FAZEM 
INSTALAÇÕES 
LOCAIS
VAGRANT 
FERRAMENTA PARA 
CONSTRUIR E DISTRIBUIR 
AMBIENTES DE FORMA 
SIMPLES
Mitchell Hashimoto 
@mitchellh 
• Inicio em 2010 
• Desenvolvido em Ruby 
• Release 1.6.5 
• HashiCorp 2012
O QUE É PRECISO 
PARA UTILIZAR O 
VAGRANT?
MULTI-PLATAFORMA 
http://www.vagrantup.com/downloads
PROVIDER 
Gerenciador de Máquinas Virtuais
PROVIDER 
OU OU 
DEFAULT OU 
OU
GUEST 
Fonte: http://www.vcritical.com/ 
HOST
$ vagrant init
VagrantFile 
VAGRANTFILE_API_VERSION = "2” 
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 
config.vm.box = "base” 
end
BOX 
REPRESENTA UM 
SISTEMA 
OPERACIONAL 
INSTALADO PARA 
UM PROVIDER 
ESPECÍFICO.
BOX BASE 
vagrantbox.es 
vagrantcloud.com
VAGRANT CLOUD
$ vagrant init hashicorp/precise64
VagrantFile 
VAGRANTFILE_API_VERSION = "2” 
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 
config.vm.box = "hashicorp/precise64” 
end
$ vagrant up
VM RODANDO NO 
VIRTUALBOX
$ vagrant ssh
$ vagrant halt
$ vagrant init 
$ vagrant up 
$ vagrant ssh 
$ vagrant halt
$ vagrant up 
$ vagrant ssh 
$ sudo apt-get install postgresql 
$ sudo apt-get install nginx 
$ sudo apt-get install php 
$ sudo apt-get uninstall php 
$ sudo apt-get install ruby
$ vagrant destroy
$ vagrant up
COMO TESTAR 
NOVAS 
FERRAMENTAS?
VAGRANT PARA 
TESTES DE SCRIPT 
DE CONFIGURAÇÃO
$ vagrant package
MEU IDE 
PREFERIDO SÓ 
FUNCIONA NO 
WINDOWS!
SYNCED FOLDERS 
AS MODIFICAÇÕES 
SÃO REFLETIDAS EM 
TEMPO REAL ENTRE 
AS MAQUINAS HOST E 
GUEST
VagrantFile 
config.vm.synced_folder ".", "/vagrant", type: "nfs"
COMO ACESSAR A 
APLICAÇÃO?
NETWORK 
UMA REDE NAT É 
CRIADA POR DEFAULT. 
A REDE PRIVADA 
PERMITE ACESSO DE 
OUTROS DISPOSITIVOS 
NA MESMA REDE.
VagrantFile 
config.vm.network :private_network, ip: "192.168.40.10” 
config.vm.network :forwarded_port, guest: 3000, host: 3000 
config.vm.network :forwarded_port, guest: 8982, host: 8982 
config.vm.network :forwarded_port, guest: 3306, host: 3306
Acessando o Rails
AMBIENTE DE 
DESENVOLVIMENTO 
IGUAL PARA TODO 
TIME
TAREFAS 
MANUAIS NÃO 
PERMITEM 
QUALIDADE
PROVISIONER 
ANSIBLE CHEF PUPPET SHELL
VagrantFile 
config.vm.provision :puppet do |puppet| 
puppet.module_path = ["modules", "custon_modules"] 
puppet.manifest_file = "development.pp” 
puppet.options = "--verbose --debug” 
end
$ vagrant provision
$ vagrant reload --provision
INCENTIVO PARA 
PRÁTICAS DO 
MOVIMENTO DEVOPS
A APLICAÇÃO PODE 
RODAR EM AMBIENTE 
SIMILAR AO DE 
PRODUÇÃO
ACABA COM A FRASE 
“FUNCIONA NA 
MINHA MÁQUINA”
GERÊNCIA DE 
CONFIGURAÇÃO
PARTICIPAR DE 
PROJETOS COM 
PECULIARIDADES 
DIFERENTES
SIMPLICIDADE PARA 
CONTRIBUIR PARA 
PROJETOS OPEN 
SOURCE
Postgresql 
Nginx 
Puma 
Assets
Nginx Postgresql Puma 
Assets
1 config.vm.define :application do |ad| 
2 config.vm.network :private_network, ip: "192.168.40.10" 
3 config.vm.network :forwarded_port, guest: 3000, host: 3000 
4 
5 ad.vm.provision :puppet do |puppet| 
6 puppet.module_path = ["modules", "custom_modules"] 
7 puppet.manifest_file = "development.pp" 
8 puppet.options = "--verbose --debug" 
9 end 
10 end 
11 
12 config.vm.define :database do |ap| 
13 ap.vm.network :private_network, ip: "192.168.40.20" 
14 ap.vm.network :forwarded_port, guest: 3306, host: 3306 
15 
16 ap.vm.provision :puppet do |puppet| 
17 puppet.module_path = ["modules", "custom_modules"] 
18 puppet.manifest_file = "production.pp" 
19 puppet.options = "--verbose --debug" 
20 end 
21 end
PLUGIN 
FUNCIONALIDADES 
EXTRAS, COMO 
SUPORTE A OUTROS 
PROVIDERS
$ vagrant install plugin vagrant-vbguest 
$ vagrant install vagrant-librarian-puppet
VAGRANT OPEN SOURCE 
Github: https://github.com/mitchellh/vagrant 
IRC: #vagrant 
Google Groups: vagrant-up
VAGRANT DOCS 
http://docs.vagrantup.com/v2/
?

Mais conteúdo relacionado

Mais procurados

Using Nagios to monitor your WO systems
Using Nagios to monitor your WO systemsUsing Nagios to monitor your WO systems
Using Nagios to monitor your WO systems
WO Community
 
Deploying WO on Windows
Deploying WO on WindowsDeploying WO on Windows
Deploying WO on Windows
WO Community
 

Mais procurados (20)

Gestión de la configuración - Jenkins ci
Gestión de la configuración - Jenkins ciGestión de la configuración - Jenkins ci
Gestión de la configuración - Jenkins ci
 
Vagrant 101 Workshop
Vagrant 101 WorkshopVagrant 101 Workshop
Vagrant 101 Workshop
 
Building Services with WSO2 Microservices framework for Java and WSO2 AS
Building Services with WSO2 Microservices framework for Java and WSO2 ASBuilding Services with WSO2 Microservices framework for Java and WSO2 AS
Building Services with WSO2 Microservices framework for Java and WSO2 AS
 
Vagrant for Virtualized Development
Vagrant for Virtualized DevelopmentVagrant for Virtualized Development
Vagrant for Virtualized Development
 
Using Nagios to monitor your WO systems
Using Nagios to monitor your WO systemsUsing Nagios to monitor your WO systems
Using Nagios to monitor your WO systems
 
Local development environment through virtualisation
Local development environment through virtualisationLocal development environment through virtualisation
Local development environment through virtualisation
 
kubeadmのしくみ
kubeadmのしくみkubeadmのしくみ
kubeadmのしくみ
 
Vagrant for Development
Vagrant for DevelopmentVagrant for Development
Vagrant for Development
 
Vagrant step-by-step guide for Beginners
Vagrant step-by-step guide for BeginnersVagrant step-by-step guide for Beginners
Vagrant step-by-step guide for Beginners
 
Intro to vagrant
Intro to vagrantIntro to vagrant
Intro to vagrant
 
Azure VM base images with Packer, Ansble and Vagrant
Azure VM base images with Packer, Ansble and VagrantAzure VM base images with Packer, Ansble and Vagrant
Azure VM base images with Packer, Ansble and Vagrant
 
Vagrant and CentOS 7
Vagrant and CentOS 7Vagrant and CentOS 7
Vagrant and CentOS 7
 
Introduction to Vagrant
Introduction to VagrantIntroduction to Vagrant
Introduction to Vagrant
 
Using the fork_cms deploy gem
Using the fork_cms deploy gemUsing the fork_cms deploy gem
Using the fork_cms deploy gem
 
Lightning branches at RedMart (Js conf Asia 2014 Talk)
Lightning branches at RedMart (Js conf Asia 2014  Talk)Lightning branches at RedMart (Js conf Asia 2014  Talk)
Lightning branches at RedMart (Js conf Asia 2014 Talk)
 
RancherOS - The perfect place to run Docker
RancherOS - The perfect place to run DockerRancherOS - The perfect place to run Docker
RancherOS - The perfect place to run Docker
 
Clustering Docker with Docker Swarm on openSUSE
Clustering Docker with Docker Swarm on openSUSEClustering Docker with Docker Swarm on openSUSE
Clustering Docker with Docker Swarm on openSUSE
 
Vagrant
VagrantVagrant
Vagrant
 
RedMart Migrating from EC2 to VPC with Chef
RedMart Migrating from EC2 to VPC with ChefRedMart Migrating from EC2 to VPC with Chef
RedMart Migrating from EC2 to VPC with Chef
 
Deploying WO on Windows
Deploying WO on WindowsDeploying WO on Windows
Deploying WO on Windows
 

Semelhante a Conhecendo o Vagrant

DevOps: Using Vagrant to Enhance Your Day to Day Development
DevOps: Using Vagrant to Enhance Your Day to Day DevelopmentDevOps: Using Vagrant to Enhance Your Day to Day Development
DevOps: Using Vagrant to Enhance Your Day to Day Development
Rob Reynolds
 
Getting started with puppet and vagrant (1)
Getting started with puppet and vagrant (1)Getting started with puppet and vagrant (1)
Getting started with puppet and vagrant (1)
Puppet
 
Virtualize and automate your development environment for fun and profit
Virtualize and automate your development environment for fun and profitVirtualize and automate your development environment for fun and profit
Virtualize and automate your development environment for fun and profit
Andreas Heim
 

Semelhante a Conhecendo o Vagrant (20)

Minicurso de Vagrant
Minicurso de VagrantMinicurso de Vagrant
Minicurso de Vagrant
 
Create Disposable Test Environments with Vagrant and Puppet
Create Disposable Test Environments with Vagrant and PuppetCreate Disposable Test Environments with Vagrant and Puppet
Create Disposable Test Environments with Vagrant and Puppet
 
Create Disposable Test Environments with Vagrant and Puppet
Create Disposable Test Environments with Vagrant and Puppet Create Disposable Test Environments with Vagrant and Puppet
Create Disposable Test Environments with Vagrant and Puppet
 
Vagrant
Vagrant Vagrant
Vagrant
 
Automation day red hat ansible
   Automation day red hat ansible    Automation day red hat ansible
Automation day red hat ansible
 
Devoxx UK 2013: Sandboxing with the Vagrant-Binding API
Devoxx UK 2013: Sandboxing with the Vagrant-Binding APIDevoxx UK 2013: Sandboxing with the Vagrant-Binding API
Devoxx UK 2013: Sandboxing with the Vagrant-Binding API
 
Fabric8 - Being devOps doesn't suck anymore
Fabric8 - Being devOps doesn't suck anymoreFabric8 - Being devOps doesn't suck anymore
Fabric8 - Being devOps doesn't suck anymore
 
Automação do físico ao NetSecDevOps
Automação do físico ao NetSecDevOpsAutomação do físico ao NetSecDevOps
Automação do físico ao NetSecDevOps
 
Continuous Delivery: The Next Frontier
Continuous Delivery: The Next FrontierContinuous Delivery: The Next Frontier
Continuous Delivery: The Next Frontier
 
Using Vagrant
Using VagrantUsing Vagrant
Using Vagrant
 
Vagrant For DevOps
Vagrant For DevOpsVagrant For DevOps
Vagrant For DevOps
 
Bare Metal to OpenStack with Razor and Chef
Bare Metal to OpenStack with Razor and ChefBare Metal to OpenStack with Razor and Chef
Bare Metal to OpenStack with Razor and Chef
 
A Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy SystemA Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy System
 
Using vagrant
Using vagrantUsing vagrant
Using vagrant
 
DevOps: Using Vagrant to Enhance Your Day to Day Development
DevOps: Using Vagrant to Enhance Your Day to Day DevelopmentDevOps: Using Vagrant to Enhance Your Day to Day Development
DevOps: Using Vagrant to Enhance Your Day to Day Development
 
Vagrant introduction for Developers
Vagrant introduction for DevelopersVagrant introduction for Developers
Vagrant introduction for Developers
 
Tech Talk - Vagrant
Tech Talk - VagrantTech Talk - Vagrant
Tech Talk - Vagrant
 
Continuously-Integrated Puppet in a Dynamic Environment
Continuously-Integrated Puppet in a Dynamic EnvironmentContinuously-Integrated Puppet in a Dynamic Environment
Continuously-Integrated Puppet in a Dynamic Environment
 
Getting started with puppet and vagrant (1)
Getting started with puppet and vagrant (1)Getting started with puppet and vagrant (1)
Getting started with puppet and vagrant (1)
 
Virtualize and automate your development environment for fun and profit
Virtualize and automate your development environment for fun and profitVirtualize and automate your development environment for fun and profit
Virtualize and automate your development environment for fun and profit
 

Último

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Último (20)

Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 

Conhecendo o Vagrant