Virtualização do                      Ambiente de                 Desenvolvimento                      com Vagrant        ...
Configuração do Ambiente de Dev              Host Machine                                   Virtual Machine●   Dependente ...
Antes de tudo...● Instale VirtualBox -> http://www.virtualbox.org● Instale Vagrant    -> http://downloads.vagrantup.com   ...
Criando um Ambiente Virtual$ vagrant box add lucid32 http://files.vagrantup.com/lucid32.box$ vagrant box add debian-squeez...
Vagrantfile              configurações do ambiente$ vagrant init lucid32
Vagrantfile               configurações do ambiente$ vagrant init debian-squeeze-64
Vagrant up                    "levantando" o ambiente$ vagrant up[default] Importing base box debian-squeeze-64...[default...
Vagrant ssh acessando a VMmario@deep-thought:~/Projects/test$ ls -altotal 16drwxrwxr-x 2 mario mario 4096 Aug 28 03:00   ....
Multi-VM           ambientes multiplos$ vagrant up$ vagrant up web$ vagrant up db
Criando Box                     distrubua seu ambiente$ vagrant   package --vagrantfile Vagrantfile.pkg --include README.t...
Provisioners   cofigure seu ambiente via scripts
VALEU !!!● Vagrant      -> http://vagrantup.com● Vagrant Boxes -> http://www.vagrantbox.es● VirtualBox   -> http://www.vir...
Upcoming SlideShare
Loading in …5
×

Virtualização do Ambiente de Desenvolvimento com Vagrant

1,458 views
1,359 views

Published on

"Lightning Talk" realizado no encontro mensal "PHPubSP" (Grupo de usuários PHP de São Paulo) - http://phpsp.org.br/2012/08/phpubsp-talks/

Published in: Technology
1 Comment
3 Likes
Statistics
Notes
No Downloads
Views
Total views
1,458
On SlideShare
0
From Embeds
0
Number of Embeds
9
Actions
Shares
0
Downloads
10
Comments
1
Likes
3
Embeds 0
No embeds

No notes for slide

Virtualização do Ambiente de Desenvolvimento com Vagrant

  1. 1. Virtualização do Ambiente de Desenvolvimento com Vagrant Crie e configure ambientes leves, reproduzíveis e portáteis. Mario Rezendehttp://vagrantup.com http://about.me/mariorez
  2. 2. Configuração do Ambiente de Dev Host Machine Virtual Machine● Dependente do Sistema Operacional ● Ambiente não interfere na maquina "Host" (isolamento)● Softwares relevantes ao Desenvolvimento ● Reproduzir Ambiente de Produção com● Duplicidade de Softwares exatidão. ( Apache x Nginx | MySQL x Postgre ) ● Varios Ambientes com configuração● Dificil reproduzir Ambiente de Produção diferentes (Apache x Nginx / MySQL x Postgre)● Maior velocidade na execusão ● Lentidão na execução
  3. 3. Antes de tudo...● Instale VirtualBox -> http://www.virtualbox.org● Instale Vagrant -> http://downloads.vagrantup.com [ Ubuntu: apt-get install vagrant ]
  4. 4. Criando um Ambiente Virtual$ vagrant box add lucid32 http://files.vagrantup.com/lucid32.box$ vagrant box add debian-squeeze-64 ~/my_boxes/debian-squeeze-64.box[vagrant] Downloading with Vagrant::Downloaders::File...[vagrant] Copying box to temporary location...[vagrant] Extracting box...[vagrant] Verifying box...[vagrant] Cleaning up downloaded box...
  5. 5. Vagrantfile configurações do ambiente$ vagrant init lucid32
  6. 6. Vagrantfile configurações do ambiente$ vagrant init debian-squeeze-64
  7. 7. Vagrant up "levantando" o ambiente$ vagrant up[default] Importing base box debian-squeeze-64...[default] Matching MAC address for NAT networking...[default] Clearing any previously set forwarded ports...[default] Forwarding ports...[default] -- 22 => 2222 (adapter 1)[default] -- 3306 => 3309 (adapter 1)[default] -- 80 => 9090 (adapter 1)[default] Exporting NFS shared folders...[vagrant] Preparing to edit /etc/exports. Administrator privileges will be required...[sudo] password for mario: * Stopping NFS kernel daemon [ OK ] * Unexporting directories for NFS kernel daemon... [ OK ] * Exporting directories for NFS kernel daemon... [ OK ] * Starting NFS kernel daemon [ OK ][default] Creating shared folders metadata...[default] Clearing any previously set network interfaces...[default] Preparing network interfaces based on configuration...[default] Booting VM...[default] Waiting for VM to boot. This can take a few minutes.[default] VM booted and ready for use![default] Configuring and enabling network interfaces...[default] Mounting shared folders...[default] -- v-root: /vagrant[default] Mounting NFS shared folders...
  8. 8. Vagrant ssh acessando a VMmario@deep-thought:~/Projects/test$ ls -altotal 16drwxrwxr-x 2 mario mario 4096 Aug 28 03:00 .drwxrwxr-x 6 mario mario 4096 Aug 28 01:47 ..-rw-rw-r-- 1 mario mario 61 Aug 28 02:31 .vagrant-rw-rw-r-- 1 mario mario 306 Aug 28 02:27 Vagrantfilemario@deep-thought:~/Projects/test$mario@deep-thought:~/Projects/test$ vagrant sshLinux vagrant-debian-squeeze 2.6.32-5-amd64 #1 SMP Sun May 6 04:00:17 UTC2012 x86_64Last login: Tue Aug 28 02:55:17 2012 from 10.0.2.2vagrant@vagrant-debian-squeeze:~$ cd /vagrant/vagrant@vagrant-debian-squeeze:/vagrant$ ls -altotal 16drwxrwxr-x 2 vagrant vagrant 4096 Aug 28 03:00 .drwxr-xr-x 23 root root 4096 Aug 28 02:33 ..-rw-rw-r-- 1 vagrant vagrant 61 Aug 28 02:31 .vagrant-rw-rw-r-- 1 vagrant vagrant 306 Aug 28 02:27 Vagrantfilevagrant@vagrant-debian-squeeze:/vagrant$
  9. 9. Multi-VM ambientes multiplos$ vagrant up$ vagrant up web$ vagrant up db
  10. 10. Criando Box distrubua seu ambiente$ vagrant package --vagrantfile Vagrantfile.pkg --include README.txt[default] Attempting graceful shutdown of VM...[default] Clearing any previously set forwarded ports...[default] Creating temporary directory for export...[default] Exporting VM...[default] Compressing package to: /home/mario/Projects/test/package.box[default] Packaging additional file: Vagrantfile.pkg[default] Packaging additional file: README.txtmario@deep-thought:~/Projects/test$ ls -altotal 467512drwxrwxr-x 2 mario mario 4096 Aug 28 03:19 .drwxrwxr-x 6 mario mario 4096 Aug 28 01:47 ..-rw-rw-r-- 1 mario mario 478708224 Aug 28 03:20 package.box-rw-rw-r-- 1 mario mario 0 Aug 28 03:18 README.txt-rw-rw-r-- 1 mario mario 61 Aug 28 02:31 .vagrant-rw-rw-r-- 1 mario mario 306 Aug 28 02:27 Vagrantfile-rw-rw-r-- 1 mario mario 306 Aug 28 02:27 Vagrantfile.pkg
  11. 11. Provisioners cofigure seu ambiente via scripts
  12. 12. VALEU !!!● Vagrant -> http://vagrantup.com● Vagrant Boxes -> http://www.vagrantbox.es● VirtualBox -> http://www.virtualbox.org Mario Rezende http://about.me/mariorez

×