From WordPress

WordPress logo

WordPress Workflow with VVV & Variable VVV

Lately I have been looking at WordPress theme design and I came across Varying Vagrant Vagrants (VVV). Despite the rather strange tongue-twister of a name this is a neat environment for developing with WordPress. Up to this point I have been doing my WordPress development using XAMPP as a local server but it appears that this is now rather an old hat way of doing things. Apparently, those in the ‘know’ use the likes of VVV for the many added benefits it brings. However when researching how to go about implementing VVV on Windows 10 I couldn’t find all the information in a single place. Therefore I’ve put this post together for anybody else for which this is new territory, though I might add its raison d’etre is that these days I tend to forget things rather more quickly than I would like and so this post serves as a crib-sheet more than anything else, but if it saves any head scratching for others than that’s just a bonus. In this first post I will cover the installation of the prerequisite software and in subsequent posts I will detail how to use VVV and associated tools. Note that the following is specifically for Windows but it is a similar procedure for other OS.

So, what exactly is Vagrant and VVV and how will it help you develop WP themes and plugins more efficiently? The benefits of using Vagrant as a developer, is that it will isolate dependencies and their configuration within a single disposable, consistent environment. While VVV allows you to run many different sites on one VVV configuration. It’s a great environment to develop themes and plugins on, and it makes contributing to WordPress core easier.  VVV installs a lot of components. git, composer, wp-cli, grunt-cli, nodeJs and a lot of other tools to help you work faster and smarter. It  also includes a lot of debugging and profiling tools:  Webgrind, Opcache Status and Xdebug, it also uses nginx by default.

The prerequisite software required to run VVV is VirtualBox (other VM software also supported, such as VMWare Fusion  or Hyper-V) to provide a VM sandboxed from your local environment and Vagrant, which is a tool for building and distributing development environments. Start off by installing VirtualBox first and then Vagrant .  Installation is straightforward, just follow the install prompts. Check that everything installed correctly by running vagrant –v from the command line which will show the version number.

You may also want to install the vagrant-hostsupdater plugin at this point. This will make things easier by adding the necessary redirects to your hosts file, otherwise you will need to manually add these. This plugin updates your hosts file when you execute vagrant up, reload and resume.

  • vagrant plugin install vagrant-hostsupdater

Next install Varying Vagrant Vagrants by cloning into a directory named vagrant-local, i.e. c:/vagrant-local/:

  • git clone git://github.com/Varying-Vagrant-Vagrants/VVV.git vagrant-local

Finally, install Variable VVV, which is a site wizard that makes it easy to create, delete, and list your WordPress sites. It also supports site creation with different options via site blueprints – a great time saver.

  • git clone https://github.com/bradp/vv.git

Once installed you now need to add this directory to your PATH variable. In Windows 10 the quickest way to do this:

Right click start menu –>System->Advanced->System Settings->Environment Variables->Edit path variable.

Just to recap we installed the required software in this order:

  1. VirtualBox into default install directory
  2. Vagrant into default install directory
  3. Vagrant-hostupdater plugin (optional)
  4. Vagrant-triggers plugin (optional  – see https://github.com/emyl/vagrant-triggers)
  5. Varying-Vagrant-Vagrants (VVV) into c:\vagrant-local
  6. Variable VVV into c:\vv
  7. Added c:\vv to the PATH variable

We are now ready to fire up all the software and start flexing it – in a command prompt cd into c:/vagrant-local and start the Vagrant environment with vagrant up.
This initial vagrant up may take quite a while to do its stuff as it has to download all the required files – subsequent runs should be considerably quicker. You may see a few warnings that the remote connection is not connected, this is normal. However, should the operation time-out after several warnings and Vagrant is not able to connect to the virtual machine then you may need to check that you have Intel virtualization enabled in your BIOS/UEFI settings. This was the case on both PCs that I installed this software on. You may also see a warning to this effect in the Preview windows of the VirtualBox Manager. Another reason being that these programs are running under different privilege levels – it may be that the ‘hosts’ file requires admin privileges. This can readily be checked by opening them as an ‘administrator’ if you trust the software.

image

You can check the status at any time with the command vagrant status or halt it with vagrant halt

Now open up a browser and navigate to vvv.dev* and if everything is working you will see all the default sites listed.

image

In subsequent posts I will be using Variable VVV to create and delete sites; adding a blueprint for creating new sites and exploring WP-CLI. Oh, and just to make life a little bit easier still we will add a VVV dashboard .

*It appears that Google have snaffled the .dev gTLD for themselves so this will change at some point. ‘Do no evil ‘– yea, right!

facebooktwittergoogle_plusredditpinterestlinkedinmail

WordPress Pedal to the Metal

Speed-Up WordPress
Click to view on Amazon

Google is on a mission to speed up the web and is suggesting that an above the fold page load should be within one second for mobile devices. While WordPress is fairly fast out of the box when combined with a well configured server and not much traffic, it is when you’ve installed a custom theme and plugins that things will start to slow down. Since loading time is one of the ranking factors there is a very good chance this will start to effect your postion in SERPs. This is one very good reason why I prefer to roll-my-own my websites as it gives me the ability to think about and integrate SEO considerations from the very beginning, and although there are always improvements that can be made I know I can always go back and tweak the code as and when either Google changes its algorithms or I learn more. However, having recently started my own blogs and so as not reinvent the wheel I opted for WordPress. I’ve always been a bit reluctant in going down this road because of the apparent lack of control of the SEO aspects. Up till now the total sum of my efforts in regard to this has been to include the odd SEO plugin such as that by Yoast:WordPress SEO Plugin

Serendipitously, just when I am looking at improving the SEO for my blogs, I came across this Kindle book. To be honest I wasn’t expecting very much as so many of these low-priced Kindle books promise so much and deliver so little and are usually badly written to boot. However, that couldn’t be further from the truth for this book. In fact I would say it under sells itself, no bold promises in the product description unlike so many others of a similar ilk. After a few pages it becomes clear that this guy knows his stuff and even better knows how to write about it, with clear step-by-step instructions and plenty of screen-shots. Don’t be put off by the occasional error in the author’s use of English, such as technic instead of technique and the occasional stilted sentence. These do not detract in any way from an otherwise well written text.

With an hour or two I had made significant improvements to both the loading speed and optimisation of my blog. All of the techniques I would say are do-able by your average blogger who knows how to open up the WordPress admin panel at the very least. Most of the techniques are applicable to both low and high traffic blogs, and the reader is even shown how to CDN their blog free of charge for the ultimate speed-up; a veritable Formula One of site loading. My site has already shown significant improvement with just a few of the techniques discussed and there are still a few more left to implement.

Your page load time will go from 5.70 seconds, or worse, to an expected goal approaching 1 second

Why should you bother in speeding up your site? We are given some very convincing reasons followed by how to actually measure your site speed before and then again after each technique to give instant feed back to show how your efforts are being rewarded.

I won’t cover the specific techniques as the reader can refer to the book description where the topics covered are given for each of the 10 chapters. However, if by the end of Chapter six you haven’t achieved a significant improvement in the loading time of your blog then I will eat my hat!

In the WP Hacks & Tricks chapter techniques are given to avoid being penalised by your host provider when the CPU time or memory usage becomes heavy, particularly relevant for average blogger on a shared server host.

I was fortunate enough to spot this book when the need arose and better still when it was on promo but would have happily parted with my hard-earned cash knowing that it actually delivers on what it says and then some.

facebooktwittergoogle_plusredditpinterestlinkedinmail