Running on startup (PM2 preferably)
I'm following the docs (I think they are a bit outdated in some places) and by the end of the installation it says I can start the server with a
systemctlcall like this:
sudo service nodebb start
But the service doesn't exist after the installation process. I tried using the service file provided in the docs, but the command is wrong (it needs to pass the
startargument) and it doesn't work (no errors, but the server is not up).
I'm setting it up on Digital Ocean, and I'm planning on using Nginx to manage SSL and other redirections we need to implement. On their guides, they recommend using PM2 and I actually quite like it. I managed to setup the NodeBB process using:
pm2 start /opt/nodebb/nodebb -- start
pm2 monitI can see the server constantly restarting with a SIGINT. The app is serving the page on the right port, everything is working fine, but the monitor shows that the app is constantly restarting. I tried using
nodebb startand it errors out after 15 restarts, and executing pm2 with
-x(loader or nodebb) doesn't change anything.
Is there a correct way of setting up NodeBB as a service, preferably using PM2?
You should just use
app.jsinstead of loader or NodeBB if you're using pm2. Nobody here uses pm2 to run NodeBB because it's not very compatible with our clustering method.
zipang last edited by
Hi Everyone !
@jcano : Did you have any success with
I have the same exact problematic.
I don't know how to setup
nodebbto start with
systemctl(we should need a nodebb.service file example)
So i wanted to ressort to
pm2to do the job as i allready use it on the same server to watch other nodejs processes and it does a great job.
So far i've tried all of these commands and they seem to work as expected :
pm2 start app.js --name nodebb pm2 list pm2 restart nodebb pm2 stop nodebb
But now, i don't know how to see the log (
./nodebb logdoesn't work anymore, or to issue commands like
@PitaJ : Is there something else to know, like env variables to setup... ?
pm2 should handle the logs for you. All of the nodebb commands like
build, upgrade, activate, etcshould still work fine.
zipang last edited by
@pitaj Well yes thxxs !
It seems to work this command :
pm2 logs nodebb
I'll update this post if i encounter any unwanted behaviours with this solution !