@jxa13/pm2ui 1.17.0
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.
- package/README.md +198 -0
- package/Services/pm2Service.js +91 -0
- package/Services/systemService.js +28 -0
- package/bin/pm2ui.js +3 -0
- package/changelog.md +250 -0
- package/frontend/dist/assets/index-BhYqcf4u.css +1 -0
- package/frontend/dist/assets/index-aVk9yHhV.js +224 -0
- package/frontend/dist/index.html +13 -0
- package/package.json +43 -0
- package/roadmap.md +170 -0
- package/server.js +889 -0
- package/user_manual.md +458 -0
package/user_manual.md
ADDED
|
@@ -0,0 +1,458 @@
|
|
|
1
|
+
# Node WebUI User Manual
|
|
2
|
+
|
|
3
|
+
Node WebUI is a local web dashboard for monitoring and managing Node.js services that are already managed by PM2. It is intended for local operations work: checking service health, controlling processes, viewing logs, creating PM2 apps, and saving PM2 state without switching back to the terminal.
|
|
4
|
+
|
|
5
|
+
## Screenshots
|
|
6
|
+
|
|
7
|
+
### React Operations Dashboard
|
|
8
|
+
|
|
9
|
+

|
|
10
|
+
|
|
11
|
+
### Logs Workspace
|
|
12
|
+
|
|
13
|
+

|
|
14
|
+
|
|
15
|
+
### Mobile Layout
|
|
16
|
+
|
|
17
|
+

|
|
18
|
+
|
|
19
|
+
## Requirements
|
|
20
|
+
|
|
21
|
+
- macOS
|
|
22
|
+
- Node.js 18 or newer
|
|
23
|
+
- npm
|
|
24
|
+
- PM2 installed and available on your shell path
|
|
25
|
+
- One or more PM2-managed processes, unless you only want to create a process from the UI
|
|
26
|
+
|
|
27
|
+
Install PM2 globally if it is not installed:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm install -g pm2
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Check PM2:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
pm2 -v
|
|
37
|
+
pm2 list
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Installation
|
|
41
|
+
|
|
42
|
+
Clone the repository:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
git clone <repo-url>
|
|
46
|
+
cd Node-WebUI
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Install dependencies:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
npm install
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Start Node WebUI:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
npm start
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
The server binds to localhost by default:
|
|
62
|
+
|
|
63
|
+
```text
|
|
64
|
+
http://127.0.0.1:3000
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Opening The App
|
|
68
|
+
|
|
69
|
+
Node WebUI serves the React operations console as the default UI:
|
|
70
|
+
|
|
71
|
+
```text
|
|
72
|
+
http://127.0.0.1:3000
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
`npm start` builds the React frontend before starting Express. The compatibility path `http://127.0.0.1:3000/react` also loads the same React UI.
|
|
76
|
+
|
|
77
|
+
## Optional Environment Variables
|
|
78
|
+
|
|
79
|
+
### Port
|
|
80
|
+
|
|
81
|
+
Use a different local port:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
PORT=3100 npm start
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Then open:
|
|
88
|
+
|
|
89
|
+
```text
|
|
90
|
+
http://127.0.0.1:3100
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Server-Enforced Protected Processes
|
|
94
|
+
|
|
95
|
+
The settings page can locally protect process names in the UI, but server-side protection is configured with an environment variable. Use this if you want the API itself to reject stop, restart, and delete actions for specific process names:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
PROTECTED_PM2_PROCESSES=node-webui,server npm start
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Names are matched case-insensitively. The default server-side protected process name is:
|
|
102
|
+
|
|
103
|
+
```text
|
|
104
|
+
node-webui
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### PM2 Home
|
|
108
|
+
|
|
109
|
+
If your PM2 data is stored outside the default `~/.pm2`, set `PM2_HOME`:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
PM2_HOME=/path/to/.pm2 npm start
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Creating Or Preparing PM2 Apps
|
|
116
|
+
|
|
117
|
+
You can use existing PM2 processes:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
pm2 start app.js --name my-app
|
|
121
|
+
pm2 list
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Save PM2 state:
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
pm2 save
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Configure PM2 startup if desired:
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
pm2 startup
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
You can also create a PM2 app from Node WebUI by using the `Create PM2 App` button.
|
|
137
|
+
|
|
138
|
+
## Dashboard Overview
|
|
139
|
+
|
|
140
|
+
The React dashboard has three main regions:
|
|
141
|
+
|
|
142
|
+
- Left sidebar: navigation, connection status, host CPU/RAM, PM2 runtime summary, quick theme controls.
|
|
143
|
+
- Main dashboard: metrics, charts, filters, process table, bulk actions.
|
|
144
|
+
- Right inspector: selected process details, actions, config, files, and optional logs.
|
|
145
|
+
|
|
146
|
+
Use the top toolbar to:
|
|
147
|
+
|
|
148
|
+
- Refresh dashboard data immediately.
|
|
149
|
+
- Pause or resume live updates.
|
|
150
|
+
- Save PM2 state.
|
|
151
|
+
- Create a new PM2 app.
|
|
152
|
+
|
|
153
|
+
## Summary Metrics
|
|
154
|
+
|
|
155
|
+
The summary row shows:
|
|
156
|
+
|
|
157
|
+
- Total Services
|
|
158
|
+
- Online
|
|
159
|
+
- Stopped
|
|
160
|
+
- Errored
|
|
161
|
+
- Restart Count
|
|
162
|
+
- PM2 CPU
|
|
163
|
+
- PM2 RAM
|
|
164
|
+
|
|
165
|
+
PM2 CPU and PM2 RAM are based on PM2-managed processes, not total host usage. Host CPU/RAM appears in the sidebar as secondary context.
|
|
166
|
+
|
|
167
|
+
## Metric History
|
|
168
|
+
|
|
169
|
+
The metric history section tracks local browser history for:
|
|
170
|
+
|
|
171
|
+
- PM2 CPU
|
|
172
|
+
- PM2 RAM
|
|
173
|
+
- Restarts
|
|
174
|
+
- Status counts
|
|
175
|
+
|
|
176
|
+
Use the `Window` selector to switch between 15, 30, and 60 minute views. This history is stored locally in your browser.
|
|
177
|
+
|
|
178
|
+
## Process Table
|
|
179
|
+
|
|
180
|
+
The process table is the main workflow area. It supports:
|
|
181
|
+
|
|
182
|
+
- Search by process name.
|
|
183
|
+
- Filter by status.
|
|
184
|
+
- Sort by status, name, CPU, RAM, restarts, uptime, and started time.
|
|
185
|
+
- Show or hide columns from the `Columns` menu.
|
|
186
|
+
- Switch between compact and comfortable density.
|
|
187
|
+
- Select rows for bulk actions.
|
|
188
|
+
- Highlight the selected process.
|
|
189
|
+
|
|
190
|
+
Each process row shows:
|
|
191
|
+
|
|
192
|
+
- Status
|
|
193
|
+
- PM2 ID
|
|
194
|
+
- Name
|
|
195
|
+
- CPU
|
|
196
|
+
- RAM
|
|
197
|
+
- Restart count
|
|
198
|
+
- Uptime
|
|
199
|
+
- Started time
|
|
200
|
+
- Actions
|
|
201
|
+
|
|
202
|
+
## Process Actions
|
|
203
|
+
|
|
204
|
+
Per-process action buttons:
|
|
205
|
+
|
|
206
|
+
- Start: start the selected PM2 process.
|
|
207
|
+
- Stop: stop the selected PM2 process.
|
|
208
|
+
- Restart: restart the selected PM2 process.
|
|
209
|
+
- Logs: open logs for that process.
|
|
210
|
+
- Open folder: open the process folder in Finder.
|
|
211
|
+
- Delete: remove the process from PM2.
|
|
212
|
+
|
|
213
|
+
Some actions require confirmation before they run.
|
|
214
|
+
|
|
215
|
+
## Bulk Actions
|
|
216
|
+
|
|
217
|
+
Select one or more rows using the table checkboxes. The bulk action bar supports:
|
|
218
|
+
|
|
219
|
+
- Start selected
|
|
220
|
+
- Stop selected
|
|
221
|
+
- Restart selected
|
|
222
|
+
- Clear selection
|
|
223
|
+
|
|
224
|
+
Protected processes are excluded from bulk stop and restart actions.
|
|
225
|
+
|
|
226
|
+
## Process Inspector
|
|
227
|
+
|
|
228
|
+
The inspector on the right shows information for the selected process.
|
|
229
|
+
|
|
230
|
+
Tabs:
|
|
231
|
+
|
|
232
|
+
- Overview: runtime, CPU, RAM, uptime, started time, restarts, PID, PM2 ID.
|
|
233
|
+
- Config: interpreter, exec mode, namespace, version, environment, instances, watch, autorestart, args, Node args, max memory restart.
|
|
234
|
+
- Files: script path, working directory, output log, error log, PID file, PM2 home.
|
|
235
|
+
- Logs: compact log viewer for the selected process.
|
|
236
|
+
|
|
237
|
+
Use the collapse button in the inspector header to reduce the inspector to a narrow rail. The choice is remembered locally.
|
|
238
|
+
|
|
239
|
+
## Logs
|
|
240
|
+
|
|
241
|
+
Use the sidebar `Logs` item to open the central logs workspace. This shows logs in the main section only, avoiding a duplicate log viewer in the inspector.
|
|
242
|
+
|
|
243
|
+
The logs workspace supports:
|
|
244
|
+
|
|
245
|
+
- Selecting a process.
|
|
246
|
+
- Viewing stdout and stderr lines.
|
|
247
|
+
- Searching visible logs.
|
|
248
|
+
- Choosing log line count.
|
|
249
|
+
- Refreshing logs.
|
|
250
|
+
- Copying logs.
|
|
251
|
+
- Downloading logs.
|
|
252
|
+
- Clearing logs.
|
|
253
|
+
- Auto-refreshing logs.
|
|
254
|
+
- Wrapping or truncating long lines.
|
|
255
|
+
|
|
256
|
+
The row-level log action opens logs for that specific process.
|
|
257
|
+
|
|
258
|
+
## Create PM2 App
|
|
259
|
+
|
|
260
|
+
Click `Create PM2 App` to register a new PM2 process.
|
|
261
|
+
|
|
262
|
+
Required fields:
|
|
263
|
+
|
|
264
|
+
- Script path
|
|
265
|
+
- Process name
|
|
266
|
+
- Working directory
|
|
267
|
+
|
|
268
|
+
Optional fields:
|
|
269
|
+
|
|
270
|
+
- Arguments
|
|
271
|
+
- Interpreter
|
|
272
|
+
- Node args
|
|
273
|
+
- `NODE_ENV`
|
|
274
|
+
- Instances
|
|
275
|
+
- Watch mode
|
|
276
|
+
- Max memory restart
|
|
277
|
+
- Output log path
|
|
278
|
+
- Error log path
|
|
279
|
+
|
|
280
|
+
After a successful create, Node WebUI saves PM2 state.
|
|
281
|
+
|
|
282
|
+
## Settings
|
|
283
|
+
|
|
284
|
+
The settings page includes:
|
|
285
|
+
|
|
286
|
+
- Theme family
|
|
287
|
+
- Theme mode: System, Light, Dark
|
|
288
|
+
- Protected process names
|
|
289
|
+
- Local storage reset
|
|
290
|
+
|
|
291
|
+
### Themes
|
|
292
|
+
|
|
293
|
+
Theme preferences are saved locally in the browser. Quick theme controls are also available in the sidebar.
|
|
294
|
+
|
|
295
|
+
### Protected Process Names
|
|
296
|
+
|
|
297
|
+
Protected process names prevent accidental UI actions against important services. Enter one name per line, or separate names with commas:
|
|
298
|
+
|
|
299
|
+
```text
|
|
300
|
+
node-webui
|
|
301
|
+
server
|
|
302
|
+
api-worker
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
Click `Save Protected Names`.
|
|
306
|
+
|
|
307
|
+
Important: this UI setting is local to your browser. For server-side API enforcement, also start the app with `PROTECTED_PM2_PROCESSES`, for example:
|
|
308
|
+
|
|
309
|
+
```bash
|
|
310
|
+
PROTECTED_PM2_PROCESSES=node-webui,server npm start
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
### Reset Local Storage
|
|
314
|
+
|
|
315
|
+
Click `Reset Local Storage` to clear saved browser preferences, including:
|
|
316
|
+
|
|
317
|
+
- Theme settings
|
|
318
|
+
- Filters
|
|
319
|
+
- Table columns
|
|
320
|
+
- Metric history
|
|
321
|
+
- Selected process
|
|
322
|
+
- Sidebar and inspector collapse state
|
|
323
|
+
- Protected process names
|
|
324
|
+
- Log settings
|
|
325
|
+
|
|
326
|
+
The app asks for confirmation before clearing local storage.
|
|
327
|
+
|
|
328
|
+
## Keyboard Shortcuts
|
|
329
|
+
|
|
330
|
+
- `/`: focus process search.
|
|
331
|
+
- `r`: refresh the dashboard.
|
|
332
|
+
- `l`: open logs for the selected process.
|
|
333
|
+
- Arrow Up / Arrow Down: move process selection.
|
|
334
|
+
- `Esc`: clear selected table rows.
|
|
335
|
+
|
|
336
|
+
Shortcuts are ignored while typing in an input, textarea, or select.
|
|
337
|
+
|
|
338
|
+
## Tooltips
|
|
339
|
+
|
|
340
|
+
Buttons include brief tooltips. Hover over a button to see what it does. When the left sidebar is collapsed, navigation buttons show a compact popover tooltip.
|
|
341
|
+
|
|
342
|
+
## Running In Development
|
|
343
|
+
|
|
344
|
+
Run the Express server:
|
|
345
|
+
|
|
346
|
+
```bash
|
|
347
|
+
npm run dev
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
Run the React Vite dev server:
|
|
351
|
+
|
|
352
|
+
```bash
|
|
353
|
+
npm run react:dev
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
The Vite dev server is useful while editing the React frontend. The production Express root route uses the built files from:
|
|
357
|
+
|
|
358
|
+
```text
|
|
359
|
+
frontend/dist
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
Rebuild after React changes:
|
|
363
|
+
|
|
364
|
+
```bash
|
|
365
|
+
npm run react:build
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
## Validation
|
|
369
|
+
|
|
370
|
+
Run the React build:
|
|
371
|
+
|
|
372
|
+
```bash
|
|
373
|
+
npm run react:build
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
Run smoke checks:
|
|
377
|
+
|
|
378
|
+
```bash
|
|
379
|
+
npm run react:smoke
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
## Troubleshooting
|
|
383
|
+
|
|
384
|
+
### PM2 processes do not appear
|
|
385
|
+
|
|
386
|
+
Check PM2 from the same shell/user that starts Node WebUI:
|
|
387
|
+
|
|
388
|
+
```bash
|
|
389
|
+
pm2 list
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
If needed, set `PM2_HOME` before starting Node WebUI.
|
|
393
|
+
|
|
394
|
+
### React UI is not available at `/`
|
|
395
|
+
|
|
396
|
+
Build the React frontend:
|
|
397
|
+
|
|
398
|
+
```bash
|
|
399
|
+
npm run react:build
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
Restart Node WebUI:
|
|
403
|
+
|
|
404
|
+
```bash
|
|
405
|
+
npm start
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
### Process actions fail
|
|
409
|
+
|
|
410
|
+
Check that PM2 is installed and available:
|
|
411
|
+
|
|
412
|
+
```bash
|
|
413
|
+
pm2 -v
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
Check that the process exists:
|
|
417
|
+
|
|
418
|
+
```bash
|
|
419
|
+
pm2 list
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
If the process is protected, remove it from the protected list or adjust `PROTECTED_PM2_PROCESSES`.
|
|
423
|
+
|
|
424
|
+
### Open folder does not work
|
|
425
|
+
|
|
426
|
+
Open folder is designed for macOS Finder. It requires the process to have a valid script path or working directory.
|
|
427
|
+
|
|
428
|
+
### Logs show repeated PM2 or socket errors
|
|
429
|
+
|
|
430
|
+
Check PM2 log output directly:
|
|
431
|
+
|
|
432
|
+
```bash
|
|
433
|
+
pm2 logs <process-name>
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
If the Node WebUI process itself is logging errors, restart it:
|
|
437
|
+
|
|
438
|
+
```bash
|
|
439
|
+
pm2 restart node-webui
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
### Port is already in use
|
|
443
|
+
|
|
444
|
+
Start Node WebUI on another port:
|
|
445
|
+
|
|
446
|
+
```bash
|
|
447
|
+
PORT=3100 npm start
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
## Security Notes
|
|
451
|
+
|
|
452
|
+
Node WebUI is designed for local use. The server binds to:
|
|
453
|
+
|
|
454
|
+
```text
|
|
455
|
+
127.0.0.1
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
Do not expose it directly to the public internet. If you need remote access, put it behind authentication and a reverse proxy.
|