I have been receiving several requests each week for information on migrating WordPress from an existing (usually a local development copy) installation to Windows Azure, so I decided to write up a quick post on how to accomplish this just for you! 🙂
The power of the scaffold
The Microsoft Open Source Technologies Inc. (A wholly owned Microsoft subsidiary. Formerly Interoperability Bridges inside of Microsoft proper) team has built some great scaffolds that help you get your website up and running quickly, one of those scaffolds specifically sets up a WordPress website. Go grab the scaffold off of Github at:
https://github.com/Interop-Bridges/Windows-Azure-PHP-Scaffolders
The team at Microsoft has also created an in-depth tutorial on using the scaffolder located at:
Importing existing WordPress files
There are now two paths to get your existing WordPress files into the Windows Azure project using the scaffold. At this point if your WordPress installation is located on an external storage you will need to make a local copy.
Let the scaffold handle it
The scaffold has a built-in parameter that will attempt to copy your local installation files into the project that is being created. The parameter syntax is as follows:
-source path/to/WordPress
You can read more about using this parameter in the existing tutorial at:
Manually import the files
If for some reason the source parameter does not work for you, or did not completely import your site files, you can always perform this step manually. Make sure that you have run the scaffold and created the Windows Azure project though as it sets up some necessary plugins and configuration.
Let’s make some assumptions at this point, and I will do so using Windows path structures as this is the largest and most likely audience reading this.
- Existing WordPress install: C:\mysite
- Windows Azure WordPress project: C:\wazwp
Here are the steps you will take to get the files over:
- Open a file browser to C:\mysite
- Open a file browser to C:\wazwp\WebRole
- Copy the files from inside C:\mysite\wp-content to C:\wazwp\WebRole\wp-content
That should do it! Try not to mess with any of the core files if you do not have to (You _really_ should not have to).
What about my data?
This is where things get a little sticky. Normally I would tell you to simply visit Tools -> Export in wp-admin on the existing site and Tools -> Import on the live Windows Azure site, and that works great, however if you have heavily customized plugins, widgets, etc you will lose all the settings. If that is ok for your situation then do it. Quick, simple, works beautifully.
Chances are that you have a lot of other settings you want to keep also, so in this case I would recommend using a product like Backup Buddy that can export and import everything on your site. Be sure that you have setup the Windows Azure Storage plugin BEFORE running backup buddy. Any new files created or uploaded to your WordPress site need to be in the centralized Windows Azure Storage account or you risk breaking your website when you attempt to scale out.
That’s all folks!
Follow the steps in the above linked tutorial to create an uploadable package and you should be staring at a shiny new WordPress installation running in Windows Azure in a few minutes! Now go find those visitors and take advantage of the massive scaling power of the Windows Azure cloud!
Good luck in your endeavors, post a comment below if I made a goof in the article or something is not working as expected and I will try to help out 🙂