Ecosystem File | Reference | PM2 Documentation
https://pm2.io/doc/en/runtime/reference/ecosystem-file/
PM2 - Guide, References, Tutorials and Best Practices about PM2 and Node.js.
Could you please provide more details for the difference between deploy options post-setup and post-deploy?
@robin-monnier Thanks
@shipengqi Could you please provide more details for the difference between deploy options
post-setupandpost-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 Thanks a lot.
Is there a way to use with existing deployment directory, and not create extra folder sources with git repo root?
test
Is there a way to set args in each env_ ? { env: { NODE_ENV: 'development', args: {} //possible? }, env_production: { NODE_ENV: 'production', args: {} //possible? } }
Could any one please clarify why should we provide restart_delay in pm2 config?
@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
@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
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 ?
this page is missing watch_delay
Why does watch has no default? I suppose it should be false.