Hosting NodeJS + MongoDB for Free

For a while I have been using Google Cloud to host a not-for-profit, not-mission-critical, small-scale MEAN application (MEAN as in Mongodb, Expressjs, Angularjs and Nodejs). Google Cloud Compute infrastructure was my first choice as I had some budget there for free and Google Cloud in general is nice. There are plenty of tutorials and lot’s of discussions with really good Q&As. It is also not too complex to setup the environment, get a small Linux instance and deploy there everything I needed on a single instance.

However, for this particular project it was not perfect and it did include few challenges:

The first thing was that I had to install and maintain the environment myself. Not huge effort but I was thinking about the on-going maintenance, security patches, software updates and all the rest.

The second one is that while it is a not-mission-critical project I still wanted to make sure it is up and running all time without my constant monitoring. There are probably some additional tools I could have used in the Google Compute ecosystem but I was not familiar with those tools. Overall, there were not a lot of interruptions but there was one time where the system went down and I discovered that only after few days.

The third challenge is that this is not-for-profit project so I wanted to reduce costs to zero or at least close to that. At the beginning I had some free budget from Google but after a while I started to pay for the small instance and while not expensive at all, it was still around $15 per month.

I was looking for some Platform-as-a-Service options that will have the NodeJS and MongoDB combination more out-of-the-box, that will take care of all the operations, and will be very cheap.

My first choice there was again to use Google Cloud, but instead of using the Compute side, use their platform support for NodeJS (Get up and running with Node.js on Google Cloud Platform). The challenge there is that as far as I can tell they do not support MongoDB as part of the platform and for that component I will have to use the Compute option again.

Surprisingly, when search for more options I could not find too many free or close to free options. Heroku from Salesforce was one option but  I ended up choosing OpenShift from redhat, mainly because I was just a little bit familiar with that platform.

It took few tutorials to get some of their concepts of cartridges, use of git and the client tool. But once I tried it with a test application everything just made sense. Next I started to migrate my application and the changes to my existing NodeJS were trivial. The main (if not only) changes was to get connection string and ip/port information from the environment variables. Really very smooth effort.

Getting the MongoDB moved was just a little bit more complex and required additional cartridge called RockMongo to upload a dump of the DB.

I also have my own domain name and the setup of the domain routing was not not tough as well.

Overall, as of now the OpenShift platform looks just like what I was looking for, it is easy to setup, easy to maintain, it is free (for up to 3 apps) and so far the performance/stability looks good.

2016-01 OpenShift NodeJS MongoDB

The tutorials/resources used in this effort:

Advertisements

Author: dave

Consider myself kid in soul and naive by choice. I am interested in people, technology and business and thrive when they all work together. My favorite quote and motto is that “You can fool some people some times but you cant fool all the people all the time” ― Bob Marley

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s