Tags

, , , , , , , , , , , , , , , ,

So I do hope my last article got y’all excited about this article!

It was not so long ago when a friend of mine and I were having this discussion about Cloud Computing, SaaS, IaaS and PaaS.

One of the important factors that we both had in common is that we started our careers together in the IT Industry and had become IT Architects/Solutions Architects in our designated fields.

So he asked me one question, about what were my thoughts on PaaS and how it would affect traditional software development/deployments practices?

That rang a bell in my mind. I then was thinking about Microsoft Azure, Cloud Foundry and incidentally, it struck me that by that time, I had gotten access to the UhuruCloud Trial PaaS.

I then mentioned UhuruCloud to him.

His first question was, is it for .NET Apps only? I then replied, no its for Windows and Linux based apps hosting both MSSQL and MySQL database platforms + NoSQL databases such as MongoDB and Redis etc

He was silent for a while. He then went on to say
We then he mentioned, isn’t Uhuru still in Beta?
I mentioned to him yes, he was correct, and also  I re-iterated to him mentioning that I stumped along a few errors initially during the process.

As Architects, we then came to a conclusion that no software in the world is bug-free Smile.

Lastly, he mentioned that he was planning on taking a look at Azure.

I then, told him that it would ok for him to try Azure, however, the time taken to deploy a .NET app in Uhuru PaaS, took me a lot lesser time than in Azure.

It then he asked me to show me how easy it was to port a .NET DB App to the Cloud.

As I was writing this blog, I told him, I will demo it for you as we speak.

He was looking forward to it.

 

Now on to the Article

Xbox


My fellow readers, as per my last article, I did mention that we would be going through on how to deploy a sample .NET Database enabled Application to the Uhuru PaaS!

[Note: If you wish to view the images in their original size, just click on the image to view the same]

 

System Requirements

Windows 7 Developer based Workstation with Visual Studio 2010 Professional or above

MMC plugin x86/x64 depending on your OS architecture from the Uhuru Software website

Visual Studio Plugin x86/x64 depending on your Visual Studio version

Sample Application that says dotNETTestApp-withDB

And finally! and most important of all getting an Uhuru Trial PaaS account here

http://www.surveygizmo.com/s3/796977/Uhuru-beta-registration

The links to the above are given below for downloading

Once you have installed the above lets Begin!

Before moving on, I wanted to explore the Architecture of how the Uhuru Public PaaS and Private PaaS is designed.

Below is how the Uhuru Public PaaS is designed

 

UhuruArchDiagram-Public

Below is how the Uhuru Private PaaS is designed


UhuruArchDiagram-Private

[Next Steps]

Extract the sample applications to a folder of your choice

1) Open the dotNETTestApp-withDB folder and double click on the DatabaseTestApp Visual C# Project

image 

2) Now in Visual Studio 2010 , you should see a screen as shown below with the App and Web.config file

image

3) To ensure that we that we indeed have the Cloud Manager setup – Click on View Menu—> Cloud Manager

CloudManager

4) We are now going to create a new Service that will allow our sample App to connect to the Uhuru PaaS

Before we jump into it, I would like to show the sample code used for creating the database table in our sample application

// This will create a table called test and will contain a series of Random GUIDs of 20 rows respectively. This application will have a GridView to display the data and a button to populate it.

 

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Configuration;
using System.Web.Configuration;

namespace DatabaseTestApp
{
    public partial class _default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            string connString = WebConfigurationManager.AppSettings["dbConnectionString"];
            string tableName = “test” + Guid.NewGuid().ToString().Replace(“-“, “”);
            SqlConnection conn = new SqlConnection(connString);
            conn.Open();
            try
            {
                SqlCommand command = conn.CreateCommand();
                command.CommandText = “Create table ” + tableName + ” (id smallint, description varchar(50))”;
                command.ExecuteNonQuery();
                for (int i = 0; i < 20; i++)
                {
                    command.CommandText = “insert into ” + tableName + ” (id, description) values (” + i + “, \'” + Guid.NewGuid().ToString() + “\’)”;
                    command.ExecuteNonQuery();
                }

                command.CommandText = “select * from ” + tableName;
                SqlDataReader reader = command.ExecuteReader();
                GridView1.DataSource = reader;
                GridView1.DataBind();
            }
            catch (Exception ex)
            {
                Response.Write(“oops, something went terribly wrong:” + ex.ToString());
            }
            finally
            {
                conn.Close();
            }
        }
    }
}

Let us now explore the Web.config file

<?xml version=”1.0″?>

<!–
  For more information on how to configure your ASP.NET application, please visit
 
http://go.microsoft.com/fwlink/?LinkId=169433
  –>

<configuration>
    <system.web>
        <compilation debug=”true” targetFramework=”4.0″ />
    </system.web>
  <appSettings>
    <add key=”dbConnectionString” value=”{mssql-2008#databaseTestAppDb}”/>
  </appSettings>
</configuration>

The <add key> component is very important as it defines the Service Name to which we will deploy our App to the Uhuru PaaS.

Make sure that you use the same name otherwise the app will not get deployed successfully.

 

Now it’s time to begin the Fun Stuff! Smile

[Defining your Uhuru Cloud Credentials in Cloud Manager]

1) In Visual Studio –> Cloud Manager Window –> Click on Connect to Target

2) Add your Uhuru Trial PaaS credentials as sent you by Uhuru Software

image

3) Click on Add once done

4) You should now see your Uhuru credentials populated

5) Click on the Connect button on the Cloud Manager and ensure that the status mentions Current Target: your Uhuru credentials

6) Click on the Services button –> Right Click and choose Add New Service

7) Now for simplicity, I will choose the same Service Name as defined in the Web.config file. For the Service Type –> Choose MSSQL and click Create

image

8) Now you can see the service being created

image

9) Now we need to verify a couple of things before we go ahead and deploy

image

As shown in the screenshot we need to ensure the following properties of the Web Application is set before deployment

1) Deployable : True

2) Services : mssql#DatabaseTestApp

3) URL : anilapp.uhurucloud.net <your custom URL.uhurucloud.net>

Finally in the Solution Explorer –> Right Click on the project and choose Build

Verify that the build has succeeded.

Now it’s time to push the App to the Uhuru PaaS

Right Click on the Project and choose Build and Push

image

And let the Uhuru Cloud Manager now do the magic Smile

 

image

Now it’s succeeded!! Woot!!!

Now click on the Back button in the Cloud Manager

image

You can see that our Application has been deployed but not started

To start the App –> Right Click under AppName and choose Start selected apps

image

You can now see that the App has started

image

Now let’s click on the URLs section to view our App in your favorite Web Browser

image

Awesome Smile!!!

Now let’s click on the Button to insert Sample Data

image

 

Congratulations!!

We just deployed a database enabled application to the Uhuru PaaS without any fuss!!

Once you are done with the results, you can go ahead and stop the application, by right clicking on the selected app and choose Stop selected apps

[Conclusion]

Please note that this is still in Beta! I have managed to run into a couple of errors but if you follow this blog to the T you should be able to deploy without any issues!

Who is Uhuru PaaS for and not?

Who is Uhuru PaaS For? Uhuru PaaS is Not For!
Application Developers who wish to build and deploy cross-platform applications from Windows and Linux to the Cloud For .NET and SQL Server Only Shops
For Test and Dev Environments where Apps need to be tested and provisioned to Production Servers with minimum configuration and less IT Management  
Can be deployed in Highly Scalable environments with Automatic Failover and VM/Self Healing by just specifying the number of instances that needs to be deployed.  
Suits both Public and Private Cloud initiatives  

 

In the coming weeks I will be continuing my journey with Uhuru PaaS as this is

a great way to deploy Multi-App/DB platform apps to the Cloud with ease.

About these ads