Unitech / pm2

Node.js Production Process Manager with a built-in Load Balancer.
https://pm2.keymetrics.io/docs/usage/quick-start/
Other
41.46k stars 2.62k forks source link

PM2 reload environment variables on server restart? #5591

Open tasdflkjweio opened 1 year ago

tasdflkjweio commented 1 year ago

I am pulling environment variables from an external store (azure, in this case) once on VM boot. I'd like PM2 to bypass its cached environment variables and inject these into the app on each restart. Is there a way of doing this?

I've called $ pm2 startOrRestart ecosystem.config.js --update-env --time && pm2 reset myApp && pm2 save to configure the daemon.

I've already provided the environment variables to PM2 via a systemd EnvironmentFile=... override.

RubenNSF commented 1 year ago

Having similar issue on pm2 v5.1.0. ecosystem.json is not being reloaded even with --update-env flag set. Right now the only workaround I found was to delete and start the service again.

cedbale commented 7 months ago

same here with 5.3.1. The only way to refresh env values is to delete and start the service. This is a problem to ensure service continuity in production provided with the cluster mode.

chenghung commented 5 months ago

same issue on version 5.2.2