Unitech / Unitech/pm2

pm2 delete and start vs restart, replace with "update"

Open
#5,383 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?

it is inconvenience to manage the application in pipeline, when

  • with command "pm2 restart" , namespace need be started first. Otherwise, will throw exit status code with 1
  • "pm2 delete" and "pm2 start" have to be paired, when repeatly do the updates and deployment.
  • if namespace is not exist, pm2 delete <namespace> will throw exit status with 1
  • if namespace is exist, pm2 start <namespace> will throw exit status with 1

How could we reproduce this issue?

Not sure I am on the right direction.

In pipeline (CD stage), when deploy the application at first time, I can't use pm2 restart to start a new namespace. Because it will report the namespace is not exist. So I replace with "pm2 start".

But start from second pipeline deployment, I can't use pm2 start, and have to switch to pm2 restart. It is inconvenience. Pipeline doesn't work with this way. It should be same commands any time whatever for first run and second+ run.

To make sure the pipeline always running properly, I run pm2 delete , update the codes, then run pm2 start. But sometimes, the developers will do some troubleshooting, and delete the namespace manually. then pm2 delete in pipeine will failed.

What I need?

My question is, are there options for me as pm2 update, with the logic of update:

  1. if the namespace is not exist, start it
  2. if the namespace is exist, restart it

So I don't have to deal with delete, start and restart, they are conflict each other in some ways.

Supporting information

$ pm2 report
--- PM2 report ----------------------------------------------------------------
Date                 : Fri Jun 17 2022 20:50:16 GMT+0000 (Coordinated Universal Time)
===============================================================================
--- Daemon -------------------------------------------------
pm2d version         : 5.1.2
node version         : 16.13.2
node path            : /usr/bin/pm2
argv                 : /usr/bin/node,/usr/lib/node_modules/pm2/lib/Daemon.js
argv0                : node
user                 : cicd
uid                  : 1001
gid                  : 1001
uptime               : 34675min
===============================================================================
--- CLI ----------------------------------------------------
local pm2            : 5.1.2
node version         : 16.13.2
node path            : /usr/bin/pm2
argv                 : /usr/bin/node,/usr/bin/pm2,report
argv0                : node
user                 : cicd
uid                  : 1001
gid                  : 1001
===============================================================================
--- System info --------------------------------------------
arch                 : x64
platform             : linux
type                 : Linux
cpus                 : Intel(R) Xeon(R) CPU E5-2686 v4 @ 2.30GHz
cpus nb              : 2
freemem              : 396804096
totalmem             : 4113248256
home                 : /home/user
===============================================================================

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 how the PM2 CLI handles the existing delete, start, and restart commands, using the pipeline scenarios in the issue as behavioral cases. Define an update command that starts a missing namespace and restarts an existing one, then verify both paths and their exit statuses in a deployment pipeline.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.