Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Packaging, Deploying, and Testing a Cloud Service : Page 3

Learn how to create services that can be run in a cloud environment. Running in the cloud allows you to start quickly, with minimal expenses and lots of flexibility.


advertisement

Packaging, deploying, and testing the service

All we need to do now is to package all of our classes, deploy this service to Amazon, and test to see if the service is working. For this, we'll use the Amazon Elastic Beanstalk. With this product, we can easily deploy and manage an application on Amazon's cloud without having to worry about the underlying platforms and products. The standard platform used by the Elastic Beanstalk is a Tomcat-based software stack. To deploy our application, we need to package it as a WAR file and upload it to the Elastic Beanstalk.

We've specified the following in the pom.xml: <packaging>war</packaging>. If we use Maven to package (execute mvn package) this project, Maven will create a war file for us. If you want to test this WAR locally, you can deploy it to a locally installed Tomcat instance. The behavior should be the same as when you deploy the WAR to the Amazon cloud.



To deploy this WAR, go to the AWS page and login to the AWS Management Console. Open the Elastic Beanstalk tab ,and you'll be greeted with Figure 3.

Cloud Development: Creating Cloud Services
Figure 3. Elastic Beanstalk welcome screen

From this screen, select the Upload your own application option and click the button. This will bring you to the screen shown in Figure 4.

Cloud Development: Creating Cloud Services
Figure 4. Creating a new application for Elastic Beanstalk deployment

In this form, fill in "soagov-cloud-test" as application name and browse to your cloud/target folder in your workspace where the .war file was created. After you've done this once again click "continue". In the next step, we're going to configure the environment in which our service will be running. This is shown in Figure 5.

Cloud Development: Creating Cloud Services
Figure 5. Configuring the environment in which to run our service

Check the Launch a new environment checkbox and fill in the hostname you'd like your service to run on. For the container select 32bit Tomcat 6 and click Continue. On the next screen, make sure the instance type is set to t1.micro and click Continue. Check whether you've filled in everything correctly in the review screen and click Finish. Now you'll have to wait a bit while your application gets uploaded en deployed. After a couple of minutes, you'll get a message stating successful deployment and, after closing that screen, you'll see the screen shown in Figure 6, which shows the applications you've got running in the cloud.

Cloud Development: Creating Cloud Services
Figure 6. Overview of your beanstalk deployed applications

The easiest way to test whether deployment was successful is to click the View running version button. This will bring you to the homepage of your web application which lists the available REST services. This should look something like Figure 7.

Cloud Development: Creating Cloud Services
Figure 7. Welcome screen of our application in the cloud applications

Now that you've got your service running in the Amazon cloud, you of course want to test this. In the "test/resources" folder for this chapter you can find a sample json request you can use to test your cloud enabled service.

Summary

We've looked at running services in the cloud and shown you an example using Amazon Web Services. The most important points are:

  • Base your choice for a cloud provider on your specific requirements.
  • Try to find a single cloud provider that offers the features you need. If that can't be found, try to find a couple that integrate well with each other.
  • Deploying and developing for the cloud isn't that hard. Most practices you're used to when developing services for a normal environment can be applied for services that run in the cloud.

About the Author

Jos Dirksen is a software architect with extensive experience applying open source tools to integration and governance challenges. He is coauthor of Open-Source ESBs in Action.



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap