I know this isnt coding but i dont know where else to look.
So I've written a chat bot using node.js and the socket.io-client module. Basically it's just a program that auto responds to messages on a chat room also written with node.js. The problem I have is hosting it. I have hosted it on my raspberry pi which works perfectly but isn't ideal as I sometimes want my pi for other things and this bot runs 24/7.
So, I looked around for some free node.js hosting. I found c9.io, heroku and appfog but all of them expect you to host websites with node.js and so aren't setup for my needs. I need a single instance to be always running but these hosts constantly restart and terminate the program causing all sorts of problems for me which wouldn't really be an issue if it was just outputting a web page.
So, is there anywhere that is suitable for hosting a node.js app like mine?
Have Amazon host it for you. That's what I'm doing with one of my projects. Just create an instance, I used Ubuntu for my OS, then installed Node.js and was good to go.
My recommendation will be to host it on openshift
https://www.openshift.com/app/account/new
Heroku is also widely used but in their free tier your bot has to "sleep" 6 hours
https://www.heroku.com/
Related
So a bit of context - I'm trying to give my create-react-app project a backend using express.
I'm following a tutorial that talks about having two servers working concurrently. This leaves me a bit confused - what's the difference between a web and a dev server, and how you can have two servers working simultaneously?
I think the underlying issue here is that I only have a shallow understanding of what a server actually is: I only understand it as being a process that listens to requests and sends responses.
Cheers
The tutorial most likely refers to the following definitions:
development server
available at localhost
runs on your local machine, i.e. your PC
intended for local development and testing
web server
available at an IP adress or domain
runs on a remote server like a cloud server such as Google Cloud / Heroku / Digital Ocean
intended for production for your real users
From what I understand of your question, this tutorial seems to be talking about 2 separate environments, a production environment (i.e. where the 'real' code that clients/users will use runs), and a development environment (i.e. where code that is currently under testing and not ready for the 'real world' runs).
The reason you want (at least) 2 of them is so you can deploy your code to the dev environment and then test it out, see if it works, how it works, and if it breaks anything, without risking the real server going out, or maybe accidentally wiping your real customer database or something like that. When you deploy to your dev environment and see that everything work as it should and nothing is broken, then you can put that version of the code to run in your real, production environment, and be pretty sure your backend is not gonna go out while you are developing
I may be misunderstanding what the article is saying, but from your description I think that is it
Hope that helps you!
I use the example for the chat server in ReactPHP. My server listens on port 8080
$socket = new React\Socket\Server(8080, $loop);
$server->listen($socket);
in my local PC. The written code is working correctly but when upload files into my Linux host, nothing works. I wrote a ticket to the support team from my hoster, they said that this is not possible in Linux. Is that correct?
ReactPHP core team member here. Your run-of-the-mill shared hosting won't be able to host this. You need your own server, VPS, or bare metal, to run ReactPHP as a server because you're dealing with a daemon process. And shared hosting generally doesn't support that.
My suggestion is to get a VPS somewhere and look into Supervisor to keep your process running and restart it when something happens to it. This also requires you to manage your own server with all the firewalling and networking knowledge that comes with it.
I've developed a wallpaper app whose backend is written in node.js . Everything in development was fine then today I bought a vps server with cpanel for 3 months from a hosting service provider .But I'm a complete beginner in server management so now how to run this node.js script in my ftp server . Can anyone please guide me to run node.js script on server ?
It may sound like off-topic but please do help me to fix my problem.
I'm a complete beginner so please do excuse me if my question is foolish.
I think there's no support for using Node.js with cPanel. But I can recommend you to use for example Heroku for testing or hobby development. Heroku is free, very simple and cool for small projects.
If it's just a simple, single node.js script, I'd recommend running this as a lambda function – basically, use a service that will run this script at a given HTTP endpoint without needing to manage a server. This can be free depending on how much it's used. For example, here are some places to run it:
https://blog.cloudflare.com/cloudflare-workers-unleashed/
https://www.netlify.com/docs/functions/
https://aws.amazon.com/lambda/
As CenyGG suggested, Heroku is also a great place to do this and will be free if you don't need the app to be live 24/7 (it will go to sleep and take a few seconds to "wake up" if it hasn't been used in a while).
I'm currently working on a Node.JS application which needs to be highly scalable for use in a particularly popular website.
Currently, the Node.JS and Socket.IO server is running as one application meaning to deploy a new release I just restart the server.
I've had suggestions to make the Socket.IO server separate to the Node.JS app running the site but feel as though this could make keeping the Javascript from the web server and Socket.IO server in sync tricky.
What should I do?
I've tried some methods online using ssh but can't figure it out. why is it so difficult to install when it's basically just Javascript?
A regular Dreamhost account will not allow a long running process which a node server is. You will need a VPS account.
Also, the node application and V8 engine inside it is not just javascript. It's an actual native application. Your scripts are "just javascript", but the infrastructure that makes the node server run is native code.
In 2015, Dreamhost started to support the deployment of nodejs (as well as ruby, python) applications through the Passenger domain option. For more information on Passenger, check Node.js with Passenger tutorial.
Unfortunately, this is available only on VPS running Unbuntu.
Note that on the Dreamhost wiki, under Nodejs, they write
DreamHost does not support node.js on shared web servers, as the security setup on DreamHost shared servers is incompatible with compiling or running node.js. If you try to compile node.js on one of the shared web servers, your user will automatically be banned through grsec (taking down all the php websites that run under that user) and the server will have to be rebooted before your user can be unbanned. If you do it one more time, you will be forced to move to a VPS.