dsh-pm2
August 22, 2026 ยท View on GitHub
PM2 process-manager plugin for the DeepSeek Harness. Keeps the Harness web server running, restarts it on crash or memory-pressure, and can be configured to start on system boot.
Quick Start
git clone https://github.com/chenjie1129/dsh-pm2.git
cd dsh-pm2
npm install
node bin/dsh-pm2.mjs start --project /path/to/deepseek-harness
Or install globally:
npm install -g dsh-pm2
dsh-pm2 start --project /path/to/deepseek-harness
Commands
| Command | Description |
|---|---|
start | Start the Harness under PM2 supervision |
stop | Stop the PM2-managed Harness |
restart | Restart the PM2-managed Harness |
delete | Remove the Harness from the PM2 process list |
status | Show PM2 process status |
logs | Show PM2 logs (--lines N, default 30) |
save | Save the PM2 process list for resurrection |
startup | Configure PM2 to start on system boot |
Options
| Option | Default | Description |
|---|---|---|
--project <path> | auto-detect | Path to the deepseek-harness checkout |
--port <port> | 3080 | Web server port |
--name <name> | deepseek-harness | PM2 process name |
--lines <N> | 30 | Number of log lines to show |
Environment Variables
| Variable | Default | Description |
|---|---|---|
PM2_HOME | <project>/.pm2 | PM2 daemon home directory |
DSH_PM2_NAME | deepseek-harness | Process name in pm2 list |
DSH_PM2_PORT | 3080 | Web server port |
DSH_PM2_MAX_MEMORY | 512M | Max RSS before restart |
DSH_PM2_DSH_HOME | ~/.dsh | DSH_HOME for the managed process |
DSH_PM2_LOG_DIR | $DSH_HOME/logs | Log output directory |
DSH_PM2_PROJECT_DIR | auto-detect | Path to the deepseek-harness checkout |
Cordis Plugin
This package also exports a Cordis function plugin. When loaded inside a Harness composition:
# cordis.yml
- name: 'dsh-pm2'
The plugin detects PM2 supervision and logs the supervisor identity through the standard logger. @deepseek-ai/cordis and @deepseek-ai/schemastery are optional peer dependencies โ the plugin is a silent no-op when they are absent.
Auto-Restart
PM2 restarts the Harness automatically when:
- The process exits unexpectedly (crash)
- Memory exceeds
DSH_PM2_MAX_MEMORY(default: 512M)
Boot-Time Startup
dsh-pm2 save
dsh-pm2 startup
Follow the printed instructions to enable PM2 to start on system boot.
License
MIT