Hosting the Ektron 3-Tier Display Layer in Azure

By Udai Ramachandran

Abstract: This blog explains how you can deploy the Ektron 3-tier display layer into Azure Web sites. (At the time of writing this article, Microsoft offered free Web site hosting.)

Introduction: Traditional cloud service requires a full setup of Ektron 8.6 or greater in the cloud, including a Windows service (a.k.a. worker role in the cloud), and a Workarea.  This approach lets you host your display layer (from Ektron 3-Tier) in the cloud while other layers are hosted in traditional on-premise or any cloud infrastructure (Azure or Amazon).

Step 1:  Log on to the Azure portal and create a new Web site.
     Azure Website hosting

Step 2: Get the FTP credentials by double clicking your Web site. You can reset the credentials by clicking Reset deployment credentials.
    Azure website hosting2

Step 3:  Use FileZilla to transfer your files to your Web site.  

         Host:  Copy and paste the value of FTP Hostname.

         Username: Copy and paste the value of Deployment/FTP User.

         Password: Enter your credential password.  You can reset this by clicking Reset deployment credentials.

         azure website filezilla

Assets, UploadedImages and UploadedFiles Directory: 

Content authors are changing content in the authoring environment and not in the display layer, so none of the files are available in the display layer. All files are uploaded to your middle layer server. In this case, you can access files in the Ektron Assets, Uploaded Files, and Uploaded Images folders using the one of the following approaches:

  • .Copy them directly to your Web sites using the previous FTP credentials.
  • Write a handler to redirect to your on-premise instance or Cloud Storage, such as Azure BLOB or Amazon S3.  You can save the following file into app_code directory, and then add the module into your web.config module section.
<add name="EkBlobModule" 
type="BlobRedirectModule" preCondition="integratedMode"/>
null
using System;
using System.Configuration;
using System.Web;
null
public class BlobOrCdnOrRemoteUrlRedirectModule : 
IHttpModule
{
    #region IHttpModule Members
null
    public void 
Dispose()
    {
        //throw new NotImplementedException();
    }
null
    public void 
Init(HttpApplication context)
    {
        context.BeginRequest += new EventHandler(context_BeginRequest);
    }
null
    void 
context_BeginRequest(object sender, EventArgs e)
    {
        string contextUrl = HttpContext.Current.Request.Url.LocalPath.ToLower();
        HttpContext.Current.Items.Add("Url", contextUrl);
        if (contextUrl.StartsWith("uploadedimages/") || contextUrl.StartsWith(@"uploadedimages\") || contextUrl.Contains(@"\uploadedimages\") || contextUrl.Contains("/uploadedimages/") || contextUrl.StartsWith("uploadedfiles/") || contextUrl.StartsWith(@"uploadedfiles\") || contextUrl.Contains(@"\uploadedfiles\") || contextUrl.Contains("/uploadedfiles/") || contextUrl.StartsWith("assets/") || contextUrl.StartsWith(@"assets\") || contextUrl.Contains(@"\assets\") || contextUrl.Contains("/assets/"))
        {
            string blobUrl = BlobOrCdnOrRemoteUrlMapper.Value + contextUrl.TrimStart('/');
            HttpContext.Current.Response.RedirectPermanent(blobUrl, true);
        }
    }

    #endregion
}
internal static class BlobOrCdnOrRemoteUrlMapper
{
    private static readonly string _roleCdnOrBlobValue = string.Empty;
    static BlobOrCdnOrRemoteUrlMapper()
    {
        if (string.IsNullOrEmpty(_roleCdnOrBlobValue))
        {
            _roleCdnOrBlobValue = (string)ConfigurationManager.AppSettings["BlobOrCdnOrRemoteUrl"];
        }
    }
    internal static string Value
    {
        get { return _roleCdnOrBlobValue; }
    }
}

If you are using remote server or Azure Blob or Amazon S3 or any CDN, make sure to set the following app settings key

<add key="BlobOrCdnOrRemoteUrl" value="http://<YOUR REMOTE SERVER OR BLOB OR CDN URL>/"/>

After following the above steps, you can change your DNS to <YourWebsiteName>.azurewebsites.net.  The world is ready to browse your Web site.

Summary:  It is very easy to set up the display layer in the Azure website model. You also can deploy your site using the TFS, Github  or CodePlex.  I will show this approach in my next article.

 

 

comments powered by Disqus

What Do You Think of our New Design?

    

Have more to say? We’d love to hear it!