At JavaOne, we had the pleasure of meeting a lot of really cool and interesting people. Jacob Feldman was one of those people. After learning about Jelastic, he quickly tried it out and then deployed some of his apps on it. The following is his how-to on deploying OpenRules Apps to the Cloud using Jelastic, as well as a review of Jelastic.
Deploying OpenRules Applications in the Cloud
A week ago at JavaOne Conference in San Francisco I had a chance to talk directly with several providers of cloud deployment solutions for Java applications. I was really impressed with a US and Ukrainian startup “Jelastic” that just won the Java Community’s version of an Oscar and was endorsed by Dr. Gosling – read more here. Coming back home to NJ, I decided to try it myself. I took an existing web application that implements a popular game “Nim” using OpenRules decision tables and forms. It looks as follows:
Previously this web application was deployed on my local Tomcat, and I wanted to move it to the Jelastic cloud with minimal effort. And I had almost no problems of doing that! Now you may try to play Nim yourself from the cloud using this URL http://openrules.jelastic.servint.net/Nim/. What have I actually done?
I went to www.jelastic.com and created a free evaluation account using their US-based host ServInt (there are plenty other hosts too). It gave me a web access to a quite intuitive Jelastic’s GUI. It prompted me to create an instance of the Cloud Environment by choosing from many predefined components. I selected two Tomcat containers and JDK 7 and called my environment “openrules”. I always may modify the environment later assuming that Jelastic will take about load balancing and other cloud administration issues (if any).
Previously my web application consisted of two war-files:
- “Nim.war” – my web application
- “openrules.forms.lib” – supporting library for OpenRules web dialogs
Usually I generated these wars from my Eclipse projects and copied them to the folder “webapps” on my local Tomcat. After starting the Tomcat I was ready to run my Nim application from a browser using URL http://localhost:8080/Nim. Now I wanted to do something similar but using a cloud-based Tomcat.
So, from the Jelastic’s GUI I clicked on the button “Upload” and “Browse…” to select and upload my local war-files. I quickly hit their limitation that filenames cannot contain special characters like “dot”. So, I changed a reference to the OpenRules library from “openrules.forms.lib” to “openrulesdialog” in only one Excel table “Environment”, and re-generated a new war file now called “openrulesdialog.war”. Then I uploaded both files “Nim.war” and “openrulesdialog.war”.
To deploy these wars to my “openrules” cloud environment I simply used Jelastic’s “Deploy” button and selected “openrules”. After the deployment, they gave me another button that opened a browser with this URL http://openrules.jelastic.servint.net/Nim/. My application was up and running on cloud with no changes in my application. Wow, this was quite impressive!
I opened another browser with the same URL and played two Nim games at the same time with no interference. I quickly added another existing OpenRules-based game “NumberGuess”. It has an old (and primitive) user interface but it works! You may try it yourself from http://openrules.jelastic.servint.net/NumberGuess/. Both games share “openrulesdialog”.
You may actually look at the rules that implement the game “Nim” by clicking on the link “Implementation Rules”. This link will download the actually used Excel file from the cloud using the URL http://openrules.jelastic.servint.net/Nim/rules/Main.xls. Just for your curiosity, here are two rule tables that represent the Nim logic for a computer. The first table
tells a computer how many objects to take based on the number of remaining objects. The second table
supports an interaction with a user after the objects have been taken. You may open the file Main.xls to also look at the graphical layouts that implement the GUI part of the Nim.
Thus, OpenRules customers have a quite practical approach for development of cloud applications:
- Develop a web application using as you always did with OpenRules Dialog and Forms
- Deploy and test them on your local Tomcat
- Upload and deploy the same wars to the Jelastic’s cloud.
Now you also may easily test the performance of multiple concurrent user sessions communicating with the same web application. You would be able to appreciate the fact that the same instance of OpenRulesEngine supports multiple user sessions without necessity to create a pool of rule engines – very essential for saving resources in the server’s memory and starting time for new sessions.
In conclusion, I want to thank and congratulate our Ukrainian friends from www.jelastic.com. Being born in Kiev myself, I was especially glad to see a successful software product initiated and created in Ukraine contrary to the traditional use of their talents for outsourcing purposes only. The way to go!