It’s been over 6 months since we decided that we would build the Tech.Days website using Umbraco and host it in Azure and in that time there have been a number of solutions created to get Umbraco working with Azure. Today I’m going to show you how you can the new Accelerator launched in April to get an Umbraco 4.7 site on to Azure with multiple instances.

When we first put the Umbraco site live on Azure, late last year we had a problem: The first version of the Accelerator would only allow us to add one node. The accelerator enabled us to get things on Azure, but critically didn’t allow us to scale. If we did, the whole site would enter a painful “waiting for node to start” loop. Having a cloud solution that is only capable of having one node is about as useful a chocolate fire guard… and so we searched for a solution.

As a temporary measure we managed to solve the issue by writing our own code based on the Accelerator. This enabled us to initialise a handful of nodes to cope with potential traffic spikes, however, getting it working was quite labour intensive and it required me to learn a lot about the Azure SDK and Umbraco. The result was a rather messy solution that worked but wasn’t particularly reusable, I talked about this solution at Tech.Days.

Surely there was a better way.

Luckily there was. Two better ways in fact.

The New Umbraco Azure Accelerator is what we used for our 2nd Version of the Tech.Day website, this site went live today. This new Accelerator enabled two critical features:

  • Multiple Instances, you can now scale your application up or down easily by spinning up as many instances as you wish.
  • Edit Individual files You can edit individual files and this is synced to all instances. You can do this without redeploying a whole new azure package.

The architecture of a site using the new accelerator looks like this:

Picture showing the Umbraco Accelerator architecture

Basically the Umbraco website is stored in blob storage and when a web role instance starts up it loads the site from blob storage and attaches it to IIS. If you edit a file inside of blob storage the file change gets replicated across the instances and if you make a change to the instance file system it gets replicated back to blob storage and then in turn it is sent out to the other instances.

All of the data is stored in SQL Azure. You can either let the Accelerator create you a fresh database for you or you can use this tool to migrate an existing SQL database into SQL Azure (This was the tool I used to get the TechDays database from our staging SQL server onto SqlAzure).

All of the session data is stored in either a SQL Azure database or if you are feeling particularly fancy you can use the Windows Azure AppFabric Caching service (there are instruction on how you can do this in the documentation that ships with the Accelerator)

Complete Instructions on how to create and deploy the application are contained as part of the download but general steps are as follows:

  1. Create a Windows Azure Storage Account
  2. Start the Setup Script, this will ask for the blob storage details and will then configure the accelerator project with this information.
  3. Build and publish the service config and package files using Visual Studio and Deploy these two files to a Windows Azure hosted service
  4. Create a SQL Azure database or enter your existing database credentials.
  5. Allow the script to create a session database for you.
  6. Allow the script to deploy Umbraco to blob storage.
  7. Wait 10-20mins and your site will be live.

Once your site is live it’s pretty easy to adjust the number of instances through the Azure Management portal. All you need to do is:

  1. Log on to the Windows Azure Platform portal, and click Hosted Services, Storage Accounts & CD on the lower part of the left pane.
  2. In the upper part of the left pane, choose Hosted Services.
  3. Select your Accelerator deployment on the middle pane and click Configure, on the ribbon.
  4. In the Configure Deployment dialog, choose Edit current configuration, and change the Instances count value in the configuration XML.

    Configure Deployment Dialog

    Figure 1 - Configure Deployment Dialog

The Windows Azure Accelerator for Umbraco will automatically replicate the Umbraco sites on each new instance, allowing your Umbraco instance to scale out.

Alternatively you can change the number of instances programmatically using the service management API . You could for example write a service that scales the application out or reduces capacity based upon traffic spikes.

To use the new accelerator there are a number of prerequisites:

 

The new version of Umbraco (Umbraco 5)was only released today as a CTP. As yet I haven’t had a chance to test it but I am assured that Azure support will be built into the application architecture. I’m heading off to Denmark today for the CodeGarden event and will be sure to update you afterwards once I know more. Incidentally they are using Azure to host the CodeGarden event site too.