What logs are you looking at? Try loading a page while watching ./nodebb log. Also, try running ./nodebb build and restarting.
SOLVED Forum down after restart
"daemon": falseworks, but I'd rather use the daemon
@PitaJ Sorry I'm a little late responding here. I've used
systemdas defined below, which works fine, and survives a rebuilt and restart
[Unit] Description=Sudonix Documentation=https://docs.nodebb.org After=system.slice multi-user.target mongod.service [Service] Type=forking User=sudonix StandardOutput=syslog StandardError=syslog SyslogIdentifier=nodebb WorkingDirectory=/home/sudonix/nodebb PIDFile=/home/sudonix/nodebb/pidfile ExecStart=/usr/bin/env node loader.js Restart=always [Install] WantedBy=multi-user.target
Many thanks for all the help and support. Greatly appreciated.
What version of node & npm are you using now?
@baris Versions below
npm --version 6.14.15
Can you try latest node 14.x, we don't official support 16 yet.
@baris ok. How can I downgrade ?
@baris thanks. I removed NodeJS and reinstalled it using 14.x version. NodeBB now looks like it starts using the daemon (according to the logs, although if I try
nodebb stopit tells me NodeBB is already stopped), and I get 502 bad gateway - but nothing has changed in terms of overall directory structure and nginx config.
So it looks like whilst the original odd message has cleared, it's not starting
My other NodeBB site works fine
@phenomlab could you try deleting your log file and starting with
@pitaj doesn't seem to do anything other than this
Starting NodeBB with logging output Hit Ctrl-C to exit The NodeBB process will continue to run in the background Use "./nodebb stop" to stop the NodeBB server tail: cannot open './logs/output.log' for reading: No such file or directory tail: './logs/output.log' has appeared; following new file
At this point, I'm totally stumped. The only other option I have available is to create a new instance and attach the current database to that to see if this resolves the issue or not.
Failing that, I'm at a total loss here.
2021-09-26T19:52:22.547Z [4567/349055] - info: Enabling 'trust proxy' 2021-09-26T19:52:22.550Z [4567/349055] - error: NodeBB address in use, exiting... Error: listen EADDRINUSE: address already in use 0.0.0.0:4567 at Server.setupListenHandle [as _listen2] (net.js:1320:16) at listenInCluster (net.js:1368:12) at doListen (net.js:1505:7) at processTicksAndRejections (internal/process/task_queues.js:83:21) 2021-09-26T19:52:22.552Z [4567/349055] - error: uncaughtException: listen EADDRINUSE: address already in use 0.0.0.0:4567 Error: listen EADDRINUSE: address already in use 0.0.0.0:4567 3 restarts in 10 seconds, most likely an error on startup. Halting.
The problem is, the port isn't actively being used anywhere. I have another NodeBB instance running on 4568, but that's it.
Any thoughts ?
@phenomlab I don't know what to tell you. It's not lying about the address being in use.
Does it work if you run
node app? If not, it's definitely a rogue process left running on that port.
@pitaj thanks. Found the rogue process, and now I'm stuck with this.
sudonix@vps:~/nodebb$ ./nodebb start && ./nodebb log Starting NodeBB "./nodebb stop" to stop the NodeBB server "./nodebb log" to view server output "./nodebb help" for more commands Hit Ctrl-C to exit at processTicksAndRejections (internal/process/task_queues.js:83:21) 2021-09-26T20:43:20.339Z [4567/2900] - info: [app] Shutdown (SIGTERM/SIGINT) Initialised. 2021-09-26T20:43:20.340Z [4567/2900] - error: Error [ERR_SERVER_NOT_RUNNING]: Server is not running. at Server.close (net.js:1608:12) at Object.onceWrapper (events.js:519:28) at Server.emit (events.js:412:35) at emitCloseNT (net.js:1661:8) at processTicksAndRejections (internal/process/task_queues.js:81:21) 2021-09-26T20:43:20.346Z [4567/2893] - info: [reputation-rules] settings loaded 3 restarts in 10 seconds, most likely an error on startup. Halting.
So it looks like the process spawns and then immediately crashes. Trouble is I don't know where. It even does this with all plugins disabled.
Does it work if you run node app?
sudonix@vps:~/nodebb$ node app 2021-09-26T21:37:41.594Z [4567/5912] - info: NodeBB v1.18.3 Copyright (C) 2013-2021 NodeBB Inc. 2021-09-26T21:37:41.596Z [4567/5912] - info: This program comes with ABSOLUTELY NO WARRANTY. 2021-09-26T21:37:41.596Z [4567/5912] - info: This is free software, and you are welcome to redistribute it under certain conditions. 2021-09-26T21:37:41.596Z [4567/5912] - info: 2021-09-26T21:37:41.597Z [4567/5912] - info: Initializing NodeBB v1.18.3 https://sudonix.com 2021-09-26T21:37:43.378Z [4567/5912] - info: [socket.io] Restricting access to origin: https://sudonix.com:* 2021-09-26T21:37:43.808Z [4567/5912] - warn: [plugins/load] The following plugins may not be compatible with your version of NodeBB. This may cause unintended behaviour or crashing. In the event of an unresponsive NodeBB caused by this plugin, run `./nodebb reset -p PLUGINNAME` to disable it. * nodebb-plugin-emoji 2021-09-26T21:37:43.931Z [4567/5912] - info: [plugins/spam-be-gone] Settings loaded 2021-09-26T21:37:43.943Z [4567/5912] - info: [reputation-rules] settings loaded 2021-09-26T21:37:43.971Z [4567/5912] - info: [api] Adding 1 route(s) to `api/v3/plugins` 2021-09-26T21:37:43.999Z [4567/5912] - info: [router] Routes added 2021-09-26T21:37:44.007Z [4567/5912] - info: NodeBB Ready 2021-09-26T21:37:44.009Z [4567/5912] - info: Enabling 'trust proxy' 2021-09-26T21:37:44.013Z [4567/5912] - info: NodeBB is now listening on: 0.0.0.0:4567
Does it still work with daemon:false or does that no longer help?
@pitaj that works fine
The only issue of course is that when performing a restart from the ACP I have to kill the process and restart it manually
@phenomlab it must be something to do with the
Can you try adding
console.logs through there to try and find where the script stops executing for you?
./nodebb slogworks (but doesn't survive a rebuild and restart) fine, but I still need to leave this running as it isn't a daemon
./nodebb slogjust runs
./nodebb startthen shows the log with
tail. Nothing fancy. When you quit the command, you're just exiting
tail, NodeBB isn't stopped.
The "production" equivalent of
node app. There are many ways you can set it up to run as a daemon. For instance, setting up a systemd service.