Run Sailsjs App using PM2 in Production Mode (passing argument as --prod)

In production, instead of sails lift, you’ll want to use forever or PM2 to make sure your app will keep running, even if it crashes.

Install forever:

sudo npm install -g forever

More about forever: https://github.com/nodejitsu/forever

Or install PM2:

sudo npm install pm2 -g —unsafe-perm

More information about that: https://github.com/Unitech/pm2

From your app directory, start the server either with

forever start app.js —prod

or

pm2 start app.js -x — —prod

This is the same thing as using sails lift —prod, but if the server crashes, it will be automatically restarted.