Noob friendly Nodejs Hosting!! Heroku vs Open-Shift

Hosting an application which we developed in a new framework is as much exciting as well as challenge than using the framework. And what better way than giving a noob the easiest way to deploy the app? So, created the app, now it’s time for me to deploy. So I went ahead, typed “Free hosting for Nodejs” and as usual trusted Google gives me a lot, but less useful. Either some links/sites have changed, and rest point me to a couple of providers. Heroku and Openshift!

So my scale to measure the best one is simple, how hard it is for me to deploy my app! Took Heroku as a challenge and man, I must say they put a lot of restrictions for a small app, and deploying is a nightmare(at-least for me!). Digged through documentation, did exactly as they say and bam!!! It looks like there were no gears assigned to the app to scale. So as usual, digged some more and do as they say, bam! Not working. And getting MySQL is not easy as I thought.

After waiting patiently for a day, I dropped the idea and turned to Openshift. Installed rhc, cloned repo, made changes and committed. The moment I push I can see the logs on one hand and deployment process on the other. Errors were clear, Connecting to MySQL was pretty easy and I got my app up and running under 30 minutes. Well, that was quick! That’s what I thought! And what’s more surprising is, PHPMyAdmin installation is just easy too!

So what about them? To be clear, There was no pre-conceived notions about Heroku, but things could have been a lot simpler like how Openshift had! If they claim it is dev friendly, then it should be noob-dev friendly too! Let them add Gears, commit the app and bam! No missing dynos gimmick, and don’t expect developer to pay heed to such things. And for gods sake, don’t make installing Relational DBs a chore. It took me a while to figure out Heroku is not for me!

So I request Heroku to make the setting the instance a bit easier like OShift! This will go a long way!

Advertisements

Noob vs Nodejs ORMs(Caminte/Sequelize/node-orm2)

Well, as they say, once you use DB in your app, you will look for ORM! And it happened to me obviously. So what’s so special or different in this post? Well, nothing really. It’s just my perspective, a Java Dev’s perspective, on the ORM eco-system of Node.js. We, Java Guys, rely too much on ORMs. Be it Spring, Play or any framework for that matter, will come bundled with ORM! But not in Node.js. This was a big blow. When I chose Expressjs, I thought I don’t have to write plain DAO like codes anymore, but how wrong am I?

It’s not that writing plain SQL is harder, but it feels too much painful. Too painful, that I have to open a connection, execute statement, close it! Eew, Seriously? People still do that? Anyways, my search started. So like all, I got sucked up into Sequelize with their shiny new home page and all those jargon’s! It all went smooth. It was so smooth, I felt like I can relax now because at this rate I’ll finish the app much before I thought. But boy, Sequelize said NO!

See the thing is, I don’t want to dig SOF or any forums to know simple thing. It should be in the documentation. And when I try to insert inside another insert and it failed with no error, this is a big RED symbol. I debugged, and cried a lot, but no help. So there I am, sitting and crying at 1 AM! So with heavy heart, I decided to go with Caminte, after looking at another shiny page! Same old, Same old. So I thought why not open a Issue! Well, it wasn’t what I expected. No one replied. Well, with last release couple of months ago, and lot of open issues with no response, I decided to knock it off from list.

The bad thing is, Caminte looked like a serious contender in the ORM race. It had all I need, but not support. So while at work, I glanced upon node-orm2. No shiny page, just simple github template. But still I thought, why not? And to my surprise, it did the trick. With such minimal documentation, it just explained things clearly. No hiccups anywhere and debugging was a lot easier compared to those 2 guys! So what was this all about? Me, bitching about famous Nodejs ORM FW for fun? Nope. There are reasons why I am writing this at 2 am. If it ain’t work, then go for the once which work. And that’s what I did. I tried hard to use them, but either due to my sheer negligence or my noob-ishness might have cause some errors, but logs are supposed to be there to give exact error. It is how we fix them and move on. This got me thinking, how come such big popular ORM’s left out such major part? Or am I missing something? Whatever it is, I did the same with all 3 and node-orm2 performed to my expectation. Which means. this guy gets it!

  1. ORM frameworks ecosystem is matured, but not to the point where we can take them to any project as I do with likes of Hibernate!!
  2. Logging is the key! Don’t overdo the documentation. If logging is perfect to the sense, every single activity is logged, it will be lot easier to debug without any help. Rather than look up SOF for everything I prefer to do it this way.

These 2 points, I feel is rather very important. I mean, whats the use of giving OBD port, when I can’t get error codes to debug? So I suggest them to improve their logging mechanism, which is a boon rather than giving a whole lot of FAQs and tutorials and putting out answers in SOF! This isn’t healthy.

Well, I maybe wrong. Maybe JS Guys like it this way, but I don’t. And if something works for me out of the box,  nothing matters. Not even support. I stayed with JDK 6 until a year ago. Yes, that’s cold, but that’s how it works. So I wish, Caminte and Sequelize step up their game and bring some new features along with proper way to debug.

NOTE : This was my short term observation. Opinions may change, once I get hold of these FWs and this is not intended to berate anyone or any Entity(Pun intended!). This post gives you a brief of how noob friendly these FWs are! And for me, if a noob can do it in a short time, it tends to be a better one(Not applicable to all things!).

Why I chose Node.js for my hobby project?

If you know me, you can easily say I’m Java addict. I prefer to use Java wherever possible. But things change. JS MVC frameworks becomes hipster framework and I’ve already took a deep dive in AngularJS. After worked in AngularJS for past 5 months, I’m completely impressed with what they can do. Leaving all the bad things aside, it is a perfect RAD framework. If not for AngularJS, we wouldn’t have finished our project on time!

So it all started like that! So one day, my long term project, which is supposed to be my personal pet project, was started with Spring MVC + MySQL! It was left as it is because of me, not having enough time to spend it, and I’m incredibly lazy to write all those boilerplate codes! Anyways, fast forward to Feb, I decided to dust it off and start again. Since I’ve been studying/practicing Nodejs for more than a year, I thought I can give it a try. Well, whats wrong gonna happen and there is nothing to lose! So, meh!

It was nothing but simple yeoman like code generator for AngularJS!!(Don’t ask me why I want to do when it’s already there! It’s secret.) So I chose to go with Expressjs for it’s sheer simplicity in setting up and huge community support, better documentation. It was not more than a week and I’m almost at 50%! And I’m not even spending more than a hour a day! It was little tough at beginning, but once dice started rolling, things went smooth! I liked how the Nodejs community matured within such short time and npm is such a bad-ass! I’m not an pro in Nodejs and calling it THE BEST at this point will be over-doing it, but for now, it seems to best bet for all my pet projects, freelancing ones too! So the moment I put Angularjs with Nodejs, things never was this simpler.

But not all is well. Where it sucks is, when it comes to hosting the app.With PHP/Java, I will setup the server and get app running within an hour, but that’s not the case with Nodejs. It is just not noob-friendly. But once you understand the nuances and terminology, it just hits you right in the face.

So you might ask, what is this post about? It is about, things I liked/dis-liked in one the most touted buzz-word framework Node.js. So here for you!

Likes

  1. Ease of use and setup! Server configuration in local, just 2 secs! Yes, that easy.
  2. Huge community support. I mean huge. And Node.js have LTS now, which is a big relief when devs going in for critical applications where support is crucials.
  3. NPM! Enuff said. Nothing can beat this, not even close.
  4. Awesome plugins. Almost anything, you can find. Never have I felt so relaxed in my 7 years of developer life. Before doing something, I just check npm to see if a plugin already exists and so far it is the case!
  5. Simple, modular code structure.
  6. Very very very very less, learning curve.

Dis-likes

  1. Few plugins I want to use, is either not maintained properly or author simply left it there hanging. I can see many such one, with lot of PRs hanging around. I mean, I’m little concerned about using it. What if something breaks after some time, who I’m gonna ask for help?
  2. Infrastructure is big PITA! This thing is harder than setting up J2EE Server! This coming from Java guy. I mean, yes, heroku is great, but not as great as I thought. If a noob cant configure it, then it is indeed not great. It needs proper, setup guide for noob like us.
  3. Callback! Yeah I know it sounds dumb, because I know there was callback, but this is serious. For first few weeks, it’s fine. No, it’s great. But when code base is expanding, things get real ugly. But there are ways but still, I wish Node.js could have come up with some slick one instead of fat one!(Don’t tell me promise!)

So, it’s not bad at all as people claim. If planned and written properly, with some research on whether it suits you, this can be the best RAD framework, be it your pet project or anything.