|
|
@@ -19,55 +19,38 @@ wedo 原型协同**中心通知服务**——多人通过 git 共建原型库(
|
|
|
| GET | `/health` | 健康检查 |
|
|
|
|
|
|
- **鉴权**:所有请求头 `x-wedo-token: <WEDO_TOKEN>`(服务端未设置 WEDO_TOKEN 时不校验);
|
|
|
+- **CORS**:回显请求 Origin 并放行 OPTIONS 预检(预检不带 token,在鉴权前处理),支持 `file://` 门户页面跨域轮询;
|
|
|
- **项目维度**:`repo` 字段隔离(如 `hanglung`、其他系统原型库各自命名),一份 hub 服务多项目;
|
|
|
- **持久化**:内存 + `events.json`(最近 200 条,重启不丢)。
|
|
|
|
|
|
## 部署
|
|
|
|
|
|
-### 方式一:node 直启(最快)
|
|
|
+**当前线上部署**:gogs 服务器(CentOS 7)以 Docker 运行,对外经宝塔 nginx 反代复用 gogs.wxapp.info 证书:
|
|
|
|
|
|
-```bash
|
|
|
-node server.js # 默认 8790 端口,无鉴权(仅内网可信环境)
|
|
|
-WEDO_PORT=8790 WEDO_TOKEN=你的口令 node server.js
|
|
|
-```
|
|
|
+- 对外地址:`https://gogs.wxapp.info/wedo-hub/`(nginx `file-upload.conf` 中 `/wedo-hub/` → `127.0.0.1:8790`,端口仅绑本机)
|
|
|
+- 容器管理:`cd /lio/projects/crrc/wedo-mcp-server && docker compose up -d`(restart=unless-stopped,开机自启)
|
|
|
+- 口令:仓库目录 `.env` 的 `WEDO_TOKEN`(git 忽略,不入库;变更后 `docker compose up -d` 重建生效)
|
|
|
|
|
|
-Windows: `set WEDO_TOKEN=xxx && node server.js`
|
|
|
-
|
|
|
-### 方式二:pm2 守护
|
|
|
+### 容器方式(线上采用,宿主机 node 版本过老时)
|
|
|
|
|
|
```bash
|
|
|
-npm i -g pm2
|
|
|
-WEDO_PORT=8790 WEDO_TOKEN=你的口令 pm2 start server.js --name wedo-hub
|
|
|
-pm2 save && pm2 startup
|
|
|
+echo "WEDO_TOKEN=你的口令" > .env
|
|
|
+docker compose up -d
|
|
|
```
|
|
|
|
|
|
-### 方式三:systemd(Linux)
|
|
|
-
|
|
|
-```ini
|
|
|
-# /etc/systemd/system/wedo-hub.service
|
|
|
-[Unit]
|
|
|
-Description=wedo prototype hub
|
|
|
-After=network.target
|
|
|
-
|
|
|
-[Service]
|
|
|
-WorkingDirectory=/opt/wedo-hub
|
|
|
-Environment=WEDO_PORT=8790
|
|
|
-Environment=WEDO_TOKEN=你的口令
|
|
|
-ExecStart=/usr/bin/node server.js
|
|
|
-Restart=always
|
|
|
-
|
|
|
-[Install]
|
|
|
-WantedBy=multi-user.target
|
|
|
-```
|
|
|
+### node 直启(内网快速试用)
|
|
|
|
|
|
```bash
|
|
|
-systemctl enable --now wedo-hub
|
|
|
+node server.js # 默认 8790 端口,无鉴权(仅内网可信环境)
|
|
|
+WEDO_PORT=8790 WEDO_TOKEN=你的口令 node server.js
|
|
|
```
|
|
|
|
|
|
+Windows: `set WEDO_TOKEN=xxx && node server.js`
|
|
|
+
|
|
|
### 验证
|
|
|
|
|
|
```bash
|
|
|
-curl -H "x-wedo-token: 你的口令" http://<host>:8790/health
|
|
|
+curl -H "x-wedo-token: 你的口令" https://gogs.wxapp.info/wedo-hub/health
|
|
|
```
|
|
|
|
|
|
## MCP 侧配套(各协作用户)
|
|
|
@@ -76,7 +59,7 @@ ZCode 的 wedo MCP 配置 env:
|
|
|
|
|
|
```json
|
|
|
{
|
|
|
- "WEDO_HUB_URL": "http://<host>:8790",
|
|
|
+ "WEDO_HUB_URL": "https://gogs.wxapp.info/wedo-hub",
|
|
|
"WEDO_HUB_TOKEN": "你的口令",
|
|
|
"WEDO_REPO": "hanglung"
|
|
|
}
|