@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/bun.lock ADDED
@@ -0,0 +1,421 @@
1
+ {
2
+ "lockfileVersion": 1,
3
+ "workspaces": {
4
+ "": {
5
+ "name": "pm2",
6
+ "dependencies": {
7
+ "@pm2/agent": "~2.1.1",
8
+ "@pm2/io": "~6.1.0",
9
+ "@pm2/js-api": "~0.8.0",
10
+ "@pm2/pm2-version-check": "latest",
11
+ "ansis": "4.0.0-node10",
12
+ "async": "~3.2.6",
13
+ "blessed": "0.1.81",
14
+ "chokidar": "^3.5.3",
15
+ "cli-tableau": "^2.0.0",
16
+ "commander": "2.15.1",
17
+ "croner": "~4.1.92",
18
+ "dayjs": "~1.11.13",
19
+ "debug": "^4.3.7",
20
+ "enquirer": "2.3.6",
21
+ "eventemitter2": "5.0.1",
22
+ "fclone": "1.0.11",
23
+ "js-yaml": "~4.1.0",
24
+ "mkdirp": "1.0.4",
25
+ "needle": "2.4.0",
26
+ "pidusage": "~3.0",
27
+ "pm2-axon": "~4.0.1",
28
+ "pm2-axon-rpc": "~0.7.1",
29
+ "pm2-deploy": "~1.0.2",
30
+ "pm2-multimeter": "^0.1.2",
31
+ "promptly": "^2",
32
+ "semver": "^7.6.2",
33
+ "source-map-support": "0.5.21",
34
+ "sprintf-js": "1.1.2",
35
+ "vizion": "~2.2.1",
36
+ },
37
+ "devDependencies": {
38
+ "mocha": "^10.8.0",
39
+ "should": "^13.2.3",
40
+ },
41
+ "optionalDependencies": {
42
+ "pm2-sysmonit": "^1.2.8",
43
+ },
44
+ },
45
+ },
46
+ "packages": {
47
+ "@pm2/agent": ["@pm2/agent@2.1.1", "", { "dependencies": { "async": "~3.2.0", "chalk": "~3.0.0", "dayjs": "~1.8.24", "debug": "~4.3.1", "eventemitter2": "~5.0.1", "fast-json-patch": "^3.1.0", "fclone": "~1.0.11", "pm2-axon": "~4.0.1", "pm2-axon-rpc": "~0.7.0", "proxy-agent": "~6.4.0", "semver": "~7.5.0", "ws": "~7.5.10" } }, ""],
48
+
49
+ "@pm2/io": ["@pm2/io@6.1.0", "", { "dependencies": { "async": "~2.6.1", "debug": "~4.3.1", "eventemitter2": "^6.3.1", "require-in-the-middle": "^5.0.0", "semver": "~7.5.4", "shimmer": "^1.2.0", "signal-exit": "^3.0.3", "tslib": "1.9.3" } }, ""],
50
+
51
+ "@pm2/js-api": ["@pm2/js-api@0.8.0", "", { "dependencies": { "async": "^2.6.3", "debug": "~4.3.1", "eventemitter2": "^6.3.1", "extrareqp2": "^1.0.0", "ws": "^7.0.0" } }, ""],
52
+
53
+ "@pm2/pm2-version-check": ["@pm2/pm2-version-check@1.0.4", "", { "dependencies": { "debug": "^4.3.1" } }, "sha512-SXsM27SGH3yTWKc2fKR4SYNxsmnvuBQ9dd6QHtEWmiZ/VqaOYPAIlS8+vMcn27YLtAEBGvNRSh3TPNvtjZgfqA=="],
54
+
55
+ "@tootallnate/quickjs-emscripten": ["@tootallnate/quickjs-emscripten@0.23.0", "", {}, ""],
56
+
57
+ "agent-base": ["agent-base@7.1.3", "", {}, ""],
58
+
59
+ "amp": ["amp@0.3.1", "", {}, ""],
60
+
61
+ "amp-message": ["amp-message@0.1.2", "", { "dependencies": { "amp": "0.3.1" } }, ""],
62
+
63
+ "ansi-colors": ["ansi-colors@4.1.3", "", {}, ""],
64
+
65
+ "ansi-regex": ["ansi-regex@5.0.1", "", {}, ""],
66
+
67
+ "ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, ""],
68
+
69
+ "ansis": ["ansis@4.0.0-node10", "", {}, ""],
70
+
71
+ "anymatch": ["anymatch@3.1.3", "", { "dependencies": { "normalize-path": "^3.0.0", "picomatch": "^2.0.4" } }, ""],
72
+
73
+ "argparse": ["argparse@2.0.1", "", {}, ""],
74
+
75
+ "ast-types": ["ast-types@0.13.4", "", { "dependencies": { "tslib": "^2.0.1" } }, ""],
76
+
77
+ "async": ["async@3.2.6", "", {}, ""],
78
+
79
+ "balanced-match": ["balanced-match@1.0.2", "", {}, ""],
80
+
81
+ "basic-ftp": ["basic-ftp@5.0.5", "", {}, ""],
82
+
83
+ "binary-extensions": ["binary-extensions@2.3.0", "", {}, ""],
84
+
85
+ "blessed": ["blessed@0.1.81", "", { "bin": "bin/tput.js" }, ""],
86
+
87
+ "bodec": ["bodec@0.1.0", "", {}, ""],
88
+
89
+ "brace-expansion": ["brace-expansion@2.0.1", "", { "dependencies": { "balanced-match": "^1.0.0" } }, ""],
90
+
91
+ "braces": ["braces@3.0.3", "", { "dependencies": { "fill-range": "^7.1.1" } }, ""],
92
+
93
+ "browser-stdout": ["browser-stdout@1.3.1", "", {}, ""],
94
+
95
+ "buffer-from": ["buffer-from@1.1.2", "", {}, ""],
96
+
97
+ "camelcase": ["camelcase@6.3.0", "", {}, ""],
98
+
99
+ "chalk": ["chalk@3.0.0", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, ""],
100
+
101
+ "charm": ["charm@0.1.2", "", {}, ""],
102
+
103
+ "chokidar": ["chokidar@3.6.0", "", { "dependencies": { "anymatch": "~3.1.2", "braces": "~3.0.2", "glob-parent": "~5.1.2", "is-binary-path": "~2.1.0", "is-glob": "~4.0.1", "normalize-path": "~3.0.0", "readdirp": "~3.6.0" }, "optionalDependencies": { "fsevents": "~2.3.2" } }, ""],
104
+
105
+ "cli-tableau": ["cli-tableau@2.0.1", "", { "dependencies": { "chalk": "3.0.0" } }, ""],
106
+
107
+ "cliui": ["cliui@7.0.4", "", { "dependencies": { "string-width": "^4.2.0", "strip-ansi": "^6.0.0", "wrap-ansi": "^7.0.0" } }, ""],
108
+
109
+ "color-convert": ["color-convert@2.0.1", "", { "dependencies": { "color-name": "~1.1.4" } }, ""],
110
+
111
+ "color-name": ["color-name@1.1.4", "", {}, ""],
112
+
113
+ "commander": ["commander@2.15.1", "", {}, ""],
114
+
115
+ "croner": ["croner@4.1.97", "", {}, ""],
116
+
117
+ "culvert": ["culvert@0.1.2", "", {}, ""],
118
+
119
+ "data-uri-to-buffer": ["data-uri-to-buffer@6.0.2", "", {}, ""],
120
+
121
+ "dayjs": ["dayjs@1.11.13", "", {}, ""],
122
+
123
+ "debug": ["debug@4.4.1", "", { "dependencies": { "ms": "^2.1.3" } }, ""],
124
+
125
+ "decamelize": ["decamelize@4.0.0", "", {}, ""],
126
+
127
+ "degenerator": ["degenerator@5.0.1", "", { "dependencies": { "ast-types": "^0.13.4", "escodegen": "^2.1.0", "esprima": "^4.0.1" } }, ""],
128
+
129
+ "diff": ["diff@5.2.0", "", {}, ""],
130
+
131
+ "emoji-regex": ["emoji-regex@8.0.0", "", {}, ""],
132
+
133
+ "enquirer": ["enquirer@2.3.6", "", { "dependencies": { "ansi-colors": "^4.1.1" } }, ""],
134
+
135
+ "escalade": ["escalade@3.2.0", "", {}, ""],
136
+
137
+ "escape-string-regexp": ["escape-string-regexp@4.0.0", "", {}, ""],
138
+
139
+ "escodegen": ["escodegen@2.1.0", "", { "dependencies": { "esprima": "^4.0.1", "estraverse": "^5.2.0", "esutils": "^2.0.2" }, "optionalDependencies": { "source-map": "~0.6.1" }, "bin": { "escodegen": "bin/escodegen.js", "esgenerate": "bin/esgenerate.js" } }, ""],
140
+
141
+ "esprima": ["esprima@4.0.1", "", { "bin": { "esparse": "bin/esparse.js", "esvalidate": "bin/esvalidate.js" } }, ""],
142
+
143
+ "estraverse": ["estraverse@5.3.0", "", {}, ""],
144
+
145
+ "esutils": ["esutils@2.0.3", "", {}, ""],
146
+
147
+ "eventemitter2": ["eventemitter2@5.0.1", "", {}, ""],
148
+
149
+ "extrareqp2": ["extrareqp2@1.0.0", "", { "dependencies": { "follow-redirects": "^1.14.0" } }, ""],
150
+
151
+ "fast-json-patch": ["fast-json-patch@3.1.1", "", {}, ""],
152
+
153
+ "fclone": ["fclone@1.0.11", "", {}, ""],
154
+
155
+ "fill-range": ["fill-range@7.1.1", "", { "dependencies": { "to-regex-range": "^5.0.1" } }, ""],
156
+
157
+ "find-up": ["find-up@5.0.0", "", { "dependencies": { "locate-path": "^6.0.0", "path-exists": "^4.0.0" } }, ""],
158
+
159
+ "flat": ["flat@5.0.2", "", { "bin": "cli.js" }, ""],
160
+
161
+ "follow-redirects": ["follow-redirects@1.15.9", "", {}, ""],
162
+
163
+ "fs.realpath": ["fs.realpath@1.0.0", "", {}, ""],
164
+
165
+ "fsevents": ["fsevents@2.3.3", "", { "os": "darwin" }, ""],
166
+
167
+ "function-bind": ["function-bind@1.1.2", "", {}, ""],
168
+
169
+ "get-caller-file": ["get-caller-file@2.0.5", "", {}, ""],
170
+
171
+ "get-uri": ["get-uri@6.0.4", "", { "dependencies": { "basic-ftp": "^5.0.2", "data-uri-to-buffer": "^6.0.2", "debug": "^4.3.4" } }, ""],
172
+
173
+ "git-node-fs": ["git-node-fs@1.0.0", "", {}, ""],
174
+
175
+ "git-sha1": ["git-sha1@0.1.2", "", {}, ""],
176
+
177
+ "glob": ["glob@8.1.0", "", { "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^5.0.1", "once": "^1.3.0" } }, ""],
178
+
179
+ "glob-parent": ["glob-parent@5.1.2", "", { "dependencies": { "is-glob": "^4.0.1" } }, ""],
180
+
181
+ "has-flag": ["has-flag@4.0.0", "", {}, ""],
182
+
183
+ "hasown": ["hasown@2.0.2", "", { "dependencies": { "function-bind": "^1.1.2" } }, ""],
184
+
185
+ "he": ["he@1.2.0", "", { "bin": "bin/he" }, ""],
186
+
187
+ "http-proxy-agent": ["http-proxy-agent@7.0.2", "", { "dependencies": { "agent-base": "^7.1.0", "debug": "^4.3.4" } }, ""],
188
+
189
+ "https-proxy-agent": ["https-proxy-agent@7.0.6", "", { "dependencies": { "agent-base": "^7.1.2", "debug": "4" } }, ""],
190
+
191
+ "iconv-lite": ["iconv-lite@0.4.24", "", { "dependencies": { "safer-buffer": ">= 2.1.2 < 3" } }, ""],
192
+
193
+ "inflight": ["inflight@1.0.6", "", { "dependencies": { "once": "^1.3.0", "wrappy": "1" } }, ""],
194
+
195
+ "inherits": ["inherits@2.0.4", "", {}, ""],
196
+
197
+ "ini": ["ini@1.3.8", "", {}, ""],
198
+
199
+ "ip-address": ["ip-address@9.0.5", "", { "dependencies": { "jsbn": "1.1.0", "sprintf-js": "^1.1.3" } }, ""],
200
+
201
+ "is-binary-path": ["is-binary-path@2.1.0", "", { "dependencies": { "binary-extensions": "^2.0.0" } }, ""],
202
+
203
+ "is-core-module": ["is-core-module@2.16.1", "", { "dependencies": { "hasown": "^2.0.2" } }, ""],
204
+
205
+ "is-extglob": ["is-extglob@2.1.1", "", {}, ""],
206
+
207
+ "is-fullwidth-code-point": ["is-fullwidth-code-point@3.0.0", "", {}, ""],
208
+
209
+ "is-glob": ["is-glob@4.0.3", "", { "dependencies": { "is-extglob": "^2.1.1" } }, ""],
210
+
211
+ "is-number": ["is-number@7.0.0", "", {}, ""],
212
+
213
+ "is-plain-obj": ["is-plain-obj@2.1.0", "", {}, ""],
214
+
215
+ "is-unicode-supported": ["is-unicode-supported@0.1.0", "", {}, ""],
216
+
217
+ "js-git": ["js-git@0.7.8", "", { "dependencies": { "bodec": "^0.1.0", "culvert": "^0.1.2", "git-sha1": "^0.1.2", "pako": "^0.2.5" } }, ""],
218
+
219
+ "js-yaml": ["js-yaml@4.1.0", "", { "dependencies": { "argparse": "^2.0.1" }, "bin": "bin/js-yaml.js" }, ""],
220
+
221
+ "jsbn": ["jsbn@1.1.0", "", {}, ""],
222
+
223
+ "json-stringify-safe": ["json-stringify-safe@5.0.1", "", {}, ""],
224
+
225
+ "locate-path": ["locate-path@6.0.0", "", { "dependencies": { "p-locate": "^5.0.0" } }, ""],
226
+
227
+ "lodash": ["lodash@4.17.21", "", {}, ""],
228
+
229
+ "log-symbols": ["log-symbols@4.1.0", "", { "dependencies": { "chalk": "^4.1.0", "is-unicode-supported": "^0.1.0" } }, ""],
230
+
231
+ "lru-cache": ["lru-cache@7.18.3", "", {}, ""],
232
+
233
+ "minimatch": ["minimatch@5.1.6", "", { "dependencies": { "brace-expansion": "^2.0.1" } }, ""],
234
+
235
+ "mkdirp": ["mkdirp@1.0.4", "", { "bin": "bin/cmd.js" }, ""],
236
+
237
+ "mocha": ["mocha@10.8.2", "", { "dependencies": { "ansi-colors": "^4.1.3", "browser-stdout": "^1.3.1", "chokidar": "^3.5.3", "debug": "^4.3.5", "diff": "^5.2.0", "escape-string-regexp": "^4.0.0", "find-up": "^5.0.0", "glob": "^8.1.0", "he": "^1.2.0", "js-yaml": "^4.1.0", "log-symbols": "^4.1.0", "minimatch": "^5.1.6", "ms": "^2.1.3", "serialize-javascript": "^6.0.2", "strip-json-comments": "^3.1.1", "supports-color": "^8.1.1", "workerpool": "^6.5.1", "yargs": "^16.2.0", "yargs-parser": "^20.2.9", "yargs-unparser": "^2.0.0" }, "bin": { "_mocha": "bin/_mocha", "mocha": "bin/mocha.js" } }, ""],
238
+
239
+ "module-details-from-path": ["module-details-from-path@1.0.4", "", {}, ""],
240
+
241
+ "ms": ["ms@2.1.3", "", {}, ""],
242
+
243
+ "mute-stream": ["mute-stream@0.0.8", "", {}, ""],
244
+
245
+ "needle": ["needle@2.4.0", "", { "dependencies": { "debug": "^3.2.6", "iconv-lite": "^0.4.4", "sax": "^1.2.4" }, "bin": "bin/needle" }, ""],
246
+
247
+ "netmask": ["netmask@2.0.2", "", {}, ""],
248
+
249
+ "normalize-path": ["normalize-path@3.0.0", "", {}, ""],
250
+
251
+ "once": ["once@1.4.0", "", { "dependencies": { "wrappy": "1" } }, ""],
252
+
253
+ "p-limit": ["p-limit@3.1.0", "", { "dependencies": { "yocto-queue": "^0.1.0" } }, ""],
254
+
255
+ "p-locate": ["p-locate@5.0.0", "", { "dependencies": { "p-limit": "^3.0.2" } }, ""],
256
+
257
+ "pac-proxy-agent": ["pac-proxy-agent@7.2.0", "", { "dependencies": { "@tootallnate/quickjs-emscripten": "^0.23.0", "agent-base": "^7.1.2", "debug": "^4.3.4", "get-uri": "^6.0.1", "http-proxy-agent": "^7.0.0", "https-proxy-agent": "^7.0.6", "pac-resolver": "^7.0.1", "socks-proxy-agent": "^8.0.5" } }, ""],
258
+
259
+ "pac-resolver": ["pac-resolver@7.0.1", "", { "dependencies": { "degenerator": "^5.0.0", "netmask": "^2.0.2" } }, ""],
260
+
261
+ "pako": ["pako@0.2.9", "", {}, ""],
262
+
263
+ "path-exists": ["path-exists@4.0.0", "", {}, ""],
264
+
265
+ "path-parse": ["path-parse@1.0.7", "", {}, ""],
266
+
267
+ "picomatch": ["picomatch@2.3.1", "", {}, ""],
268
+
269
+ "pidusage": ["pidusage@3.0.2", "", { "dependencies": { "safe-buffer": "^5.2.1" } }, ""],
270
+
271
+ "pm2-axon": ["pm2-axon@4.0.1", "", { "dependencies": { "amp": "~0.3.1", "amp-message": "~0.1.1", "debug": "^4.3.1", "escape-string-regexp": "^4.0.0" } }, ""],
272
+
273
+ "pm2-axon-rpc": ["pm2-axon-rpc@0.7.1", "", { "dependencies": { "debug": "^4.3.1" } }, ""],
274
+
275
+ "pm2-deploy": ["pm2-deploy@1.0.2", "", { "dependencies": { "run-series": "^1.1.8", "tv4": "^1.3.0" } }, ""],
276
+
277
+ "pm2-multimeter": ["pm2-multimeter@0.1.2", "", { "dependencies": { "charm": "~0.1.1" } }, ""],
278
+
279
+ "pm2-sysmonit": ["pm2-sysmonit@1.2.8", "", { "dependencies": { "async": "^3.2.0", "debug": "^4.3.1", "pidusage": "^2.0.21", "systeminformation": "^5.7", "tx2": "~1.0.4" } }, ""],
280
+
281
+ "promptly": ["promptly@2.2.0", "", { "dependencies": { "read": "^1.0.4" } }, ""],
282
+
283
+ "proxy-agent": ["proxy-agent@6.4.0", "", { "dependencies": { "agent-base": "^7.0.2", "debug": "^4.3.4", "http-proxy-agent": "^7.0.1", "https-proxy-agent": "^7.0.3", "lru-cache": "^7.14.1", "pac-proxy-agent": "^7.0.1", "proxy-from-env": "^1.1.0", "socks-proxy-agent": "^8.0.2" } }, ""],
284
+
285
+ "proxy-from-env": ["proxy-from-env@1.1.0", "", {}, ""],
286
+
287
+ "randombytes": ["randombytes@2.1.0", "", { "dependencies": { "safe-buffer": "^5.1.0" } }, ""],
288
+
289
+ "read": ["read@1.0.7", "", { "dependencies": { "mute-stream": "~0.0.4" } }, ""],
290
+
291
+ "readdirp": ["readdirp@3.6.0", "", { "dependencies": { "picomatch": "^2.2.1" } }, ""],
292
+
293
+ "require-directory": ["require-directory@2.1.1", "", {}, ""],
294
+
295
+ "require-in-the-middle": ["require-in-the-middle@5.2.0", "", { "dependencies": { "debug": "^4.1.1", "module-details-from-path": "^1.0.3", "resolve": "^1.22.1" } }, ""],
296
+
297
+ "resolve": ["resolve@1.22.10", "", { "dependencies": { "is-core-module": "^2.16.0", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, "bin": "bin/resolve" }, ""],
298
+
299
+ "run-series": ["run-series@1.1.9", "", {}, ""],
300
+
301
+ "safe-buffer": ["safe-buffer@5.2.1", "", {}, ""],
302
+
303
+ "safer-buffer": ["safer-buffer@2.1.2", "", {}, ""],
304
+
305
+ "sax": ["sax@1.4.1", "", {}, ""],
306
+
307
+ "semver": ["semver@7.7.2", "", { "bin": "bin/semver.js" }, ""],
308
+
309
+ "serialize-javascript": ["serialize-javascript@6.0.2", "", { "dependencies": { "randombytes": "^2.1.0" } }, ""],
310
+
311
+ "shimmer": ["shimmer@1.2.1", "", {}, ""],
312
+
313
+ "should": ["should@13.2.3", "", { "dependencies": { "should-equal": "^2.0.0", "should-format": "^3.0.3", "should-type": "^1.4.0", "should-type-adaptors": "^1.0.1", "should-util": "^1.0.0" } }, ""],
314
+
315
+ "should-equal": ["should-equal@2.0.0", "", { "dependencies": { "should-type": "^1.4.0" } }, ""],
316
+
317
+ "should-format": ["should-format@3.0.3", "", { "dependencies": { "should-type": "^1.3.0", "should-type-adaptors": "^1.0.1" } }, ""],
318
+
319
+ "should-type": ["should-type@1.4.0", "", {}, ""],
320
+
321
+ "should-type-adaptors": ["should-type-adaptors@1.1.0", "", { "dependencies": { "should-type": "^1.3.0", "should-util": "^1.0.0" } }, ""],
322
+
323
+ "should-util": ["should-util@1.0.1", "", {}, ""],
324
+
325
+ "signal-exit": ["signal-exit@3.0.7", "", {}, ""],
326
+
327
+ "smart-buffer": ["smart-buffer@4.2.0", "", {}, ""],
328
+
329
+ "socks": ["socks@2.8.4", "", { "dependencies": { "ip-address": "^9.0.5", "smart-buffer": "^4.2.0" } }, ""],
330
+
331
+ "socks-proxy-agent": ["socks-proxy-agent@8.0.5", "", { "dependencies": { "agent-base": "^7.1.2", "debug": "^4.3.4", "socks": "^2.8.3" } }, ""],
332
+
333
+ "source-map": ["source-map@0.6.1", "", {}, ""],
334
+
335
+ "source-map-support": ["source-map-support@0.5.21", "", { "dependencies": { "buffer-from": "^1.0.0", "source-map": "^0.6.0" } }, ""],
336
+
337
+ "sprintf-js": ["sprintf-js@1.1.2", "", {}, ""],
338
+
339
+ "string-width": ["string-width@4.2.3", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, ""],
340
+
341
+ "strip-ansi": ["strip-ansi@6.0.1", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, ""],
342
+
343
+ "strip-json-comments": ["strip-json-comments@3.1.1", "", {}, ""],
344
+
345
+ "supports-color": ["supports-color@8.1.1", "", { "dependencies": { "has-flag": "^4.0.0" } }, ""],
346
+
347
+ "supports-preserve-symlinks-flag": ["supports-preserve-symlinks-flag@1.0.0", "", {}, ""],
348
+
349
+ "systeminformation": ["systeminformation@5.25.11", "", { "os": "!aix", "bin": "lib/cli.js" }, ""],
350
+
351
+ "to-regex-range": ["to-regex-range@5.0.1", "", { "dependencies": { "is-number": "^7.0.0" } }, ""],
352
+
353
+ "tslib": ["tslib@1.9.3", "", {}, ""],
354
+
355
+ "tv4": ["tv4@1.3.0", "", {}, ""],
356
+
357
+ "tx2": ["tx2@1.0.5", "", { "dependencies": { "json-stringify-safe": "^5.0.1" } }, ""],
358
+
359
+ "vizion": ["vizion@2.2.1", "", { "dependencies": { "async": "^2.6.3", "git-node-fs": "^1.0.0", "ini": "^1.3.5", "js-git": "^0.7.8" } }, ""],
360
+
361
+ "workerpool": ["workerpool@6.5.1", "", {}, ""],
362
+
363
+ "wrap-ansi": ["wrap-ansi@7.0.0", "", { "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } }, ""],
364
+
365
+ "wrappy": ["wrappy@1.0.2", "", {}, ""],
366
+
367
+ "ws": ["ws@7.5.10", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": "^5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, ""],
368
+
369
+ "y18n": ["y18n@5.0.8", "", {}, ""],
370
+
371
+ "yallist": ["yallist@4.0.0", "", {}, ""],
372
+
373
+ "yargs": ["yargs@16.2.0", "", { "dependencies": { "cliui": "^7.0.2", "escalade": "^3.1.1", "get-caller-file": "^2.0.5", "require-directory": "^2.1.1", "string-width": "^4.2.0", "y18n": "^5.0.5", "yargs-parser": "^20.2.2" } }, ""],
374
+
375
+ "yargs-parser": ["yargs-parser@20.2.9", "", {}, ""],
376
+
377
+ "yargs-unparser": ["yargs-unparser@2.0.0", "", { "dependencies": { "camelcase": "^6.0.0", "decamelize": "^4.0.0", "flat": "^5.0.2", "is-plain-obj": "^2.1.0" } }, ""],
378
+
379
+ "yocto-queue": ["yocto-queue@0.1.0", "", {}, ""],
380
+
381
+ "@pm2/agent/dayjs": ["dayjs@1.8.36", "", {}, ""],
382
+
383
+ "@pm2/agent/debug": ["debug@4.3.7", "", { "dependencies": { "ms": "^2.1.3" } }, ""],
384
+
385
+ "@pm2/agent/semver": ["semver@7.5.4", "", { "dependencies": { "lru-cache": "^6.0.0" }, "bin": "bin/semver.js" }, ""],
386
+
387
+ "@pm2/io/async": ["async@2.6.4", "", { "dependencies": { "lodash": "^4.17.14" } }, ""],
388
+
389
+ "@pm2/io/debug": ["debug@4.3.7", "", { "dependencies": { "ms": "^2.1.3" } }, ""],
390
+
391
+ "@pm2/io/eventemitter2": ["eventemitter2@6.4.9", "", {}, ""],
392
+
393
+ "@pm2/io/semver": ["semver@7.5.4", "", { "dependencies": { "lru-cache": "^6.0.0" }, "bin": "bin/semver.js" }, ""],
394
+
395
+ "@pm2/js-api/async": ["async@2.6.4", "", { "dependencies": { "lodash": "^4.17.14" } }, ""],
396
+
397
+ "@pm2/js-api/debug": ["debug@4.3.7", "", { "dependencies": { "ms": "^2.1.3" } }, ""],
398
+
399
+ "@pm2/js-api/eventemitter2": ["eventemitter2@6.4.9", "", {}, ""],
400
+
401
+ "ast-types/tslib": ["tslib@2.8.1", "", {}, ""],
402
+
403
+ "chalk/supports-color": ["supports-color@7.2.0", "", { "dependencies": { "has-flag": "^4.0.0" } }, ""],
404
+
405
+ "ip-address/sprintf-js": ["sprintf-js@1.1.3", "", {}, ""],
406
+
407
+ "log-symbols/chalk": ["chalk@4.1.2", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, ""],
408
+
409
+ "needle/debug": ["debug@3.2.7", "", { "dependencies": { "ms": "^2.1.1" } }, ""],
410
+
411
+ "pm2-sysmonit/pidusage": ["pidusage@2.0.21", "", { "dependencies": { "safe-buffer": "^5.2.1" } }, ""],
412
+
413
+ "vizion/async": ["async@2.6.4", "", { "dependencies": { "lodash": "^4.17.14" } }, ""],
414
+
415
+ "@pm2/agent/semver/lru-cache": ["lru-cache@6.0.0", "", { "dependencies": { "yallist": "^4.0.0" } }, ""],
416
+
417
+ "@pm2/io/semver/lru-cache": ["lru-cache@6.0.0", "", { "dependencies": { "yallist": "^4.0.0" } }, ""],
418
+
419
+ "log-symbols/chalk/supports-color": ["supports-color@7.2.0", "", { "dependencies": { "has-flag": "^4.0.0" } }, ""],
420
+ }
421
+ }
package/constants.js ADDED
@@ -0,0 +1,114 @@
1
+ /**
2
+ * Copyright 2013-2022 the PM2 project authors. All rights reserved.
3
+ * Use of this source code is governed by a license that
4
+ * can be found in the LICENSE file.
5
+ */
6
+
7
+ var debug = require('debug')('zm2:conf');
8
+ var p = require('path');
9
+ var util = require('util');
10
+ var chalk = require('ansis');
11
+
12
+ /**
13
+ * Get PM2 path structure
14
+ */
15
+ var path_structure = require('./paths.js')(process.env.OVER_HOME);
16
+
17
+ /**
18
+ * Constants variables used by PM2
19
+ */
20
+ var csts = {
21
+ PREFIX_MSG : chalk.green('[ZM2] '),
22
+ PREFIX_MSG_INFO : chalk.cyan('[ZM2][INFO] '),
23
+ PREFIX_MSG_ERR : chalk.red('[ZM2][ERROR] '),
24
+ PREFIX_MSG_MOD : chalk.bold.green('[ZM2][Module] '),
25
+ PREFIX_MSG_MOD_ERR : chalk.red('[ZM2][Module][ERROR] '),
26
+ PREFIX_MSG_WARNING : chalk.yellow('[ZM2][WARN] '),
27
+ PREFIX_MSG_SUCCESS : chalk.cyan('[ZM2] '),
28
+
29
+ PM2_IO_MSG : chalk.cyan('[ZM2 I/O]'),
30
+ PM2_IO_MSG_ERR : chalk.red('[ZM2 I/O]'),
31
+
32
+ TEMPLATE_FOLDER : p.join(__dirname, 'lib/templates'),
33
+
34
+ APP_CONF_DEFAULT_FILE : 'ecosystem.config.js',
35
+ APP_CONF_TPL : 'ecosystem.tpl',
36
+ APP_CONF_TPL_SIMPLE : 'ecosystem-simple.tpl',
37
+ SAMPLE_CONF_FILE : 'sample-conf.js',
38
+ LOGROTATE_SCRIPT : 'logrotate.d/zm2',
39
+
40
+ DOCKERFILE_NODEJS : 'Dockerfiles/Dockerfile-nodejs.tpl',
41
+ DOCKERFILE_JAVA : 'Dockerfiles/Dockerfile-java.tpl',
42
+ DOCKERFILE_RUBY : 'Dockerfiles/Dockerfile-ruby.tpl',
43
+
44
+ SUCCESS_EXIT : 0,
45
+ ERROR_EXIT : 1,
46
+ CODE_UNCAUGHTEXCEPTION : 1,
47
+
48
+ IS_BUN : typeof Bun !== 'undefined',
49
+ IS_WINDOWS : (process.platform === 'win32' || process.platform === 'win64' || /^(msys|cygwin)$/.test(process.env.OSTYPE)),
50
+ ONLINE_STATUS : 'online',
51
+ STOPPED_STATUS : 'stopped',
52
+ STOPPING_STATUS : 'stopping',
53
+ WAITING_RESTART : 'waiting restart',
54
+ LAUNCHING_STATUS : 'launching',
55
+ ERRORED_STATUS : 'errored',
56
+ ONE_LAUNCH_STATUS : 'one-launch-status',
57
+
58
+ CLUSTER_MODE_ID : 'cluster_mode',
59
+ FORK_MODE_ID : 'fork_mode',
60
+
61
+ ENABLE_GIT_PARSING : false,
62
+ LOW_MEMORY_ENVIRONMENT : process.env.ZM2_OPTIMIZE_MEMORY || process.env.PM2_OPTIMIZE_MEMORY || false,
63
+
64
+ MACHINE_NAME : process.env.INSTANCE_NAME || process.env.MACHINE_NAME || process.env.ZM2_MACHINE_NAME || process.env.PM2_MACHINE_NAME,
65
+ SECRET_KEY : process.env.KEYMETRICS_SECRET || process.env.ZM2_SECRET_KEY || process.env.PM2_SECRET_KEY || process.env.SECRET_KEY,
66
+ PUBLIC_KEY : process.env.KEYMETRICS_PUBLIC || process.env.ZM2_PUBLIC_KEY || process.env.PM2_PUBLIC_KEY || process.env.PUBLIC_KEY,
67
+ KEYMETRICS_ROOT_URL : process.env.KEYMETRICS_NODE || process.env.ZM2_APM_ADDRESS || process.env.PM2_APM_ADDRESS || process.env.ROOT_URL || process.env.INFO_NODE || 'root.keymetrics.io',
68
+
69
+
70
+ PM2_BANNER : '../lib/motd',
71
+ PM2_UPDATE : '../lib/API/pm2-plus/pres/motd.update',
72
+ DEFAULT_MODULE_JSON : 'package.json',
73
+
74
+ MODULE_BASEFOLDER: 'module',
75
+ MODULE_CONF_PREFIX: 'module-db-v2',
76
+ MODULE_CONF_PREFIX_TAR: 'tar-modules',
77
+
78
+ EXP_BACKOFF_RESET_TIMER : parseInt(process.env.EXP_BACKOFF_RESET_TIMER) || 30000,
79
+ REMOTE_PORT_TCP : isNaN(parseInt(process.env.KEYMETRICS_PUSH_PORT)) ? 80 : parseInt(process.env.KEYMETRICS_PUSH_PORT),
80
+ REMOTE_PORT : 41624,
81
+ REMOTE_HOST : 's1.keymetrics.io',
82
+ SEND_INTERVAL : 1000,
83
+ RELOAD_LOCK_TIMEOUT : parseInt(process.env.ZM2_RELOAD_LOCK_TIMEOUT || process.env.PM2_RELOAD_LOCK_TIMEOUT) || 30000,
84
+ GRACEFUL_TIMEOUT : parseInt(process.env.ZM2_GRACEFUL_TIMEOUT || process.env.PM2_GRACEFUL_TIMEOUT) || 8000,
85
+ GRACEFUL_LISTEN_TIMEOUT : parseInt(process.env.ZM2_GRACEFUL_LISTEN_TIMEOUT || process.env.PM2_GRACEFUL_LISTEN_TIMEOUT) || 3000,
86
+ LOGS_BUFFER_SIZE : 8,
87
+ CONTEXT_ON_ERROR : 2,
88
+ AGGREGATION_DURATION : process.env.ZM2_DEBUG || process.env.PM2_DEBUG || process.env.NODE_ENV === 'local_test' || process.env.NODE_ENV === 'development' ? 3000 : 5 * 60000,
89
+ TRACE_FLUSH_INTERVAL : process.env.ZM2_DEBUG || process.env.PM2_DEBUG || process.env.NODE_ENV === 'local_test' ? 1000 : 60000,
90
+
91
+ // Concurrent actions when doing start/restart/reload
92
+ CONCURRENT_ACTIONS : (function() {
93
+ var concurrent_actions = parseInt(process.env.ZM2_CONCURRENT_ACTIONS || process.env.PM2_CONCURRENT_ACTIONS) || 2;
94
+ debug('Using %d parallelism (CONCURRENT_ACTIONS)', concurrent_actions);
95
+ return concurrent_actions;
96
+ })(),
97
+
98
+ DEBUG : process.env.ZM2_DEBUG || process.env.PM2_DEBUG || false,
99
+ WEB_IPADDR : process.env.ZM2_API_IPADDR || process.env.PM2_API_IPADDR || '0.0.0.0',
100
+ WEB_PORT : parseInt(process.env.ZM2_API_PORT || process.env.PM2_API_PORT) || 9615,
101
+ WEB_STRIP_ENV_VARS : process.env.ZM2_WEB_STRIP_ENV_VARS || process.env.PM2_WEB_STRIP_ENV_VARS || false,
102
+ MODIFY_REQUIRE : process.env.ZM2_MODIFY_REQUIRE || process.env.PM2_MODIFY_REQUIRE || false,
103
+
104
+ WORKER_INTERVAL : process.env.ZM2_WORKER_INTERVAL || process.env.PM2_WORKER_INTERVAL || 30000,
105
+ KILL_TIMEOUT : process.env.ZM2_KILL_TIMEOUT || process.env.PM2_KILL_TIMEOUT || 1600,
106
+ KILL_SIGNAL : process.env.ZM2_KILL_SIGNAL || process.env.PM2_KILL_SIGNAL || 'SIGINT',
107
+ KILL_USE_MESSAGE : process.env.ZM2_KILL_USE_MESSAGE || process.env.PM2_KILL_USE_MESSAGE || false,
108
+
109
+ PM2_PROGRAMMATIC : typeof(process.env.pm_id) !== 'undefined' || process.env.ZM2_PROGRAMMATIC || process.env.PM2_PROGRAMMATIC,
110
+ PM2_LOG_DATE_FORMAT : process.env.ZM2_LOG_DATE_FORMAT !== undefined ? process.env.ZM2_LOG_DATE_FORMAT : (process.env.PM2_LOG_DATE_FORMAT !== undefined ? process.env.PM2_LOG_DATE_FORMAT : 'YYYY-MM-DDTHH:mm:ss')
111
+
112
+ };
113
+
114
+ module.exports = Object.assign(csts, path_structure);
package/index.js ADDED
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Copyright 2013-2022 the PM2 project authors. All rights reserved.
3
+ * Use of this source code is governed by a license that
4
+ * can be found in the LICENSE file.
5
+ */
6
+
7
+ process.env.ZM2_PROGRAMMATIC = 'true';
8
+ process.env.PM2_PROGRAMMATIC = 'true';
9
+
10
+ var API = require('./lib/API.js');
11
+
12
+ module.exports = new API;
13
+ module.exports.custom = API;