Unitech / Unitech/pm2

pm2 startOrReload reboots specific server when entering a typo

Open
#5,486 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
43.3k
Forks
2.7k
PR merge metrics
No merged PRs in 30d

Description

What's going wrong?

So basically I have 3 folders (next to each other) with each folder running a specific version of our app.
When I do "pm2 startOrReload ecosystem.config.js --env testing" in the /testing folder and version of the app. Then that pm2 correctly reboots this app. However if I would type "pm2 startOrReload ecosystem.config.js --env tetsing", so basically I mistype the environment. Then somehow pm2 always thinks it's wise to reboot the other app running in the another folder. And it always reboots this one, not for example the third app. This is really annoying.

I do not understand why pm2 specifically always reboots this app when you incorrectly provide the environment. Each folder/app has their own ecosystem.config.js with one defined environment (testing for example). Why does pm2 just jump to the other folder and reboot that other app? What do I do to avoid accidentally rebooting the other app ? Each app has their own ecosystem.config.js with a named environment. None is using a default environment.

For example:

module.exports = {
apps : [{
name: 'APP_testing',
exec_mode: 'cluster',
instances: '1',
script: './server.js',
watch: 'true',
shutdown_with_message : true,
wait_ready: true,
merge_logs: true,
env_testing: {
PORT: 3000,
....
}
}],
}

How could we reproduce this issue?

Supporting information

$ pm2 report

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing pm2 startOrReload ecosystem.config.js --env testing and the misspelled --env tetsing command across the separate apps, using the shown ecosystem.config.js structure. Trace the startOrReload CLI handling of environment selection; done means an invalid environment cannot reboot an unrelated app, with a regression test covering the typo.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
cli, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.