5

I want to run 2 node.js application on single server , using pm2 and those application need to deploy via puppet.Could you please advise is this possible.

Regards, Bala

mbm
  • 77
  • 1
  • 1
  • 4

1 Answers1

6

YOu can run same nodejs app as a cluster via pm2. https://github.com/Unitech/pm2#commands-overview

pm2 start app.js -i 4         # Start 4 instances of application in cluster mode

So it balances your processes as well. it has nothing to do with puppet.

To run multi diff node apps you can check the process.yml

http://pm2.keymetrics.io/docs/usage/application-declaration/

and than

# Start all applications
$ pm2 start process.json
sagie
  • 1,744
  • 14
  • 15
  • 1
    He wants to create `two` node applications on same server not two instances I think – abdulbarik Sep 04 '16 at 12:34
  • 1
    hmmm you might be right. anyway via pm2 he can do that too. – sagie Sep 04 '16 at 12:35
  • 2
    I want to run two different type of nod.js app on single server via pm2 ,is this possible?? – mbm Sep 04 '16 at 12:57
  • updated my answer, checkout the process.yml/process.json where you define all your apps and start ALL of them via pm2 start process.json/yml – sagie Sep 04 '16 at 13:00
  • @mbm you can run multiple node.js app on a single server each with multiple process. I have pushed it to the limit but it depends on the server's capacity – Nditah Sep 16 '20 at 00:02