vagrant

Remove ALL your local Vagrant Boxes via this bash command

Assuming you have only one box per provider, this command will delete ALL Vagrant boxes you currently have on your system:

$ vagrant box list | cut -f 1 -d ' ' | xargs -L 1 vagrant box remove -f

This command does the following:

  1. vagrant box list: Prints out a list of all installed vagrant boxes (with two columns—box name or path, and meta info)
  2. cut -f 1 -d ' ': Cuts the list and takes out just the first column (using spaces to delimit the columns)
  3. xargs -L 1 vagrant box remove -f: Use xargs to run one command per line, running the command vagrant box remove -f [box name from list/cut].

You can use xargs' -t option to output the commands being run just before they're executed. And if you have multiple boxes per provider, or if you have multiple versions of the same box, you'll likely need to modify the command a bit.

Speeding up Composer-based Drupal installation

Drupal VM is one of the most flexible and powerful local development environments for Drupal, but one the main goals of the project is to build a fully-functional Drupal 8 site quickly and easily without doing much setup work. The ideal would be to install Vagrant, clone or download the project, then run vagrant up. A few minutes later, you'd have a Drupal 8 site ready for hacking on!

In the past, you always had to do a couple extra steps in between, configuring a drupal.make.yml file and a config.yml file. Recently, thanks in huge part to Oskar Schöldström's herculean efforts, we achieved that ideal by switching from defaulting to a Drush make-based workflow to a Composer-based workflow (this will come in the 3.1.0 release, very soon!). But it wasn't without trial and tribulation!

Drupal VM 3 is here!

Drupal VM 3.0.0 "The Light Sailer" was just released, and you can grab it from the Drupal VM website now. We spent a lot of time during DrupalCon New Orleans sprinting on Drupal VM, fixing bugs, and updating ALL THE THINGS to make sure this release solves a lot of pain points for individuals and teams who need a great local development environment.

Drupal VM - Website Homepage

Let's get right into why this is the best release of Drupal VM EVER!

The fastest and most modern environment

Drupal VM now defaults to Ubuntu 16.04 (which was just released in late April), running MySQL 5.7 and PHP 7. This means you're getting the fastest, most reliable, and most modern development environment for your Drupal 8 projects.

Developing with VirtualBox and Vagrant on Windows

I've been supporting Drupal VM (a local Drupal CMS development environment) for Windows, Mac, and Linux for the past couple years, and have been using Vagrant and virtual machines for almost all my development (mostly PHP, but also some Python and Node.js at the moment) for the past four years. One theme that comes up quite frequently when dealing with VMs, open source software stacks (especially Drupal/LAMP), and development, is how much extra effort there is to make things work well on Windows.

Problem: tool-builders use Linux or macOS

The big problem, I see, is that almost all the tool-builders for OSS web software run either macOS or a flavor of Linux, and many don't even have access to a Windows PC (outside of maybe an odd VM for testing sites in Internet Explorer or Edge, if they're a designer/front-end developer). My evidence is anecdotal, but go to any OSS conference/meetup and you'll likely see the same.

Drupal VM - Quick Introduction Video

After months of having this on my todo list, I've finally had the time to record a quick introduction video for Drupal VM. Watch the video below, then a transcript below the video:

Drupal VM is a local development environment for Drupal that's built with Vagrant and Ansible. It helps you build and maintain Drupal sites using best practices and the best tools. In this quick overview, I'll show you where you can learn more about Drupal VM, then show you a simple Drupal VM setup.

The Drupal VM website gives a general overview of the project and links to:

Drupal VM 2.3.0 released - dashboard, Windows, tests, and more

Update: I just posted a new video about Drupal VM, Drupal VM - Quick Introduction, covering some of these new features!

I'm excited to announce the release of Drupal VM 2.3.0 "Miracle and Magician"—with over 21 new features and bugs fixed!

One of the most amazing improvements is the new Drupal VM dashboard; after you build Drupal VM, visit the VM's IP address to see all the sites, tools, and connection details in your local development environment:

Drupal VM 2.3.0 release - new dashboard UI

This feature was singlehandedly implemented by Oskar Schöldström—who also happens to have practically matched my commit activity for the past month or so. I'm pretty sure I owe him something like 100 beers at this point!

Here are some of the other great new features of Drupal VM in 2.3.0:

Using SMB with symlinks instead of native synced folders with Vagrant and VirtualBox

VirtualBox's native shared folders will be used by default on Windows with the type of your synced folder set to nfs, or if it's not set. This method works great in many cases, but can be fairly slow when doing work with projects with many files in a synced folder, as is often the case with Drupal sites that I work with in Drupal VM.

Another option is to switch the type to smb. This is often a plug-and-play change (vagrant reload to make the change take effect—you'll likely need to enter in your Windows username and password during the startup process. However, symlinks inside the synced folder will likely break, and so we need to make one more important change:

The synced folder configuration needs to have:

Drupal VM's latest update adds Redis, PHP-FPM support to Apache

tl;dr: Drupal VM 2.2.0 'Wormhole' was released today, and it adds even more features for local dev!

Over the past few months, I've been working towards a more reliable release cadence for Drupal VM, and I've targeted one or two large features, a number of small improvements, and as many bugfixes as I have time to review. The community surrounding Drupal VM's development has been amazing; in the past few months I've noticed:

Use Vagrant 1.8's new ansible_local provisioner for Ansible provisioning

I build a lot of local development VMs in a typical week, and need to support Ansible provisioning on Mac, Linux, and Windows workstations (with or without Ansible installed)—Vagrant 1.8.0 was an early Christmas gift for me!

In the past, when I wanted to build a Vagrantfile to provision a VM using an Ansible playbook, I added the following, which used the JJG-Ansible-Windows shell script to install Ansible inside the VM, install role dependencies, and run a given Ansible playbook:

Vagrant web development - is VMware better than VirtualBox?

[Update 2015-08-25: I reran some of the tests using two different settings in VirtualBox. First, I explicitly set KVM as the paravirtualization mode (it was saved as 'Legacy' by default, due to a bug in VirtualBox 5.0.0), which showed impressive performance improvements, making VirtualBox perform 1.5-2x faster, and bringing some benchmarks to a dead heat with VMware Fusion. I also set the virtual network card to use 'virtio' instead of emulating an Intel PRO/1000 MT card, but this made little difference in raw network throughput or any other benchmarks.]

My Mac spends the majority of the day running at between one and a dozen VMs. I do all my development (besides iOS or Mac dev) running code inside VMs, and for many years I used VirtualBox, a free virtualization tool, along with Vagrant and Ansible, to build and manage all these VMs.