NoSQL Zone is brought to you in partnership with:

Nathan has posted 1 posts at DZone. You can read more from them at their website. View Full User Profile

Java and MongoDB in PaaS

  • submit to reddit

  Short prequisites. I'm working in my spare time on personal project, for current easiness and future scalability I chose MongoDB for data, programming language is Java, it's my mother tongue :) Eclipse IDE and Tomcat as web server because of it's popularity and ease of use. To work with MongoDB from Java I chose Morphia. This choice of tools reduced my options to Heroku, AWS, CloudBees, CloudFoundry, Jelastic, OpenShift, DotCloud.

  Google app engine is nice, but it's binds you to their big data and if we are going for PaaS which should mean freedom, this is not an option.

  As I said, I work on this project in my spare time which is scarce and precious. My main requirements were, that deployment should be fast and easy, and service should be free for small development environment.

  From the start I used GitHub as my repository and thought that Heroku would be my natural choice, but my project is built from number of modules and web application is only one of those modules. Now, that I created second web app it's a necessity. While trying to deploy my app to Heroku and similar services where deployment is done by using git, I failed to do so without changing my project structure, also I haven't found any help for this issue, so I moved over.

  Removing git oriented PaaS'es left me with AWS, CloudFoundry, CloudBees and Jelastic.

  AWS is nice, but you have to do a lot of configuration and it's free only for one year for micro instances.

  Jelastic is very nice and simple, but they have free program only for a week.

  CloudFoundry was good, until I found that their version of MongoDB doesn't work with Morphia. Also plugin for Eclipse is still raw and buggy.

  Here I came to CloudBees. I came to it last, because they ask for credit card details to use extended services like MongoDB. Easiness of use and plugin for Eclipse to deploy projects from IDE made it my choice of development environment. In addition to running environment CloudBees also gives git and svn code repositories, but I haven't used it yet. Tip: to see application logs on site you have to route your logs to standard output. Onsite logs representation may be confusing for a large applications with a lot of logging, but there is useful service Papertail that helps to manage logs for those cases.

  All in all I think that PaaS is a great leap in reducing headache for developers who want to concentrate on development and not to lose time on environment maintenance.

Published at DZone with permission of its author, Nathan Gurfinkel.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)


Basanta Thapa replied on Wed, 2013/02/27 - 11:13pm

I think you left OpenShift without any analysis. We can deploy using GIT over there in my humble opinion. Can you please provide the details why you left OpenShift as I am thinking to move on to it as my first free deployment.

Your input might help me in my selection among various PaaS  services.

Nathan Gurfinkel replied on Thu, 2013/02/28 - 4:06am in response to: Basanta Thapa

As I said, I failed to deploy complex project by GIT. You have to deploy only web app, so it will be built and deployed. My project constructed from 10 modules, each one is a separate module on same hierarchical level as web app. For my project to be deployed I had to change hierarchical structure of maven modules, which  I think is not right, I don't want to change my project structure to make it deployable on PaaS. Another option that I found is to add external dependencies to maven and to put modules jars in resources folder. That solution complicates compilation process and need to upload jars extends deployment time.

Basanta Thapa replied on Mon, 2013/03/04 - 10:37pm in response to: Nathan Gurfinkel

Thank you Nathan, for your reply and a very well suggested scenario. I was wondering which on to select for the hosting. In fact, I have a scenario that my application is developed on EJB, JPA, MySQL, JSP/Servlet, HTML5, CSS3 and I want a good service for hosting these. It's a moderate application not a very heavyweight but probably will scale. Hence your input on this would be so much valuable for me. 

Thank you once again.

Nathan Gurfinkel replied on Tue, 2013/03/05 - 10:19am in response to: Basanta Thapa

I haven't got to the scaling stage so I have nothing to say about it. For now I'm happy with CloudBees. If your app is not enterprise, I would advise against EJB, I use for messaging services Apache Camel which is based on ActiveMQ, also if you choose Glassfish as your server, it has built in ActiveMQ. If you expect heavy traffic I would like your feedback on how CloudBees cope with load.

Aleksey Sundukovskiy replied on Wed, 2013/03/06 - 2:23pm

Nathan,  I also tried Jelastic, CloudFoundry and OpenShift. OpenShift just didn't work and the worst thing is, it couldn't deploy a war that contained a Drools lib which is created by the same umbrella organization.

CloudFoundry works for me but I was also interested in CloudBees. Just a couple of questions. Does CloudBees actually charge for Mongo? 

Also what do you mean by "onsite logs"? Is papertail just another jar to use instead of log4j and alternatives? 

Nathan Gurfinkel replied on Thu, 2013/03/07 - 4:47am in response to: Aleksey Sundukovskiy

OpenShift I didn't even try beyond deployment because it's GIT deployment, in any case deployment process in OpenShift and Heroku created for me same problems.

In CloudBees I have two MongoDB developments instances. Development MongoDB instance is free and limited to 16Mb, but because I still haven't got to this size I wasn't charged and I don't know what will happen when I reach this limit, probably they will charge me for small instance.

By onsite logs I meant that you can't define different logs by log4j properties and view them as files like in Jelastic. All logs streamed to std out. Papertail is service that helps you to manage logs, search throught them online and download as files. It's free for basic use which is suffice for me now.

Aleksey Sundukovskiy replied on Thu, 2013/03/07 - 1:31pm in response to: Nathan Gurfinkel

Thanks Nathan, pretty clear on Mongo. 

I think you mean Papertrail ? I looked at their site. But it just brought out more questions

Since it is a service I wonder how you are able to hook into CloodBees logs?

 If cloudbees gives you some admin rights on your instance can't you tail the log?

I guess if I understood correctly, you can't create multiple logs on cloudbees but then if you're limited at the source how does papertrail help ?

This is a concern for me because on the CloudFoundry, there are no time-stamps on the log. It's already grown huge and I have no idea how to delete it. You can't tail it or do any type of unix admin to it, so it's pretty much useless. 

Nathan Gurfinkel replied on Sun, 2013/03/10 - 12:02pm in response to: Aleksey Sundukovskiy

When you go to page of your instance, you can open app log, but it's doesn't tail. In addition on app page you can switch on Papertail service, it will work after instance restart and you can tail log in Papertail in separate tab. In addition Papertail has search on logs, so if you configure log4j to add tags to different packages, classes whatever, you can filter log by tag word pretty like files view. Admin rights is problematic. All idea of PaaS is to hide all technothingy from you, this way you gain less headache because there is no need to configure environment, but also you have less or no access to environment guts.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.