Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NodeJS Managed Hostings vs VPS [closed]

Tags:

There are a bunch of managed cloud based hosting services for nodejs out there which seem relatively new and some still in Beta.

Yet another path to host a nodejs app is setting up a stack on a VPS like Linode.

I'm wondering what's the basic difference here between these two kinds of deployment. Which factors should one consider in choosing one over another?

Which one is more suitable for production considering how young these services are.

To be clear I'm not asking on choosing a provider but to decide whether to host on a managed nodejs specific hosting or on an old fashioned self setup VPS.

like image 237
Yousef Salimpour Avatar asked Sep 29 '12 12:09

Yousef Salimpour


People also ask

Can NodeJS run on shared hosting?

Node. js is an open-source, cross-platform, back-end JavaScript runtime environment that runs on the V8 engine and executes JavaScript code outside a web browser. Node. js is not supported on Shared and Cloud hosting packages.


2 Answers

Using one of the services is for the most part hands off - you write your code and let them worry about managing the box, keep your process up, creating the publishing channel, patching the OS, etc...

In contrast having your own VM gives you more control but with more up front and ongoing time investment.

Another consideration is some hosters and cloud providers offer proprietary or distinct variations on technologies. They have reasons for them and they offer value but it does mean that if you want to switch cloud providers, it might mean you have to rewrite code, deployment scripts etc... On the other hand using VMs with standard OS as the baseline is pretty generic. If you automate/script/document the configuration of your VMs and your code stays generic, then your options stay open. If you do take a dependency on a proprietary cloud technology then it would be good to abstract it away behind an interface so it's a decoupled component and not sprinkled throughout your code.

I've done both. I did the VM path recently mostly because I wanted the learning experience. I had to:

  • get the VM from the cloud provider
  • I had to update and patch the OS
  • I had to install and configure git as a publishing channel
  • I had to write some scripts and use things like forever to keep it running
  • I had to configure the reverse http-proxy to get it to run multiple sites.
  • I had to configure DNS with the cloud provider, open ports for git etc...

The list goes on. In the end, it cost me more up front time not coding but I learned about a lot more things. If those are important to you, then give it a shot. If you want to focus on writing your code, then a node hosting provider may be for you.

At the end of it, I had also had more options - I wanted to add a second site. I added an entry to my reverse proxy, append my script to start up another app with forever, voila, another site. More control. After that, I wanted to try out MongoDB - simple - installed it.

Cost wise they're about the same but if you start hosting multiple sites with many other packages like databases etc..., then the VM can start getting cheaper.

Nodejitsu open sourced their tools which also makes it easier if you do your own.

If you do it yourself, here's some links that may help you:

Keeping the server up:

https://github.com/nodejitsu/forever/

http://blog.nodejitsu.com/keep-a-nodejs-server-up-with-forever

https://github.com/bryanmacfarlane/svchost

Upstart and Monit generic auto start and restart through monitoring

http://howtonode.org/deploying-node-upstart-monit

Cluster Node Runs one process per core

http://nodejs.org/docs/latest/api/cluster.html

Reverse Proxy

https://github.com/nodejitsu/node-http-proxy

https://github.com/nodejitsu/node-http-proxy/issues/232

http://blog.nodejitsu.com/http-proxy-middlewares

https://github.com/nodejitsu/node-http-proxy/issues/168#issuecomment-3289492

http://blog.argteam.com/coding/hardening-node-js-for-production-part-2-using-nginx-to-avoid-node-js-load/

Script the install

https://github.com/bryanmacfarlane/svcinstall

Exit Shell Script Based on Process Exit Code

Publish Site

Using git to publish to a website

like image 105
bryanmac Avatar answered Sep 27 '22 16:09

bryanmac


IMHO the biggest drawback of setting up your own stack is that you need to manage things like making Node.js run forever, start it as a daemon, bring it behind a reverse-proxy such as Nginx, and so on ... the great thing about Node.js - making firing up a web server a one-liner - is one of its biggest drawbacks when it comes to production-ready systems.

Plus, you've got all the issues of managing and updating and securing your server yourself.

This is so much easier with the hosters: Usually it's a git push and that's it. Scaling? Easy. Replication? Easy. ...? Easy. All within a few clicks.

The drawback with the hosters is that you can not adjust the environment. Okay, you can probably choose which version of Node.js and / or npm to run, but that's it. You have no control over what 3rd party software is installed. You've got no control over the OS. You've got no control over where the servers are located. And so on ...

Of course, some hosters allow you access to some of these things, but there is rarely a hoster that supports all.

So, basically the question regarding Node.js is the same as with each other technology: It's a pro vs con of individualism, pricing, scalabilty, reliability, knowledge, ...

I personally chose to go with a hoster: The time and effort I save easily outperform the disadvantages. Mind you: For me, personally.

This question needs to be answered individually.

like image 35
Golo Roden Avatar answered Sep 27 '22 17:09

Golo Roden