Vagrant with puppet - Install webserver environment with Symfony2 project

vagrant-puppet-symfony.jpg

Before incoming Symfony2 training I've decided to upgrade a little puppet-symfony configuration for our developers (original on https://github.com/l3l0/puppet-symfony).

Requirements:

Next Clone the puppet modules and manifests into your project:

cd your-project
git clone git://github.com/exu/puppet-symfony.git .puppet

Create symlink to a Vagrantfile:

ln -s .puppet/Vagrantfile ./Vagrantfile

Boot your virtual machine:

vagrant up

Finally ssh into it once it boots:

vagrant ssh

Networking details

  • VMs network is configured in host-only mode to handle IP 10.0.100.110.
  • Your client accessing it with IP: 10.0.100.1.
  • You can ssh vagrant@10.0.100.110 (default password is vagrant)

Next you should add vagrant.dev to your hosts file (/etc/hosts)

sudo sh -c 'echo "10.0.100.110 vagrant.dev" >> /etc/hosts'

Editing files on VM

To edit files you can install sshfs sudo apt-get install sshfs and then mount project directory wherever you want (I've mounted it in /home/exu/Training directory, use directory where you want to mount it)

sudo apt-get install sshfs
sshfs vagrant@10.0.100.110:/home/vagrant/vagrant.dev /home/exu/Training

If you don't want to enter your password you can execute ssh-copy-id vagrant@10.0.100.110 first (if you use PKI).

Additional tips:

If you don't want to provision machine after each restart (with new basic Symfony project) use --no-provision when you run vagrant up command

vagrant up --no-provision

I've added alias to speed up VM start

alias vup='vagrant up --no-provision'

You can put it in your .bashrc or .zshrc file

comments powered by Disqus