doc-pm2 icon indicating copy to clipboard operation
doc-pm2 copied to clipboard

Ecosystem File | Reference | PM2 Documentation

Open rmonnier9 opened this issue 7 years ago • 13 comments

https://pm2.io/doc/en/runtime/reference/ecosystem-file/

PM2 - Guide, References, Tutorials and Best Practices about PM2 and Node.js.

rmonnier9 avatar May 30 '18 14:05 rmonnier9

Could you please provide more details for the difference between deploy options post-setup and post-deploy?

shipengqi avatar Aug 26 '18 06:08 shipengqi

@robin-monnier Thanks

shipengqi avatar Aug 26 '18 10:08 shipengqi

@shipengqi Could you please provide more details for the difference between deploy options post-setup and post-deploy?

To give you a short example, let say:

when you use a setup like this one:

pm2 deploy ecosystem.config.js staging setup

It will execute the instruction(s) that is/are set in the key "post-setup" in the remote machine. Now why? well because the setup is used to clone the repo and the "update" is used to only pull/merge changes.

So when you use a deploy like this one it will pull/merge the changes of the branch with post-deploy:

pm2 deploy ecosystem.config.js staging update

To summarize it "setup" is for clone and "update" for pull changes.

Note: both will run in the remote machine, not locally and the command can be a file.sh with your instructions or npm scripts and so on.

Hope it help you.

normancarcamo avatar Sep 05 '18 07:09 normancarcamo

@normancarcamo Thanks a lot.

shipengqi avatar Sep 07 '18 07:09 shipengqi

Is there a way to use with existing deployment directory, and not create extra folder sources with git repo root?

yetithefoot avatar Sep 30 '18 23:09 yetithefoot

test

iamhanson avatar Nov 22 '18 03:11 iamhanson

Is there a way to set args in each env_ ? { env: { NODE_ENV: 'development', args: {} //possible? }, env_production: { NODE_ENV: 'production', args: {} //possible? } }

adiploma avatar Jan 14 '19 14:01 adiploma

Could any one please clarify why should we provide restart_delay in pm2 config?

ghost avatar Jan 18 '19 12:01 ghost

@adiploma Is there a way to set args in each env_ ? { env: { NODE_ENV: 'development', args: {} //possible? }, env_production: { NODE_ENV: 'production', args: {} //possible? } }

A workaround would be to pass your arguments as environmental variables instead

Daniel-M avatar Jan 24 '19 15:01 Daniel-M

@Ambay54 Could any one please clarify why should we provide restart_delay in pm2 config?

As far as I know, pm2 tries to restart the app immediately after a crash, some applications would require to delay the restart. Take for instance the case when you have a script which runs only twice a day, you would want to delay the restart for about 12 hours so pm2 monitors and restart the app at the proper time, and not just in sequence after each execution ends

Daniel-M avatar Jan 24 '19 15:01 Daniel-M

What if the apps are in different repos, how to deploy them by using one ecosystem file ? Or should I write a ecosystem file for each app ?

luotiantian66 avatar Mar 08 '19 03:03 luotiantian66

this page is missing watch_delay

ghost avatar Mar 31 '19 22:03 ghost

Why does watch has no default? I suppose it should be false.

chiawendt avatar May 06 '19 08:05 chiawendt