The preferred way to start and stop NodeBB is by invoking its executable:
./nodebb startStarts the NodeBB server
./nodebb stopStops the NodeBB server
- Alternatively, you may use
npm stopto do the same
The methods listed below are alternatives to starting NodeBB via the executable.
Later version of Ubuntu may utilise Upstart to manage processes at boot. Upstart also handles restarts of scripts if/when they crash.
You can use Upstart to start/stop/restart your NodeBB.
Note: Prior to NodeBB v0.7.0, Upstart processes would not track the proper pid, meaning there was no way to stop the NodeBB process. NodeBB v0.7.0 includes some changes that allow Upstart to control NodeBB more effectively.
You can utilise this Upstart configuration as a template to manage your NodeBB:
start on startup stop on runlevel  respawn setuid someuser setgid someuser script cd /path/to/nodebb node loader.js --no-silent --no-daemon end script
From there, you can start stop and restart NodeBB as the root user:
restart nodebb, assuming
nodebb.conf is the name of the Upstart config file.
Simple Node.js Process
To start NodeBB, run it with
node (some distributions use the executable
nodejs, please adjust accordingly):
$ cd /path/to/nodebb/install $ node app
However, bear in mind that crashes will cause the NodeBB process to halt, bringing down your forum. Consider some of the more reliable options, below:
Using the supervisor package, you can have NodeBB restart itself if it crashes:
$ npm install -g supervisor $ supervisor app
supervisor by default continues to pipe output to
stdout, it is best suited to development builds.
Another way to keep NodeBB up is to use the forever package via the command line interface, which can monitor NodeBB and re-launch it if necessary:
$ npm install -g forever $ forever start app.js
We can utilize grunt to launch NodeBB and re-compile assets when files are changed. Start up speed is increased because we don't compile assets that weren't modified.
$ npm install -g grunt-cli
Run grunt to start up NodeBB and watch for code changes.