Skip to content

Commit e45132d

Browse files
committed
docs: difference between pm2
1 parent ce04345 commit e45132d

1 file changed

Lines changed: 36 additions & 1 deletion

File tree

README.md

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[![npm downloads](https://img.shields.io/npm/dm/@hackmd/spm.svg)](https://www.npmjs.com/package/@hackmd/spm)
55
[![npm license](https://img.shields.io/npm/l/@hackmd/spm.svg)](https://www.npmjs.com/package/@hackmd/spm)
66

7-
A minimal process manager implementing a lean subset of [pm2](https://pm2.keymetrics.io/) features, with some extensions, designed for better development script setup. Lightweight, zero daemon, and ecosystem config compatible.
7+
A minimal process manager implementing a lean subset of [pm2](https://pm2.keymetrics.io/) features, with some extensions, designed for better development script setup. Lightweight, zero daemon, and PM2-inspired ecosystem config support.
88

99
## Features
1010

@@ -71,13 +71,48 @@ spm logs api -t # Tail logs
7171
| `instances` | Number of instances (default: 1) |
7272
| `env` | Environment variables |
7373
| `increment_vars` | Env vars to increment per instance (e.g. `PORT`) |
74+
| `increment_var` | Legacy alias for increment vars (comma-separated string, e.g. `PORT,WS_PORT`) |
75+
76+
### Ecosystem File Field Support
77+
78+
SPM supports PM2-inspired ecosystem files and deeper app objects without failing on extra fields.
79+
80+
- SPM **actively uses**: `name`, `script`, `args`, `instances`, `env`, `increment_vars`, `increment_var`
81+
- SPM **ignores unsupported fields safely** so you can keep partially shared configs across tools
82+
- `increment_vars` is the preferred form; `increment_var` is kept as a compatibility alias in SPM
7483

7584
Config file is resolved from `./ecosystem.custom.config.js` by default. Override with `--config`:
7685

7786
```bash
7887
spm --config ./my-ecosystem.config.js start
7988
```
8089

90+
## PM2 Differences
91+
92+
SPM intentionally implements a lean subset of PM2 behavior.
93+
94+
- No daemon mode: processes are started detached and tracked with pid files under `~/.spm2/pids/`
95+
- No PM2 process metadata store: runtime state comes from pid files + OS process checks
96+
- `increment_vars` is supported directly; `increment_var` is also accepted and split by comma
97+
- Extra PM2 ecosystem fields are allowed in config objects but not interpreted unless listed in SPM supported fields
98+
99+
Example for split increment vars:
100+
101+
```javascript
102+
export default {
103+
apps: [
104+
{
105+
name: 'api',
106+
script: 'node',
107+
args: 'server.js',
108+
instances: 2,
109+
env: { PORT: '3000', WS_PORT: '4000' },
110+
increment_var: 'PORT,WS_PORT',
111+
},
112+
],
113+
}
114+
```
115+
81116
## Commands
82117

83118
| Command | Description |

0 commit comments

Comments
 (0)