doc-pm2
doc-pm2 copied to clipboard
Ecosystem File | Guide | PM2 Documentation
https://pm2.io/doc/en/runtime/guide/ecosystem-file/
PM2 - Guide, References, Tutorials and Best Practices about PM2 and Node.js.
How to dump or list environment for current process? like pm2 about my_process
@phan7om How to dump or list environment for current process? like pm2 about my_process
Hi!
You can use pm2 prettylist to display all informations about the processes as json.
You can save all processes added to the process list with pm2 dump and restore them with pm2 resurrect.
I hope it will help.
hi, when i run pm2 ecosystem.config.js it´t toll me that app.js and web.js doen´t found, im new on that, can someone help me please?
@AlexFerreras hi, when i run pm2 ecosystem.config.js it´t toll me that app.js and web.js doen´t found, im new on that, can someone help me please?
Hi!
You probably need to edit the ecosystem file.
Follow this article to know how. The most important is to set the script parameter with the path of your app entry point.
hi, once I start app with ecosystem.config.js, can I still change its setting ONLINE ( without restarting )? e.g. I want to disable log, but I don't like to restart?
How to add custom environments like QA staging etc
We could do something like
apps : [{ name: 'API', script: './bin/www',
instances: 1,
autorestart: true,
watch: true,
max_memory_restart: '1G',
env: {
NODE_ENV: 'development'
},
env_production: {
NODE_ENV: 'production'
},
env_qa:{
NODE_ENV:'QA'
}
}],
and When you are calling
pm2 start ecosystem.config.js --env QA
Can somebody confirm that the config file does not need to be named ecosystem.config.js please?
I'm having issues where I can start any number of processes manually but starting from config files fails and I want to rule this out as an issue.
(although currently I can even get an ecosystem.config.js to start my apps reliably)
@suburbanworrier Can somebody confirm that the config file does not need to be named
ecosystem.config.jsplease? I'm having issues where I can start any number of processes manually but starting from config files fails and I want to rule this out as an issue. (although currently I can even get anecosystem.config.jsto start my apps reliably)
you can name it whatever you want ex.: pm2 start whateveriwant.js
Hi, anyone can tell me what the 'version' column in 'pm2 ps' is and how to specify it? I have deployed more than one version, I did tag the git repo with tag 1.0.2 - but nothing changed the version.
It'd be great to have the pm2 monit show the actual version of the app - even better if it would be automatically versioned :)
OK - I figured it out :) The version field in monitoring is taken from package.json's version field :)
can 'pm2 start ecosystem.config.js' specify a host like 'pm2 start ecosystem.config.js --host ... ' ? or shold I use deploy to specify a host?
when i switch env production it was error.
Is the ecosystem.config.js file mandatory? Or is it still possible to just specify stuff on the command line and not have that file?
@igordata
@suburbanworrier Can somebody confirm that the config file does not need to be named
ecosystem.config.jsplease? I'm having issues where I can start any number of processes manually but starting from config files fails and I want to rule this out as an issue. (although currently I can even get anecosystem.config.jsto start my apps reliably)you can name it whatever you want ex.: pm2 start whateveriwant.js
That doesn't work for me, it only works if the file is exactly named ecosystem.config.js. E.g. naming the file pm2.js then pm2 will list the App name as "pm2" and restart all the time without output, indicating it tries to use it as an app and not as a configuration file. Please fix or adjust documentation.
@Badestrand I did get pm2 to load ad-hoc named config files so there is definitely no dependency on ecosystem.config.js per se. Loading and updating configurations using config files didn't appear 100% reliable though - unfortunately nothing repeatable/reportable.
I recommend you keep trying :)
@suburbanworrier @Badestrand I did get pm2 to load ad-hoc named config files so there is definitely no dependency on
ecosystem.config.jsper se. Loading and updating configurations using config files didn't appear 100% reliable though - unfortunately nothing repeatable/reportable.I recommend you keep trying :)
Thank you for your reply. It loads pm2.config.js so maybe the ending just needs to be .config.js and .js itself is not enough? This really needs to be documented though!
@Badestrand
I can confirm that all of my working examples end .config.js so you may well have discovered the nub of the issue.
Is it possible to use diff file name other than ecosystem.config.js