I have heard of virtualization 5 or 6 years ago and at the time, I didn’t understand the real implications of its use, save it was a tool toward an agile infrastructure. More recently, I heard that a virtual platform could be run on top of an undetermined number of physical platforms: you need more power, you can add platforms; a platform is down, there’s no effect (except a decrease in performance). At this time, I realized all the power we could gain from virtualization, or more precisely, all the power operations could gain from it.
As for myself, I tried VMWare to be able to get my hands on a Linux distro once, but I quickly lost interest since I had no real needs. Meanwhile, I had some seemingly unrelated problems bothering me in parallel:
- When writing a book (ok, I only wrote one, but it still applies), I installed all the needed software on my main system. Never mind the latest products versions, I installed the version I had to and had to play with scripts to have different environment variables configurations. Moreover, I had to describe the install process of my operating system (Windows), which may be suitable… or not.
- The same could be said for Proof-Of-Concepts: I had to manage a whole new bunch of products and a new set of environment variables that had the potential to wreak havoc with my existing system.
- When I have to pre-sale, this is even more damaging since the demo effect enters the scene.
- Finally, despite having both a Wordpress blog and a Drupal site, I couldn’t resign myself to install PHP on my system and I made all changes, whatever their criticity, directly on the production platform. I admit it’s bad, very bad indeed, but well, the heart has reasons and all that.
Very recently, I found myself teaching basic Linux to students and we used virtualization to run a Ubuntu distro on top of Windows. That’s when it became clear to me; I had only to create a virtual machine for each of the above problems!
Since my top priority was to create a staging area for my blog and CMS, here are the steps I took to cover my needs:
- Download and install the latest VMWare Player(free, but need to register)
- Download the latest Ubuntu distribution in ISO format
- Create a new virtual machine with the ISO
- Run the new VM, welcome to Ubuntu!
- Install versions of Apache Web Server, PHP, MySQL and the PHP MySQL driver that mirror those provided by my host. With Ubuntu, this is easy as pie with my friend the
- Configure my
etc/hostfile to resolve my sites URL to 127.0.0.1
- Configure Apache with two virtual hosts, one to
/var/www/blogfrankel, the other to
- Export SQL from both sites thanks to the Plesk interface providing phpMyAdmin and import them in my virtualized MySQL instance
- FTP files from both sites to my virtualized filesystem
- Optional but just to be sure: configure both sites to have a big "Staging" warning as the site name to avoid confusion
That was it. I fumbled a little here and there since I’m not an Ubuntu guru but the process was fairly straightforward. The part I spent the most time on was configuring Apache to redirect requests to the right site (I’m also not an Apache guru). Now I can do and undo what I want and have no effect on my production environment until I decide. As an added value, I get no security hole from having a PHP environment since I shut the VM down when not needing it.
It’s a big step from where I come from but I see some improvements to be made:
- Being able to directly push updates to the right site. At present, I have to redo actions manually (thus taking the risk to do something wrong/forget something)
- Being able to synchronize the VM with the production data (SQL and files), either periodically or on-demand so as to have the latest image on my VM
Any ideas on how to accomplish these would be welcome; even more welcome if they are simple to implement (KISS), remember I’m neither a sysadmin nor a devops.