@zappinginc/zm2 6.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/.claude/settings.local.json +8 -0
  2. package/.gitattributes +4 -0
  3. package/.mocharc.js +14 -0
  4. package/CHANGELOG.md +2416 -0
  5. package/CLAUDE.md +84 -0
  6. package/CONTRIBUTING.md +124 -0
  7. package/GNU-AGPL-3.0.txt +665 -0
  8. package/LICENSE +1 -0
  9. package/README.md +248 -0
  10. package/bin/zm2 +3 -0
  11. package/bin/zm2-dev +3 -0
  12. package/bin/zm2-docker +3 -0
  13. package/bin/zm2-runtime +3 -0
  14. package/bin/zm2-windows +3 -0
  15. package/bin/zm2.ps1 +3 -0
  16. package/bun.lock +421 -0
  17. package/constants.js +114 -0
  18. package/index.js +13 -0
  19. package/lib/API/Configuration.js +212 -0
  20. package/lib/API/Containerizer.js +335 -0
  21. package/lib/API/Dashboard.js +459 -0
  22. package/lib/API/Deploy.js +117 -0
  23. package/lib/API/Extra.js +775 -0
  24. package/lib/API/ExtraMgmt/Docker.js +30 -0
  25. package/lib/API/Log.js +315 -0
  26. package/lib/API/LogManagement.js +371 -0
  27. package/lib/API/Modules/LOCAL.js +122 -0
  28. package/lib/API/Modules/Modularizer.js +148 -0
  29. package/lib/API/Modules/NPM.js +445 -0
  30. package/lib/API/Modules/TAR.js +362 -0
  31. package/lib/API/Modules/flagExt.js +46 -0
  32. package/lib/API/Modules/index.js +120 -0
  33. package/lib/API/Monit.js +247 -0
  34. package/lib/API/Serve.js +343 -0
  35. package/lib/API/Startup.js +629 -0
  36. package/lib/API/UX/helpers.js +213 -0
  37. package/lib/API/UX/index.js +9 -0
  38. package/lib/API/UX/pm2-describe.js +193 -0
  39. package/lib/API/UX/pm2-ls-minimal.js +31 -0
  40. package/lib/API/UX/pm2-ls.js +483 -0
  41. package/lib/API/Version.js +382 -0
  42. package/lib/API/interpreter.json +12 -0
  43. package/lib/API/pm2-plus/PM2IO.js +372 -0
  44. package/lib/API/pm2-plus/auth-strategies/CliAuth.js +288 -0
  45. package/lib/API/pm2-plus/auth-strategies/WebAuth.js +187 -0
  46. package/lib/API/pm2-plus/helpers.js +97 -0
  47. package/lib/API/pm2-plus/link.js +126 -0
  48. package/lib/API/pm2-plus/pres/motd +16 -0
  49. package/lib/API/pm2-plus/pres/motd.update +26 -0
  50. package/lib/API/pm2-plus/pres/welcome +28 -0
  51. package/lib/API/pm2-plus/process-selector.js +52 -0
  52. package/lib/API/schema.json +379 -0
  53. package/lib/API.js +1931 -0
  54. package/lib/Client.js +776 -0
  55. package/lib/Common.js +911 -0
  56. package/lib/Configuration.js +304 -0
  57. package/lib/Daemon.js +456 -0
  58. package/lib/Event.js +37 -0
  59. package/lib/God/ActionMethods.js +909 -0
  60. package/lib/God/ClusterMode.js +97 -0
  61. package/lib/God/ForkMode.js +297 -0
  62. package/lib/God/Methods.js +265 -0
  63. package/lib/God/Reload.js +240 -0
  64. package/lib/God.js +632 -0
  65. package/lib/HttpInterface.js +76 -0
  66. package/lib/ProcessContainer.js +305 -0
  67. package/lib/ProcessContainerBun.js +360 -0
  68. package/lib/ProcessContainerFork.js +42 -0
  69. package/lib/ProcessContainerForkBun.js +33 -0
  70. package/lib/ProcessUtils.js +55 -0
  71. package/lib/TreeKill.js +118 -0
  72. package/lib/Utility.js +430 -0
  73. package/lib/VersionCheck.js +46 -0
  74. package/lib/Watcher.js +117 -0
  75. package/lib/Worker.js +169 -0
  76. package/lib/binaries/CLI.js +1041 -0
  77. package/lib/binaries/DevCLI.js +183 -0
  78. package/lib/binaries/Runtime.js +101 -0
  79. package/lib/binaries/Runtime4Docker.js +192 -0
  80. package/lib/completion.js +229 -0
  81. package/lib/completion.sh +40 -0
  82. package/lib/motd +36 -0
  83. package/lib/templates/Dockerfiles/Dockerfile-java.tpl +7 -0
  84. package/lib/templates/Dockerfiles/Dockerfile-nodejs.tpl +8 -0
  85. package/lib/templates/Dockerfiles/Dockerfile-ruby.tpl +7 -0
  86. package/lib/templates/ecosystem-es.tpl +24 -0
  87. package/lib/templates/ecosystem-simple-es.tpl +8 -0
  88. package/lib/templates/ecosystem-simple.tpl +6 -0
  89. package/lib/templates/ecosystem.tpl +22 -0
  90. package/lib/templates/init-scripts/launchd.tpl +35 -0
  91. package/lib/templates/init-scripts/openrc.tpl +52 -0
  92. package/lib/templates/init-scripts/pm2-init-amazon.sh +86 -0
  93. package/lib/templates/init-scripts/rcd-openbsd.tpl +41 -0
  94. package/lib/templates/init-scripts/rcd.tpl +44 -0
  95. package/lib/templates/init-scripts/smf.tpl +43 -0
  96. package/lib/templates/init-scripts/systemd-online.tpl +22 -0
  97. package/lib/templates/init-scripts/systemd.tpl +22 -0
  98. package/lib/templates/init-scripts/upstart.tpl +103 -0
  99. package/lib/templates/logrotate.d/pm2 +10 -0
  100. package/lib/templates/sample-apps/http-server/README.md +14 -0
  101. package/lib/templates/sample-apps/http-server/api.js +9 -0
  102. package/lib/templates/sample-apps/http-server/ecosystem.config.js +14 -0
  103. package/lib/templates/sample-apps/http-server/package.json +11 -0
  104. package/lib/templates/sample-apps/pm2-plus-metrics-actions/README.md +45 -0
  105. package/lib/templates/sample-apps/pm2-plus-metrics-actions/custom-metrics.js +66 -0
  106. package/lib/templates/sample-apps/pm2-plus-metrics-actions/ecosystem.config.js +12 -0
  107. package/lib/templates/sample-apps/pm2-plus-metrics-actions/package.json +11 -0
  108. package/lib/templates/sample-apps/python-app/README.md +4 -0
  109. package/lib/templates/sample-apps/python-app/echo.py +7 -0
  110. package/lib/templates/sample-apps/python-app/ecosystem.config.js +12 -0
  111. package/lib/templates/sample-apps/python-app/package.json +11 -0
  112. package/lib/tools/Config.js +248 -0
  113. package/lib/tools/IsAbsolute.js +20 -0
  114. package/lib/tools/copydirSync.js +101 -0
  115. package/lib/tools/deleteFolderRecursive.js +19 -0
  116. package/lib/tools/find-package-json.js +74 -0
  117. package/lib/tools/fmt.js +72 -0
  118. package/lib/tools/isbinaryfile.js +94 -0
  119. package/lib/tools/json5.js +752 -0
  120. package/lib/tools/open.js +63 -0
  121. package/lib/tools/passwd.js +58 -0
  122. package/lib/tools/promise.min.js +1 -0
  123. package/lib/tools/sexec.js +55 -0
  124. package/lib/tools/treeify.js +113 -0
  125. package/lib/tools/which.js +120 -0
  126. package/lib/tools/xdg-open +861 -0
  127. package/package.json +219 -0
  128. package/paths.js +93 -0
  129. package/pm2 +11 -0
  130. package/preinstall.js +24 -0
  131. package/run.sh +9 -0
  132. package/types/index.d.ts +722 -0
  133. package/types/tsconfig.json +14 -0
package/README.md ADDED
@@ -0,0 +1,248 @@
1
+ <div align="center">
2
+ <br/>
3
+
4
+ ![https://raw.githubusercontent.com/Unitech/pm2/master/pres/pm2-logo-2.png](https://raw.githubusercontent.com/Unitech/pm2/master/pres/pm2-logo-2.png)
5
+
6
+ <b>P</b>(rocess) <b>M</b>(anager) <b>2</b><br/>
7
+ <i>Runtime Edition</i>
8
+ <br/><br/>
9
+
10
+
11
+ <a title="PM2 Downloads" href="https://npm-stat.com/charts.html?package=pm2&from=2018-01-01&to=2023-08-01">
12
+ <img src="https://img.shields.io/npm/dm/pm2" alt="Downloads per Month"/>
13
+ </a>
14
+
15
+ <a title="PM2 Downloads" href="https://npm-stat.com/charts.html?package=pm2&from=2018-01-01&to=2023-08-01">
16
+ <img src="https://img.shields.io/npm/dy/pm2" alt="Downloads per Year"/>
17
+ </a>
18
+
19
+ <a href="https://badge.fury.io/js/pm2" title="NPM Version Badge">
20
+ <img src="https://badge.fury.io/js/pm2.svg" alt="npm version">
21
+ </a>
22
+
23
+ <br/>
24
+ <br/>
25
+ <br/>
26
+ </div>
27
+
28
+
29
+ PM2 is a production process manager for Node.js/Bun applications with a built-in load balancer. It allows you to keep applications alive forever, to reload them without downtime and to facilitate common system admin tasks.
30
+
31
+ Starting an application in production mode is as easy as:
32
+
33
+ ```bash
34
+ $ pm2 start app.js
35
+ ```
36
+
37
+ PM2 is constantly assailed by [more than 1800 tests](https://github.com/Unitech/pm2/actions/workflows/node.js.yml).
38
+
39
+ Official website: [https://pm2.keymetrics.io/](https://pm2.keymetrics.io/)
40
+
41
+ Works on Linux (stable) & macOS (stable) & Windows (stable). All Node.js versions are supported starting Node.js 12.X and Bun since v1
42
+
43
+
44
+ ## Installing PM2
45
+
46
+ ### With NPM
47
+
48
+ ```bash
49
+ $ npm install pm2 -g
50
+ ```
51
+
52
+ ### With Bun
53
+
54
+ ```bash
55
+ $ bun install pm2 -g
56
+ ```
57
+ **Please note that you might need to symlink node to bun if you only want to use bun via `sudo ln -s /home/$USER/.bun/bin/bun /usr/bin/node`**
58
+
59
+ ___
60
+
61
+ You can install Node.js easily with [NVM](https://github.com/nvm-sh/nvm#installing-and-updating) or [FNM](https://github.com/Schniz/fnm) or install Bun with `curl -fsSL https://bun.sh/install | bash`
62
+
63
+ ### Start an application
64
+
65
+ You can start any application (Node.js, Bun, and also Python, Ruby, binaries in $PATH...) like that:
66
+
67
+ ```bash
68
+ $ pm2 start app.js
69
+ ```
70
+
71
+ Your app is now daemonized, monitored and kept alive forever.
72
+
73
+ ### Managing Applications
74
+
75
+ Once applications are started you can manage them easily:
76
+
77
+ ![Process listing](https://github.com/Unitech/pm2/raw/master/pres/pm2-ls-v2.png)
78
+
79
+ To list all running applications:
80
+
81
+ ```bash
82
+ $ pm2 list
83
+ ```
84
+
85
+ Managing apps is straightforward:
86
+
87
+ ```bash
88
+ $ pm2 stop <app_name|namespace|id|'all'|json_conf>
89
+ $ pm2 restart <app_name|namespace|id|'all'|json_conf>
90
+ $ pm2 delete <app_name|namespace|id|'all'|json_conf>
91
+ ```
92
+
93
+ To have more details on a specific application:
94
+
95
+ ```bash
96
+ $ pm2 describe <id|app_name>
97
+ ```
98
+
99
+ To monitor logs, custom metrics, application information:
100
+
101
+ ```bash
102
+ $ pm2 monit
103
+ ```
104
+
105
+ [More about Process Management](https://pm2.keymetrics.io/docs/usage/process-management/)
106
+
107
+ ### Cluster Mode: Node.js Load Balancing & Zero Downtime Reload
108
+
109
+ 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).
110
+
111
+ ![Framework supported](https://raw.githubusercontent.com/Unitech/PM2/master/pres/cluster.png)
112
+
113
+ Starting a Node.js application in cluster mode that will leverage all CPUs available:
114
+
115
+ ```bash
116
+ $ pm2 start api.js -i <processes>
117
+ ```
118
+
119
+ `<processes>` can be `'max'`, `-1` (all cpu minus 1) or a specified number of instances to start.
120
+
121
+ **Zero Downtime Reload**
122
+
123
+ Hot Reload allows to update an application without any downtime:
124
+
125
+ ```bash
126
+ $ pm2 reload all
127
+ ```
128
+
129
+ [More informations about how PM2 make clustering easy](https://pm2.keymetrics.io/docs/usage/cluster-mode/)
130
+
131
+ ### Container Support
132
+
133
+ With the drop-in replacement command for `node`, called `pm2-runtime`, run your Node.js application in a hardened production environment.
134
+ Using it is seamless:
135
+
136
+ ```
137
+ RUN npm install pm2 -g
138
+ CMD [ "pm2-runtime", "npm", "--", "start" ]
139
+ ```
140
+
141
+ [Read More about the dedicated integration](https://pm2.keymetrics.io/docs/usage/docker-pm2-nodejs/)
142
+
143
+ ### Host monitoring speedbar
144
+
145
+ PM2 allows to monitor your host/server vitals with a monitoring speedbar.
146
+
147
+ To enable host monitoring:
148
+
149
+ ```bash
150
+ $ pm2 set pm2:sysmonit true
151
+ $ pm2 update
152
+ ```
153
+
154
+ ![Framework supported](https://raw.githubusercontent.com/Unitech/PM2/master/pres/vitals.png)
155
+
156
+ ### Terminal Based Monitoring
157
+
158
+ ![Monit](https://github.com/Unitech/pm2/raw/master/pres/pm2-monit.png)
159
+
160
+ Monitor all processes launched straight from the command line:
161
+
162
+ ```bash
163
+ $ pm2 monit
164
+ ```
165
+
166
+ ### Log Management
167
+
168
+ To consult logs just type the command:
169
+
170
+ ```bash
171
+ $ pm2 logs
172
+ ```
173
+
174
+ Standard, Raw, JSON and formated output are available.
175
+
176
+ Examples:
177
+
178
+ ```bash
179
+ $ pm2 logs APP-NAME # Display APP-NAME logs
180
+ $ pm2 logs --json # JSON output
181
+ $ pm2 logs --format # Formated output
182
+
183
+ $ pm2 flush # Flush all logs
184
+ $ pm2 reloadLogs # Reload all logs
185
+ ```
186
+
187
+ To enable log rotation install the following module
188
+
189
+ ```bash
190
+ $ pm2 install pm2-logrotate
191
+ ```
192
+
193
+ [More about log management](https://pm2.keymetrics.io/docs/usage/log-management/)
194
+
195
+ ### Startup Scripts Generation
196
+
197
+ PM2 can generate and configure a Startup Script to keep PM2 and your processes alive at every server restart.
198
+
199
+ Init Systems Supported: **systemd**, **upstart**, **launchd**, **rc.d**
200
+
201
+ ```bash
202
+ # Generate Startup Script
203
+ $ pm2 startup
204
+
205
+ # Freeze your process list across server restart
206
+ $ pm2 save
207
+
208
+ # Remove Startup Script
209
+ $ pm2 unstartup
210
+ ```
211
+
212
+ [More about Startup Scripts Generation](https://pm2.keymetrics.io/docs/usage/startup/)
213
+
214
+ ### Updating PM2
215
+
216
+ ```bash
217
+ # Install latest PM2 version
218
+ $ npm install pm2@latest -g
219
+ # Save process list, exit old PM2 & restore all processes
220
+ $ pm2 update
221
+ ```
222
+
223
+ *PM2 updates are seamless*
224
+
225
+ ## PM2+ Monitoring
226
+
227
+ If you manage your apps with PM2, PM2+ makes it easy to monitor and manage apps across servers.
228
+
229
+ ![https://app.pm2.io/](https://pm2.io/img/app-overview.png)
230
+
231
+ Feel free to try it:
232
+
233
+ [Discover the monitoring dashboard for PM2](https://app.pm2.io/)
234
+
235
+ Thanks in advance and we hope that you like PM2!
236
+
237
+ ## CHANGELOG
238
+
239
+ [CHANGELOG](https://github.com/Unitech/PM2/blob/master/CHANGELOG.md)
240
+
241
+ ## Contributors
242
+
243
+ [Contributors](http://pm2.keymetrics.io/hall-of-fame/)
244
+
245
+ ## License
246
+
247
+ PM2 is made available under the terms of the GNU Affero General Public License 3.0 (AGPL 3.0).
248
+ For other licenses [contact us](mailto:contact@keymetrics.io).
package/bin/zm2 ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+
3
+ require('../lib/binaries/CLI.js');
package/bin/zm2-dev ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+
3
+ require('../lib/binaries/DevCLI.js');
package/bin/zm2-docker ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+
3
+ require('../lib/binaries/Runtime4Docker.js');
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+
3
+ require('../lib/binaries/Runtime4Docker.js');
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+
3
+ require('../lib/binaries/CLI.js');
package/bin/zm2.ps1 ADDED
@@ -0,0 +1,3 @@
1
+ # pm2.ps1
2
+ $pm2Path = Join-Path $PSScriptRoot "../lib/binaries/CLI.js"
3
+ node $pm2Path $args