Unitech / Unitech/pm2

pm2 deploy doesn't support localhost and number type port

Open
#5,373 1 comment 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?

I should deploy my app thru ssh tunneling, so that it should be deployed to localhost.
However, localhost causes deploy failure.
127.0.0.1 works well instead of localhost.

And pm2 document does not mention port for deploy target config.
port property of deploy config works, but it should be a string, not a number.

How could we reproduce this issue?

  deploy: {
    staging: {
      user: 'deployer',
      host: 'localhost',
      port: 3030,
      ref: 'origin/staging',
      repo: 'git@github.com:xxxxxx/yyyyyy',
      path: '/home/deployer/yyyyyy',
      'pre-deploy-local': '',
      'post-deploy': '. ~/.profile && yarn install && pm2 reload scripts/pm2/ecosystem.config.js --env staging',
      'pre-setup': '',
    },
  }

Supporting information

$ pm2 report

--- Daemon -------------------------------------------------
pm2d version         : 5.2.0
node version         : 16.14.0
node path            : /Users/xxxxx/.nvm/versions/node/v16.14.0/bin/pm2
argv                 : /Users/xxxxx/.nvm/versions/node/v16.14.0/bin/node,/Users/xxxxx/.nvm/versions/node/v16.14.0/node_modules/pm2/lib/Daemon.js
argv0                : node
user                 : xxxxx
uid                  : 501
gid                  : 20
uptime               : 8min
===============================================================================
--- CLI ----------------------------------------------------
local pm2            : 5.2.0
node version         : 16.14.0
node path            : /Users/xxxxx/.nvm/versions/node/v16.14.0/bin/pm2
argv                 : /Users/xxxxx/.nvm/versions/node/v16.14.0/bin/node,/Users/xxxxx/.nvm/versions/node/v16.14.0/bin/pm2,report
argv0                : node
user                 : xxxxx
uid                  : 501
gid                  : 20
===============================================================================
--- System info --------------------------------------------
arch                 : arm64
platform             : darwin
type                 : Darwin
cpus                 : Apple M1 Pro
cpus nb              : 10
freemem              : 74645504
totalmem             : 17179869184
home                 : /Users/xxxxx
===============================================================================

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 tracing the pm2 deploy entry point that handles the shown staging configuration, then reproduce the failure with host set to localhost and port set to 3030. Done means localhost deploys through the SSH tunnel, numeric ports work, and the deploy configuration documentation describes the port property.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
cli, devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.