These days Platform as a Service (PaaS) is one of my interest areas and I like to play with different PaaS providers to see how easy or difficult it is to develop and deploy application on them. The best thing about most of the current new generation PaaS systems is that they don’t require you to change your code or learn new programming paradigm. Google App Engine is thing of past and is losing ground in PaaS race. For last six months I have spend some of my spare time on OpenShift and Cloud Foundry and one thing I can say is that I love both of the platforms. Today I decided to spend some time on Jelastic — seeing how easy or difficult is to deploy a simple Spring MongoDB application on it. According to Jelastic website
Jelastic is the next generation of Java hosting platforms which can run and scale ANY Java application with no code changes required
Jelastic provides a web ui using which you can create the deployment environment and upload your war file to it.To check the usability of the UI I decided that I will not refer to Jelastic documentation and will try to deploy the application based on my understanding. So in this blog I am sharing the steps I performed to deploy a simple Spring MongoDB application to Jelastic.
- To start I created a very simple simple moviestore application using Spring Roo. For those of you who are not aware of Spring Roo can refer to my article series at IBM Developerworks on Spring Roo.Once you have installed Spring Roo, fire the Roo shell and execute following commands. This will create a Spring MVC web application with MongoDB as backend.
project --topLevelPackage com.shekhar.moviestore --projectName moviestore mongo setup --databaseName moviestore entity mongo --class ~.domain.Movie field string --fieldName title --notNull field string --fieldName description --notNull repository mongo --interface ~.repository.MovieRepository service --interface ~.service.MovieService web mvc setup web mvc all --package ~.web q
- You can test the application locally by first starting the MongoDB server and then starting the application using mvn tomcat:run.
- But the point is to test the application on Jelastic. So go to http://jelastic.com/ and sign up for free. You don’t need to pay anything. I choose North America hosting provider.
- Once you have registered at Jelastic login with your credentials at https://app.jelastic.servint.net/
- After you have logged in to Jelastic portal you will see a Create environment link on the left. In Jelastic you have to first create environment under which your application will run. Click on the environment link and choose MongoDB, Tomcat, Java 6 as the environment topology. This is shown in image below. I really liked the UI. It is sexy.
- When you press create it will take couple of minutes to create the environment. So please be patient.
- You will receive an email from Jelastic with the MongoDB connection details. It will give you a url to access MongoDB from web UI and an admin username and password.In my case I received url http://mongodb-moviestore.jelastic.servint.net/. I am not going to share username and password.
- The MongoDB UI is a RockMongo MongoDB web client. Login into it using admin username and password and Rock 🙂
- Next we need to create a MongoDB database and user with which our application can connect. To create database first click on databases and then “Create new Database”. Enter the name of database as moviestore and press create button. Next click on newly created moviestore database and click more then authentication and then click on add user to create a new user. Create a user with username as moviestore and password as password and press Add user.
- Now that we have created a user we should update the database.properties and applicationContext-mongo.xml files which were created by Spring Roo. By default they were pointing to localhost. Update the files as shown below.
database.properties#Updated at Tue Feb 28 12:26:32 IST 2012 #Tue Feb 28 12:26:32 IST 2012 mongo.host=mongodb-moviestore.jelastic.servint.net mongo.name=moviestore mongo.password=password mongo.port=27017 mongo.username=moviestore
applicationContext-mongo.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:cloud="http://schema.cloudfoundry.org/spring" xmlns:context="http://www.springframework.org/schema/context" xmlns:mongo="http://www.springframework.org/schema/data/mongo" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd http://www.springframework.org/schema/data/mongo http://www.springframework.org/schema/data/mongo/spring-mongo-1.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://schema.cloudfoundry.org/spring http://schema.cloudfoundry.org/spring/cloudfoundry-spring-0.8.xsd"> <mongo:db-factory dbname="${mongo.name}" host="${mongo.host}" id="mongoDbFactory" password="${mongo.password}" port="${mongo.port}" username="${mongo.username}"/> <mongo:repositories base-package="com.shekhar.moviestore"/> <!-- To translate any MongoExceptions thrown in @Repository annotated classes --> <context:annotation-config/> <bean class="org.springframework.data.mongodb.core.MongoTemplate" id="mongoTemplate"> <constructor-arg ref="mongoDbFactory"/> </bean> </beans>
- Build the maven project by executing mvn clean install command.
- Then upload the war by clicking on upload link in the Jelastic web UI.This will take some time depending on your internet connection.
- After the war is uploaded you will see the war in deployment manager tab. Click deploy to moviestore environment to deploy to tomcat and select context as ROOT.
- Finally you will be able to view the application running at http://moviestore.jelastic.servint.net/
This was my first write up on Jelastic and I will continue experimenting with it and evaluating its capabilities. I will also spend time reading its documentation and see how it compare with other PaaS providers. Overall I was impressed with Jelastic and to me it looks like a good deployment option for Java applications.
Hey Shekhar,
How would you say Jelastic compared to Clod Foundry? Easier to use? Any advantages or disadvantages?
Thanks,
Shaun
It is too early to say because I have played with Jelastic for a day but I have some things which I like in Jelastic as compared to Cloud Foundry :
1) If you like Web UI client instead of command line ruby gem then Jelastic is better. It means that you are not required to install anything on your client machine.
2) You can configure your domain name in Jelastic which is yet not available in Cloud Foundry.
3) Jelastic has more choice for application servers or web servers . You can choose from Jetty, Tomcat, GlassFish.
4) Jelastic is a whole sole Java or JVM PaaS Solution.
5) Web UI is very user friendly and you can configure hell lot of things.
After saying all I still think Cloud Foundry is more complete PaaS solution. Reasons :
1) CLoud Foundry will come with UI in future
2) Domain Name support will be soon
3) Its multi language not just JVM language
4) It has much bigger ecosystem or community.
Interesting post Shekhar.
I got a question: is Jelastic service free?
Thanks, Giorgio
It is free to start off. There are some limitation on number of environment you can create. But the free one is good enough to play and test the jelastic service
Thank you, very interesting post :)))
Hey Shekhar,
Thanks for the great read. I wanted to answer your points that you brought up at the end about Jelastic vs CloudFoundry:
1) CloudFoundry will come with UI in future
Some of our users have asked for command line and we will be releasing that soon. A UI is more difficult to build than CLI but we know that some people prefer it. So, we are doing that as well.
2) Domain Name support will be soon
We already offer custom domain name support. You can see our quick how-to video here: http://www.youtube.com/watch?v=pHETX5zd7Ug
3) Its multi language not just JVM language
We started off with Java because it is the most popular language by far, but we aren’t stopping there. 🙂 PHP is next. We started with Java though, because unlike some of the other languages, there was no good solution to deploying Java apps to the Cloud easily. We are making it easy to deploy Java apps. After we hit this homerun, we will go to PHP. 🙂
4) It has much bigger ecosystem or community.
As of now, yes. CloudFoundry has been around longer and therefore has a bigger community and ecosystem, but look for that to change soon. We are growing at an incredible rate and our ecosystem and partner community is growing fast as well. It won’t be long before we are offered locally in a ton of new countries and markets. So, keep an eye out for that.
—
Finally, thanks for the review. If it wasn’t for people like you that are on the cutting edge, trying out new stuff and staying on top of what’s new in the space, Jelastic wouldn’t be growing. I would love to chat with you a little more and get your comments and suggestions on Jelastic. Hit me up at Judah(at)Jelastic.com or on Facebook (judahjohns).
Cheers!
certainly like your web-site but you need to check the spelling on quite a few of your posts. A number of them are rife with spelling issues and I find it very bothersome to inform the reality however I’ll definitely come back again.|
It’s awesome to visit this web site and reading the views of all colleagues on the topic of this post, while I am also eager of getting familiarity.
Really interesting article but time goes by and there’re also reviews about the advantages of Jelastic provider. I found out the article which can help to learn more about Jelasic benefits http://polontech.com/blog/benefits-pricing-jelastic-on-amazon/