Unitech / Unitech/pm2

Improve pm2 cooperation with homebrew node version on mac

Open
#3,253 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

S: Open for PR SYS: Startup T: Enhancement
Dominant language
JavaScript
Stars
43.3k
Forks
2.7k
PR merge metrics
No merged PRs in 30d

Description

What's going wrong?

In the launchd script on mac the path indicates the path of the node binary installed by homebrew:

<string>/usr/local/Cellar/node/8.5.0/bin</string>

This becomes a problem as soon as homebrew updates node to a new version because in that case the path information becomes wrong.

As the current homebrew node binary is symlinked into /usr/local/bin, it would be better to use following path in the launchd script:

<string>/usr/local/bin</string>

How could we reproduce this issue?

Install node with homebrew on a mac. The problem occurs as soon as there is an update to node installed with homebrew.

Supporting information

===============================================================================
--- PM2 REPORT (Tue Oct 31 2017 11:30:03 GMT+0100 (CET)) ----------------------
===============================================================================
--- Daemon -------------------------------------------------
pm2d version         : 2.7.2
node version         : 8.8.1
node path            : /usr/local/bin/pm2
argv                 : /usr/local/Cellar/node/8.8.1/bin/node,/usr/local/lib/node_modules/pm2/lib/Daemon.js
argv0                : node
user                 : tolink
uid                  : 501
gid                  : 20
uptime               : 805min
===============================================================================
--- CLI ----------------------------------------------------
local pm2            : 2.7.2
node version         : 8.8.1
node path            : /usr/local/bin/pm2
argv                 : /usr/local/Cellar/node/8.8.1/bin/node,/usr/local/bin/pm2,report
argv0                : node
user                 : tolink
uid                  : 501
gid                  : 20
===============================================================================
--- System info --------------------------------------------
arch                 : x64
platform             : darwin
type                 : Darwin
cpus                 : Intel(R) Core(TM) i5-6360U CPU @ 2.00GHz
cpus nb              : 4
freemem              : 356536320
totalmem             : 8589934592
home                 : /Users/tolink
===============================================================================
--- PM2 list -----------------------------------------------
┌──────────┬────┬──────┬──────┬────────┬─────────┬────────┬─────┬───────────┬────────┬──────────┐
│ App name │ id │ mode │ pid  │ status │ restart │ uptime │ cpu │ mem       │ user   │ watching │
├──────────┼────┼──────┼──────┼────────┼─────────┼────────┼─────┼───────────┼────────┼──────────┤
│ datstore │ 0  │ fork │ 4302 │ online │ 0       │ 12h    │ 0%  │ 45.5 MB   │ tolink │ disabled │
└──────────┴────┴──────┴──────┴────────┴─────────┴────────┴─────┴───────────┴────────┴──────────┘
===============================================================================
--- Daemon logs --------------------------------------------
/Users/tolink/.pm2/pm2.log last 20 lines:
PM2        | 2017-10-26 07:41:13: App [datstore] with id [0] and pid [20795], exited with code [0] via signal [SIGTERM]
PM2        | 2017-10-26 07:41:13: pid=20795 msg=process killed
PM2        | 2017-10-26 07:41:13: [PM2] Exited peacefully
PM2        | 2017-10-30 22:04:03: ===============================================================================
PM2        | 2017-10-30 22:04:03: --- New PM2 Daemon started ----------------------------------------------------
PM2        | 2017-10-30 22:04:03: Time                 : Mon Oct 30 2017 22:04:03 GMT+0100 (CET)
PM2        | 2017-10-30 22:04:03: PM2 version          : 2.7.2
PM2        | 2017-10-30 22:04:03: Node.js version      : 8.8.1
PM2        | 2017-10-30 22:04:03: Current arch         : x64
PM2        | 2017-10-30 22:04:03: PM2 home             : /Users/tolink/.pm2
PM2        | 2017-10-30 22:04:03: PM2 PID file         : /Users/tolink/.pm2/pm2.pid
PM2        | 2017-10-30 22:04:03: RPC socket file      : /Users/tolink/.pm2/rpc.sock
PM2        | 2017-10-30 22:04:03: BUS socket file      : /Users/tolink/.pm2/pub.sock
PM2        | 2017-10-30 22:04:03: Application log path : /Users/tolink/.pm2/logs
PM2        | 2017-10-30 22:04:03: Process dump file    : /Users/tolink/.pm2/dump.pm2
PM2        | 2017-10-30 22:04:03: Concurrent actions   : 2
PM2        | 2017-10-30 22:04:03: SIGTERM timeout      : 1600
PM2        | 2017-10-30 22:04:03: ===============================================================================
PM2        | 2017-10-30 22:41:55: Starting execution sequence in -fork mode- for app name:datstore id:0
PM2        | 2017-10-30 22:41:55: App name:datstore id:0 online

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

Locate the macOS launchd script that currently embeds the versioned Homebrew Node path under /usr/local/Cellar. Reproduce the problem by updating Homebrew Node, then verify the launchd configuration continues to use the stable /usr/local/bin path after the change.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, macos, node.js
Domain
devops, operating-systems
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.