create-openclaw-bot 5.1.5 → 5.1.6
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/CHANGELOG.md +8 -0
- package/CHANGELOG.vi.md +8 -0
- package/README.md +3 -3
- package/README.vi.md +3 -3
- package/cli.js +41 -23
- package/package.json +1 -1
- package/setup.js +5 -5
- package/tests/smoke-cli-logic.mjs +3 -3
- package/tmp_diff.patch +0 -114
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
# Changelog (English)
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
## [5.1.6] — 2026-04-07
|
|
5
|
+
|
|
6
|
+
### 🐞 Fix PM2 SIGKILL on Native VPS Installs
|
|
7
|
+
|
|
8
|
+
- **Fix `PM2 SIGKILL` Error**: Removed the `-t` (interactive TTY) flag from all background `9router` launches. This terminal-dependent flag could cause PM2 to hang and aggressively SIGKILL the spawned process on headless VPS environments.
|
|
9
|
+
- **Robust PM2 Sync Helper**: Added a two-stage fallback for the 9Router smart-route sync script. If PM2 encounters `SIGKILL` or memory limits while spawning the sync helper, the setup gracefully falls back to a background `nohup node ... &` process instead of throwing a hard exception. If both fail, it logs a warning but allows the overall OpenClaw setup to finish successfully.
|
|
10
|
+
|
|
11
|
+
|
|
4
12
|
## [5.1.5] — 2026-04-06
|
|
5
13
|
|
|
6
14
|
### 🐞 Fix Native PM2 9Router Startup
|
package/CHANGELOG.vi.md
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
# Changelog (Tiếng Việt)
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
## [5.1.6] — 2026-04-07
|
|
5
|
+
|
|
6
|
+
### 🐞 Khắc phục lỗi PM2 ngắt cài đặt (SIGKILL) trên VPS
|
|
7
|
+
|
|
8
|
+
- **Sửa lỗi `PM2 SIGKILL`**: Loại bỏ cờ `-t` (chế độ giao diện terminal) khỏi tất cả các lệnh gọi `9router` chạy ngầm. Trên các VPS không giao diện (headless), cờ này có thể khiến PM2 bị treo và ném ra lỗi SIGKILL làm chết toàn bộ quá trình cài đặt.
|
|
9
|
+
- **Tối ưu Sync Helper chạy ngầm**: Bổ sung cơ chế dự phòng 2 lớp cho script tự động đồng bộ (sync helper). Nếu PM2 bị giới hạn RAM hoặc quá tải gây lỗi SIGKILL, script sẽ không văng lỗi sập Setup nữa mà tự động fallback xuống chạy ẩn bằng `nohup node ... &`. Trong trường hợp xấu nhất, bộ cài chỉ báo cảnh báo vàng và rẽ nhánh cho phép tiến trình Setup tiếp tục tới bước cuối cùng thành công.
|
|
10
|
+
|
|
11
|
+
|
|
4
12
|
## [5.1.5] — 2026-04-06
|
|
5
13
|
|
|
6
14
|
### 🐞 Sửa lỗi PM2 khởi động 9Router trên Native
|
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# 🦞 OpenClaw Setup
|
|
4
4
|
|
|
5
5
|
<p align="center">
|
|
6
|
-
<a href="https://github.com/tuanminhhole/openclaw-setup/releases"><img src="https://img.shields.io/badge/RELEASE-v5.1.
|
|
6
|
+
<a href="https://github.com/tuanminhhole/openclaw-setup/releases"><img src="https://img.shields.io/badge/RELEASE-v5.1.6-0EA5E9?style=for-the-badge" alt="Version 5.1.6" /></a>
|
|
7
7
|
<a href="https://github.com/tuanminhhole/openclaw-setup?tab=MIT-1-ov-file"><img src="https://img.shields.io/badge/LICENSE-MIT-success?style=for-the-badge" alt="MIT License" /></a>
|
|
8
8
|
<a href="https://www.npmjs.com/package/create-openclaw-bot"><img src="https://img.shields.io/npm/v/create-openclaw-bot?style=for-the-badge&label=CLI&color=2563EB&logo=npm&logoColor=white" alt="NPM Version" /></a>
|
|
9
9
|
<a href="https://github.com/tuanminhhole/openclaw-setup/stargazers"><img src="https://img.shields.io/github/stars/tuanminhhole/openclaw-setup?style=for-the-badge&color=eab308&logo=github&logoColor=white" alt="GitHub Stars" /></a>
|
|
@@ -24,7 +24,7 @@ An interactive **CLI tool** and **Setup Wizard** to deploy your own free AI Bot
|
|
|
24
24
|
|
|
25
25
|
---
|
|
26
26
|
|
|
27
|
-
## 🆕 What's new in v5.1.
|
|
27
|
+
## 🆕 What's new in v5.1.6
|
|
28
28
|
|
|
29
29
|
- 💻 **OS-First Setup** — Step 1 is now choosing your OS (Windows, macOS, Ubuntu, VPS). All scripts, configs, and instructions are generated to match.
|
|
30
30
|
- 🧠 **Gemma 4 — 4 sizes** — `gemma4:e2b` (~4 GB), `gemma4:e4b` (~8 GB), `gemma4:26b` (~18 GB), `gemma4:31b` (~24 GB). Auto-pulled on first launch.
|
|
@@ -112,7 +112,7 @@ Run in your terminal → follow the interactive prompts → startup script is ge
|
|
|
112
112
|
2. Open this repo as your workspace
|
|
113
113
|
3. Paste into chat:
|
|
114
114
|
```
|
|
115
|
-
Read SETUP.md and set up OpenClaw v5.1.
|
|
115
|
+
Read SETUP.md and set up OpenClaw v5.1.6 for me.
|
|
116
116
|
My bot token is X. Use 9Router (no API key).
|
|
117
117
|
My project folder: <YOUR_PATH>
|
|
118
118
|
```
|
package/README.vi.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# 🦞 OpenClaw Setup
|
|
4
4
|
|
|
5
5
|
<p align="center">
|
|
6
|
-
<a href="https://github.com/tuanminhhole/openclaw-setup/releases"><img src="https://img.shields.io/badge/RELEASE-v5.1.
|
|
6
|
+
<a href="https://github.com/tuanminhhole/openclaw-setup/releases"><img src="https://img.shields.io/badge/RELEASE-v5.1.6-0EA5E9?style=for-the-badge" alt="Version 5.1.6" /></a>
|
|
7
7
|
<a href="https://github.com/tuanminhhole/openclaw-setup?tab=MIT-1-ov-file"><img src="https://img.shields.io/badge/LICENSE-MIT-success?style=for-the-badge" alt="MIT License" /></a>
|
|
8
8
|
<a href="https://www.npmjs.com/package/create-openclaw-bot"><img src="https://img.shields.io/npm/v/create-openclaw-bot?style=for-the-badge&label=CLI&color=2563EB&logo=npm&logoColor=white" alt="NPM Version" /></a>
|
|
9
9
|
<a href="https://github.com/tuanminhhole/openclaw-setup/stargazers"><img src="https://img.shields.io/github/stars/tuanminhhole/openclaw-setup?style=for-the-badge&color=eab308&logo=github&logoColor=white" alt="GitHub Stars" /></a>
|
|
@@ -24,7 +24,7 @@ Công cụ **CLI tương tác** và **Setup Wizard** để tự triển khai Bot
|
|
|
24
24
|
|
|
25
25
|
---
|
|
26
26
|
|
|
27
|
-
## 🆕 Có gì mới trong v5.1.
|
|
27
|
+
## 🆕 Có gì mới trong v5.1.6
|
|
28
28
|
|
|
29
29
|
- 💻 **OS-First Setup** — Bước đầu tiên bây giờ là chọn hệ điều hành của bạn (Windows, macOS, Ubuntu, VPS). Toàn bộ script, cấu hình và hướng dẫn được tạo ra phù hợp với lựa chọn đó.
|
|
30
30
|
- 🧠 **Gemma 4 — 4 kích thước** — `gemma4:e2b` (~4 GB), `gemma4:e4b` (~8 GB), `gemma4:26b` (~18 GB), `gemma4:31b` (~24 GB). Tự pull về khi bot khởi động lần đầu.
|
|
@@ -112,7 +112,7 @@ Chạy lệnh trên trong Terminal → làm theo các prompt tương tác → sc
|
|
|
112
112
|
2. Mở repo này làm workspace
|
|
113
113
|
3. Paste vào chat:
|
|
114
114
|
```
|
|
115
|
-
Read SETUP.md and set up OpenClaw v5.1.
|
|
115
|
+
Read SETUP.md and set up OpenClaw v5.1.6 for me.
|
|
116
116
|
My bot token is X. Use 9Router (no API key).
|
|
117
117
|
My project folder: <THƯ_MỤC_CỦA_BẠN>
|
|
118
118
|
```
|
package/cli.js
CHANGED
|
@@ -145,7 +145,7 @@ function spawnBackgroundProcess(command, args, options = {}) {
|
|
|
145
145
|
});
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
-
function resolveNative9RouterDesktopLaunch() {
|
|
148
|
+
function resolveNative9RouterDesktopLaunch() {
|
|
149
149
|
if (process.platform === 'win32') {
|
|
150
150
|
const npmRoot = (() => {
|
|
151
151
|
try {
|
|
@@ -170,12 +170,12 @@ function resolveNative9RouterDesktopLaunch() {
|
|
|
170
170
|
};
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
-
return {
|
|
174
|
-
command: '9router',
|
|
175
|
-
args: ['-n', '-
|
|
176
|
-
env: {}
|
|
177
|
-
};
|
|
178
|
-
}
|
|
173
|
+
return {
|
|
174
|
+
command: '9router',
|
|
175
|
+
args: ['-n', '-l', '-H', '0.0.0.0', '-p', '20128', '--skip-update'],
|
|
176
|
+
env: {}
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
179
|
|
|
180
180
|
function getNative9RouterDataDir() {
|
|
181
181
|
if (process.platform === 'win32') {
|
|
@@ -393,7 +393,7 @@ function build9RouterComposeEntrypointScript(syncScriptBase64) {
|
|
|
393
393
|
'npm install -g 9router',
|
|
394
394
|
`node -e "require('fs').writeFileSync('/tmp/sync.js',Buffer.from('${syncScriptBase64}','base64').toString())"`,
|
|
395
395
|
'node /tmp/sync.js > /tmp/sync.log 2>&1 &',
|
|
396
|
-
'exec 9router -n -
|
|
396
|
+
'exec 9router -n -l -H 0.0.0.0 -p 20128 --skip-update'
|
|
397
397
|
].join('\n');
|
|
398
398
|
}
|
|
399
399
|
|
|
@@ -637,7 +637,6 @@ function startNative9RouterPm2({ isVi, projectDir, appName, syncScriptPath }) {
|
|
|
637
637
|
'none',
|
|
638
638
|
'--',
|
|
639
639
|
'-n',
|
|
640
|
-
'-t',
|
|
641
640
|
'-l',
|
|
642
641
|
'-H',
|
|
643
642
|
'0.0.0.0',
|
|
@@ -651,20 +650,39 @@ function startNative9RouterPm2({ isVi, projectDir, appName, syncScriptPath }) {
|
|
|
651
650
|
});
|
|
652
651
|
if (syncScriptPath) {
|
|
653
652
|
const syncAppName = `${appName}-9router-sync`;
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
653
|
+
const normalizedSyncScriptPath = syncScriptPath.replace(/\\/g, '/');
|
|
654
|
+
try {
|
|
655
|
+
execFileSync('pm2', [
|
|
656
|
+
'start',
|
|
657
|
+
normalizedSyncScriptPath,
|
|
658
|
+
'--name',
|
|
659
|
+
syncAppName,
|
|
660
|
+
'--cwd',
|
|
661
|
+
projectDir.replace(/\\/g, '/'),
|
|
662
|
+
'--interpreter',
|
|
663
|
+
process.execPath
|
|
664
|
+
], {
|
|
665
|
+
cwd: projectDir,
|
|
666
|
+
stdio: 'inherit',
|
|
667
|
+
env: process.env
|
|
668
|
+
});
|
|
669
|
+
} catch {
|
|
670
|
+
try {
|
|
671
|
+
execSync(`nohup "${process.execPath}" "${normalizedSyncScriptPath}" >/tmp/${syncAppName}.log 2>&1 &`, {
|
|
672
|
+
cwd: projectDir,
|
|
673
|
+
stdio: 'ignore',
|
|
674
|
+
shell: true,
|
|
675
|
+
env: process.env
|
|
676
|
+
});
|
|
677
|
+
console.log(chalk.yellow(isVi
|
|
678
|
+
? `⚠️ PM2 khong khoi dong duoc sync helper. Da fallback sang background node: /tmp/${syncAppName}.log`
|
|
679
|
+
: `⚠️ PM2 could not start the sync helper. Fell back to a background node process: /tmp/${syncAppName}.log`));
|
|
680
|
+
} catch {
|
|
681
|
+
console.log(chalk.yellow(isVi
|
|
682
|
+
? `⚠️ Khong the khoi dong 9Router sync helper. 9Router van chay, nhung smart-route co the can dong bo thu cong sau.`
|
|
683
|
+
: `⚠️ Could not start the 9Router sync helper. 9Router is still running, but smart-route may need manual syncing later.`));
|
|
684
|
+
}
|
|
685
|
+
}
|
|
668
686
|
}
|
|
669
687
|
runPm2Save({ projectDir, isVi });
|
|
670
688
|
console.log(chalk.green(`\n✅ ${isVi ? '9Router da duoc khoi dong qua PM2.' : '9Router is running via PM2.'}`));
|
package/package.json
CHANGED
package/setup.js
CHANGED
|
@@ -1767,7 +1767,7 @@ model:
|
|
|
1767
1767
|
'npm install -g 9router',
|
|
1768
1768
|
`node -e "require('fs').writeFileSync('/tmp/sync.js',Buffer.from('${syncScriptBase64}','base64').toString())"`,
|
|
1769
1769
|
'node /tmp/sync.js > /tmp/sync.log 2>&1 &',
|
|
1770
|
-
'exec 9router -n -
|
|
1770
|
+
'exec 9router -n -l -H 0.0.0.0 -p 20128 --skip-update'
|
|
1771
1771
|
].join('\n');
|
|
1772
1772
|
|
|
1773
1773
|
state.config.plugins.forEach((pid) => {
|
|
@@ -2870,12 +2870,12 @@ const sync=()=>{try{let db={};try{db=JSON.parse(fs.readFileSync(p,'utf8'));}catc
|
|
|
2870
2870
|
if (is9Router) {
|
|
2871
2871
|
if (shell === 'bat') {
|
|
2872
2872
|
arr.push('npm install -g 9router');
|
|
2873
|
-
arr.push('start "9Router" cmd /k "9router -n -
|
|
2873
|
+
arr.push('start "9Router" cmd /k "9router -n -l -H 0.0.0.0 -p 20128 --skip-update"');
|
|
2874
2874
|
arr.push('start "9Router Smart Route Sync" cmd /k "node .\\.openclaw\\9router-smart-route-sync.js"');
|
|
2875
2875
|
arr.push('timeout /t 5 /nobreak >nul');
|
|
2876
2876
|
} else {
|
|
2877
2877
|
arr.push('npm install -g 9router');
|
|
2878
|
-
arr.push('nohup 9router -n -
|
|
2878
|
+
arr.push('nohup 9router -n -l -H 0.0.0.0 -p 20128 --skip-update >/tmp/9router.log 2>&1 &');
|
|
2879
2879
|
arr.push('nohup node ./.openclaw/9router-smart-route-sync.js >/tmp/9router-sync.log 2>&1 &');
|
|
2880
2880
|
arr.push('sleep 3');
|
|
2881
2881
|
}
|
|
@@ -3536,7 +3536,7 @@ ${selectedSkillNames.length ? selectedSkillNames.join('\n') : '- _(No skills ins
|
|
|
3536
3536
|
appendShWriteCommands(vps, sharedNativeFileMap());
|
|
3537
3537
|
vps.push('echo "--- Starting shared gateway via PM2 ---"');
|
|
3538
3538
|
if (is9Router) {
|
|
3539
|
-
vps.push('pm2 start --name openclaw-multibot-9router -- sh -c "9router -n -
|
|
3539
|
+
vps.push('pm2 start --name openclaw-multibot-9router -- sh -c "9router -n -l -H 0.0.0.0 -p 20128 --skip-update"');
|
|
3540
3540
|
vps.push('pm2 start --name openclaw-multibot-9router-sync -- sh -c "node ./.openclaw/9router-smart-route-sync.js"');
|
|
3541
3541
|
}
|
|
3542
3542
|
vps.push('pm2 start --name openclaw-multibot -- sh -c "openclaw gateway run"');
|
|
@@ -3549,7 +3549,7 @@ ${selectedSkillNames.length ? selectedSkillNames.join('\n') : '- _(No skills ins
|
|
|
3549
3549
|
} else {
|
|
3550
3550
|
appendShWriteCommands(vps, botFiles(0));
|
|
3551
3551
|
if (is9Router) {
|
|
3552
|
-
vps.push('pm2 start --name openclaw-9router -- sh -c "9router -n -
|
|
3552
|
+
vps.push('pm2 start --name openclaw-9router -- sh -c "9router -n -l -H 0.0.0.0 -p 20128 --skip-update"');
|
|
3553
3553
|
vps.push('pm2 start --name openclaw-9router-sync -- sh -c "node ./.openclaw/9router-smart-route-sync.js"');
|
|
3554
3554
|
}
|
|
3555
3555
|
vps.push('pm2 start --name openclaw -- sh -c "openclaw gateway run"');
|
|
@@ -195,7 +195,7 @@ checks.push(() => expectMatch(
|
|
|
195
195
|
|
|
196
196
|
checks.push(() => expectMatch(
|
|
197
197
|
cli,
|
|
198
|
-
/function startNative9RouterPm2\(\{ isVi, projectDir, appName, syncScriptPath \}\) \{[\s\S]*resolveCommandOnPath\('9router'\)[\s\S]*execFileSync\('pm2'[\s\S]*--interpreter'?,?[\s\S]*none[\s\S]
|
|
198
|
+
/function startNative9RouterPm2\(\{ isVi, projectDir, appName, syncScriptPath \}\) \{[\s\S]*resolveCommandOnPath\('9router'\)[\s\S]*execFileSync\('pm2'[\s\S]*--interpreter'?,?[\s\S]*none[\s\S]*'-n'[\s\S]*'-l'[\s\S]*'--skip-update'[\s\S]*nohup "\$\{process\.execPath\}" "\$\{normalizedSyncScriptPath\}" >\/tmp\/\$\{syncAppName\}\.log 2>&1 &[\s\S]*runPm2Save\(\{ projectDir, isVi \}\)/s,
|
|
199
199
|
'VPS native 9Router flow must start a standalone 9Router dashboard on port 20128 via PM2'
|
|
200
200
|
));
|
|
201
201
|
|
|
@@ -207,7 +207,7 @@ checks.push(() => expectMatch(
|
|
|
207
207
|
|
|
208
208
|
checks.push(() => expectMatch(
|
|
209
209
|
cli,
|
|
210
|
-
/function resolveNative9RouterDesktopLaunch\(\) \{[\s\S]*process\.platform === 'win32'[\s\S]*npm root -g[\s\S]*9router', 'app', 'server\.js'[\s\S]*PORT: '20128'[\s\S]*HOSTNAME: '0\.0\.0\.0'[\s\S]*command: '9router'[\s\S]*\['-n', '-
|
|
210
|
+
/function resolveNative9RouterDesktopLaunch\(\) \{[\s\S]*process\.platform === 'win32'[\s\S]*npm root -g[\s\S]*9router', 'app', 'server\.js'[\s\S]*PORT: '20128'[\s\S]*HOSTNAME: '0\.0\.0\.0'[\s\S]*command: '9router'[\s\S]*\['-n', '-l', '-H', '0\.0\.0\.0', '-p', '20128', '--skip-update'\]/s,
|
|
211
211
|
'Native desktop 9Router launch must bypass the interactive CLI menu on Windows while preserving the standard CLI launch elsewhere'
|
|
212
212
|
));
|
|
213
213
|
|
|
@@ -292,7 +292,7 @@ checks.push(() => expectMatch(
|
|
|
292
292
|
|
|
293
293
|
checks.push(() => expectMatch(
|
|
294
294
|
setup,
|
|
295
|
-
/function providerLines\(arr, shell\) \{[\s\S]*npm install -g 9router[\s\S]*start "9Router" cmd \/k "9router -n -
|
|
295
|
+
/function providerLines\(arr, shell\) \{[\s\S]*npm install -g 9router[\s\S]*start "9Router" cmd \/k "9router -n -l -H 0\.0\.0\.0 -p 20128 --skip-update"[\s\S]*nohup 9router -n -l -H 0\.0\.0\.0 -p 20128 --skip-update[\s\S]*9router-smart-route-sync\.js/s,
|
|
296
296
|
'Native script generation must install and start a standalone 9Router dashboard on port 20128'
|
|
297
297
|
));
|
|
298
298
|
|
package/tmp_diff.patch
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
diff --git a/cli.js b/cli.js
|
|
2
|
-
index e0bbb01..4d1b591 100644
|
|
3
|
-
--- a/cli.js
|
|
4
|
-
+++ b/cli.js
|
|
5
|
-
@@ -5,7 +5,7 @@ import fs from 'fs-extra';
|
|
6
|
-
import path from 'path';
|
|
7
|
-
import os from 'os';
|
|
8
|
-
import chalk from 'chalk';
|
|
9
|
-
-import { spawn, execSync } from 'child_process';
|
|
10
|
-
+import { spawn, execSync, execFileSync } from 'child_process';
|
|
11
|
-
const TELEGRAM_RELAY_PLUGIN_ID = 'openclaw-telegram-multibot-relay';
|
|
12
|
-
// Use plain npm package name ΓÇö clawhub: protocol not supported in all OpenClaw versions
|
|
13
|
-
const TELEGRAM_RELAY_PLUGIN_SPEC = TELEGRAM_RELAY_PLUGIN_ID;
|
|
14
|
-
@@ -363,6 +363,23 @@ setTimeout(sync, 5000);
|
|
15
|
-
setInterval(sync, INTERVAL);`;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
+function resolveCommandOnPath(command) {
|
|
19
|
-
+ if (process.platform === 'win32') {
|
|
20
|
-
+ return resolveWindowsCommand(command);
|
|
21
|
-
+ }
|
|
22
|
-
+
|
|
23
|
-
+ try {
|
|
24
|
-
+ return execSync(`command -v ${command}`, {
|
|
25
|
-
+ stdio: ['ignore', 'pipe', 'ignore'],
|
|
26
|
-
+ encoding: 'utf8',
|
|
27
|
-
+ shell: true,
|
|
28
|
-
+ env: process.env
|
|
29
|
-
+ }).trim() || command;
|
|
30
|
-
+ } catch {
|
|
31
|
-
+ return command;
|
|
32
|
-
+ }
|
|
33
|
-
+}
|
|
34
|
-
+
|
|
35
|
-
function indentBlock(text, spaces) {
|
|
36
|
-
const prefix = ' '.repeat(spaces);
|
|
37
|
-
return String(text)
|
|
38
|
-
@@ -608,26 +625,46 @@ function runPm2Save({ projectDir, isVi }) {
|
|
39
|
-
|
|
40
|
-
function startNative9RouterPm2({ isVi, projectDir, appName, syncScriptPath }) {
|
|
41
|
-
const routerAppName = `${appName}-9router`;
|
|
42
|
-
- execSync(
|
|
43
|
-
- `pm2 start "9router -n -t -l -H 0.0.0.0 -p 20128 --skip-update" --name "${routerAppName}" --cwd "${projectDir.replace(/\\/g, '/')}"`,
|
|
44
|
-
- {
|
|
45
|
-
+ const routerCommand = resolveCommandOnPath('9router');
|
|
46
|
-
+ execFileSync('pm2', [
|
|
47
|
-
+ 'start',
|
|
48
|
-
+ routerCommand,
|
|
49
|
-
+ '--name',
|
|
50
|
-
+ routerAppName,
|
|
51
|
-
+ '--cwd',
|
|
52
|
-
+ projectDir.replace(/\\/g, '/'),
|
|
53
|
-
+ '--interpreter',
|
|
54
|
-
+ 'none',
|
|
55
|
-
+ '--',
|
|
56
|
-
+ '-n',
|
|
57
|
-
+ '-t',
|
|
58
|
-
+ '-l',
|
|
59
|
-
+ '-H',
|
|
60
|
-
+ '0.0.0.0',
|
|
61
|
-
+ '-p',
|
|
62
|
-
+ '20128',
|
|
63
|
-
+ '--skip-update'
|
|
64
|
-
+ ], {
|
|
65
|
-
+ cwd: projectDir,
|
|
66
|
-
+ stdio: 'inherit',
|
|
67
|
-
+ env: process.env
|
|
68
|
-
+ });
|
|
69
|
-
+ if (syncScriptPath) {
|
|
70
|
-
+ const syncAppName = `${appName}-9router-sync`;
|
|
71
|
-
+ execFileSync('pm2', [
|
|
72
|
-
+ 'start',
|
|
73
|
-
+ syncScriptPath.replace(/\\/g, '/'),
|
|
74
|
-
+ '--name',
|
|
75
|
-
+ syncAppName,
|
|
76
|
-
+ '--cwd',
|
|
77
|
-
+ projectDir.replace(/\\/g, '/'),
|
|
78
|
-
+ '--interpreter',
|
|
79
|
-
+ process.execPath
|
|
80
|
-
+ ], {
|
|
81
|
-
cwd: projectDir,
|
|
82
|
-
stdio: 'inherit',
|
|
83
|
-
- shell: true,
|
|
84
|
-
env: process.env
|
|
85
|
-
- }
|
|
86
|
-
- );
|
|
87
|
-
- if (syncScriptPath) {
|
|
88
|
-
- const syncAppName = `${appName}-9router-sync`;
|
|
89
|
-
- execSync(
|
|
90
|
-
- `pm2 start "node ${syncScriptPath.replace(/\\/g, '/')}" --name "${syncAppName}" --cwd "${projectDir.replace(/\\/g, '/')}"`,
|
|
91
|
-
- {
|
|
92
|
-
- cwd: projectDir,
|
|
93
|
-
- stdio: 'inherit',
|
|
94
|
-
- shell: true,
|
|
95
|
-
- env: process.env
|
|
96
|
-
- }
|
|
97
|
-
- );
|
|
98
|
-
+ });
|
|
99
|
-
}
|
|
100
|
-
runPm2Save({ projectDir, isVi });
|
|
101
|
-
console.log(chalk.green(`\n✅ ${isVi ? '9Router da duoc khoi dong qua PM2.' : '9Router is running via PM2.'}`));
|
|
102
|
-
diff --git a/tests/smoke-cli-logic.mjs b/tests/smoke-cli-logic.mjs
|
|
103
|
-
index 3ab996c..7fd80f8 100644
|
|
104
|
-
--- a/tests/smoke-cli-logic.mjs
|
|
105
|
-
+++ b/tests/smoke-cli-logic.mjs
|
|
106
|
-
@@ -195,7 +195,7 @@ checks.push(() => expectMatch(
|
|
107
|
-
|
|
108
|
-
checks.push(() => expectMatch(
|
|
109
|
-
cli,
|
|
110
|
-
- /function startNative9RouterPm2\(\{ isVi, projectDir, appName, syncScriptPath \}\) \{[\s\S]*9router -n -t -l -H 0\.0\.0\.0 -p 20128 --skip-update[\s\S]*9router-sync[\s\S]*runPm2Save\(\{ projectDir, isVi \}\)/s,
|
|
111
|
-
+ /function startNative9RouterPm2\(\{ isVi, projectDir, appName, syncScriptPath \}\) \{[\s\S]*resolveCommandOnPath\('9router'\)[\s\S]*execFileSync\('pm2'[\s\S]*--interpreter'?,?[\s\S]*none[\s\S]*--skip-update[\s\S]*syncScriptPath\.replace\(\/\\\\\/g, '\/'\)[\s\S]*process\.execPath[\s\S]*runPm2Save\(\{ projectDir, isVi \}\)/s,
|
|
112
|
-
'VPS native 9Router flow must start a standalone 9Router dashboard on port 20128 via PM2'
|
|
113
|
-
));
|
|
114
|
-
|