I've seen slightly similar issues reported ( #3677, #3587 ) and I would like to add more detail
None of the restart | startOrRestart | startOrReload read updates from an ecosystem file.
I.e. changing the script path and running pm2 restart ecosystem.config.js --env production --update-env doesn't update the process process info
pm2 startOrReload ecosystem.config.js --env production --update-env
``` ecosystem.config.js
module.exports = {
apps: [{
name: "Internal API",
script: "./internal_api/bundle.js",
watch: true,
kill_timeout: 10000,
wait_ready: true,
env_production: {
NODE_ENV: "production",
NODE_CONFIG_DIR: "./config"
},
}],
};
`pm2 info 0`
status โ online โ
โ name โ Internal API โ
โ restarts โ 15 โ
โ uptime โ 75s โ
โ script path โ /home/centos/internal_api/bundle.js โ
โ script args โ N/A โ
โ error log path โ /home/centos/.pm2/logs/Internal-API-error-0.log โ
โ out log path โ /home/centos/.pm2/logs/Internal-API-out-0.log โ
โ pid path โ /home/centos/.pm2/pids/Internal-API-0.pid โ
โ interpreter โ node โ
โ interpreter args โ N/A โ
โ script id โ 0 โ
โ exec cwd โ /home/centos โ
โ exec mode โ fork_mode โ
โ node.js version โ 8.11.3 โ
โ watch & reload โ โ โ
โ unstable restarts โ 0 โ
โ created at โ N/A
Update the `ecosystem.config.js` and change script path to `script: "./internal-api/bundle.js"` (hyphen instead of underscore), run `pm2 startOrReload ecosystem.config.js --env production --update-env` (same for `reload`, `startOrRestart`)
$ pm2 startOrReload ecosystem.config.js --env production --update-env
[PM2] Applying action reloadProcessId on app Internal API
[PM2] [Internal API](0) โ
```
pm2 info 0will show the old script path
โ script path โ /home/centos/internal_api/bundle.js `
Edit:
Also, more of a question, but I would've expected that supplying an ecosystem file will enforce whatever apps are running?
I.e if I change the name of an app in the ecosystem file the it will be registered as a new process and the old one will keep running instead of killing everything except what's in the ecosystem.
$ pm2 report
[centos@ip-10-0-19-234 ~]$ pm2 report
===============================================================================
--- PM2 REPORT (Wed Jun 27 2018 10:03:50 GMT+0000 (UTC)) ----------------------
===============================================================================
--- Daemon -------------------------------------------------
pm2d version : 2.10.4
node version : 8.11.3
node path : /usr/local/lib/npm/bin/pm2
argv : /usr/bin/node,/usr/local/lib/npm/lib/node_modules/pm2/lib/Daemon.js
argv0 : node
user : centos
uid : 1000
gid : 1000
uptime : 5min
===============================================================================
--- CLI ----------------------------------------------------
local pm2 : 2.10.4
node version : 8.11.3
node path : /usr/local/lib/npm/bin/pm2
argv : /usr/bin/node,/usr/local/lib/npm/bin/pm2,report
argv0 : node
user : centos
uid : 1000
gid : 1000
===============================================================================
--- System info --------------------------------------------
arch : x64
platform : linux
type : Linux
cpus : Intel(R) Xeon(R) CPU E5-2676 v3 @ 2.40GHz
cpus nb : 1
freemem : 389451776
totalmem : 1038929920
home : /home/centos
===============================================================================
--- PM2 list -----------------------------------------------
โโโโโโโโโโโโโโโโฌโโโโโฌโโโโโโโฌโโโโโโฌโโโโโโโโโฌโโโโโโโโโโฌโโโโโโโโโฌโโโโโโฌโโโโโโโโโฌโโโโโโโโโฌโโโโโโโโโโโ
โ App name โ id โ mode โ pid โ status โ restart โ uptime โ cpu โ mem โ user โ watching โ
โโโโโโโโโโโโโโโโผโโโโโผโโโโโโโผโโโโโโผโโโโโโโโโผโโโโโโโโโโผโโโโโโโโโผโโโโโโผโโโโโโโโโผโโโโโโโโโผโโโโโโโโโโโค
โ Internal API โ 0 โ fork โ 0 โ online โ 31 โ 58s โ 0% โ 0 B โ centos โ enabled โ
โโโโโโโโโโโโโโโโดโโโโโดโโโโโโโดโโโโโโดโโโโโโโโโดโโโโโโโโโโดโโโโโโโโโดโโโโโโดโโโโโโโโโดโโโโโโโโโดโโโโโโโโโโโ
===============================================================================
--- Daemon logs --------------------------------------------
โโโโโโโโโโโโโโโโฌโโโโโฌโโโโโโโฌโโโโโโฌโโโโโโโโโฌโโโโโโโโโโฌโโโโโโโโโฌโโโโโโฌโโโโโโโโโฌโโโโโโโโโฌโโโโโโโโโโโ
โ App name โ id โ mode โ pid โ status โ restart โ uptime โ cpu โ mem โ user โ watching โ
โโโโโโโโโโโโโโโโผโโโโโผโโโโโโโผโโโโโโผโโโโโโโโโผโโโโโโโโโโผโโโโโโโโโผโโโโโโผโโโโโโโโโผโโโโโโโโโผโโโโโโโโโโโค
โ Internal API โ 0 โ fork โ 0 โ online โ 31 โ 58s โ 0% โ 0 B โ centos โ enabled โ
โโโโโโโโโโโโโโโโดโโโโโดโโโโโโโดโโโโโโดโโโโโโโโโดโโโโโโโโโโดโโโโโโโโโดโโโโโโดโโโโโโโโโดโโโโโโโโโดโโโโโโโโโโโ
me too
I seem to be having the same issue. Did either of you manage to figure it out?
not really, I am using pm2 kill as we're running a cluster of servers and we will always have one up
please, make a new command to "full-reload" the ecosystem file.....
i am sick of having to kill and start app over and over again during development...
@the-noob from PM2 docs: updating-running-conf
Starting PM2 v2.1.X, environments are immutable by default, that means the environment will never be updated unless you tell PM2 to do so, to update configurations, you will need to use --update-env options. Please note that some options will not be updated (options that are listed under General Attributes below).
script won't be updated with --update-env, I am also searching ways to update interpreter without downtime.
+1
+1
pm2 kill && pm2 start ecosystem.config.js
worked for me.
Do " pm2 ecosystem" to generate a new ecosystem file
+1
@the-noob from PM2 docs: updating-running-conf
Starting PM2 v2.1.X, environments are immutable by default, that means the environment will never be updated unless you tell PM2 to do so, to update configurations, you will need to use --update-env options. Please note that some options will not be updated (options that are listed under General Attributes below).
scriptwon't be updated with--update-env, I am also searching ways to updateinterpreterwithout downtime.
@roman-yu this makes total sense with the observed behavior, but this quote does no longer appear in the documentation, does it mean that could have been changes (couldn't find them)?
i am facing the same issue.. running
pm2 reload ecosystem.json
code updates dont seem to be present in reloaded pm2 processes eventhou there has been new code pushed to server - any help here?
Currently pm2 kill and pm2 resurrect seems to reload ecosystem file. It's a makeshift solution if you're fine with restarting all your other applications, or if you have none other running.
Edit: don't forget to run pm2 save before you restart!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
No, this is not stale.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
@Unitech Could you tell stale bot to stop closing this one?
They need a spam bot to counter the stale bot, apparently.
JK
I'm having this issue too. I have two pm2 processes running and I only want to reload one of them with an updated ecosystem.config file. There doesn't seem to be a way to do this
I stumbled upon the same issue when I updated the script property of one of my apps in my ecosystem file.
Just doing the reload part with pm2 reload ~/.pm2/ecosystem.config.js --only myapp1 didn't use the new script path either.
But I have found a workaround for me.
Assuming the app in question has id myapp1
First delete the application from the runtime:
pm2 delete myapp1
Re-add the app with:
pm2 reload ~/.pm2/ecosystem.config.js --only myapp1
That kept all other running apps untouched and just reloaded/restarted the changed one.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
No-no, not stale!
the problem is still present.
pm2 reload ./ecosystem.config.js does not updates configuration
Most helpful comment
No, this is not stale.