Chapter 5

Discussing ASP.NET MVC 4 Windows Azure Deployment Techniques

CONCEPTS

IN THIS CHAPTER

  • Preparing your application for the Windows Azure Platform
  • Examining Developer Centers and supported SDKs
  • Introducing Cloud Computing Services
  • Accessing the Windows Azure Platform
  • Choosing your Windows Azure Services
  • Discussing deployment options
  • Planning database migration and storage
  • Monitoring the status of a deployment

To this point, the focus of this book has been on migrating an ASP.NET website to an ASP.NET MVC 4 application and optimizing it. New topics learned during this reinvention included models, views, controllers, RouteMaps, the Razor scripting language, MiniProfiler, and the F12 Developer tools available in Internet Explorer. These concepts and tools advanced the example blog website for this book from older to newer technology and models. After utilizing some online tools such as Modern.IE or Google PageSpeed and incorporating those tools’ suggestions, the ASP.NET MVC 4 application can now perform and respond much faster. With that, the ASP.NET MVC 4 application for this book is complete and ready for you to host so that people can find, use, and share the information on the blog.

Besides the cloud, you can use a variety of platforms, hosting types, and services to deploy the ASP.NET MVC 4 application. For example, you can create a co-hosted website with a web hosting provider, build your own server, and then connect it to the Internet, or rent a server or virtual machine from an outsourcer.

In this chapter you will learn how to prepare an application for deployment and hosting on the Windows Azure platform. This chapter discusses topics such as understanding the supported SDKs like PHP, Ruby, Java and so on, as well as understanding the different types of Cloud Services, such as IaaS, PaaS and SaaS (defined later in the chapter). Additionally, the chapter covers the different deployment options and how to monitor the status of a deployment.

Because you have a number of hosting options, you should exercise due diligence in researching what works for your situation before making the final decision on where to host your website. The next section provides some tips for determining if Windows Azure is the best platform for your system as well as the sample ASP.NET MVC 4 application for this book.


NOTE This chapter contains key deployment concepts. For a step-by-step guide on how to implement these concepts, see Chapter 6.

PREPARING YOUR APPLICATION FOR THE WINDOWS AZURE PLATFORM

To evaluate whether the Windows Azure platform suitably meets your needs (and the needs of the ASP.NET MVC 4 sample application), you should consider the benefits it offers, which include but are not limited to those discussed in the following sections.

Straightforward Implementation

Without much effort, a company can get its system implemented and running in a live environment on the Windows Azure platform faster than ever before — without purchasing hardware or software licenses, or implementing services, such as a Release Manager. You simply gain access to the Windows Azure environment, create the website or Web Role and/or storage feature, and, with a little configuration, the system is ready for use.

Scalability, Availability, and Durability

As mentioned in more detail in Chapter 3, a benefit of the Windows Azure platform is that it scales quickly and easily. The Windows Azure platform has something called elastic scalability, which allows you to quickly add more physical resources when your system requires them, such as an increase in traffic. Then, when the burst of traffic decreases, you can remove the additional capacity.

Releasing Internal Resources

In addition, by having multiple instances of a Windows Azure Web Role, if one were to fail due to a worker process hang, for example, you can deploy a new role and automatically direct traffic to the working instance. From a data storage perspective, Windows Azure replicates storage services to multiple different servers to guarantee availability and durability.

Quality Support/Experienced Practitioners

Another benefit is that you can release internal IT resources to focus on tasks and activities that are most critical to business and innovation. Because management of infrastructure is increasingly outsourced, the in-house IT department no longer attends to network, OS patching, system issues, and other duties. These outsourced responsibilities are thus managed by high-quality support engineers and top experienced practitioners who proactively work to quickly respond to the technical issues happening on the platform.


NOTE The Microsoft Assessment and Planning Toolkit can help you plan your migration to Windows Azure. You can search for it using Bing or access it directly at this URL: http://technet.microsoft.com/de-de/solutionaccelerators/dd537566.aspx

Mobility

Azure’s mobility enables you to access files, notes, intellectual property, and e-mail from a large variety of devices from almost any location in the world. For example, Microsoft’s SkyDrive or Office 365 are cloud applications hosted on the Windows Azure platform — both of which enable a company or an individual to store, share, and collaborate on tasks from anywhere on any device. You get all of this is at a price that is likely to be lower than the cost of hosting your own server or managing and running your own data center.

Reduced Cost

Cost is a significant factor when deciding which hosting service or model to use for your website. If your website does not get significant traffic or generate revenue, most likely the Windows Azure platform or any of the cloud platforms are not the most affordable or logical option to host your website. For these instances, some web-hosting companies have only a few dollars ($US) a month for hosting. Therefore, if you are an individual, the cheapest solution is likely the best option.

UNDERSTANDING DEVELOPER CENTERS AND SUPPORTED SDKS

Because ASP.NET MVC 4 is based on the .NET Framework, it is certain to be supported when you deploy to the Windows Azure platform. At minimum, you must install the .NET Framework 4.0 for an ASP.NET MVC 4 application to function as expected. As shown on the Windows Azure Web Site and illustrated in Figure 5-1, you can download and use a number of other SDKs to code your application. By using the frameworks provided in the SDKs, you can be confident of seamless integration and support when you deploy to a Windows Azure Web Site, Web Role, or virtual machine.

Each of the Developer Centers provides information for the selected technology. As a result, .NET, Node.js, Java, PHP, and Python are currently supported on the Windows Azure platform. Additionally, Mobile Services and Media Services have tutorials and SDKs to implement those features available on the website. You can also find tutorials, reference documents, API, and REST interface descriptions for the website’s technology framework.


NOTE You can access the Getting Started and Developer Center SDKs at this URL: https://www.windowsazure.com/en-us/documentation.

It is important to confirm that the technology and components your website requires to function and operate properly on the Windows Azure platform. By using these SDKs in preparation for deployment and performing a proof of concept early during your project, you can avoid surprises and costly delays. Proof of concept is a small program that you use to test the basic features of a software library before you make a large scale commitment to it.

INTRODUCING CLOUD COMPUTING SERVICES

Before moving into the cloud, you need to make two specific decisions. The first is determining the service model on which you’ll host your application, for example IaaS, PaaS or SaaS. Each of these service models requires different levels of support and responsibilities once a system is deployed to the platform. These differences are discussed in detail in later sections of this chapter. The second decision is determining in which deployment model you will host those service models. Do you want a private or on-premises cloud, or do you want to deploy your application directly into a public cloud? Security and cost are relevant things to consider for these deployment models, which are discussed in later sections of this chapter.

Understanding Cloud Computing Service Models

Different Cloud Services have different levels of technological support. These Cloud Services offer the resources required to operate most web-enabled systems imaginable. Cloud Services give you the hardware and the operating systems to run the website or solution as well as the binaries for executing and compiling your code. Other features are the Network connections and bandwidth that funnel information to your customer. Table 5-1 illustrates some of the most common Cloud Computing Service models.

TABLE 5-1: Common Cloud Computing Service Models

ACRONYM DESCRIPTION SHORT DEFINITION
IaaS Infrastructure as a Service Provides physical or virtual machines for service hosting.
PaaS Platform as a Service Computing platform with OS, programming language execution, database, and websites.
SaaS Software as a Service Cloud providers install software that users can access and use from any location, for example, Microsoft Office 365.
DaaS Database as a Service A database for systems to connect to and use.
NaaS Network as a Service VPN, bandwidth on demand, and network/transport connection services.

The most common Cloud Computing Services, all of which are supported in the Windows Azure environment are IaaS, PaaS, and SaaS. As illustrated in Figure 5-2, each of those services are built on top of each other and sometimes referred to as the Cloud Stack.

NaaS, recently released on the Windows Azure platform, allows you to now configure Virtual Private Networks, site-to-site networks and point-to-site networks. DaaS is deployed and used by creating a database in the cloud and connecting to it. All the previously mentioned service models are available on the Windows Azure platform.

What is IaaS?

At the bottom level of Figure 5-2, you’ll notice Infrastructure as a Service (IaaS) which is the most basic model level. IaaS provides the physical hardware where cloud users can install operating systems and/or applications that run on this hardware. In most cases, it contains the virtual machines managed by products, such as Hyper-V or VMware. As previously discussed, virtual machines support the elastic scalability needed for system usage bursts. Other resources commonly provided with IaaS may include IP addresses, firewalls, and file storage.

What is PaaS?

The operating system exists on top of the physical hardware or virtual machine; this is where the Platform as a Service (PaaS) resides. Besides operating systems (such as Windows Server 2008 R2, Windows Server 2012, or Linux), code execution binaries, web servers, and databases provide environments where individuals, developers, or companies can host their computer system. The PaaS is also where the ASP.NET MVC 4 sample website (used throughout this book) exists. Both the Windows Azure Web Site and Windows Azure Cloud Service provide the PaaS services.


NOTE For more on how the ASP.NET MVC 4 sample operates on the PaaS, see Chapter 6.

What is SaaS?

Cloud providers offer Software as a Service (SaaS) so consumers can access and use software on numerous devices from any location provided they have an Internet connection. The software is typically installed, supported, and managed on the PaaS environment by the cloud provider thereby eliminating those responsibilities from the individual or company. Some examples of SaaS are Microsoft Office 365, Microsoft SkyDrive, and Microsoft CRM Dynamics Online.

Understanding Deployment Models

In addition to the Cloud Computing Service Models there are also different types of deployment models, which are summarized in Table 5-2. These are discussed in more detail in the following sections.

TABLE 5-2: Cloud Deployment Models

DEPLOYMENT TYPE DESCRIPTION
Private cloud Cloud infrastructure for a single organization
Public cloud Cloud infrastructure made available by a provider, that is, Windows Azure
Community cloud Cloud infrastructure shared between two or more organizations
Hybrid cloud An arrangement of two or more of the other deployment models

Understanding Private and Public Clouds

The primary difference between a private and public cloud is as follows:

  • A private cloud infrastructure is owned, operated and managed by the same company who owns the systems hosted in that cloud. You have the further option of having either an offline versus an online private cloud.
  • A public cloud is typically owned and managed by a cloud hosting company that allows external businesses or individuals to host and manage their applications on their platform for a fee. Freeing the business and individuals of the management of the cloud infrastructure. The following sections discuss each.

The following sections examine private and public clouds in more detail.

What Is a Private Cloud?

A private cloud is likely utilized and implemented by companies or governments that must perform actions required by law or for regulatory compliance. These capabilities may not yet be possible in the public cloud. For example, a private cloud in the Windows Azure environment located onsite, resides in a company’s or organizations own private data center. The benefits of a private cloud are that you can customize it however you want, and it is perceived to be more secure compared to a public cloud because you have more control over the environment. Contrast that with a public cloud where you do not control operating system patches, the hardware, or the infrastructure, such as load balancers, network, and firewalls.

Offsite versus Onsite Private Clouds

You can have either an offsite or onsite private cloud. The main difference between the two is that the offsite infrastructure is hosted in an outsourced data center (see Figure 5-3):

  • With an offsite private cloud, the company owns and supports all the infrastructure required to run the cloud. Because the offsite private cloud is a cloud environment in an outsourced data center, it is not shared with other companies or customers. A business might decide to host their system in an offsite cloud instead of building and managing their own data center facilities. This results in a lower cost of IT ownership and maintenance because the data center owner provides the building, power supplies, and network infrastructure.
  • An onsite private cloud is maintained by the company that owns the facilities in which it operates.

What is a Public Cloud?

A public cloud is a large group of servers owned, operated, supported, and maintained by a cloud provider. When individuals or companies sign up for a Windows Azure account and deploy a website or Web Role, it is deployed into a public cloud.

Pros and Cons of a Private versus a Public Cloud

Figure 5-4 illustrates a comparison or pros and cons between a private and public cloud. Full control of the environment, the usage of a private network, and having full control of and access to the content (that is, more security) are positives of the private cloud. Whereas initial capital costs, the requirement of building and managing the environment, and not getting many synergies by sharing the capacity are the private cloud deployment model’s downsides.

Don’t get the wrong impression that placing content or intellectual property into a public cloud is not secure. The private cloud does give complete control of access to the company owning and operating the private deployment model; however, even the public cloud has sophisticated layers of security.

The positive aspects of the public cloud deployment model are that it is less expensive to deploy and run; scaling the environment does not require the purchase and configuration of any hardware; and there are many real-world examples of high-performing, high-available solutions deployed to the public cloud that you can use as models. Negative aspects include the possibility you may be sharing your environment with other customers or companies and that this somehow will impact your websites’ performance or availability. Also, initially, the cost of the deployment may be complicated to calculate, and you do not have complete control over operating system patches or if other third-party components get installed. For all these reasons, you should use the private cloud only if you have a legitimate business justification.

Understanding a Community Cloud

A community cloud is a group of servers shared by a group of companies or individuals.

This approach is usually performed with partners or individuals who want to gain more control over their environment while spreading the costs across a group of trusted partners in the community. An advantage to this model is that you reduce the costs incurred by the purchase of hardware and maintenance. A disadvantage is that you share the environments with other systems that may impact the performance of your system by either using too much of the systems resources or by installing or updating dependencies that have a negative impact on the co-hosted systems.

Understanding a Hybrid Cloud

A hybrid cloud is generally only used by enterprises who want to build a solution that is not yet completely available in the cloud. Figure 5-5 shows a hybrid deployment model that implements two or more of the four described deployment models. This model means you can control areas that you do not want outsourced but rather want to keep in-house or on-premises, while at the same time placing the pieces you want to make public into a multi-tenant cloud. You can also realize some cost advantages by placing content you still consider intellectual property on the public cloud.

A hybrid cloud is more cost effective when compared to a private cloud because your internal IT department only manages, supports, and scales out a portion of the company’s solution. You can pick and choose the best components of each deployment model, and build your own cloud solution. The down side is that because the system is hybrid, it’s also unique and you’ll have no best practice examples or patterns to follow. If you choose a hybrid cloud deployment model, you innovate and build a solution, which may result in unique problems that might need skilled and experienced cloud experts to work through and support. Therefore, you must choose your solution carefully and consider supportability and flexibility options before committing.

ACCESSING THE WINDOWS AZURE PLATFORM

At this point the different Cloud Service and deployment models, plus the supported SDKs should be understood. The next step is to gain access to the Windows Azure platform. This, of course, assumes that you have decided to deploy to a public cloud and chose either an IaaS, PaaS, or SaaS Cloud Service. There are currently no private, hybrid, or community deployment models on the Windows Azure platform.

Obtaining access to the Windows Azure platform is not complicated. The details of this are discussed and performed in Chapter 6. After you provide the required information to access the platform, you log into the Windows Azure Portal, and can view the main overview page similar to that shown in Figure 5-6.

The right side of the management pane contains various platform items. You can click a group to access a specific item, or click the +NEW link to create a new item of any type. Table 5-3 shows the various services you have available to you.

TABLE 5-3: Windows Azure Item Services

image

Most of the services are intuitive and do as they are called, such as Web Sites, SQL Database, and Cloud Services, all of which have examples and exercises provided in Chapter 6. For many, Service Bus, Active Directory, SQL Reporting, and others likely need some additional investigation and study. All the details and descriptions for these services are provided at the following URL; click the Services link as shown in Figure 5-7: https://www.windowsazure.com/en-us/documentation. There is also a discussion of some Windows Azure Services provided in the following section, “Choosing your Windows Azure Services.” Nonetheless, a brief explanation of each Windows Azure service item is provided in the following list.

  • Compute:
    • Web Sites: An example for creating a Windows Azure Web Site is provided in Chapter 6. When you create a website in Windows Azure, it is co-hosted with other websites on a single virtual machine.
    • Virtual Machines: An example of Window Azures IaaS feature. It is similar to creating a virtual machine using Hyper-V or VMware, however it is now done in the cloud.
    • Mobile Services: Provides a back-end for your mobile app. If you have created, for example a Windows Phone app, and need to store some data, this service is quick and easy to setup and configure for just that purpose.
    • Cloud Services: An example of Window Azure’s PaaS feature. You do not have control or responsibility over the infrastructure, but can choose from multiple operating systems like Windows Server 2008R2, Windows Server 2012 or many versions of Linux. An exercise of creating a Cloud Service is provided in Chapter 6.
  • Data Service:
    • SQL Database: A Windows Azure DaaS feature, this is a full SQL Server database instance hosted in the cloud. A detailed description of how to create and utilize a SQL Server database in the cloud is provided in Chapter 6.
    • Table Storage: A storage structure that does not require complicated data structures but does required very large storage resources.
    • HDInsight: Windows Azure Big Data service feature. This is a new industry with many unknown opportunities. You can use this feature to learn more about Big Data analysis with tools like Hadoop.
    • SQL Reporting: SQL Server reporting services is a platform for quick creation and execution of reporting commonly used for sales and marketing forecasting.
    • Recovery Services: Tools for backing up and recovering your application hosted on the Windows Azure platform.
  • App Service:
    • Service Bus: Is similar to MSMQ or Tuxedo in that is manages the flow of requests from clients to a backend system.
    • Media Services: Provides a platform for multicasting and video streaming.
    • Active Directory: A location for creating domains and authenticating users in the cloud, similar to an Active Directory (AD) hosted in a standard enterprise. Connection between the enterprise’s AD with an AD in the cloud is supported.
  • Network:
    • Virtual Networks: You can create a standalone network in the cloud with virtual machine and manage it just as any corporate or personal network. Virtual Network supports site-to-site, point-to-site, and VPN tunneling.

This section did not cover the details of all the services and options available on the Windows Azure platform because the best way to understand your options is to access the platform and start testing them, working with them, and obtaining practical experience. Learning how to apply the services to your company and communicating those benefits internally can come only after using and working in the platform over time. Some very good documentation that discusses all the Windows Azure service can be found here: www.windowsazure.com/en-us/documentation/.

CHOOSING YOUR WINDOWS AZURE SERVICES

For the examples and exercises provided in this book, the Compute and Data Services are chosen for you. However, when you’re choosing which services you require for a system other than the example, you may need more information. For example, what are the differences between a Windows Azure Web Site, Cloud Service, and Virtual Machines, and when should you use which? What is the difference between a Windows Azure SQL Database and Table Storage? And what are SQL Reporting, HDInsight, and Active Directory?

Using Azure Web Site versus Cloud versus Virtual Machine

Let’s begin with the analysis and comparison of the Windows Azure Web Site, Cloud Service, and virtual machine. With a Windows Azure Virtual Machine, you can do basically anything you could do with a VMware or Hyper-V virtual machine. For example, you can build the infrastructure completely on your terms, choose the operating system, such as Windows Server or Linux, and securely connect your on-premises system with virtual machines running on the Windows Azure platform.

A Cloud Service, also referred to as a Web Role, provides an easy way to build and extend enterprise-level applications that require high availability and multitier settings. Windows Azure customers can also use Web Roles to create a Software as a Service (SaaS) product for their customers, which customers can use and access from any place in the world. Websites are co-hosted on multitenant instances, meaning they are co-hosted with other websites on the same virtual machine, but neither Remote Desktop Connection nor the ability to run programs nor software in an elevated mode (such as Run as Administrator) are supported. However, websites support FTP and GIT deployment options, which provide for near-continuous deployment strategies. Figure 5-8 illustrates these capabilities in more detail. Note that when running a virtual machine on the Windows Azure platform, you can utilize features available to both a website and a Web Role. Therefore, all the capabilities shown in Figure 5-8 apply to a virtual machine, too.

Understanding Data Storage Features

There are also two data storage capabilities to choose from:

  • The Windows Azure SQL Server database: This is a fully functional relational database service. You should chose the Windows Azure SQL Server database instance if you require a relational database, stored procedures, TSQL, and want to run ACID Transactions. Many complex enterprise and even some smaller systems have a relational database powering it. However, some simpler systems, requiring only a storage solution that uses key/value pairs, should consider Windows Azure Table Storage.
  • Windows Table Storage: Using Table Storage, you are not locking down your system to a data model; the data structure is not relational and therefore does not support SQL queries using JOINs or stored procedures, but transactions are supported.

You choose Windows Azure SQL Database when:

  • Your database must support rich data types, access to data using joins, or database aggregates such as MAX, MIN, AVG, and so on.
  • Your database needs to support stored procedures.
  • Your database likely will not exceed 150 GB. This is not a limit; it just means that additional actions need to be taken if exceeded.
  • Your database is relational with primary and foreign keys linking table together.
  • Your application already uses the Microsoft SQL Server database engine.

Choose Windows Azure Table Storage if:

  • You need large data storage (multiple terabytes).
  • Your database does not have complicated data schemes.
  • Your database does not use joins and complicated server-side queries and does not require secondary indexes.

What is Windows Azure SQL Reporting?

Windows Azure SQL Reporting is built on the SQL Server Reporting services. This capability provides access to reports using only an Internet browser. After the report is accessed and rendered, it can be extracted to Excel and saved as a PDF. You can find more information by searching for Windows Azure SQL Reporting from any major search engine.

What is HDInsight?

HDInsight is one Microsoft’s Big Data initiatives and solutions. Big Data analysis and technologies are all over the news and discussion boards, and it is commonly referred to as a solution without a problem to solve. Nonetheless, most of the major players in the IT industry, such as Amazon.com, Google, IBM, Facebook, Microsoft, and so on are investing big into this technology. If you are interested in working with it, you can add the feature to your Windows Azure platform and give it a test drive.


NOTE There are a number of articles and labs available for learning HDInsight. You can find more information about Big Data analysis using HDInsight here: www.windowsazure.com/en-us/manage/services/hdinsight/.

Using Active Directory

The Active Directory capabilities available on Windows Azure are similar to those available in a standard domain. The Active Directory supports the creation of domains, user, computer and service accounts, and the authentication of those accounts. This is a feature that is not currently available with any other cloud provider. A significant benefit and usage for this feature is to create and support a single-sign-on (SSO) solution for all your applications that exist in your domain, similar to the Windows Authentication, which uses either NTLM or Kerberos. In many corporations, employees need to know multiple user IDs and passwords to access the many systems in the company to do their job. With an SSO solution, the employee can sign-on once and access all the systems that they have authorization to as long as these resources exist in the same domain. This is one of the more exciting features available in the Windows Azure platform, and is full of innovative possibilities.

Now that you know how to prepare your application for Windows Azure, which SDKs are supported, the different types of Cloud Services (PaaS, IaaS, and SaaS), and the differences between a Web Site, Web Role/Cloud Service, and a virtual machine, it’s now time to review the different deployment methods. The next section covers the many options in detail.

UNDERSTANDING DEPLOYMENT OPTIONS

The Chapter 6 exercises and examples have steps that walk you through using FTP, GIT, and TFS to deploy the sample ASP.NET MVC 4 project to both an Azure Web Site and a Web Role. There are a few other deployment options, and new ones are added often. A current list of available deployment options include:

  • Team Foundation Service
  • CodePlex
  • GitHub
  • Dropbox
  • Bitbucket
  • Local Git

Integrating Source Control with a Cloud Service

Having a source code repository is important for a number of reasons. Primarily, the repository stores and secures source code, which is likely one of the most valuable sources of intellectual property that a company has. Additionally, many source code repositories have version controls that allow you to roll back from one version to another as well as simple comparison tools to see how code changes between different versions. Source code repositories are, thus, a recommended and commonly followed practice. Finally, the source code repository is the location where Release Managers get the final version of a release that’s eventually moved into the production environment for the customers and visitors to use.

The basic steps for integrating the source control with a Cloud Service are as follows:

1. Select the Cloud Service with Windows Azure management console.
2. Under the Integrate Source Control header, click the Set Up TFS Publishing link, shown in Figure 5-9.
3. Follow the wizard and link an existing TFS account to this Web Role or create a new account.

NOTE A more complete example of how to integrate a source control with a Cloud Service is provided in the following chapter. In this example, after you create the link, you can deploy and compile the migrated source code, and make it available to your users from the online TFS website capabilities or from Visual Studio 2012.

Integrating Source Control with an Azure Web Site

To integrate source control with an Azure Web Site, you must select a preferred source control repository. You have several options for doing this including Team Foundation Service, CodePlex, and GitHub.

Although this section only covers the CodePlex and Dropbox source code repositories, the principles illustrated in the following sections are the same for the remaining deployment options.


NOTE Some options do not support or provide source code management capabilities that TFS, Git, and CodePlex have. Many of the options are simply a portal or staging area from which to deploy code to the Windows Azure Web Site, similar to FTP. Exercises for integrating GitHub and TFS with Windows Azure are provided in Chapter 6.

Using CodePlex

You can use CodePlex to create new projects to share with the world or join others who have already started their own projects. Basic steps follow for integrating your source control with a Windows Azure Web Site utilizing CodePlex.


NOTE The Windows Azure Platform is described as “Microsoft’s open source project hosting website. You can use CodePlex to create new projects to share with the world or join others who have already started their own projects.”

1. Access the website from the Windows Azure management portal.
2. Click the Set Up Deployment from Source Control link under the Integrate Source Control heading, and the window shown in Figure 5-10 appears.
3. Select the preferred source control repository and follow the wizard to configure it. For this example CodePlex is used. When you select CodePlex and then click the Next Arrow, a window opens (Figure 5-11) that requests your CodePlex credentials or allows you to register for the source code repository hosting service. After the link is created, you can deploy your source from CodePlex.

Using Dropbox

Like Microsoft’s SkyDrive, after the Dropbox software is installed on your PC, it acts like a mapped drive or folder accessible using Windows Explorer, as illustrated with Figure 5-12. Windows Azure describes this software as follows:

“Dropbox is a free service that lets you bring all your photos, docs, and videos anywhere, and share them easily. Use Windows Azure to quickly sync and deploy your code from your Dropbox folder.”

To configure Dropbox as your source code repository, follow these steps:

1. Select the Dropbox from the pop-up, as shown previously in Figure 5-10, and select the Next arrow. The Connection Wizard navigates you through the process of binding the Dropbox account with your Windows Azure account.
2. When you’re finished with the Wizard, click the Allow button, as shown in Figure 5-13. When authenticated, a folder called Apps is created in your Dropbox account.
3. Place your code into this directory, and select the Sync button to deploy the code to the Windows Azure Web Site if for some reason it doesn’t kick off automatically.

Deploying Web Roles

The final deployment option discussed in this section is deploying a Web Role using a Service Definition File, Service Configuration File, and a Service Package, all of which are described in Table 5-4.

TABLE 5-4: Windows Azure Deployment Components

COMPONENT DESCRIPTION
Service Definition File (.csdef) Defines the service model and number of roles
Service Configuration File (.cscfg) An XML based file the provides configuration settings for the Cloud Service, individual roles, and number of role instances
Service Package (.cspkg) Contains application code and the Service Definition File

You have numerous options for moving or replicating your source code to the Windows Azure platform. But remember that a Windows Azure Web Site and Windows Azure Web Role have different features. In addition, some deployment options do not provide source control, but rather only a source code depot for deployment. Depending on the complexity and requirements of your system, you need to assess which deployment option best meets your needs.

You can create both the deployment configuration and package files from Visual Studio 2012 after you install the Windows Azure SDK, using these basic steps:

1. Right-click the Web Role (not the project) and click Package, as shown in Figure 5-14. The process runs to create the required files for performing a package deployment.
2. You deploy the created package using Visual Studio 2012, by accessing the Windows Azure Management Portal and selecting the Cloud Service to which you want to deploy the package.

NOTE You can also create a deployment package using the CSPack command-line tool available from the Windows Azure SDK.

3. Select either the New Production Deployment or New Staging Deployment options, as shown in Figure 5-15. A window appears enabling you to add the deployment package configuration files. If a deployment already exists, instead of seeing the New Staging Deployment option, you’ll see the Update Staging Deployment option instead.

NOTE It is recommended that you deploy the package to the Staging environment first, perform testing, and then, by selecting the Swap link, deploy to the Production environment.

PLANNING DATABASE MIGRATION AND STORAGE

Most systems require a database to store and manage the capabilities or features that are available for users. The sample ASP.NET MVC 4 Web Role detailed in Chapter 6 requires a relational database that is accessed by NHibernate and uses the Model First approach, where you create the database structure by coding the class files required for implementation. With this approach, instead of the database driving the application, the design and relationship between the classes drives relationships already existing in the database.

However, many systems that you migrate to the Windows Azure platform usually have relational databases or data structures with a significant amount of data stored in them already. The question then becomes, “How do you migrate an existing database to the Windows Azure platform?” One answer is to use the SQL Service Migration Assistant, a free download from the Microsoft Download Center. You then use tool to convert an existing database to a SQL Server hosted on the Windows Azure platform. Numerous database-management system conversions are supported. For example, you can migrate Oracle, MySQL, Sybase, and Access databases to a Windows Azure SQL Server database using this tool.


NOTE Database management, scaling, tuning, and maintenance are specialized skills. For further information about database options, review the “Choosing Your Windows Azure Services” section in this chapter, purchase a book specific to this topic, or review online documents that discuss this topic further.

After you create the structure and schemas of the database, it is recommended that you migrate the majority of your data using the SQL Server Integration Services (SSIS) available. Compared to importing the data directly into tables from a PC or other data source, migrating data using this tool can speed up the process and minimize incurred charges.

MONITORING THE STATUS OF A DEPLOYMENT

Watching the deployment of your code, knowing when it is complete, and monitoring any issues in its deployment are important pieces of information to capture, maintain, and communicate. For large-scale enterprise applications, this type of information is a critical step in the software design life cycle. You need to know that code has deployed to the staging or production environment before you can begin the testing phase, which in turn leads to making go/no-go decisions for a project.

A number of Azure features enable a Release Manager or deployment expert to observe code movement from the source code repository to either a Windows Azure Web Site or Web Role. When the code is ready for deployment, you can then move code to the Production or Staging Windows Azure environment. As discussed in the previous section, the Windows Azure Web Site supports the deployment of code from numerous sources, whereas the Web Role is currently bound to the Team Foundation Server.

The Windows Azure Web Site supports the most deployment methods:

  • FTP: The most common deployment method for a hosting provider. After you create the Windows Azure Web Site, the FTP address appears in the Quick Glance column of the Dashboard for the website. With this address, you can use a tool, such as FileZilla, to deploy your code to the website, similar to when you publish to a hosting provider’s server or to a standalone server. Most FTP tools have a status bar to show how far along you deployment is.
  • Dropbox: If you deploy your source code using Dropbox, you can view your deployment status in the Windows Azure management console. As illustrated by Figure 5-16, the status tracks deployment from the moment you make a connection between the Windows Azure Web Site and Dropbox.

During deployment, the status of synchronization updates as the static files and binaries deploy. When complete, you can test to determine if the code has installed as expected.

Deployment history also provides a list of deployments, containing the number of items changed, identification of which one is the most current and the date when the deployment was made (see Figure 5-17). Deployment history is available when you deploy from a number of repositories — not only Dropbox. For example TFS and GitHub both provide history, while FTP does not. Git and CodePlex have the same features as Dropbox.

In addition to these deployment options, Team Foundation Server (TFS) is available for both the Windows Azure Web Site and Web Role. When you configure the link between TFS and your Windows Azure Web Site or Web Role deployment occurs immediately after you check your code into the TFS source code repository. For example, in the Visual Studio 2012 IDE (which is connected to the same TFS instance bound to the Windows Azure Web Site or Web Role), when you make a code change and check in, shown in Figure 5-18, these changes automatically deploy to either your website or Web Role.

To learn about the many features available for monitoring and managing deployments, you can use the online version of TFS via your Microsoft ID at http://***.visualstudio.com, where *** is the name provided to you when you created your TFS connection with Windows Azure. For example, for a given project, a complete list of currently queued builds, completed builds, and deployed builds are available for real-time and post-mortem analyses.

SUMMARY

In this chapter you learned many decision points, capabilities, and limitations for deployment to the Windows Azure platform. You learned under which circumstances certain websites or applications should not be deployed to Windows Azure, primarily based on the incurred cost of the platform. A discussion occurred for SDKs supported on the Windows Azure platform such as PHP, Python, Java, and .NET.

The different Cloud Computing Services such as IaaS, PaaS, and SaaS were discussed as well as the primary differences between a Windows Azure Web Site and Web Role, which is also commonly referred to as a Cloud Service. Data storage options, such as Table Storage and SQL Server database were discussed in addition to how to deploy to them and how to deploy to the website or Web Role using source code repositories such as Git, TFS, Dropbox, or CodePlex. There are also many options for monitoring the deployments in real-time so that testing can begin when complete.

In the following chapter, you can find exercises and examples using many of the concepts discussed in this chapter.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset