Tutorial - Using the Windows Azure Companion

Author: Jim O'Neil

Date: Sunday, September 19, 2010, 12:00:00 AM

Tags:

Table of Contents

IMPORTANT NOTE - July 13, 2011

The Windows Azure Companion was an experimental tool to provide a simple experience installing and configuring platform-elements (PHP runtime, extensions) and web applications on Windows Azure. Preliminary feedback on this tool has informed the creation of a new set of tools to deploy applications to Windows Azure - available at http://azurephp.interopbridges.com/downloads

-----------------------------------------------------------------------------------------------------
THE FOLLOWING CONTENT IS NO LONGER CURRENT. REFER TO THE LINK IN NOTE ABOVE

Recommended pre-read

To put this new tool through its paces, I thought I'd try installing WordPress on Azure, so the rest of this article will walk through doing just that and in doing so we should touch upon most of the features.

Window Azure Companion is hosted on the MSDN Code Gallery, and when you visit the project site, you'll see the five download options shown below. The first four are variants of an Azure cloud service which you can quickly upload within a provisioned Azure account (Don't have an Azure account? Check out the offers). ; Those options differ only by the VM size of the worker role to which you're deploying - the same worker role that will host whatever applications you install via the Windows Azure Companion. ; The code is available, so the last option can be used to tailor the utility to your own needs or just to satisfy your own curiosity as to how it all works under the covers.

clip_image001

We'll start simply, with the small VM prepackaged option (WindowsAzureCompanion-SmallVM-Sep2010CTP.zip). ; When you download that ZIP file, you'll get two files in the archive (ok, there's three, but does anyone actually read the license.txt?) ; If you've done deployments on Windows Azure before, you'll recognize one of the files as a .cspkg, which contains your compiled application code, and a .cscfg file, which contains the service configuration XML document ; (kind of like a web.config for you ASP.NET developers, but applying to the entire cloud service.)

If you don't have a storage account configured on Windows Azure, you'll need to do so now ( check out "Provisioning an Azure Storage Account" in my blog post if you need help here.)

Before you deploy the service to Windows Azure, a few modifications to the service configuration file are required:

  • Specify your Azure storage account (Lines 2 and 3, below),
  • Set up an admin account for accessing the Windows Azure Companion once it's running (Lines 6 through 8), and
  • Specify a feed (Line 11) that indicates what applications are available to be installed. ; For this example, I've piggybacked off of a feed that Maarten Balliauw has made available, but you can generate your own following the Windows Azure Companion Feed Schema.

1: <!-- Windows Azure Storage Account Details. -->

2: <Setting name="WindowsAzureStorageAccountName" value="wacstorage" />

3: <Setting name="WindowsAzureStorageAccountKey" value="redacted" />

4:

5: <!-- Admin user name, password and e-mail. Please use a good username and strong password -->

6: <Setting name="AdminUserName" value="admin" />

7: <Setting name="AdminPassword" value="redacted" />

8: <Setting name="AdminEmail" value="jim.oneil@live.com" />

9:

10: <!-- Atom Feed for Product items to be installed. This URL should be internet addressable -->

11: <Setting name="ProductListXmlFeed" value="http://wazstorage.blob.core.windows.net/azurecompanion/default/WindowsAzureCompanionFeed.xml" />

Next, deploy your application to a new hosted service on your Azure account. ; If you need a refresher for this part, refer to the "To select a project and create a compute service" section of this walkthrough on MSDN, using the .cspkg and (just updated) .cscfg files comprising the Windows Azure Companion application. ; Once it's deployed you can browse to it at port 8080 (don't forget that part!) of whatever URL you specified when you set up the Azure hosted service (computing) instance.

You'll be greeted with a welcome message via an ASP.NET MVC application; that message, by the way, is configurable via the ApplicationDescription setting in the ServiceConfiguration.cscfg. Upon logging in (via the link in the upper right), you'll have access to the other functionality of the Windows Azure Companion as well.

clip_image002

Installing PHP and WordPress

The Platform tab exposes elements of the ProductListXmlFeed with a matching <tabname> tag. ; My feed includes PHP and the PHP Wincache Extension, both of which seem like a good way to achieve my goal of installing WordPress.

clip_image003

But, wait a minute… WordPress requires PHP to run, and since the Windows Azure Companion is aware of those prerequisites (well, so long as they are included in the ProductListXmlFeed as dependencies), why not just go straight there?

So on to the Applications tab, which here includes WordPress along with some other popular Open Source PHP packages.

clip_image004

I'm picking only WordPress in this case, and so the next screen prompts for some versioning information for WordPress along with similar requests for other prerequisites. ; Note here that the PHP drivers for SQL Server will be installed, so this implementation of WordPress will use SQL Server versus MySQL, although MySQL can also be run on Windows Azure.

clip_image005

While the applications are installing, you'll see progress messages appear on the Admin tab of the Windows Azure Companion site. ; Those messages, by the way, are recorded to the Windows Azure Storage account you configured in the .cscfg file.

clip_image006

Upon completion, the application will show as installed and ready to launch.

clip_image007

Configuring WordPress

At this point, WordPress is installed, but it's not yet configured. ; If you've installed WordPress before, you know you need to point to the backend database as well as provide an ID and password for the WordPress administrator. ; Pressing the Launch… button will walk you through the process of supplying that information, which ultimately gets incorporated into the wp-config.php file.

Now's a good time to make sure you've got SQL Azure set up appropriately to support WordPress. ; If you haven't created a SQL Azure database before, I recommend Getting Started with SQL Azure. Presuming you already have an Azure account provisioned, you can blow past the first 15 pages, which walk through setting up an account via the Microsoft Online Services Customer Portal.

First off is the connection with the database; below is a diagram highlighting the correlation between the SQL Azure setup and what's needed for WordPress. ; Note specifically that the WordPress User Name must be in the format: user@servername, and you need to ensure that the SQL Azure instance will accept requests from WordPress by enabling the "Allow Microsoft Services access to this server" checkbox on the Firewall Settings tab (not shown).

clip_image008

Ok, now WordPress is talking to SQL Azure just fine, so the next step is setting up the WordPress site - providing a site title, username and password. ; Hopefully, it's clear that this is all "WordPress stuff," and you'd do this for any installation of WordPress regardless of host.

clip_image009

Press Install WordPress and you're good to go! ; Go ahead and log in to the WordPress dashboard and start creating content; I did! ; If you browse to

http://wacompanion.cloudapp.net/wordpress/

you should see a copy of this very article (presuming the account is still around when you check, that is!)

The Admin Tab

We briefly touched upon the Admin tab in the Windows Azure Companion when viewing the log entries showing the installation progress, but there's a lot of additional functionality there as well:

  • Windows Azure Logs - view the Windows Azure logs, specifically the entries in the WADLogs table of your Windows Azure storage account.
  • PHP Logs - view the PHP error log.
  • Configure Runtime - access configuration settings for MySQL and PHP.
  • Cron Jobs - get list of the PHP cron jobs that are specified in the ProductListXmlFeed (see the schema documentation for how to set this up).
  • Performance Monitor - sample CPU utilization and available memory based on the performance data collected and stored in the WADPerformanceCounters table in Windows Azure storage.
  • Backup and Cleanup - manage the Windows Azure drive storage on which were installed WordPress, PHP, and whatever other applications you selected.

Wrap Up

Hopefully it's clear that the Window Azure Companion goes a long way towards reducing the pain of installing PHP and related applications on Windows Azure. ; Since the options are controlled by an XML feed, adding Drupal, Joomla!, and other open source packages that have been vetted to work on Azure should be a simple matter.

That pretty much covers it. ; Remember, you have access to all the source code for the Windows Azure Companion, so check it out, add your own features, or contribute to the discussion on the MSDN CodeGallery.



What's next

[This content was initially posted 09/19/2010 at http://blogs.msdn.com/b/jimoneil/archive/2010/09/19/windows-azure-companion-php-and-wordpress-in-azure.aspx]

 
blog comments powered by Disqus

Related Content

No related content was found