PM2 Startup & Save
-
Hi All,
Trying to get Webadmin to start on server start. For some reason the PM2 Startup (copy and paste) and PM2 save is not working for me. When I restart server I manually have to start up the webadmin.
I look at PM2 log and get this
smiley@fmjcod4:~$ pm2 log
[TAILING] Tailing last 15 lines for [all] processes (change the value with --lines option)
/home/smiley/.pm2/pm2.log last 15 lines:
PM2 | 2022-02-10T15:15:15: PM2 log: RPC socket file : /home/smiley/.pm2/rpc.sock
PM2 | 2022-02-10T15:15:15: PM2 log: BUS socket file : /home/smiley/.pm2/pub.sock
PM2 | 2022-02-10T15:15:15: PM2 log: Application log path : /home/smiley/.pm2/logs
PM2 | 2022-02-10T15:15:15: PM2 log: Worker Interval : 30000
PM2 | 2022-02-10T15:15:15: PM2 log: Process dump file : /home/smiley/.pm2/dump.pm2
PM2 | 2022-02-10T15:15:15: PM2 log: Concurrent actions : 2
PM2 | 2022-02-10T15:15:15: PM2 log: SIGTERM timeout : 1600
PM2 | 2022-02-10T15:15:15: PM2 log: ===============================================================================
PM2 | 2022-02-10T15:15:15: PM2 log: App [cod4xwebadmin:0] starting in -fork mode-
PM2 | 2022-02-10T15:15:15: PM2 log: App [cod4xwebadmin:0] online
PM2 | 2022-02-10T15:16:43: PM2 log: Stopping app:cod4xwebadmin id:0
PM2 | 2022-02-10T15:16:43: PM2 log: App [cod4xwebadmin:0] exited with code [0] via signal [SIGINT]
PM2 | 2022-02-10T15:16:43: PM2 log: pid=1305 msg=process killed
PM2 | 2022-02-10T15:16:43: PM2 log: App [cod4xwebadmin:0] starting in -fork mode-
PM2 | 2022-02-10T15:16:43: PM2 log: App [cod4xwebadmin:0] online/home/smiley/.pm2/logs/cod4xwebadmin-error.log last 15 lines:
0|cod4xweb | at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1148:16)
0|cod4xweb | Unhandled rejection Error: connect ECONNREFUSED ::1:27017
0|cod4xweb | at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1148:16)
0|cod4xweb | Unhandled rejection Error: connect ECONNREFUSED ::1:27017
0|cod4xweb | at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1148:16)
0|cod4xweb | Unhandled rejection Error: connect ECONNREFUSED ::1:27017
0|cod4xweb | at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1148:16)
0|cod4xweb | Unhandled rejection Error: connect ECONNREFUSED ::1:27017
0|cod4xweb | at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1148:16)
0|cod4xweb | Unhandled rejection Error: connect ECONNREFUSED ::1:27017
0|cod4xweb | at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1148:16)
0|cod4xweb | Unhandled rejection Error: connect ECONNREFUSED ::1:27017
0|cod4xweb | at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1148:16)
0|cod4xweb | Unhandled rejection Error: connect ECONNREFUSED ::1:27017
0|cod4xweb | at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1148:16)/home/smiley/.pm2/logs/cod4xwebadmin-out.log last 15 lines:
0|cod4xweb |
0|cod4xweb | Your mongoDB Username, Password is wrong in file app/config/config.json . Could not connect to database! MongoNetworkError: connect ECONNREFUSED ::1:27017
0|cod4xweb | GET / - - ms - -
0|cod4xweb | GET /service-worker.js - - ms - -
0|cod4xweb |
0|cod4xweb | > cod4x-webadmin@4.3.0 start /home/smiley/cod4xwebadmin
0|cod4xweb | > node ./bin/www
0|cod4xweb |
0|cod4xweb | GET /robots.txt 404 291.487 ms - 3902
0|cod4xweb | GET /robots.txt 404 89.183 ms - 3902
0|cod4xweb | GET / 200 341.087 ms - 10348
0|cod4xweb | POST /mifs/.;/services/LogService 403 153.473 ms - 8524
0|cod4xweb | GET /robots.txt 404 46.264 ms - 3902
0|cod4xweb | GET /members/61a68d85dc73dd0988077200 302 11.982 ms - 33
0|cod4xweb | GET /user/login 200 139.772 ms - 7451I have also highlighted above that Username/Password is wrong in app/config/config.json ? This is in cod4xwebadmin ? Because I know the congig.json is correct with that? Everything is working fine (apart from startup)
This is a second install of cod4xwebadmin and it was working before. Maybe i left something behind that makes error...? But all passwords and usernames are same as first install.
Anyone?
Thank you.
-
@smiley maybe you MongoDB didn't start so it could not connect to database, the error is that the app could not connect to db
-
smiley@fmjcod4:~$ /etc/init.d/mongodb status
● mongodb.service - An object/document-oriented database
Loaded: loaded (/lib/systemd/system/mongodb.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2022-02-11 11:02:24 EET; 3min 24s ago
Docs: man:mongod(1)
Main PID: 1080 (mongod)
Tasks: 47 (limit: 16613)
Memory: 187.0M
CGroup: /system.slice/mongodb.service
└─1080 /usr/bin/mongod --unixSocketPrefix=/run/mongodb --config /etc/mongodb.confFeb 11 11:02:24 fmjcod4 systemd[1]: Started An object/document-oriented database.
smiley@fmjcod4:~$ pm2 log
[TAILING] Tailing last 15 lines for [all] processes (change the value with --lines option)
/home/smiley/.pm2/pm2.log last 15 lines:
PM2 | 2022-02-11T11:02:25: PM2 log: RPC socket file : /home/smiley/.pm2/rpc.sock
PM2 | 2022-02-11T11:02:25: PM2 log: BUS socket file : /home/smiley/.pm2/pub.sock
PM2 | 2022-02-11T11:02:25: PM2 log: Application log path : /home/smiley/.pm2/logs
PM2 | 2022-02-11T11:02:25: PM2 log: Worker Interval : 30000
PM2 | 2022-02-11T11:02:25: PM2 log: Process dump file : /home/smiley/.pm2/dump.pm2
PM2 | 2022-02-11T11:02:25: PM2 log: Concurrent actions : 2
PM2 | 2022-02-11T11:02:25: PM2 log: SIGTERM timeout : 1600
PM2 | 2022-02-11T11:02:25: PM2 log: ===============================================================================
PM2 | 2022-02-11T11:02:25: PM2 log: App [cod4xwebadmin:0] starting in -fork mode-
PM2 | 2022-02-11T11:02:25: PM2 log: App [cod4xwebadmin:0] online
PM2 | 2022-02-11T11:04:27: PM2 log: Stopping app:cod4xwebadmin id:0
PM2 | 2022-02-11T11:04:27: PM2 log: App [cod4xwebadmin:0] exited with code [0] via signal [SIGINT]
PM2 | 2022-02-11T11:04:27: PM2 log: pid=1325 msg=process killed
PM2 | 2022-02-11T11:04:27: PM2 log: App [cod4xwebadmin:0] starting in -fork mode-
PM2 | 2022-02-11T11:04:27: PM2 log: App [cod4xwebadmin:0] online/home/smiley/.pm2/logs/cod4xwebadmin-error.log last 15 lines:
0|cod4xweb | at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1148:16)
0|cod4xweb | Unhandled rejection Error: connect ECONNREFUSED ::1:27017
0|cod4xweb | at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1148:16)
0|cod4xweb | Unhandled rejection Error: connect ECONNREFUSED ::1:27017
0|cod4xweb | at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1148:16)
0|cod4xweb | Unhandled rejection Error: connect ECONNREFUSED ::1:27017
0|cod4xweb | at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1148:16)
0|cod4xweb | Unhandled rejection Error: connect ECONNREFUSED ::1:27017
0|cod4xweb | at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1148:16)
0|cod4xweb | Unhandled rejection Error: connect ECONNREFUSED ::1:27017
0|cod4xweb | at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1148:16)
0|cod4xweb | Unhandled rejection Error: connect ECONNREFUSED ::1:27017
0|cod4xweb | at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1148:16)
0|cod4xweb | Unhandled rejection Error: connect ECONNREFUSED ::1:27017
0|cod4xweb | at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1148:16)/home/smiley/.pm2/logs/cod4xwebadmin-out.log last 15 lines:
0|cod4xweb |
0|cod4xweb | > cod4x-webadmin@4.3.0 start /home/smiley/cod4xwebadmin
0|cod4xweb | > node ./bin/www
0|cod4xweb |
0|cod4xweb | Your mongoDB Username, Password is wrong in file app/config/config.json . Could not connect to database! MongoNetworkError: connect ECONNREFUSED ::1:27017
0|cod4xweb | GET / - - ms - -
0|cod4xweb | GET /service-worker.js - - ms - -
0|cod4xweb | GET / - - ms - -
0|cod4xweb |
0|cod4xweb | > cod4x-webadmin@4.3.0 start /home/smiley/cod4xwebadmin
0|cod4xweb | > node ./bin/www
0|cod4xweb |
0|cod4xweb | GET / 200 544.685 ms - 12844
0|cod4xweb | GET /service-worker.js 404 57.806 ms - 3902
0|cod4xweb | GET /service-worker.js 404 121.749 ms - 3902Password is 100% correct....PM2 save still did not work...
-
When I tried again about 5 mins later that connection error was gone.
As long as all is working thats fine When i look in PM2 logs for example I start thinking why did I bother haha...A LOT of errors going back in time. I cleared them for now and will watch next days.
No idea why PM2 save is not working. That's always worked in the past.