When browsing the Vagrant 1.8 Changelog file I realized that the latest Vagrant version supports Linked Clones which according to the Changelog means that imports during the vagrant up process will run much faster than before. Since it did not work out-of-the-box for me, I had to dig deep in the Vagrant documentation to figure out that you need to explicitly enable the feature. Simply add the following lines to your Vagrant configuration and your vagrant up command will probably run faster than ever:
Earlier this morning Mitchell Hashimoto released version 1.8 of Vagrant. I immediately upgraded and quickly hit a problem. After running vagrant up I got this error message:
Am Mittwoch den 18.11.2015 trifft sich die DevOps Rhein-Neckar Usergroup bei uns. Ich werde bei dem Meetup meinen Vortrag "From Vagrant To Production" halten. Anmeldungen bitte auf der entsprechenden meetup.com Seite vornehmen. Danke!
I recently covered our Vagrant setup. As mentioned in the blog post we mostly use the Vagrant shared folders setup which unfortunately is rather slow. When searching for alternatives I came across the vagrant-gatling-rsync plugin which seems to work better compared to the built-in rsync support of Vagrant. As it seems the built-in rsync support uses a lot of CPU and disk I/O especially when working with very large rsynced directories. The vagrant-gatling-rsync plugin is designed to work well with such large rsynced folders and performs a lot better. In addition to that you are able to fine-tune the rsync latency via your Vagrantfile which is also a huge win. To install the plugin simply run the following command:
There`s one plugin for Vagrant which I love to promote in my talks and this is the Cachier plugin. When giving my talks and mentioning the plugin I realized that not many people are aware of the plugin. That`s the main reason I write the following lines. The downside of Vagrant is what whenever you destroy a virtual machine and build it again all packages (eg. .deb packages for the OS or Composer packages for the application) need to be downloaded again. Downloading and installing a lot of packages can be quite time consuming which in turn means developers try to avoid it. Which in turn means no one regularly checks if provisioning of the virtual machine still works as it should. The Cachier plugin is the solution for that problem. As the name implies the plugin will cache the downloaded packages and re-use them when possible. To achieve that the plugin will link several folders of the virtual machine back to the host, so that the packages are actually stored on the host, not the vm. Very clever.
Every now an than when provisioning a virtual machine with Vagrant I got an error during the provisioning process. Everything seemed to work fine but the error confused me and my developers so I was looking for the source of the error. I came a across a Vagrant bug report where Mitchell Hashimoto explained that "the reason this error message even appears is due to a bug in Ubuntu not checking whether stdin is a TTY, and just assuming it is". One of the comments in the discussion of this "bug" proposed a "bugfix" by adding the following line to the VagrantFile. Up to now this fix works fine for us and you might use it as well:
Forced Motivated by Robert Reiz and his blog post about how to set-up a Vagrant environment I thought that it`ll be a good idea to quickly outline how we typically configure Vagrant in our projects. The bare minmium VagrantFile looks like this:
Recently we converted one of project to use Vagrant Rsync Folders instead of the default VirtualBox shared folders setup. After running the vagrant rsync-auto command for a while we realized that the symlinks in Composers ./vendor/bin/ where replaced with the content of the previously symlinked files. This made the commands unusable.
After a bit of investigation is was clear what was happening: Vagrant does not by default pass the -l flag to rsync which means symlinks are not preserved (even though the vendor folder was not copied to the guest vm). To fix this we had to adjust the rsync options by setting the rsync__args for the folder to:
Since quite a while Vagrant has support for syncing folders via rsync. While it is quite easy to set things up on a linux box, I was struggling a bit to get things going on a windows host. As the vagrant docs recommended I installed rsync and ssh client via the Cygwin package. After running "vagrant up" I got an error from the Vagrant rsync plugin stating "No such file or directory". Via Google search I came across a bug report on Github. As it turns out the problem seems to occur because Vagrant "tries to be smart and detect the environment but it obviously doesn't work reliably". The proposed solution is to patch the Vagrant ruby sources. You have to edit the file C:\HashiCorp\Vagrant\embedded\gems\gems\vagrant-1.6.3\plugins\synced_folders\rsync\helper.rb and change line 43 to:
Using Composer in your Vagrant / Puppet setup is as simple as this: