Hosting NodeJS + MongoDB for Free

September 2017 update: This entry is no longer valid. Redhat changed the free plan and it is no longer useful (at least for what I need). It was good for as long as it lasted and now it is time to switch (back) to Heroku.

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:


Do-It-Yourself Hosting Static Website at Google Cloud

For a while I hosted my small static website using Dropbox (see here). But recently i started to see performance issues and finally also connection reset errors (see here for more details).

I decided to take action and experiment with the Google Cloud platform. Once i passed the mental issue of creating an account there and providing a method of payment, i found the following tutorial:

How to Host a Static Website

The instructions were fairly easy to follow and in a matter of minutes the new website was up and running.

So far from performance and stability it is nothing like what i had before. In other words, it is dam fast and i have seen no error so far.

For now I’m on their trial, but assuming i understand everything correctly and since the size of the website is small and the amount of traffic is also small, this should be a freebie for ever. Time will tell and i will share.