Vagrant Improvements in latest PhpStorm Update

VagrantWith PhpStorm 7, we introduced built-in support for working with Vagrant, a tool which helps to create reproducible development environments. These scripted virtual machines can then be shared using a simple script, instead of having to share a full-blown virtual machine. These scripts can even be added to source control so virtual machine configurations can be versioned.

The latest PhpStorm 7.1.1 and 7.1.2 updates enhance IDE support for Vagrant with a number of new features! It’s now possible to specify the Vagrant instance folder, manage plugins, install and specify the provider to use and much more. Let’s go over our new toys!

This functionality is available in IntelliJ IDEA, WebStormRubyMine, PhpStorm, PyCharm and AppCode.

Specifying Vagrant instance folder

We’ve added support for configuring the instance folder. Before, the Vagrantfile and all other Vagrant specifics (like Puppet manifests) had to be placed in the project root to work in PhpStorm, often resulting in a messy project structure. With the latest update, we can now specify the instance folder where the IDE should look for Vagrantfile through Project Settings | Vagrant:

Vagrant Instance Folder

Manage Vagrant plugins through settings

There is more to be found under Project Settings | Vagrant! What about managing Vagrant plugins? We can make use of the toolbar buttons to install, uninstall and update plugins. Licenses can also be installed, for example for the VMWare Fusion Provider.

Manage Vagrant plugins through PhpStorm

Providers support

When working with alternate Vagrant providers, we can now specify the provider through Project Settings | Vagrant. All installed providers will be available from the settings. Once selected, PhpStorm will execute all Vagrant commands using the provider configured.

Configure Vagrant Provider

Vagrant works with Oracle VirtualBox by default. Using providers, the virtualization platform can be changed and so virtual machines can be run by a system other than VirtualBox, such as VMWare or Amazon EC2. A list of available providers can be found on the Vagrant plugins list.

Vagrant Provision command

A Vagrantfile (the Vagrant configuration file) can contain a series of provisioners that can launch installation and configuration routines once a virtual machine is running. The Provision command invokes the configured provisioners on an already running Vagrant box, without having to first destroy the virtual machine.

The Tools | Vagrant menu now features this Provision command as well. Using it, we can run provisioning on a running environment.

Vagrant Provision command

Environment variables

Ever wanted to pass project-specific environment variables into the Vagrantfile? It’s easy! From the Project Settings | Vagrant we can specify environment variables to be set for the current project.

Vagrant environment variable

Once set, we can make use of them in our Vagrantfile using the #{ENV['name_of_variable']} syntax:

Using environment variable in Vagrantfile

Working with environment variables is really handy for doing several things, like:

  • setting the Puppet node
  • setting the Puppet environment
  • setting custom facts
  • setting AWS keys

Multi-machine support

Working with Vagrant multi-machine environments? PhpStorm now supports this too. All we have to do is configure our multi-machine environment in the Vagrantfile and PhpStorm will make sure it all works when making use of the Tools | Vagrant menu.

We’ve updated our Vagrant tutorials page if you want to learn more about how this all works. Never tried Vagrant integration before? Here’s a short video that will guide you through.

Got feedback? We’re listening! Use the issue tracker, post your comments below or in our forums!

Develop with pleasure!
– JetBrains PhpStorm Team

This entry was posted in Cool Feature and tagged , , , . Bookmark the permalink.

12 Responses to Vagrant Improvements in latest PhpStorm Update

  1. Hi. The Youtube link goes to a video about file watchers, not Vagrant.

  2. The “short video” link is wrong. It goes to a video about File Watchers.
    I think you meant this one http://youtu.be/f7Kss62DHhw

  3. This functionality is available in WebStorm

    How do I enable this in WebStorm?

  4. Pingback: Magento-Neuigkeiten der Wochen 09/10 2014

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">