Skip to content

refactor(updatenotification): replace pm2 usage with node logic#4134

Merged
khassel merged 1 commit into
MagicMirrorOrg:developfrom
KristjanESPERANTO:pm2
May 3, 2026
Merged

refactor(updatenotification): replace pm2 usage with node logic#4134
khassel merged 1 commit into
MagicMirrorOrg:developfrom
KristjanESPERANTO:pm2

Conversation

@KristjanESPERANTO
Copy link
Copy Markdown
Collaborator

@KristjanESPERANTO KristjanESPERANTO commented May 2, 2026

We can rely on PM2's native restart-on-exit behavior instead of the programmatic pm2 API.

Fixes https://github.com/MagicMirrorOrg/MagicMirror/security/dependabot/82 by removing pm2.

Note: Originally this PR was intended to update pm2, but after discussion, we decided to replace it instead. See the discussion below.

@KristjanESPERANTO KristjanESPERANTO changed the title chore: bump pm2 to ^7.0.1 chore: bump pm2, add dsiconnect and tests May 2, 2026
@KristjanESPERANTO KristjanESPERANTO changed the title chore: bump pm2, add dsiconnect and tests chore: bump pm2, add disconnect and tests May 2, 2026
@KristjanESPERANTO KristjanESPERANTO changed the title chore: bump pm2, add disconnect and tests pm2: bump version, add disconnect and tests May 2, 2026
@khassel
Copy link
Copy Markdown
Collaborator

khassel commented May 2, 2026

I have a general question to the pm2 stuff. We use it here to restart mm after updating.

AFAIS the pm2 stuff does restart mm whenever it exits. So why do we need the whole pm2 stuff inside mm?

Would it be sufficient to exit mm and pm2 does the restart from outside?

Background:

  • pm2 is a big dependency
  • in my docker setup I don't need it at all, I uninstall it (now I have to remove the test too, otherwise it will fail)

@sdetweil
Copy link
Copy Markdown
Collaborator

sdetweil commented May 2, 2026

Good question. I think it was not forcing the error path. Oops, app just disappeared, better restart.

Vs crash and hope, in the auto update module path

@KristjanESPERANTO
Copy link
Copy Markdown
Collaborator Author

Yes, good question! I took another look and don't see any significant downside for PM2 users if we replace the PM2 logic with node logic. I'm open to provide another PR or adapt this one if we decide to remove PM2.

@sdetweil since Karsten's take is clear, what is yours about the removal?

@sdetweil
Copy link
Copy Markdown
Collaborator

sdetweil commented May 2, 2026

I see no reason to keep the pm2 restart code. If we can kill the process we are in as there may be other instances running too

@KristjanESPERANTO KristjanESPERANTO changed the title pm2: bump version, add disconnect and tests refactor(updatenotification): replace pm2 usage with node logic May 3, 2026
@khassel khassel merged commit f2759ad into MagicMirrorOrg:develop May 3, 2026
12 checks passed
@KristjanESPERANTO KristjanESPERANTO deleted the pm2 branch May 3, 2026 07:55
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

Successfully merging this pull request may close these issues.

3 participants