Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reloading a deployment file, issues with removed or changed entries #2516

Closed
qqilihq opened this issue Nov 12, 2016 · 3 comments
Closed

Reloading a deployment file, issues with removed or changed entries #2516

qqilihq opened this issue Nov 12, 2016 · 3 comments
Assignees

Comments

@qqilihq
Copy link

qqilihq commented Nov 12, 2016

I'm currently switching our deployment process to pm2 and so far it seems simple and straight forward. Especially the zero downtime reload is awesome. However, I've come to one issue:

Our very simple deployment config looks like this:

module.exports = {
  apps : [
    {
      name: 'web',
      script: './bin/web',
      instances : max,
      exec_mode : 'cluster'
    },
    // ...
  ]
};

Upon deployment, we simply execute pm2 reload ecosystem.config.js, and everything is fine. But as we're an agile team, our apps will eventually change and this leads to the following issues:

  1. Path of a script is changed: Assume, the script for the web part is no longer in ./bin/web, but moved to server/app.js. We modify the ecosystem.config.js accordingly, execute pm2 reload ecosystem.config.js, but pm2 still runs the former entry, i.e. the change to the script is not reflected.

  2. Motivated by above's issue, we tried to rename web to web-new. Upon invoking pm2 reload ecosystem.config.js, web-new is added, but obviously web is still in pm2's list, although it's been deleted from the configuration.

Both issues could be avoided by doing pm2 delete all && pm2 reload ecosystem.config.js obviously, where we would first delete all entries and then re-add them. But naturally, we would lose the zero downtime functionality (which, ironically, made me switch to pm2 in the first place).

Is there a different solution which I might have overlooked? Something which would simply sync currently running processes with the entries from the deployment configuration?

@vmarchaud
Copy link
Contributor

To reflect change in environnement, use CLI options --update-env or updateEnv: true in json configuration.

@qqilihq
Copy link
Author

qqilihq commented Nov 13, 2016

Thank you for your response, however neither of them seems to have an effect.

PM2 still runs the old scripts formerly defined. And entries which were removed in the config are still listed in PM2.

Tried via CLI: pm2 reload ecosystem.config.js --update-env

And in the configuration:

module.exports = {
  apps : [
    {
      name: 'web',
      script: './bin/web',
      instances : max,
      exec_mode : 'cluster',
      updateEnv: true // XXX put it here ...
    },
    // ...
  ],
  updateEnv: true // XXX ... and here
};

[edit] Using PM2 2.1.4.

@Unitech
Copy link
Owner

Unitech commented Nov 22, 2016

closing in favor of #2533

@Unitech Unitech closed this as completed Nov 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants