Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Unitech/pm2
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 76d3e387648a0555b955d45e0339f34246f617c6
Choose a base ref
...
head repository: Unitech/pm2
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: a092db2d89e7206ef446d9eb6e385d182d2f0c58
Choose a head ref

Commits on Jun 8, 2021

  1. Copy the full SHA
    2ba5a1c View commit details
  2. pm2@5.0.2

    Unitech committed Jun 8, 2021
    Copy the full SHA
    889119c View commit details
  3. Copy the full SHA
    f173315 View commit details
  4. pm2@5.0.3

    Unitech committed Jun 8, 2021
    Copy the full SHA
    6d85e73 View commit details
  5. fix: skip unknown interfaces

    Unitech committed Jun 8, 2021
    Copy the full SHA
    f29816d View commit details
  6. pm2@5.0.4

    Unitech committed Jun 8, 2021
    Copy the full SHA
    9768a7f View commit details

Commits on Jun 10, 2021

  1. Copy the full SHA
    e8651f1 View commit details
  2. pm2@5.1.0

    Unitech committed Jun 10, 2021
    Copy the full SHA
    590f044 View commit details

Commits on Jul 12, 2021

  1. feat: default behavior chan

    Unitech committed Jul 12, 2021
    Copy the full SHA
    318676a View commit details

Commits on Jul 15, 2021

  1. Update README.md

    Unitech authored Jul 15, 2021
    Copy the full SHA
    224372c View commit details
  2. bump travis-ci

    Unitech authored Jul 15, 2021
    Copy the full SHA
    624d8cc View commit details
  3. update travis-ci link

    Unitech authored Jul 15, 2021
    Copy the full SHA
    7f97612 View commit details

Commits on Jul 16, 2021

  1. Update README.md

    Unitech authored Jul 16, 2021
    Copy the full SHA
    494caa6 View commit details

Commits on Aug 11, 2021

  1. Remove legacy node version shims

    Signed-off-by: Matthew Peveler <matt.peveler@gmail.com>
    MasterOdin committed Aug 11, 2021
    Copy the full SHA
    0fb0419 View commit details

Commits on Aug 19, 2021

  1. Copy the full SHA
    93dc017 View commit details
  2. pm2@5.1.1

    Unitech committed Aug 19, 2021
    Copy the full SHA
    8fec746 View commit details

Commits on Sep 24, 2021

  1. cron restarts improvements

    Unitech committed Sep 24, 2021
    Copy the full SHA
    120e31a View commit details
  2. readme improvements

    Unitech committed Sep 24, 2021
    Copy the full SHA
    8a9b576 View commit details
  3. update pm2-ls-v2 image

    Unitech committed Sep 24, 2021
    Copy the full SHA
    785e717 View commit details
  4. pm2@5.1.2

    Unitech committed Sep 24, 2021
    Copy the full SHA
    cef1c9e View commit details
  5. Copy the full SHA
    62afc6c View commit details

Commits on Oct 4, 2021

  1. Copy the full SHA
    7ced8c6 View commit details

Commits on Oct 7, 2021

  1. chore: remove empty file removeFolderRecursive.js

    File was added in 593b43c
    
    Same commit added a module called deleteFolderRecursive.js so this is
    probably a rename artifact.
    rjoonas committed Oct 7, 2021
    Copy the full SHA
    cb2e3fa View commit details

Commits on Oct 8, 2021

  1. Copy the full SHA
    8c47387 View commit details

Commits on Oct 22, 2021

  1. Copy the full SHA
    7b392a9 View commit details
  2. test on Node 17

    Unitech committed Oct 22, 2021
    Copy the full SHA
    aca7d0b View commit details

Commits on Nov 5, 2021

  1. Typo

    kurtfurbush authored Nov 5, 2021
    Copy the full SHA
    d9199e6 View commit details
  2. Add CORS headers

    Tsingbo-Kooboo committed Nov 5, 2021
    Copy the full SHA
    73906f3 View commit details

Commits on Nov 9, 2021

  1. update travis ci link

    Unitech authored Nov 9, 2021
    Copy the full SHA
    b902551 View commit details
  2. merge master

    Unitech committed Nov 9, 2021
    Copy the full SHA
    30fce64 View commit details
  3. Merge pull request #5220 from Tsingbo-Kooboo/master

    Add CORS headers
    Unitech authored Nov 9, 2021
    Copy the full SHA
    8855482 View commit details
  4. Copy the full SHA
    ffaa1e5 View commit details
  5. Merge pull request #5207 from Unitech/pidusage

    Pidusage drops node < 10 in 3.0
    Unitech authored Nov 9, 2021
    Copy the full SHA
    81014a6 View commit details
  6. Merge pull request #5200 from rjoonas/rm-empty-file

    chore: remove empty file removeFolderRecursive.js
    Unitech authored Nov 9, 2021
    Copy the full SHA
    2fbf3dd View commit details
  7. Merge pull request #5194 from dislick/fix-missing-folder

    Ensure directory exists before writing to it
    Unitech authored Nov 9, 2021
    Copy the full SHA
    467c8ca View commit details

Commits on Dec 4, 2021

  1. Copy the full SHA
    df7a9be View commit details

Commits on Dec 7, 2021

  1. Copy the full SHA
    d77ea05 View commit details

Commits on Jan 11, 2022

  1. Find the nearest package.json

    Tomás Hernández committed Jan 11, 2022
    Copy the full SHA
    4007cf5 View commit details

Commits on Jan 14, 2022

  1. Copy the full SHA
    f0e28ac View commit details

Commits on Jan 16, 2022

  1. Copy the full SHA
    76b64ae View commit details

Commits on Jan 19, 2022

  1. Copy the full SHA
    4c9cb4d View commit details
  2. Copy the full SHA
    725569f View commit details
  3. Copy the full SHA
    d66b645 View commit details
  4. Copy the full SHA
    e9485aa View commit details
  5. Copy the full SHA
    0c671d7 View commit details
  6. Copy the full SHA
    199e141 View commit details
  7. Copy the full SHA
    3cca7b3 View commit details

Commits on Jan 20, 2022

  1. Merge pull request #5280 from theCuriousOne/reduce_async_import

    Reduce async import
    Unitech authored Jan 20, 2022
    Copy the full SHA
    83401b2 View commit details
  2. Merge pull request #5279 from theCuriousOne/unnecessary_import

    fix: remove constants import from VersionCheck (not needed)
    Unitech authored Jan 20, 2022
    Copy the full SHA
    07b59d8 View commit details
  3. Merge pull request #5278 from theCuriousOne/copyright_update_2022

    Copyright update 2022
    Unitech authored Jan 20, 2022
    Copy the full SHA
    b636744 View commit details
Showing with 2,908 additions and 794 deletions.
  1. +1 −8 .github/ISSUE_TEMPLATE.md
  2. +31 −0 .github/workflows/node.js.yml
  3. +0 −1 .gitignore
  4. +0 −23 .travis.yml
  5. +65 −0 CHANGELOG.md
  6. +47 −36 README.md
  7. +2 −2 constants.js
  8. +1 −1 examples/cluster-http/http.js
  9. +9 −0 examples/send-msg/pm2-app.js
  10. +29 −0 examples/send-msg/pm2-msg.js
  11. +16 −0 examples/send-msg/t2.js
  12. +2 −2 examples/sourcemap-auto-resolve/API.js
  13. +1 −1 index.js
  14. +10 −15 lib/API.js
  15. +2 −2 lib/API/Dashboard.js
  16. +3 −2 lib/API/Deploy.js
  17. +37 −31 lib/API/Extra.js
  18. +7 −4 lib/API/Log.js
  19. +9 −7 lib/API/LogManagement.js
  20. +1 −1 lib/API/Modules/Modularizer.js
  21. +6 −5 lib/API/Modules/TAR.js
  22. +1 −1 lib/API/Monit.js
  23. +16 −17 lib/API/Serve.js
  24. +2 −1 lib/API/Startup.js
  25. +11 −5 lib/API/UX/pm2-ls.js
  26. +2 −2 lib/API/interpreter.json
  27. +2 −2 lib/API/pm2-plus/auth-strategies/WebAuth.js
  28. +0 −8 lib/API/pm2-plus/helpers.js
  29. +11 −1 lib/API/schema.json
  30. +4 −4 lib/Client.js
  31. +54 −35 lib/Common.js
  32. +1 −1 lib/Configuration.js
  33. +2 −2 lib/Daemon.js
  34. +1 −1 lib/Event.js
  35. +16 −19 lib/God.js
  36. +2 −1 lib/God/ActionMethods.js
  37. +1 −1 lib/God/ClusterMode.js
  38. +2 −7 lib/God/ForkMode.js
  39. +1 −1 lib/God/Methods.js
  40. +1 −1 lib/God/Reload.js
  41. +1 −1 lib/HttpInterface.js
  42. +3 −2 lib/ProcessContainer.js
  43. +1 −1 lib/ProcessContainerFork.js
  44. +0 −37 lib/ProcessContainerForkLegacy.js
  45. +0 −309 lib/ProcessContainerLegacy.js
  46. +13 −11 lib/ProcessUtils.js
  47. +2 −2 lib/Utility.js
  48. +0 −1 lib/VersionCheck.js
  49. +2 −2 lib/Watcher.js
  50. +20 −20 lib/Worker.js
  51. +2 −1 lib/binaries/CLI.js
  52. +1 −0 lib/binaries/Runtime4Docker.js
  53. +1 −1 lib/completion.js
  54. +24 −0 lib/templates/ecosystem-es.tpl
  55. +8 −0 lib/templates/ecosystem-simple-es.tpl
  56. +1 −1 lib/templates/init-scripts/openrc.tpl
  57. +2 −2 lib/tools/Config.js
  58. +1 −1 lib/tools/isbinaryfile.js
  59. 0 lib/tools/removeFolderRecursive.js
  60. +2,187 −0 package-lock.json
  61. +13 −11 package.json
  62. +1 −1 packager/setup.deb.sh
  63. +1 −2 packager/setup.rpm.sh
  64. +1 −1 paths.js
  65. BIN pres/cluster.png
  66. BIN pres/pm2-ls-v2.png
  67. BIN pres/pm2-v4-dark-mode.png
  68. BIN pres/vitals.png
  69. +2 −1 test/e2e.sh
  70. +1 −0 test/e2e/cli/.#interpreter.sh
  71. +32 −0 test/e2e/cli/bun.sh
  72. +3 −3 test/e2e/cli/cli-actions-2.sh
  73. +2 −2 test/e2e/cli/extra-lang.sh
  74. +0 −5 test/e2e/cli/fork.sh
  75. +0 −103 test/e2e/cli/interpreter.sh
  76. +0 −3 test/e2e/cli/python-support.sh
  77. +24 −0 test/e2e/cli/reload.sh
  78. +3 −1 test/e2e/cli/start-app.sh
  79. +35 −0 test/e2e/logs/log-namespace.sh
  80. +17 −0 test/e2e/misc/cron-system.sh
  81. +4 −0 test/fixtures/exitcode42.js
  82. +11 −0 test/fixtures/interpreter/echo.tsx
  83. +4 −0 test/fixtures/log-namespace/echo.js
  84. +1 −1 test/fixtures/python-script.py
  85. +7 −0 test/fixtures/stop-exit-codes.json
  86. +0 −4 test/interface/bus.fork.spec.mocha.js
  87. +0 −4 test/interface/bus.spec.mocha.js
  88. +43 −0 test/programmatic/common.mocha.js
  89. +0 −5 test/programmatic/custom_action.mocha.js
  90. +0 −4 test/programmatic/graceful.mocha.js
  91. +1 −0 test/unit.sh
  92. +24 −0 types/index.d.ts
9 changes: 1 addition & 8 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
<!--
Your issue may already be reported!
Please search on the [issue tracker](https://github.com/Unitech/pm2/search?type=Issues) before creating one.
-->

## What's going wrong?

## How could we reproduce this issue?

## Supporting information

<!--
Please run the following command (available on PM2 >= 2.6)
-->
```
# Run the following commands
$ pm2 report
```
31 changes: 31 additions & 0 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: Node.js CI

on: [push, pull_request]

jobs:
build:

runs-on: ubuntu-latest
timeout-minutes: 30

strategy:
matrix:
node-version: [20.x, 18.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v3
- uses: oven-sh/setup-bun@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: sudo apt install python3
- run: sudo apt install php-cli
- run: npm install
- run: npm run test:e2e
- run: npm run test:unit
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -10,7 +10,6 @@ test/child
dist/
*.deb
*.rpm
package-lock.json
.DS_Store
*.swp
*.swo
23 changes: 0 additions & 23 deletions .travis.yml

This file was deleted.

65 changes: 65 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,68 @@
## 5.3.1

- #5686 Switch from Travis CI to Github Actions
- #5680 Fixed reserved keyword for ES6 Strict Mode when Bundling @juaneth
- #5683 update badges
- #5684 auto switch light and dark mode logos
- #5678 Bugfix/deploy ecosystem filename extension / esm module default ecosystem config name @TeleMediaCC
- #5660 Fix matching logic for logs from namespace when lines = 0 @bawjensen
- fix "vulnerabilities" in axios module

## 5.3.0

- fix: replace non-working condition that blocks flush from clearing the logs #5533 @Sailboat265
- fix: ESM script loader #5524 @BlueWater86

## 5.2.2

- fix: correct pm2 ls display when there is a (very) long process id (@dko-slapdash)
- typo: corrections

## 5.2.1

- fix cluster error avoiding process restart (#5396)
- ensure increment_var value is a number (#5435)
- update dependencies
- add node latest to travis testing

## 5.2.0

- replace node-cron by croner (#5183 #5035)
- upgrade mocha deps
- fix pm2 report when daemon not running
- remove semver check for legacy node.js versions
- update node version in setup.deb.sh by using lts (#5201) + openrc
- replace legacy util._extend by Object.assign (#5239)
- add missing start options types (#5242)
- recursive detection of package.json (#5267)
- make tarball module uninstall cross-platform (#5269)
- Fix unnecessary "ENOENT" console.error when serving a spa (#5272)
- fix: used env variable instead of hardcode datetime format (#5277)
- copyright update (#5278)
- fix: remove constants import from VersionCheck (not needed) (#5279)
- Reduce async import (#5280)

## 5.1.2

- easily disable cron-restart strategy via `$ pm2 restart --cron-restart 0`
- allow to update cron-restart on restart

## 5.1.1

- remove fast-printf and replace with sprintfjs

## 5.1.0

- add back Node 10.x support
- make pm2-sysmonit module optional

## 5.0.3

- skip system monitoring on Windows

## 5.0.1/5.0.2

- fix npm install --no-optional pm2

## 5.0.0

83 changes: 47 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,42 @@
<div align="center">
<br/>
<a href="http://pm2.keymetrics.io/" title="PM2 Keymetrics link">
<img width=710px src="https://raw.githubusercontent.com/Unitech/pm2/development/pres/pm2-v4.png" alt="pm2 logo">
</a>
<br/>
<picture>
<source
srcset="https://raw.githubusercontent.com/Unitech/pm2/master/pres/pm2-v4.png"
width=710px
media="(prefers-color-scheme: light)"
/>
<source
srcset="https://raw.githubusercontent.com/Unitech/pm2/development/pres/pm2-v4-dark-mode.png"
width=710px
media="(prefers-color-scheme: dark), (prefers-color-scheme: no-preference)"
/>
<img src="https://raw.githubusercontent.com/Unitech/pm2/master/pres/pm2-v4.png" />
</picture>

<br/>
<br/>
<b>P</b>(rocess) <b>M</b>(anager) <b>2</b><br/>
<i>Runtime Edition</i>
<br/><br/>

<a href="https://npm-stat.com/charts.html?package=pm2&from=2015-10-09" title="PM2 Downloads">

<a title="Donate" href="https://explorer.kaspa.org/addresses/kaspa:qr2gxmun87mc8wt8adegy6fulvpfdjgsa8zcdxyulvzzr2utra3jv4s8txkq9">
<img src="https://img.shields.io/badge/donation-kaspa-green" alt="Donate"/>
</a>

<a title="PM2 Downloads" href="https://npm-stat.com/charts.html?package=pm2&from=2018-01-01&to=2023-08-01">
<img src="https://img.shields.io/npm/dm/pm2" alt="Downloads per Month"/>
</a>

<a href="https://npm-stat.com/charts.html?package=pm2&from=2015-10-09" title="PM2 Downloads">
<a title="PM2 Downloads" href="https://npm-stat.com/charts.html?package=pm2&from=2018-01-01&to=2023-08-01">
<img src="https://img.shields.io/npm/dy/pm2" alt="Downloads per Year"/>
</a>

<a href="https://badge.fury.io/js/pm2" title="NPM Version Badge">
<img src="https://badge.fury.io/js/pm2.svg" alt="npm version">
</a>

<a href="https://travis-ci.org/Unitech/pm2" title="PM2 Tests">
<img src="https://travis-ci.org/Unitech/pm2.svg?branch=master" alt="Build Status"/>
</a>

<br/>
<br/>
<br/>
@@ -39,7 +51,7 @@ Starting an application in production mode is as easy as:
$ pm2 start app.js
```

PM2 is constantly assailed by [more than 1800 tests](https://travis-ci.org/Unitech/pm2).
PM2 is constantly assailed by [more than 1800 tests](https://github.com/Unitech/pm2/actions/workflows/node.js.yml).

Official website: [https://pm2.keymetrics.io/](https://pm2.keymetrics.io/)

@@ -54,11 +66,7 @@ With NPM:
$ npm install pm2 -g
```

Or if you don't have Node.js installed:

```bash
wget -qO- https://getpm2.com/install.sh | bash
```
You can install Node.js easily with [NVM](https://github.com/nvm-sh/nvm#installing-and-updating) or [FNM](https://github.com/Schniz/fnm).

### Start an application

@@ -74,7 +82,7 @@ Your app is now daemonized, monitored and kept alive forever.

Once applications are started you can manage them easily:

![Process listing](https://github.com/unitech/pm2/raw/master/pres/pm2-list.png)
![Process listing](https://github.com/Unitech/pm2/raw/master/pres/pm2-ls-v2.png)

To list all running applications:

@@ -102,13 +110,14 @@ To monitor logs, custom metrics, application information:
$ pm2 monit
```


[More about Process Management](https://pm2.keymetrics.io/docs/usage/process-management/)

### Cluster Mode: Node.js Load Balancing & Zero Downtime Reload

The Cluster mode is a special mode when starting a Node.js application, it starts multiple processes and load-balance HTTP/TCP/UDP queries between them. This increase overall performance (by a factor of x10 on 16 cores machines) and reliability (faster socket re-balancing in case of unhandled errors).

![Framework supported](https://raw.githubusercontent.com/Unitech/PM2/master/pres/cluster.png)

Starting a Node.js application in cluster mode that will leverage all CPUs available:

```bash
@@ -125,10 +134,6 @@ Hot Reload allows to update an application without any downtime:
$ pm2 reload all
```

Seamlessly supported by all major Node.js frameworks and any Node.js applications without any code change:

![Framework supported](https://raw.githubusercontent.com/Unitech/PM2/master/pres/cluster-support.png)

[More informations about how PM2 make clustering easy](https://pm2.keymetrics.io/docs/usage/cluster-mode/)

### Container Support
@@ -143,6 +148,19 @@ CMD [ "pm2-runtime", "npm", "--", "start" ]

[Read More about the dedicated integration](https://pm2.keymetrics.io/docs/usage/docker-pm2-nodejs/)

### Host monitoring speedbar

PM2 allows to monitor your host/server vitals with a monitoring speedbar.

To enable host monitoring:

```bash
$ pm2 set pm2:sysmonit true
$ pm2 update
```

![Framework supported](https://raw.githubusercontent.com/Unitech/PM2/master/pres/vitals.png)

### Terminal Based Monitoring

![Monit](https://github.com/Unitech/pm2/raw/master/pres/pm2-monit.png)
@@ -174,11 +192,17 @@ $ pm2 flush # Flush all logs
$ pm2 reloadLogs # Reload all logs
```

To enable log rotation install the following module

```bash
$ pm2 install pm2-logrotate
```

[More about log management](https://pm2.keymetrics.io/docs/usage/log-management/)

### Startup Scripts Generation

PM2 can generates and configure a Startup Script to keep PM2 and your processes alive at every server restart.
PM2 can generate and configure a Startup Script to keep PM2 and your processes alive at every server restart.

Init Systems Supported: **systemd**, **upstart**, **launchd**, **rc.d**

@@ -195,19 +219,6 @@ $ pm2 unstartup

[More about Startup Scripts Generation](https://pm2.keymetrics.io/docs/usage/startup/)

### PM2 Modules

PM2 embeds a simple and powerful module system. Installing a module is straightforward:

```bash
$ pm2 install <module_name>
```

Here are some PM2 compatible modules (standalone Node.js applications managed by PM2):

[**pm2-logrotate**](https://www.npmjs.com/package/pm2-logrotate) automatically rotate logs and limit logs size<br/>
[**pm2-server-monit**](https://www.npmjs.com/package/pm2-server-monit) monitor the current server with more than 20+ metrics and 8 actions<br/>

### Updating PM2

```bash
4 changes: 2 additions & 2 deletions constants.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2013 the PM2 project authors. All rights reserved.
* Copyright 2013-2022 the PM2 project authors. All rights reserved.
* Use of this source code is governed by a license that
* can be found in the LICENSE file.
*/
@@ -109,4 +109,4 @@ var csts = {

};

module.exports = util._extend(csts, path_structure);
module.exports = Object.assign(csts, path_structure);
2 changes: 1 addition & 1 deletion examples/cluster-http/http.js
Original file line number Diff line number Diff line change
@@ -5,5 +5,5 @@ var server = http.createServer(function(req, res) {
res.writeHead(200);
res.end('hey');
}).listen(process.env.PORT || 8089, '0.0.0.0', function() {
console.log('App listening on port %d', server.address().port);
console.log('App listening on port 8089');
});
9 changes: 9 additions & 0 deletions examples/send-msg/pm2-app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

process.on('message', function(packet) {
process.send({
type : 'process:msg',
data : {
success : true
}
});
});
29 changes: 29 additions & 0 deletions examples/send-msg/pm2-msg.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

const pm2 = require('../..')

console.log(pm2)

pm2.connect(function() {
pm2.sendDataToProcessId({
// id of procces from "pm2 list" command or from pm2.list(errback) method
id : '1',

// process:msg will be send as 'message' on target process
type : 'process:msg',

// Data to be sent
data : {
some : 'data'
},

topic: true
}, function(err, res) {
})
})

// Listen to messages from application
pm2.launchBus(function(err, pm2_bus) {
pm2_bus.on('process:msg', function(packet) {
console.log(packet)
})
})
16 changes: 16 additions & 0 deletions examples/send-msg/t2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

var tx2 = require('tx2')
var http = require('http')

var meter = tx2.meter({
name : 'req/sec',
samples : 1,
timeframe : 60
})

http.createServer(function (req, res) {
meter.mark()
res.writeHead(200, {'Content-Type': 'text/plain'})
res.write('Hello World!')
res.end()
}).listen(6001)
Loading