Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add production mode to sailsjs app when started using PM2

To start sailsjs in production mode you append --prod.

Run: node app.js --prod

I'm using PM2 and a simple json file for settings, which contains name of process and scriptname, to kick off the node process.

How would I pass the production argument using PM2?

like image 728
aludvigsen Avatar asked Apr 14 '14 08:04

aludvigsen


2 Answers

Read PM2 JSON app declaration. E.g. (not tested)

[{
  "name"      : "Sails",
  "script"    : "./app.js",
  "args"      : "['--prod']"
}]
like image 175
UpCat Avatar answered Nov 01 '22 20:11

UpCat


first delete: pm2 delete app

again:

pm2 start app.js -x -- --prod

like image 2
Felipe Avatar answered Nov 01 '22 18:11

Felipe