WordPress on Windows Azure – a bit of history

In February 2011 I had the fortune of getting a meeting with Alessandro Catrioni, head of the Azure Interop team at Microsoft. We had a long chat about the possibility of creating a persistent, scaleable WordPress Networks solution that could run natively on Windows Azure. A bit like trying to boil the ocean, but we knew it was technically possible. Last Friday, the first fully functioning version of this crazy idea went live and we were able to run multiple WordPress sites from one core installation as a native Windows Azure application utilizing an Azure instance, a SQL Azure database, Azure Blob Storage and the Azure DNS.

It may not sound like much, but this is big. As in you can make your own WordPress.com. In the cloud. With infinite scaleability and redundancy. Without managing your own server.

The Idea

As with many other WordPress developers one of my big challenges has always been hosting. You basically have two options: Host your clients independently on their respective shared hosting plans all over the web or host them on your own server. If you choose to host them on your own server you again have two options: Host them as separate WordPress installs or host them all under a WordPress Network (previously WordPress MU). By far the best option from a content management and administration point of view is the WordPress Networks option. But it came with some pretty brutal downsides: When hosting multiple sites under a WordPress Network you are basically calling one set of core files and one database from many sites at the same time. And though this is unproblematic if each of the sites get a couple of hundred visits a day it becomes a huge problem if you have say ten sites that each pull 10,000 visits an hour. Why? Because that amounts to 100,000 calls to the same core files and the same database. That kind of traffic requires a robust server and a big pipe.

The solution to this problem has been to host such networks on unreasonably large and powerful servers. You basically scale for the worst case scenario and pay for a lot of down time in between. An inefficient solution, and also a cumbersome one as these setups in most cases require constant server maintenance and upkeep. Not to mention the enormous headache of adding additional drives and servers should upscaling be necessary.

This is what the cloud was built for: Dynamic scaleability both in terms of bandwith, capacity and processing power. So the best solution for WordPress Networks must surely lie in the cloud somewhere.

There’s just one problem: The cloud is complicated. And that’s where Windows Azure comes in – at least it did for me.

I’m not a gardener

Though I consider myself proficient at web development and people have referred to me as a “WordPress Adept” I am by no means a server expert. Quite the contrary. I have only a superficial understanding of servers and server maintenance, and I have little interest in expanding my knowledge in this field. So though a cloud server would provide me with a garden in the cloud I have little interest in becoming a gardener. I just want it to work. And that’s what Windows Azure offers: A maintained garden where I could deploy my applications.

The problem of course was that Windows Azure runs a .NET framework and a SQL server, not the PHP framework and MySQL server required by WordPress runs on. What was needed was some sort of symbiosis. Which is what we’ve been working on for the last 6 months.

Make it Native

Previous attempts had been made to make WordPress run on Azure, and they did work, at least for short periods of time. The problem was that they created pseudo states within the Azure framework where the PHP application could run, but these pseudo states were not stable. What was needed was a way of making WordPress into a native Azure application. That way it would be persistent, properly scaleable, and could be managed like any other Azure application. But this had to be done without touching the core files within WordPress, otherwise future updates would become a nightmare and that would defeat the purpose of doing this in the first place.

The solution was to create a set of adjoining files that served as bridges or translators between WordPress and the foreign Azure environment. That way the administrator could swap out and upgrade core files within WordPress without breaking anything and also change the configurations of the application through the normal Azure interface. And after a lot of experimentation and tweaking it worked.

Domains for everyone

So now we had a persistent, upgradable installation of WordPress running in Network mode on Azure. The last hurdle, the one that would prove to me most challenging, was to achieve seamless domain remapping for the different network sites. Let me explain:

A WordPress Network can be set up in two ways: Sub-sites or Sub-directories. The former produces site URIs such as newsite.pinkandyellow.com while the latter produces URIs like pinkandyellow.com/newsite. The obvious problem with both is that they use the pinkandyellow.com domain as the root. Which won’t work if you intend to host other sites or client sites under your network.

Domain remapping allows you to point these sub-sites or sub-directories to a different domain, so instead of newsite.pinkandyellow.com you’d get newsite.com. This requires a WordPress plugin (of which there are several) because the remapping has to be done based on the core URL. I could go on ad nauseum about how this works but suffice it to say it only works with one of these plugins. Problem is none of these plugins worked with SQL servers. Instead they produced bizarre errors and messed everything up quite badly. For a long time. Until the lead developer Satish found a solution.

Your own personal garden in the blue cloud

The end result of all this is a simple solution that allows you to deploy WordPress Networks on Windows Azure as a native application. By doing this you can take advantage of every aspect of the cloud including scaleability, persistency, CDNs and redundancy. But most importantly you will no longer be paying for processing power and bandwidth you are not using. Because Azure is a scaleable environment your solution will breathe with traffic, expanding and contracting as visitor numbers go up and down. As a result your costs will be a true representation of actual use, not a worst case scenario approach.

There are other great benefits to this solution including the ability to remote desktop into the application itself for beta testing and quick resets should something go wrong. In fact there are more possibilities here than I am able to wrap my mind around and as we move forward with the project countless more will undoubtedly take shape.

For now the only thing that matters is that you can set up and deploy your own installation right now and give this new solution a spin for yourself.

In the coming months I’ll be posting a series of tutorials and articles on my own experiences running WordPress on Azure. The first one on how to create a single site installation went live a couple of weeks ago and will be updated as the deployment solution matures. To see a live example of WordPress running on Windows Azure you can head on over to PhotoPivot.com which currently runs on four extra small instances.

 

One thought on “WordPress on Windows Azure – a bit of history

  1. You mention here lead developer Satish found a solution for domain re-mapping when using WordPress on Windows Azure. We are running into these same issues. Can you please point me to more information regarding his solution and how it might be implemented?

Comments are closed.