nuwax-deploy-installer 0.2.1-beta.1

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 ADDED
@@ -0,0 +1,25 @@
1
+ # nuwax-deploy-installer
2
+
3
+ Unified deployment CLI for nuwax services. **Binaries are bundled inside this npm package** (no GitHub Release download).
4
+
5
+ ## Quick start (Mac Apple Silicon)
6
+
7
+ ```bash
8
+ npm install -g nuwax-deploy-installer
9
+ deploy-installer document-parser install --install-dir ~/document-parser
10
+ ```
11
+
12
+ See [crates/deploy-installer/doc/mac-mini-quickstart.md](../crates/deploy-installer/doc/mac-mini-quickstart.md) for full guide.
13
+
14
+ ## Commands
15
+
16
+ ```bash
17
+ deploy-installer doctor
18
+ deploy-installer document-parser setup --install-dir ~/document-parser
19
+ deploy-installer document-parser install --install-dir ~/document-parser
20
+ deploy-installer document-parser service status --install-dir ~/document-parser
21
+ ```
22
+
23
+ ## Supported platforms (phase 1)
24
+
25
+ - macOS Apple Silicon (`darwin-arm64`)
@@ -0,0 +1,63 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ const { spawnSync } = require('node:child_process');
5
+ const fs = require('node:fs');
6
+ const path = require('node:path');
7
+
8
+ function platformKey() {
9
+ if (process.platform === 'darwin' && process.arch === 'arm64') {
10
+ return 'darwin-arm64';
11
+ }
12
+ if (process.platform === 'darwin' && process.arch === 'x64') {
13
+ return 'darwin-x64';
14
+ }
15
+ if (process.platform === 'linux' && process.arch === 'x64') {
16
+ return 'linux-x64';
17
+ }
18
+ if (process.platform === 'linux' && process.arch === 'arm64') {
19
+ return 'linux-arm64';
20
+ }
21
+ return null;
22
+ }
23
+
24
+ function main() {
25
+ const key = platformKey();
26
+ if (!key) {
27
+ console.error(
28
+ `nuwax-deploy-installer: unsupported platform ${process.platform}-${process.arch}`
29
+ );
30
+ process.exit(1);
31
+ }
32
+
33
+ const pkgRoot = path.resolve(__dirname, '..');
34
+ const vendorRoot = path.join(pkgRoot, 'vendor');
35
+ const binary = path.join(vendorRoot, key, 'deploy-installer');
36
+
37
+ if (!fs.existsSync(binary)) {
38
+ console.error(
39
+ `nuwax-deploy-installer: missing binary for ${key} at ${binary}\n` +
40
+ 'Reinstall the package or use a build that includes your platform.'
41
+ );
42
+ process.exit(1);
43
+ }
44
+
45
+ const env = {
46
+ ...process.env,
47
+ NUWAX_DEPLOY_ROOT: vendorRoot,
48
+ NUWAX_DEPLOY_VERSION: require(path.join(pkgRoot, 'package.json')).version,
49
+ };
50
+
51
+ const result = spawnSync(binary, process.argv.slice(2), {
52
+ stdio: 'inherit',
53
+ env,
54
+ });
55
+
56
+ if (result.error) {
57
+ console.error(result.error.message);
58
+ process.exit(1);
59
+ }
60
+ process.exit(result.status ?? 1);
61
+ }
62
+
63
+ main();
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "nuwax-deploy-installer",
3
+ "version": "0.2.1-beta.1",
4
+ "description": "Unified deployment CLI for nuwax services (document-parser, voice-cli)",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/nuwax-ai/mcp-proxy.git",
9
+ "directory": "npm/nuwax-deploy-installer"
10
+ },
11
+ "bin": {
12
+ "deploy-installer": "bin/deploy-installer.js"
13
+ },
14
+ "files": [
15
+ "bin",
16
+ "vendor",
17
+ "README.md"
18
+ ],
19
+ "engines": {
20
+ "node": ">=18"
21
+ },
22
+ "keywords": [
23
+ "nuwax",
24
+ "document-parser",
25
+ "deploy",
26
+ "launchd",
27
+ "systemd"
28
+ ]
29
+ }
@@ -0,0 +1,17 @@
1
+ # document-parser 环境变量(OSS 密钥必填)
2
+ #
3
+ # 格式要点:
4
+ # - 不要写 export(systemd EnvironmentFile 不识别 shell 语法),纯 KEY=value
5
+ # - 值含特殊字符用单引号: KEY='value'
6
+ # - 权限: chmod 600 .document-parser.env && chown <运行用户> .document-parser.env
7
+
8
+ # ===== 阿里云 OSS 密钥(必填,否则 OSS 上传/下载失败)=====
9
+ OSS_ACCESS_KEY_ID=
10
+ OSS_ACCESS_KEY_SECRET=
11
+
12
+ # ===== 以下为可选环境变量(一般无需手动设)=====
13
+ # document-parser 会按 config.yml 自动把 device/vram/model-source 注入给 mineru 子进程
14
+ # (MINERU_DEVICE_MODE / MINERU_VIRTUAL_VRAM_SIZE / MINERU_MODEL_SOURCE),用户层不用管。
15
+
16
+ # 仅当想强制覆盖模型源时才设(默认国内会自动用 modelscope):
17
+ # MINERU_MODEL_SOURCE=modelscope
@@ -0,0 +1,32 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>Label</key>
6
+ <string>com.nuwax.document-parser</string>
7
+ <key>WorkingDirectory</key>
8
+ <string>__INSTALL_DIR__</string>
9
+ <key>ProgramArguments</key>
10
+ <array>
11
+ <string>__INSTALL_DIR__/run-server.sh</string>
12
+ </array>
13
+ <key>EnvironmentVariables</key>
14
+ <dict>
15
+ <key>PATH</key>
16
+ <string>/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Frameworks/Python.framework/Versions/Current/bin</string>
17
+ </dict>
18
+ <key>RunAtLoad</key>
19
+ <true/>
20
+ <key>KeepAlive</key>
21
+ <dict>
22
+ <key>SuccessfulExit</key>
23
+ <false/>
24
+ </dict>
25
+ <key>StandardOutPath</key>
26
+ <string>__INSTALL_DIR__/logs/launchd.stdout.log</string>
27
+ <key>StandardErrorPath</key>
28
+ <string>__INSTALL_DIR__/logs/launchd.stderr.log</string>
29
+ <key>ProcessType</key>
30
+ <string>Background</string>
31
+ </dict>
32
+ </plist>
@@ -0,0 +1,79 @@
1
+ # ===== document-parser 配置模板 =====
2
+ # 部署时复制为 config.yml,按需修改:
3
+ # - mineru.backend / vram / gpu_memory_utilization(见下方注释)
4
+ # - storage.oss 的 bucket / endpoint(改成你自己的)
5
+ # - OSS 密钥不放这里,放 .document-parser.env(见 systemd/.document-parser.env.example)
6
+
7
+ environment: "development"
8
+
9
+ server:
10
+ # document-parser 默认 8087;与 voice-cli(默认 8077)同机部署时避免端口冲突
11
+ port: 8087
12
+ host: "0.0.0.0"
13
+
14
+ log:
15
+ level: "info"
16
+ path: "logs"
17
+ retain_days: 20
18
+
19
+ document_parser:
20
+ max_concurrent: 5
21
+ queue_size: 1000
22
+ download_timeout: 3600
23
+ processing_timeout: 3600 # 60 分钟,MinerU/MarkItDown 解析超时
24
+
25
+ # MinerU 配置(mineru 3.4)
26
+ mineru:
27
+ # 后端选择(按解析需求切,改完 service restart 生效):
28
+ # pipeline(默认) — 传统 OCR+layout,快(~30s/文档),GPU 间歇加速。大多数文档够用。
29
+ # hybrid-engine — VLM 后端,复杂版式/扫描件/公式密集文档解析质量更好,但慢
30
+ # (VLM 模型每次加载 ~60s)。依赖 python3.12-dev(triton 编译 GPU kernel):
31
+ # sudo apt-get install -y python3.12-dev
32
+ # vlm-engine / vlm-http-client / hybrid-http-client — 见 MinerU 文档
33
+ backend: "pipeline"
34
+ python_path: "./venv/bin/python"
35
+ max_concurrent: 3
36
+ queue_size: 100
37
+ batch_size: 1
38
+ quality_level: "Balanced"
39
+ # 推理设备: cpu / cuda / cuda:0 / mps / npu
40
+ # - Linux+NVIDIA: 写 cpu 会自动升 cuda(nvidia-smi 探测),也可显式 cuda:0
41
+ # - macOS(Metal): 必须显式写 "mps",否则跑 CPU(MPS 不自动检测,慢 5-10 倍)
42
+ # - 多 GPU: 写 cuda:0 / cuda:1 指定
43
+ device: "cpu"
44
+ # 显存(GB), 通过 MINERU_VIRTUAL_VRAM_SIZE 注入; 0=不限
45
+ vram: 0
46
+ # VLM 推理显存占比(仅 hybrid-engine/vlm-engine), 通过 --gpu-memory-utilization 注入;
47
+ # 0=用 mineru 默认(~0.5); 与其他 GPU 进程(如 voice-cli)共存建议 0.3 避免 OOM
48
+ gpu_memory_utilization: 0.3
49
+
50
+ markitdown:
51
+ python_path: "./venv/bin/python"
52
+ enable_plugins: false
53
+ features:
54
+ ocr: true
55
+ audio_transcription: true
56
+ azure_doc_intel: false
57
+ youtube_transcription: false
58
+
59
+ storage:
60
+ sled:
61
+ path: "data/document_parser"
62
+ cache_capacity: 104857600 # 100MB
63
+ oss:
64
+ endpoint: "oss-rg-china-mainland.aliyuncs.com" # ← 改成你的 OSS endpoint
65
+ public_bucket: "your-public-bucket" # ← 改成你的公共 bucket
66
+ private_bucket: "your-private-bucket" # ← 改成你的私有 bucket
67
+ access_key_id: "${OSS_ACCESS_KEY_ID}" # 从 .document-parser.env 读
68
+ access_key_secret: "${OSS_ACCESS_KEY_SECRET}"
69
+ region: "oss-rg-china-mainland"
70
+ upload_directory: "document_parser"
71
+
72
+ file_size_config:
73
+ max_file_size: "200MB"
74
+ large_document_threshold: "50MB"
75
+
76
+ external_integration:
77
+ webhook_url: ""
78
+ api_key: ""
79
+ timeout: 30
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env bash
2
+ # LaunchAgent wrapper: load OSS secrets then start document-parser.
3
+ set -euo pipefail
4
+ export PATH="/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Frameworks/Python.framework/Versions/Current/bin:${PATH:-}"
5
+ cd "$(dirname "$0")"
6
+ set -a
7
+ # shellcheck disable=SC1091
8
+ source .document-parser.env
9
+ set +a
10
+ exec ./document-parser --config ./config.yml server
@@ -0,0 +1,8 @@
1
+ {
2
+ "version": "0.2.1-beta.1",
3
+ "optionalAssets": {
4
+ "venv": {
5
+ "darwin-arm64": "https://nuwa-packages.oss-rg-china-mainland.aliyuncs.com/uploads/document-parser/venv-macos-arm64-{version}.tar.gz"
6
+ }
7
+ }
8
+ }