node.js app running using forever inaccessible after a while - node.js

I have a node.js server and a java client communicating using socket.io. I use this api https://github.com/Gottox/socket.io-java-client for the java client. I am using forever module
to run my server.
Everything works well but after some time , my server becomes inaccessible and I need to restart it, Also, most of the times i need to update/edit my node.js server file in order to make my server work again (restarted). Its been two weeks already and im still keep restarting my server :(.
Has anyone run into the same problem ? and solution or advice please.
Thanks

Related

Optimizing Node and socket.io on NGINX Proxy

I'm attempting to scale a Node.js application but am a little confused on one piece of it. I moved all my static files to the gateway server running NGINX, and it routes them accordingly. Now looking at the waterfall diagram in Chrome's dev tools, I notice a full second of wait time to access the socket.io javascript file. I'm assuming that is because this is still being accessed from the application server, not the web server. My question is, can I move this file to the web server to have it load faster? It's an npm module so it seems a little fishy to me, like it needs some sort of interaction with the application server to initialize the connection or something. Or am I thinking about this all wrong? Thanks!

Pomelo app kill and remove servers automatically

What are the circumstances to kill pomelo app itself?
The issue I am facing is that, the pomelo kills its own application without throwing any exception. When I try to run command 'pomelo list', it shows no server is running. The app gets close after few hours of running and automatically as well. I have gone through logs generated by pomelo on each server but there were no exception or blockage for the app.
Below are the details that might help you guys:
We are using distributed server structure of pomelo framework
MongoDB on different server
Redis instance on master-server itself
Pomelo version 1.2.1
We are also running same architecture for our different multi-player games but haven't gone through such issues ever. Can anybody explain why it might be happening? If you need any other info then please ask for the same.

All my Node.js apps crash unpredictably at the same time

I've written two simple Node.js apps, each of which run a server on a port (1337 and 1338), and using PM2 (and Keymetrics) to keep them alive, but every few days all three Node.js apps (including PM2) crash simultaneously. I'm fairly new to Node.js and am not sure how to investigate the source of the problem.
DETAILS:
The two servers respond to incoming GET requests. One is to automatically do a GIT fetch/pull in response to a Bitbucket trigger, and the other converts a URL to PDF and sends the PDF back to the browser (using wkhtmltopdf). They both work fine while they're running.
I'm running Node.js v0.12.4.
When the three apps go down, my first indication is from my Uptime (https://github.com/fzaninotto/uptime) instance on OpenShift which emails me to say one of my Node.js servers is down, returning "connect ECONNREFUSED".
A couple of minutes later Keymetrics emails me saying "Agent is offline: Keymetrics Agent seems to be offline".
In other words, ALL my node.js stuff seems to go down at the same time; neither of the two apps nor even PM2 are running. I thought Node spawned a process for each app, so how could they all go down at once?
WHAT I'VE TRIED:
I've tried digging through the ~/.pm2/pm2.log but haven't been able to find anything useful in there. Maybe I just don't know what to look for.
$ pm2 resurrect always brings everything back to life just fine.
Please upgrade to latest PM2 version:
$ npm install pm2 -g
$ pm2 update

Way to connect Clojurescript Repl to running node process

I was wondering if there is a way to connect a cljs repl to a nodejs process that I already have running, that is say in debug mode and stopped at a breakpoint.
So I know there is https://github.com/bodil/cljs-noderepl, and I have this running fine, but it starts up a 'sandboxed environment' as it says in the documentation. I'd like it to connect to a node process of my choosing (e.g. node debug my_project.js).
I can use the normal node debugger, but that's plain old JS, not CLJS.
I also looked into nRepl, but that doesn't seem to be the solution.
Is what I'm asking for possible at the moment, or can I only do this type of repl in a browser environment?
Thanks
I know it's a bit late, but I don't think node has a way to communicate with a running enviroment. nREPL actually is a step there as it will listen in a nodejs app and let clients send it code, but I haven't seen a nREPL server for node.js clojurescript.
The best I've gotten is https://plus.google.com/112151928607622120183/posts/fNr5h8BgLEp

Where can I host a node.js chat bot?

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/

Resources