How to host nodejs application with sockect.io - node.js

I have build an chat application using nodejs with mysql database. I have developed on my windows system and it works fine.
Now I want to make it live on a server to check its real time performance, As a beginner I don't know which server hosting should I choose to develop nodejs application, so someone please suggest me a hosting for nodejs application?

If you want something relatively easy to test on, Heroku will provide you with a free instance.
I can also recommend Azure over Amazon for a simple nodejs based app. The main reason is that Azure has a very simplified interface for deploying node apps after a little bit of minor setup. Amazon offers similar capabilities, but the last time I looked at them they aren't quite as simple to get up and running. Again, they're competitive in cost and reliability, this is just a subjective opinion on what I think will be easier for a dev to get up and running without prior experience.

I use Dokku, an open source solution for a Heroku like PaaS. Either of those are great for doing git style deployments. Heroku has better documentation, and doesn't require your own server so I would start with them.
https://www.heroku.com
http://dokku.viewdocs.io/dokku

Related

How to handle Heroku idle?

I have an issue where heroku apps goes idle every 2mins, which makes the user wait a few minutes to get a payment request. Is there a way to solve this issue? Also what are some good alternatives to heroku? I'm also seeing low scores on Google Page Insights and I'm guessing that's because heroku is idle most of the time. My app is built in nodejs and react
There are many different deployment solutions available; It really depends what kind of functionality is important to you as a developer. There are other Heroku-esque solutions, such as Netlify who over CD as well as Git integration. Any cloud provider will also be able to do a good job of hosting your application at a low cost. I personally, use Amazon Web Services, but Google Cloud, and Microsoft Azure will do an equally good job.
You can deploy your Node/React app to an AWS EC2 instance, as long as you're reasonably proficient at Linux system configuration, and it will be extremely low cost and very fast.

Hosting NodeJS noSQL website

I'm just starting to learn more about the Node.js paradigm and finding it hard to grasp basic concepts. I'm familiar with front-end tools (HTML, CSS, JS) and have been using PHP with Apache server and mySQL db to deploy websites until now.
It seems to be that node is it's own server, and I would then need a SaaS platform like Heroku, or AWS (I'm not even sure if i'm understanding the purpose of these) if someone could explain the difference?
Is the database managed inside this service?
Is the website being hosted there?
In steps how would you get the node app to be served onto your domain name?
For Scalability purposes I understand how having dedicated big infrastructure can help, but if building a low traffic website with small number of members is there even a point in using node?
normal hosting services cost between $4-20 usd. per month and AWS or Heroku seem to start at a MUCH higher price. Is Node only to be used for large scale scaling business model?
Thank you for any answers or good recent external resources (websites or books) you could point me to.
You could easily host a low traffic website built with node.js absolutely for free on Heroku.
To see how easy that is, just go through the Getting Started With Node.js Heroku tutorial, in which you will do just that.
When you build your website with node.js, your own code that your write is the web server. You have no separate web server to configure and interact with (such as Apache). So what you see (or code...) is exactly what you get.
You will probably want to use a framework such as Express to build your web server functionality in your node.js app.
As for NoSQL databases, the way to do this on Heroku is to use an appropriate "add-on" from the Heroku Elements Marketplace. For example, you could easily add Heroku Redis or MongoLab. These are just some of the NoSQL "Database as a Service" options. That means that the Database is itself hosted somewhere in the cloud, and your app simply interacts with it. You don't need to worry about database maintenance, security upgrades etc. You just need to concentrate on your app's interaction with the DB.
Almost all add-ons in the Heroku Elements Marketplace feature a free-tier, that may suffice for your needs, at least initially. So you might be able to get your low-traffic website (including the DB) up and running completely for free, at least initially.
One thing you will need to understand is how Heroku free dyno hours work.
If you need your website to be continuously available 24/7, you may need to verify your Heroku account with a credit card (even though no charges would be incurred as long as you deploy only 1 free web dyno and are on a free-tier plan of your NoSQL DB as a Service). For further details, see this answer.
You also need to consider whether you can tolerate dyno sleeping in your low-traffic app. If not, you would need to prevent your web app from sleeping, which can also be done completely for free. For tips on how to do that see here.
As for serving your Heroku node.js app website from your own domain name, see here. Note that for this too you will need to verify your Heroku account with a credit card, although this too does not incur any charges.
Node.js is supported by many web hosting already, especially for those who use Plesk or cPanel as their web hosting control panel. Here is guide about how to setup a Node.js website via Plesk control, https://www.bisend.com/blog/how-to-set-up-a-node-js-site-in-plesk. As you said, it's very easy to host your website with a cheap shared web hosting.

deploy node.js app to an actual www.mywebsite.com website

Here's a noob question. I made a small app in node.js and to see it I have to go to localhost:4000 in my web browser. How can I publish it in an actual website that everybody can see? I already have a domain name and a hosting service.
Thanks in advance
Your hosting service may not actually support Node. If it doesn't let you install and run your own software then you may be out of luck.
Generally you have few options:
You can host it yourself on your own machine but it will not be as easy and efficient as using a service for hosting, unless you have a high quality symmetric internet connection with low latency and high bandwidth.
You can host it cheaply on a VPS using Digital Ocean, Vultr or AWS in which case you will have to configure Node yourself and install all of the databases and other software that you need.
Or you can use managed platforms like Heroku for Node (and Compose for databse like Mongo that you will probably also need) in which case the price will be higher but everything will be taken care of for you.
It depends on what costs are you willing to take, both in terms of service fees and your time and expertise needed to configure and maintain different layers of the system.
IMO the simplest way to deploy a Node app is with Heroku. You can find the documentation here.
It's free, and basically just requires that you create an app and then push your code to Heroku. It takes care of the rest for you!

Easiest server and database services available for deploying an application (AWS specifically)

I have written a real-time multiplayer game and currently writing its server in NodeJS. I want my game to have login, level up etc, so I need to have a database. This is the first time I am deploying something and I am mostly self taught, so please correct me if I am mixing things up. Since this is my first trial, I do not want to make much commitment right away so I am looking for free options only. And since this should be a real-time game, I need a relatively fast server response. That is why I am looking for the easiest database and server provider that would do and I am aware that with those restrictions I have limited choices and functionality.
As far as I have read online, Heroku seems to be my simplest option for a server (that is why I started writing in NodeJS). However it seems like there is no free database service since all options on https://devcenter.heroku.com/articles/heroku-postgres-plans has monthly fee. I did not want to use Google App Engine since I am new (it certainly is not mentioned as beginner friendly).
So I have found AWS following Free Cloud Database Service for home development post, it seems like I could use Amazon Web Services as a server and database. However most posts I have encountered suggests Google App Engine or Heroku with little mention of AWS. Is this because I am mixing concepts up, or does AWS have drawbacks that I am not aware of? Do you think it is a good idea to use AWS for both as server and database, is it possible to use Heroku as server while using AWS as database or do you have any other suggestion?
Note: Sorry for the question bombardment but those are all related and I am sort of lost in this topic so I had to ask...
Use AWS EC2 for the server and RDS for the database. The reason why people use heroku is that it deploys to a custom url very quickly (it's easy to set up). Setting up AWS requires some knowledge of how servers work, but it's not that complicated (and it's free for small apps). Best of luck!

Recommendations for Cloud Hosting Service for Socket.io

I'm currently evaluating the different cloud service providers to determine which is best for the use of NodeJS backend with Socket.IO implementation that is speedy. While i know that is really dependent on the physical location of their servers, i hope there is one in south-east asia.
I've already deployed on the following:
Amazon EC2
Heroku
Appfog (doesnt seem like it works on it)
Any other good ones to recommend? Would be good if they have a free tier much like how AWS works.
Look forward to your opinions!
Note that at this time Heroku does not support web sockets, so any use of socket.io will have to degrade to a long-polling approach.
With your use of Socket.io in mind, I would recommend using Amazon EC2. The main advantage of many other hosting options in the past has been their easy of deployment and management of all your resources (think Heroku). Amazon has recently launched OpsWorks, which you can use to take care of most of that for you. If you don't have any complex, custom requirements then the basic Node set up should work for you.
Keep in mind that if you are using OpsWorks there are a few small things to keep in mind. Some of them are discussed in this question. Has anyone been successful deploying a node (express) app with Amazon OpsWorks?
#Nick Mitchinson gave an amazing answer. Also you can have a look into the Elastic beanstalk. AWS recently released Paas version of Nodejs.
Websocket is now supported on Heroku by the way.

Resources