Deploying a node application to Nodejitsu

tl;dr – Nodejitsu + custom MongoHQ database are really good to get something out the door.

Running and dealing with your own server is, let’s be honest, a pain in the ass. I don’t want to be dealing with that initially (maybe ever really) when all I’m trying to do is test out an application. With all this in mind, I looked into using a PaaS to deploy my little application I’ve been working on.

Relatively arbitrarily, I ended up going with Nodejitsu (over others listed here because, why not. I needed to pick one and this seemed decent. I also like that it was node specific, unlike Heroku for example. Means that they care only about node applications. And at least off the bat, I’m happy with that decision.

Following this guide, I was up and running in under 10 minutes, most of that time being server setup time on their end. I was able to pick a subdomain, and hit my landing page and see the app deployed on the web. Considering I had never used a PaaS before, I was more than happy with the result. Unfortunately, I hadn’t set up a database yet, so actually registering wasn’t an option.

Nodejitsu provides a database creation service from both their command line interface, as well as a web interface. To start, I created a mongohq db from the web, and copied the uri into my configuration file. I’ll take a second to say that I was also surprised at how the NODE_ENV variable was already set to production. So since I had my config file setup, I didn’t have to do anything special. Also, Nodejitsu has an interface where you’re able to set any environment variables you want from their website.

I tried connecting to their database using the credentials that Nodejitsu gave me, but the server seemed unresponsive. After trying a few different ways to connect, I ditched going through their db management, and went straight to Mongohq itself.

Over there, I was able to create a database and a prod_test user along with a password. I was able to connect to that db right away with those credentials, so I put the new uri into my config file, redeployed, and 20 seconds later, I was interacting with a full database!

So with about 30 minutes of fussing around, I had a fully db backed node application running on the internet. This is way less time and complication than I was expecting considering I had tried to run my own server up until now.

Advertisements

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