Sunday, 30 May 2010

Cloud Hopping

Like this rock crevice that illuminates this cave at the "Murder Hole" near Melmore, Co. Donegal, windows of opportunity come in many shapes and sizes.
Currently there are many opportunities in the abundance of Cloud computing options.
The hard part is taking such fantastic resources and harnessing these to your particular needs. The Cloud provides many options for fledgling projects and businesses to quickly get up and running, but what if your business is not necessarily going to live in the Cloud?

We face one such problem as we develop our Order Management System.  It's an office system for a small company with no particular pretensions to live on-line.  So where's the Cloud angle on this?  For us the immediate need is to get our application in front of our customers as soon as possible so we can start the customer feedback cycle.  However, to go straight to the end system with an on site server to host our application is going to take time and money.

That's where the Cloud provides the window of opportunity, given that our application is built using the mighty Grails framework we can easily deploy our application with Grails on Cloud Foundry.  With a minimum of effort we where up and running with a test system that our users could validate new feature and give valuable feedback.  With short one week sprints and no fuss deployment we can now iterate quickly and keep the customer engaged in the project.

On the practical side of things we have found no need to have a permanent web presence for our test application, we simply deploy a new instance when we need our customer to test, send them the new URL and then stop the instance when they are done.  This keeps the hosting costs to a bare minimum, data is persisted in the Amazon EBS and available to the next deployed instance.

In conclusion, the Cloud is going to influence software development in many ways.  Whether you are the next big internet start up, or merely cloud hopping your way to delivering small office systems the opportunity to utilize the Cloud is an opportunity not to be missed.

Monday, 24 May 2010

Grails on Cloud Foundry

Some brief notes on Getting Started with Grails and Cloud Foundry.  I found the Cloud Foundry getting started page to be excellent, but there are a few details beyond the getting started guide that you need to deploy a real application.

Sign up with Cloud Foundry

Sign up with Cloud Foundry - https://www.cloudfoundry.com/cfapp/reg.html?_flowId=register-flow

I found it takes about 48 hours for your sign up to be approved.


follow the instructions on getting started with Cloud Foundry.  Remember to save your RSA Private Key you'll need it for SSH access.

http://www.cloudfoundry.com/getting_started.html

Creating WAR
Before creating the war ensure the DataSource.groovy is set up correctly, to make sure you don't reset the database every time you redeploy  set 

dbCreate = "update"

Now create the war:

grails prod clean
grails war

Deploying WAR
I toyed with the SpringSource Tools Suite, great for Grails development but for Grails deployment to Cloud Foundry it is not quite there yet.  I expect this to improve in the near future.  For now I find it easier to use the Grails Cloud Foundry plugin to upload:


grails cloud-foundry-upload


Then login to the Cloud Foundry web app: https://www.cloudfoundry.com/


on the applications tab select deploy for my application

You need to enter a name or the deployment - aoms

Select the database storage type as EBS New Volume and accept the default volume name, set backup interval appropriately

select Launch button

Subsequently when you redeploy the application you will select either:
- a Snapshot as the storage type and select the appropriate snapshot to restore from (this will result in a new EBS volume being created)
- an Existing Volume as the storage type and select the appropriate volume

You need to manage your EBS volumes and snapshots from the AWS Management Console - https://console.aws.amazon.com/ec2/home

Setting up SSH
For SSH access to my EC2 instance I use putty, the following guide is a great help:

http://docs.amazonwebservices.com/AWSEC2/2007-08-29/GettingStartedGuide/putty.html

You'll need the RSA Private Key you generated when setting up Cloud Foundry