Deploying Web Application on the Cloud

Search CCF4XAP
Searching Cloud Computing Framework for XAP
Browse CCF4XAP

                                                              

Overview

Prior deploying your web application on the Cloud you should build your application and test it on your local environment. A good example for building such can be found as part of the quick start section.
Once you have your web application running on your local environment you can deploy it on the cloud.

We will use the web application created with the quick start as an example when explaining the steps you need to perform when deploying your web application on the cloud.

See Deploying Your Existing Application on the Cloud Webinar that will walk you through the steps you need to perform to deploy a web application on the Cloud.

Here are the basic steps you should go through:
– Step 1 - Create your Application Cloud Repository - put your application libraries and supporting files on S3 application repository.
– Step 2 - Create your Application Deployment Configuration - This file include the relevant components you would like to be enabled , PUs to deploy, amount of containers and deployment settings.
– Step 3 - Deploy your Application using the Cloud Web Console or the Cloud Tools Command Line Framework.
– Step 4 - Manage your application via the different Management tools provided.
– Step 5 - Once you are done - Shutdown your Application.

Deployment Topology

The Deployment will involve the following:

  • Load-Balancer Machine - Routes http traffic to the GSC Machines
  • GSM Machine - Deploying the Web Application on the GSC Machines
  • GSC Machine - Running Web Application
  • UI Machine - Allows access to the XAP Management Console using an NX Client.

Here is the basic flow of the application:

  1. A browser connects to the Load-Balancer machine and the Load-Balancer process
  2. The Load-Balancer process rout the HTTP request to the Web server running the web application on the GSC machine
  3. The web application generates a page that will be returned back to the Client browser

Step 1 - Create your Application Cloud Repository

The Application Cloud Repository used to store the application libraries.
To specify the Application Cloud Repository location your deployment file should include the <alternate-s3-source-dir> tag with the S3 folder - see example below:

<alternate-s3-source-dir>myapplicationfiles</alternate-s3-source-dir>

Step 2 - Create your Application Deployment Configuration

The deployment process uses an XML-based configuration file that stores the deployment parameters. Here is the Web Application Cloud Configuration file you should create:

<cloud-config>
    <cloud-name>plainwebapp</cloud-name>
    
    <alternate-s3-source-dir>plainwebapp-bucketname</alternate-s3-source-dir> 
    
    <zone>us-east-1a</zone>

    <machines>
        <gsm-machine>
            <name>gsm</name>
            <number-of-machines>1</number-of-machines>
            <gsm-per-machine>1</gsm-per-machine>
            <processing-units>
                <processing-unit>
                    <name>$CPD/PlainWebAppExample.war</name>
                    <deploy-options/>
                </processing-unit>
            </processing-units>
            <web-app-url>PlainWebAppExample</web-app-url>
        </gsm-machine>

		 <gsc-machine>
			<name>gsc</name> 
			<number-of-machines>1</number-of-machines> 
			<gsc-per-machine>1</gsc-per-machine> 
		  </gsc-machine>
		  
		<load-balancer-machine>
			<name>load_balancer</name>
			<number-of-machines>1</number-of-machines>
		</load-balancer-machine>

        <ui-machine>
            <name>ui</name>
            <number-of-machines>1</number-of-machines>
        </ui-machine>

    </machines>

</cloud-config>

For more details on the deploy options - See the gs deploy command.

The above example will deploy on the cloud a jar named PlainWebAppExample.war.
We assume the war file placed on S3 and located at myapplicationfiles.
The deployment process will start 3 type of machines:

  • GSM - will deploy the web application.
  • GSC - Will host the web application.
  • Load-Balancer - Will direct HTTP requests to the web application.

See the Cloud Application Deployment Configuration File for details about the supported options.

Step 3 - Deploy your Application

You can use the Cloud Web Console or the Cloud Tools Command Line Framework.

With this example we will use the Cloud Web Console.
Login into the Cloud Web Console.
To access the Cloud Web Console you should login via the Login page
– Load the cloud deployment file - Click the Browser button , select your application config file and Click Open.
– Click the Deploy button.

This will will start GSM machine, GSC machine and Load-Balancer Machine and deploy the web application on the cloud.

Once the deployment process will be completed you will be able to access the web server running on the cloud.
To access the web server and view the deployed application pages:

  • Click the Running link next to the Load-Balancer link at the machine list.
  • This will display your web application.

Step 4 - Manage your Application

One of the most useful tools to use in order to manage your application when running on the cloud is the GigaSpaces Management Center. The same tools you have been using to manage the application on your local environment can be used when running your application on the cloud. The only difference is that you should run in on the Cloud and not on your local environment. In order to run the GigaSpaces Management Center on the cloud click the Manage button.
This will start an applet that will download into your client a remote desktop application that will allow you to access a machine running on the cloud. This machine will have the GigaSpaces Management Center running allowing you to manage your deployed application.
The java applet may not work with Windows Vista or Windows 7 (due to security settings). You could login to the UI machine using NX Client for Windows using the machine's public ip address and the gsadmin/gsadmin credentials.

Step 5 - Shutdown your Application

Once you are done, or in case you would like to terminate the machines running your application Click the Shutdown button.

More things you can do...

Start Multiple Web Servers

The following configuration will deploy 2 instances of the web application, each into different GSC, each running on different virtual machine. The load-balancer will rout incoming requests into these different web servers based on its load-balancing policy configuration.

<machines>
	<gsm-machine>
	...
	<processing-unit>
		<name>$CPD/PlainWebAppExample.war</name>
		<deploy-options>-cluster total_members=2  -max-instances-per-vm 1 -max-instances-per-machine 1 
		</deploy-options>
	</processing-unit>
</machines>

Scale your Web Application Dynamically

The Scale Web Application Dynamically explains how to configure your web application to scale dynamically.

Labels

 
(None)