Deploying Orchard on Azure Web Sites using Storage Account

Topics: Customizing Orchard, General, Installing Orchard, Writing modules
Oct 12, 2012 at 12:21 PM
Edited Oct 12, 2012 at 8:17 PM

Hi,

I've contributed the changes to the solution needed to deploy Orchard to Azure Web Sites with support for Azure Storage Accounts in the fork http://orchard.codeplex.com/SourceControl/network/forks/pnmcosta/azurewebsites 

Using this fork you should be able to develop using visual studio and build your solution to Azure Web Sites using Azure Storage Accounts for media and site configuration.

Changelog:

  • modified the implementations of IShellSettingsManager, IStorageProvider and AppenderSkeleton in the Orchard.Azure project to use CloudStorageAccount.FromConfigurationSetting 
  • references to Orchard.Azure and WindowsAzure SDK have been added to the Orchard.Web project
  • the Orchard.Web\global.asax was updated to define that configuration settings should be gathered from the web.config appsettings.
  • the Orchard.Web\web.config includes Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString and DataConnectionString appsetting keys with UseDevelopmentStorage=true but these can be overriden via the azure web site manage portal.
  • Config\Host.config and Config\Sites.config are included in the Orchard.Web project

Notes:

  • These modifications have been done to the default branch.
  • You should use ClickToBuild.cmd and not ClickToBuildAzurePackage.cmd to build the solution.
  • Once deployed to Azure Web Sites don't forget to override the web.config keys via the portal (or modify them directly in the file).
  • Orchard prompt will not work if in Azure Storage Mode, to disable the storage mode clear the app_data and rename Config\Host.config and Config\Sites.config to something else.
  • Logging AzureAppender probably won't work, but was not a requirement of mine at this stage.
  • If you encounter this error "The virtual path '/' maps to another application, which is not allowed." when testing the solution locally with storage emulator use local IIS or set the Virtual Path of the Orchard.Web project to "/". This is because the storage emulator runs of http://127.0.0.1:10000/devstoreaccount1/ causing virtual directory conflicts.

This is my first contribution and I'm looking forward to any feedback (good or bad) the community might have? And I truly hope I have helped someone with it :)

Cheers,
P.

Oct 12, 2012 at 7:48 PM

Cool that you made this change. What's the build that is being used when you do "Find Apps for Azure" and pick Orchard? Is your fork any different than that build? 

Oct 12, 2012 at 8:17 PM

I suppose it's the default build.

Out of "Find Apps for Azure" it works great on Azure Web Sites, but to be able to use the storage the changes above need to be done.

Maybe a new build from this fork could be added to the "Find Apps for Azure"?