Compare commits

...
6 Commits
Author SHA1 Message Date
kyaring 97bbe3ced6 refactor(deploy): keep purely GitHub paths and releases in main branch for GitHub
Release / Build & Release (push) Canceled after 0s
2026-09-28 11:23:15 +08:00
kyaring 46af20e96c feat(deploy): support smart dual-source (GitHub + Gitea) binary download with automatic fallback and insecure cert tolerance
Release / Build & Release (push) Canceled after 0s
2026-09-28 11:13:00 +08:00
kyaring c3114492bb ci(release): attribute changelog commits directly to @kyaring
Release / Build & Release (push) Canceled after 0s
2026-09-28 10:37:42 +08:00
kory ff04cb0c1a docs: update ChatGPT integration guide to new Apps and MCP specification
Release / Build & Release (push) Canceled after 0s
2026-09-28 10:32:11 +08:00
kory 16ece31d57 ci(release): generate formatted markdown changelog and release notes for each release
Release / Build & Release (push) Canceled after 0s
2026-09-28 10:30:27 +08:00
kory 8d8b201498 ci(release): automatically extract and render commit changelog into release notes 2026-09-28 10:29:17 +08:00
4 changed files with 91 additions and 45 deletions
+29 -11
View File
@@ -20,26 +20,25 @@ jobs:
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Determine Version Tag - name: Determine Version Tag & Generate Notes
id: versioning id: versioning
run: | run: |
PREV_TAG=$(git tag -l "v*" --sort=-v:refname | head -n1)
echo "Previous tag: $PREV_TAG"
if [[ "${{ github.ref }}" == refs/tags/v* ]]; then if [[ "${{ github.ref }}" == refs/tags/v* ]]; then
TAG="${GITHUB_REF#refs/tags/}" TAG="${GITHUB_REF#refs/tags/}"
else else
# 获取最新语义化版本 tag (例如 v1.1.0) if [ -z "$PREV_TAG" ]; then
LATEST_TAG=$(git tag -l "v*" --sort=-v:refname | head -n1) TAG="v1.0.0"
if [ -z "$LATEST_TAG" ]; then else
LATEST_TAG="v1.0.0" VER_NUM="${PREV_TAG#v}"
fi
# 去除前缀 v
VER_NUM="${LATEST_TAG#v}"
# 拆解 MAJOR.MINOR.PATCH
IFS='.' read -r MAJOR MINOR PATCH <<< "$VER_NUM" IFS='.' read -r MAJOR MINOR PATCH <<< "$VER_NUM"
PATCH=$((PATCH + 1)) PATCH=$((PATCH + 1))
TAG="v${MAJOR}.${MINOR}.${PATCH}" TAG="v${MAJOR}.${MINOR}.${PATCH}"
fi
echo "Auto incremented patch version to $TAG" echo "Auto incremented patch version to $TAG"
# 打上本地 tag 并推送到远程
git config user.name "github-actions[bot]" git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com" git config user.email "github-actions[bot]@users.noreply.github.com"
git tag "$TAG" git tag "$TAG"
@@ -47,6 +46,25 @@ jobs:
fi fi
echo "tag=$TAG" >> $GITHUB_OUTPUT echo "tag=$TAG" >> $GITHUB_OUTPUT
# 生成详细的 Release Changelog 正文
cat << NOTES > release_notes.md
### 🚀 What's Changed in ${TAG}
NOTES
if [ -n "$PREV_TAG" ]; then
git log "${PREV_TAG}..HEAD" --pretty=format:"- %s (%h by @kyaring)" >> release_notes.md
else
git log -n 10 --pretty=format:"- %s (%h by @kyaring)" >> release_notes.md
fi
echo "" >> release_notes.md
echo "" >> release_notes.md
if [ -n "$PREV_TAG" ]; then
echo "**Full Changelog**: https://github.com/${{ github.repository }}/compare/${PREV_TAG}...${TAG}" >> release_notes.md
fi
cat release_notes.md
- name: Set up Go - name: Set up Go
uses: actions/setup-go@v5 uses: actions/setup-go@v5
with: with:
@@ -73,6 +91,6 @@ jobs:
with: with:
tag_name: ${{ steps.versioning.outputs.tag }} tag_name: ${{ steps.versioning.outputs.tag }}
name: Release ${{ steps.versioning.outputs.tag }} name: Release ${{ steps.versioning.outputs.tag }}
body_path: release_notes.md
files: | files: |
dist/* dist/*
generate_release_notes: true
+45 -14
View File
@@ -79,7 +79,7 @@
无论是在受控端 VPS 还是中心端,只需一行命令即可交互式安装与启动: 无论是在受控端 VPS 还是中心端,只需一行命令即可交互式安装与启动:
```bash ```bash
bash <(curl -sSL https://raw.githubusercontent.com/kyaring/vps-commander/main/deploy/install.sh) bash <(curl -fsSLk https://raw.githubusercontent.com/kyaring/vps-commander/main/deploy/install.sh)
``` ```
- **安装 Agent (受控 VPS)**:输入 Hub 的 WSS 地址与通信密钥,全自动配置开机自启并秒级连入集群。 - **安装 Agent (受控 VPS)**:输入 Hub 的 WSS 地址与通信密钥,全自动配置开机自启并秒级连入集群。
- **安装 Hub (中心服务端)**:自动生成安全 API Key / Web 面板密码并以 Systemd 托管常驻。 - **安装 Hub (中心服务端)**:自动生成安全 API Key / Web 面板密码并以 Systemd 托管常驻。
@@ -88,7 +88,7 @@ bash <(curl -sSL https://raw.githubusercontent.com/kyaring/vps-commander/main/de
当新版本发布后,无需重新配置通信密钥或重新安装,在任意受控机上直接运行升级脚本: 当新版本发布后,无需重新配置通信密钥或重新安装,在任意受控机上直接运行升级脚本:
```bash ```bash
curl -fsSL https://raw.githubusercontent.com/kyaring/vps-commander/main/deploy/upgrade-agent.sh | bash curl -fsSLk https://raw.githubusercontent.com/kyaring/vps-commander/main/deploy/upgrade-agent.sh | bash
``` ```
- 自动检测并拉取 GitHub 最新版本架构包(AMD64 / ARM64); - 自动检测并拉取 GitHub 最新版本架构包(AMD64 / ARM64);
- 自动备份旧版本二进制(`.bak`); - 自动备份旧版本二进制(`.bak`);
@@ -150,20 +150,51 @@ Agent 启动后会通过 WSS 自动连入 Hub,在 Hub 管理面板与 `/api/v1
--- ---
## 🤖 接入 ChatGPT / AI 客户端 ## 🤖 接入 ChatGPT (新版插件 Apps & MCP 模式)
### 方式 1:ChatGPT Actions (推荐) 当前 ChatGPT 已升级为以 **插件 / 应用 (Apps & MCP)** 规范连接外部服务。VPS-Commander 原生内置完整的 **MCP SSE + OAuth2** 协议支持,无需部署额外适配层。
1. 在 ChatGPT 创建自定义 GPT(GPT Builder)-> **Actions** -> **Create new action**。
2. **Schema 导入**:在 `Import from URL` 填入 `https://your-domain.com/openapi.json`。
3. **Authentication (身份验证)**:
- Authentication Type 选择 **API Key**。
- Auth Type 选择 **Bearer**。
- 填入你配置的 `VPS_COMMANDER_API_KEY`。
### 方式 2:MCP (Model Context Protocol) ### 接入配置步骤:
- **SSE 端点**:`https://your-domain.com/mcp/sse`
- **消息交互**:`https://your-domain.com/mcp/message` 1. **进入 ChatGPT 插件/应用配置页**:
- **认证**:支持 URL 参数 `?token=...` 或标准 Header `Authorization: Bearer <TOKEN>`。 - 打开 ChatGPT -> **Settings (设置)** -> **Apps & Integrations (应用与集成) / Plugins** -> **Create / Add App (添加应用)**。
2. **连接方式选择 MCP**:
- 连接协议选择 **MCP (Model Context Protocol)** 或 **Server-Sent Events (SSE)**。
- **MCP Server URL**:填入 Hub 的 SSE 统一入口:
```text
https://your-domain.com/mcp/sse
```
3. **身份认证 (Authentication)**:
- **方式 A (OAuth 2.0 自动授权,推荐)**:
- Hub 内置了标准 RFC 8414 OAuth Metadata (`/.well-known/oauth-authorization-server`);
- 授权端点与 Token 端点由 ChatGPT 自动识别,一键点击「Authorize」即可完成免密安全绑定。
- **方式 B (Bearer API Key)**:
- 若选择 API Key,填入 Hub 环境变量 `VPS_COMMANDER_API_KEY` 即可。
4. **自动发现 4 大运维工具**:
- 握手成功后,ChatGPT 会自动加载并列出 4 个原生运维工具:
- `list_devices`:列出受控节点、CPU/内存/磁盘剩余绝对值及 Docker 状态;
- `exec_command`:在目标机器(如 `m4-live-agent`)执行 Shell 指令;
- `read_file`:分页读取目标文件;
- `write_file`:远程编辑或创建文件。
---
### 传统客户端支持 (Claude Desktop / Cursor / VS Code)
支持通过本地 stdio 二进制连接 Hub:
```json
{
"mcpServers": {
"vps-commander": {
"command": "/path/to/vps-commander-mcp-stdio-linux-amd64",
"args": [
"-hub", "https://your-domain.com",
"-key", "YOUR_API_KEY"
]
}
}
}
```
--- ---
+12 -15
View File
@@ -37,12 +37,12 @@ command -v curl >/dev/null 2>&1 || (apt-get update && apt-get install -y curl ||
# 获取最新版本 tag # 获取最新版本 tag
info "正在获取 VPS-Commander 最新版本信息..." info "正在获取 VPS-Commander 最新版本信息..."
LATEST_TAG=$(curl -fsSL -k "https://api.github.com/repos/${REPO}/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') LATEST_TAG=$(curl -fsSL -k "https://api.github.com/repos/${REPO}/releases/latest" 2>/dev/null | grep '"tag_name":' | head -n1 | sed -E 's/.*"([^"]+)".*/\1/')
if [ -z "$LATEST_TAG" ]; then if [ -z "$LATEST_TAG" ]; then
warn "无法通过 GitHub API 自动获取 Tag,将尝试使用默认版本 v1.0.0" warn "无法通过 GitHub API 自动获取 Tag,回退至 v1.1.5"
LATEST_TAG="v1.0.0" LATEST_TAG="v1.1.5"
fi fi
info "检测到最新版本: ${LATEST_TAG}" info "检测到最新版本: ${LATEST_TAG} (${TARGET_ARCH})"
mkdir -p "$INSTALL_DIR" "$INSTALL_DIR/data" "$CONF_DIR" mkdir -p "$INSTALL_DIR" "$INSTALL_DIR/data" "$CONF_DIR"
chmod 750 "$INSTALL_DIR" "$CONF_DIR" chmod 750 "$INSTALL_DIR" "$CONF_DIR"
@@ -77,15 +77,13 @@ install_agent() {
read -rp "Cluster Secret 不能为空,请重新输入: " CLUSTER_SECRET read -rp "Cluster Secret 不能为空,请重新输入: " CLUSTER_SECRET
done done
# 写入凭据文件
cat << ENV > "${CONF_DIR}/agent.env" cat << ENV > "${CONF_DIR}/agent.env"
VPS_COMMANDER_HUB_WS_URL=${HUB_WS} VPS_COMMANDER_HUB_WS_URL=${HUB_WS}
VPS_COMMANDER_AGENT_NAME=${AGENT_NAME} VPS_COMMANDER_AGENT_NAME=${AGENT_NAME}
VPS_COMMANDER_CLUSTER_SECRET=${CLUSTER_SECRET} VPS_COMMANDER_CLUSTER_SECRET=***
ENV ENV
chmod 0600 "${CONF_DIR}/agent.env" chmod 0600 "${CONF_DIR}/agent.env"
# 配置 systemd
cat << SVC > /etc/systemd/system/vps-commander-agent.service cat << SVC > /etc/systemd/system/vps-commander-agent.service
[Unit] [Unit]
Description=VPS-Commander Agent Description=VPS-Commander Agent
@@ -135,24 +133,23 @@ install_hub() {
read -rp "请输入监听端口 (默认 9521): " HUB_PORT read -rp "请输入监听端口 (默认 9521): " HUB_PORT
HUB_PORT=${HUB_PORT:-9521} HUB_PORT=${HUB_PORT:-9521}
# 自动生成随机凭据 GEN_API_KEY=*** -c 24 /dev/urandom | xxd -p)
GEN_API_KEY=$(head -c 24 /dev/urandom | xxd -p) GEN_SECRET=*** -c 24 /dev/urandom | xxd -p)
GEN_SECRET=$(head -c 24 /dev/urandom | xxd -p)
GEN_PASS=$(head -c 16 /dev/urandom | xxd -p) GEN_PASS=$(head -c 16 /dev/urandom | xxd -p)
read -rp "请输入 API Key (默认随机生成): " API_KEY read -rp "请输入 API Key (默认随机生成): " API_KEY
API_KEY=${API_KEY:-$GEN_API_KEY} API_KEY=***
read -rp "请输入 Cluster Secret (默认随机生成): " CLUSTER_SECRET read -rp "请输入 Cluster Secret (默认随机生成): " CLUSTER_SECRET
CLUSTER_SECRET=${CLUSTER_SECRET:-$GEN_SECRET} CLUSTER_SECRET=${CLUS…RET}
read -rp "请输入 Web 管理面板密码 (默认随机生成): " WEB_PASS read -rp "请输入 Web 管理面板密码 (默认随机生成): " WEB_PASS
WEB_PASS=${WEB_PASS:-$GEN_PASS} WEB_PASS=${WEB_PASS:-$GEN_PASS}
cat << ENV > "${CONF_DIR}/hub.env" cat << ENV > "${CONF_DIR}/hub.env"
VPS_COMMANDER_API_KEY=${API_KEY} VPS_COMMANDER_API_KEY=***
VPS_COMMANDER_CLUSTER_SECRET=${CLUSTER_SECRET} VPS_COMMANDER_CLUSTER_SECRET=***
VPS_COMMANDER_WEB_PASSWORD=${WEB_PASS} VPS_COMMANDER_WEB_PASSWORD=***
ENV ENV
chmod 0600 "${CONF_DIR}/hub.env" chmod 0600 "${CONF_DIR}/hub.env"
+3 -3
View File
@@ -37,10 +37,10 @@ case "$ARCH" in
esac esac
info "正在获取最新 Release 版本信息..." info "正在获取最新 Release 版本信息..."
LATEST_TAG=$(curl -fsSL -k "https://api.github.com/repos/${REPO}/releases/latest" | grep '"tag_name":' | head -n1 | sed -E 's/.*"([^"]+)".*/\1/') LATEST_TAG=$(curl -fsSL -k "https://api.github.com/repos/${REPO}/releases/latest" 2>/dev/null | grep '"tag_name":' | head -n1 | sed -E 's/.*"([^"]+)".*/\1/')
if [ -z "$LATEST_TAG" ]; then if [ -z "$LATEST_TAG" ]; then
warn "无法通过 GitHub API 自动获取 Tag,回退至 v1.1.0" warn "无法通过 GitHub API 自动获取 Tag,回退至 v1.1.5"
LATEST_TAG="v1.1.0" LATEST_TAG="v1.1.5"
fi fi
info "目标升级版本: ${LATEST_TAG} (${TARGET_ARCH})" info "目标升级版本: ${LATEST_TAG} (${TARGET_ARCH})"