Every once in a while, we take some time to update you on some of the more geeky aspects of what we do at Needmore. We pride ourselves on staying current with the technology of our industry and it’s time we talked a little bit about virtualization.
What is Virtualization?
Hardware virtualization or platform virtualization refers to the creation of a virtual machine that acts like a real computer with an operating system. Software executed on these virtual machines is separated from the underlying hardware resources. For example, a computer that is running Microsoft Windows may host a virtual machine that looks like a computer with the Ubuntu Linux operating system; Ubuntu-based software can be run on the virtual machine. [Wikipedia]
Virtualization is a scary-sounding concept that probably keeps too many people from taking advantage of it, so I want to write a little about it from our studio’s perspective. I also thought it would help to understand how much it has improved our process since most of the benefits were not clear to me until very recently.
The original—and most obvious—use for virtual machines in web design is to run Windows on your Mac computer. This saves you the cost of buying another machine (or numerous machines) just to test your work. It was impossible to ignore windows in the past, even if we refused to use it for our day to day work, because it was the dominant platform. And, while that has changed in recent years, it is still important.
A virtual machine is something that we have used for a long time at Needmore. In the past, we had to pay quite a bit to get the right software to run a virtual machine and then buy a version of Windows for testing. And, that’s just one version! If we wanted to test multiple versions of Windows with multiple versions of Internet Explorer, it could get expensive fast.
Recently, I was looking into how people are setting up virtual machines nowadays and noticed that Microsoft is actually letting people download virtual machines for free in order to test various versions of Internet Explorer and Windows. This is great news! This soon led to the discovery that one does not need to pay for software to run their virtual machines since there is also a free alternative that runs quite well. Now, you no longer need to pay to test your sites on the Internet Explorer (something that we used to pay a monthly fee for) or buy expensive software.
The next step was to figure out how deep this rabbit hole went. I kept hearing about something called vagrant, so we decided to investigate.
Vagrant is free and open-source software for creating and configuring virtual development environments. It can be seen as a wrapper around virtualization software such as VirtualBox, KVM, VMware and around configuration management software such as Ansible, Chef, Salt or Puppet. [Wikipedia]
Vagrant is software that lets you run virtual machines easily on your system and provides a routine, predictable way to manage their “boxes.” You can use Vagrant to spin up Windows or manage boxes. You can also use it to spin up versions of Linux that are just like the ones you would use to host your site.
It was exciting to find out that other WordPress developers had already made systems to manage this for us, replacing another costly tool that we were using to manage and run the machines. Bonus: the way that it replaces them is far superior.
One big difference is that the environment that we run things in Vagrant is identical to the environment we’re running them in on the server. This means that we can test websites in a way that mirrors the way they’ll run when they get to the web. We can also pull down the site and play with it just like it was running on the web. Revolutionary.
Another benefit is that that our team has much less friction now because we’re not dealing with a license for one thing…and another…and another. Instead, we simply run everything in the exact same way. It becomes easy for a number of us to work on the same project at the same time in the same way.
With of the popularity of virtual machines, there are also many advanced hosting offerings, which means that the same commands you use to manage the boxes inside your computer can be used to manage boxes on the Internet (these are the ones that serve up the actual website).
Another benefit: it becomes trivially easy to pass projects back-and-forth with someone who is designing. We no longer have to worry about how you mock up the many unique pages that you see during a complex e-commerce experience. Instead, our designer simply spins up a box on her computer and sees the website in production. She then works with the exact layout that the website will be in, which saves us a lot of time because the design that she is heading off to a developer is already partly complete and production ready.
The tool that we would use to run websites on our computers before was inherently problematic and very messy. It sucked. When you’re running things in the same environment as the rest of your computer, things can get out of sync and start to behave oddly from one developers’ computer to the next. One person is running one version of one thing, someone else is running a different version of a different thing, and nobody can predict what will happen. Setting up a new project took an hour or two, and this would apply to every single developer on a project. Now, we get all the benefits of working on our computer with the environment that we’re most comfortable with as a user, which is also the environment that we’re developing websites in. This is an isolated environment that is predictable.
And don’t get me started on staging or deploying the sites.
When you have automation and virtualization happening, problems melt away. Everything a developer needs can be on their computer in a matter of minutes. And, best of all, what’s on their computer is almost guaranteed to be identical to what’s on yours. Cumbersome manual steps involving clicking on things to configure things disappear (when it all happens from the command line, it can be automated to an incredible extent).
Now that providers work the same way, many of the more messy aspects of managing staging and test environments are gone. On a host like Digital Ocean, it’s trivial to make a copy of complete website. This means you could just clone one, play around with it, and then throw it away when you’re done.
We’ll write more about virtualization in the future. In particular, our team has a game plan about how to take advantage of virtualization and automation for WordPress in the coming year. In the meantime, we’re enjoying the heck out of our new process.