Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Run Sails in production with pm2 (sails lift --prod) with pm2

How to lift sails in production with pm2 ?? I mean what is the the command of pm2 to get similar action like below command.

sails lift --prod

like we can run sails lift as pm2 start app.js

In pm2 we can specify command line arguments after --

I tried pm2 start app.js -- --prod to lift sails in production but not working,

How we can achieve this?

like image 577
Satyam Koyani Avatar asked Jul 15 '15 03:07

Satyam Koyani


2 Answers

Here Finally I found the correct command for that is like below

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

I went to the all commands of pm2 and found

-x --execute-command execute a program using fork system

so here this is works fine. Even later I found this command on sails docs too.

Sails Deployment

like image 74
Satyam Koyani Avatar answered Oct 05 '22 06:10

Satyam Koyani


NODE_ENV=production pm2 start app.js
like image 21
Garach Ankur Avatar answered Oct 05 '22 07:10

Garach Ankur