Jot Server won't work when the SSH console is closed
Once again my Jot Server stopped working because the AutoSSL got renewed automatically (It renews every 3 months). I have managed to fix it by entering the new .crt and .key files and restarting the Jot Server as described in this post:
https://una.io/page/cmts-view?sys=bx_forum&id=8651&cmt_id=39478
I have run:
forever stop app.js
and
forever -w --watchDirectory=/home/xxxxx/ssl/certs/ start app.js
Everything went smoothly and the messenger was back working.
Now I am having a very weird issue: My messenger only works when I have my SSH Console (Putty) opened. When I closed the SSH Console, the forever process also stops automatically. As a result, my messenger won't connect to the Jot Server. Very strange! Closing SSH connection kills all the forever processes.
I have to go back, connect to the server through SSH, run the command live above again to get the messenger back and live. Then when i disconnect from SSH (Close Putty), the problem starts back again.
I didn't change anything on my UNA installation. The only thing that changed on my server was the AutoSSL that got renewed with new .crt and .key files. I have been using AutoSSL with Jot Server for a long time now and i have never had this problem.
Any idea on what is causing this issue and how to fix it?
I came across these two posts, Hope they will give us some clues:
https://stackoverflow.com/questions/5818202/how-to-run-node-js-app-forever-when-console-is-closed
and
Thanks
-
- · OneEagle
- ·
@Alexey @LeonidS Please any help? I am stuck with this problem.
-
-
·
Alexey
-
·
In reply to OneEagle
- ·
Hello!
It may happen when Jot Server is run as not background app and when you close the session, app is also closed. So, when you use forever it should work as background app.
Contact me please vi PM, I will check your server.
-
·
Alexey
-
Did you update the config file for jot-server to reflect the updated .CRT and .KEY files? When my SSL autorenewed last week, I realised that the .CER and .KEY filenames were different.
-
- · OneEagle
- ·
Hi, Yes I did. Everything works fine when I am connected to my server using SSH. When I close the SSH console, the Messenger also stops working. It disconnects.
-
- · OneEagle
-
·
In reply to Alexey
- ·
Thanks for our reply @Alexey I have contaced you via PM and sent my server and UNA credentials. Thanks
-
- · OneEagle
- ·
Update: This issue occurs when you restart the Jot server using the cpanel user account. When you close the SSH console (e.g. Puty), Jot server stops working.
Solution: Retart the Jot server using the server root access (root account). That fixes the problem.
-
-
·
Alexey
-
·
In reply to OneEagle
- ·
Hello!
Usually, it happens when Jot Server is run as not background process/daemon like "node app.js"
-
·
Alexey
-
- · OneEagle
-
·
In reply to Alexey
- ·
Hi @Alexey
Oh Ok. Thanks. So, how to run it as a background process/daemon?
-
-
·
Alexey
-
·
In reply to OneEagle
- ·
@OneEagle You can use forever module for node js or to add custom system service to run the app.js.
Here is the description https://github.com/unaio/jot-server how to run Jot Server using forever plugin.
-
·
Alexey
-
- · OneEagle
-
·
In reply to Alexey
- ·
@Alexey I did everything described in the link you mentioned above. I do believe that Jot Server was installed correctly.
When I check the forever process using this command line:
forever list
I get this result:
(node:26054) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:26054) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
info: Forever processes running
data: uid command script forever pid id logfile uptime
data: [0] StUH /usr/bin/node app.js 26386 26397 /root/.forever/StUH.log 1:20:48:5.690999999991618
Is there any other way to check whether Jot Server is run as background process/daemon like "node app.js" or not?
Thanks
-
-
·
Alexey
-
·
In reply to OneEagle
- ·
Hello!
Yes, you can check if the node is active, you should run this command:
ps ax | grep node
It shows the all processes with node js. You need to find line with path_to_jot_server/app.js . If it exists, then it is running.
Also may be you forgot to install the all dependencies using command:
npm install
You may provide me with server details via PM, I can check.
-
·
Alexey
-
- · OneEagle
-
·
In reply to Alexey
- ·
I have checked, indeed the node is active.
I run the command:
ps ax | grep node
and it gave me this result:
21007 pts/0 S+ 0:00 grep --color=auto node
26386 ? Ssl 0:00 /usr/bin/node /usr/lib/node_modules/forever/bin/monitor app.js
26397 ? Sl 0:12 /usr/bin/node /home/xxxxxx/xxxxxx/app.js
Also I installed all dependecies using the command line: npm install when installing Jot server. 69 packages were installed as I described in the link (post) below and you told me back then that everythig was good.
https://una.io/d/jot-server-installation-and-messenger
Anyway, I double-checked whether all the dependencies were installed using:
npm list
npm list --global
npm list -g
It gave me a long list of installed npm packages and their dependencies like this:
/root
└─┬ forever@4.0.1
├── async@1.5.2
├─┬ cliff@0.1.10
│ ├── colors@1.0.3 extraneous
│ ├── eyes@0.1.8
│ └── winston@0.8.3 deduped
├── clone@2.1.2
├── colors@0.6.2
├─┬ configstore@4.0.0
│ ├─┬ dot-prop@4.2.1
│ │ └── is-obj@1.0.1
etc... (the list is long)
Also, it gave me some errors like:
npm ERR! extraneous: colors@1.0.3 /root/node_modules/cliff/node_modules/colors
npm ERR! extraneous: cliff@0.1.9 /root/node_modules/broadway/node_modules/cliff
npm ERR! extraneous: eventemitter2@0.4.14 /root/node_modules/broadway/node_modules/eventemitter2
npm ERR! extraneous: winston@0.8.0 /root/node_modules/broadway/node_modules/winston
etc... (the list is long)
I don't know what those errors mean, but as you call tell, all the dependencies were installed.
I am sending you my server details via PM so that you can check.
Thanks.
-