Running Railo in CloudBees

Posted by Mark Drew on code on March 30, 2011

Tagged under railo,getrailo,cloudbees

A while ago I was playing with the deployment system, since then they have been bought by CloudBees, a Platform as a Service for Java Web Apps and I wanted to see how easy it was to run Railo on it.

One of the advantages of running Railo in CloudBees (apart from scaling and versioning) is the ability to deploy incremental changes, rather than having to deploy the whole WAR as you have to do with AWS's BeanStalk. In this post I shall go through how to get a sample application running.

Before we get started we need to do the following:

Once you have setup the CloudBees SDK as they have mentioned, you need to setup your API and Secret Keys, to do this you can go get your keys from your account page, and add them to the file that should have been created (if you are using OSX or a Linux OS ) in:


Now that we have all that installed, let's go create a simple app through the CloudBees web interface, I have named my application "railo" (surprise, surprise!).
Once it has been created, click on the configure button so that you can get the ID of the application, in my case it is "markdrew/railo".

Now we have that application, we can go and download it, go to the folder you want to download the application to in the command line/terminal and type the following:

> mkdir markdrew_railo > cd markdrew_railo > bees getapp -a markdrew/railo

That was easy, if you setup your API and Secret keys you should get some XML and some other commands appearing and it should all be downloaded. Let's run it before adding Railo to the mix:

> bees run

After a few seconds you can head to http://localhost:8080/ and get something that looks like the following:

Now to add Railo to our application. You can stop the application by pressing Ctrl + C, and then rename the railo- to and uncompress it:

> mv railo- > unzip -d railo

Now that we have unzipped the WAR file into the railo directory we can copy the contents from the railo/ directory to the markdrew_railo/webapp directory.

> cp -r railo/ markdrew_railo/webapp/

To test this, we can run the "bees run" command again and after a while you can test your application at http://localhost:8080/, you should get the Railo start page! Awesome!
Stop the application using Ctrl + C and let's clean out some files that are left over that we don't need:

> rm -r webapp/WEB-INF/classes/ > rm webapp/index.jsp

Now that we have cleaned it up and tested it , let's go ahead and deploy it. This is as simple as typing:

> bees deploy

The upload will take a while since it will upload something like 55Mb as our initial upload. Once this is done you should be able to check out your application live at the url defined in your configuration, mine is:

Let's change the default homepage, so that we can see how much it has to upload next time. Change the contents of index.cfm to just display the current time:

<!DOCTYPE html> Changed! #Now()#

This time when we run the "bees deploy" command you should see that it has very quickly uploaded the changes and they should be live, without having to re-deploy the whole thing! Awesome! This is a massive advantage over AWS Beanstalk, that where small changes would require of a total re-deploy of your application.

comments powered by Disqus