修复 Agent 部署 Pages 问题

This commit is contained in:
ryan
2026-06-21 11:53:54 +08:00
parent 36f11c6ecb
commit 13a375e042
19 changed files with 755 additions and 59 deletions
+4
View File
@@ -30,6 +30,10 @@ sidebar: false
- 修复 Pages 上传或节点同步时报 `pages file size out of bounds`:允许 ZIP 包内的 0 字节文件,并兼容未声明解压大小的 ZIP 条目。
- 修复 Agent 在 OpenResty 配置 checksum 已一致时跳过 Pages 部署包下载,导致 `deployments/{id}/releases` 为空、站点文件未落地:在 state 中缓存 Pages 部署引用;周期同步通过 `GET /api/v1/agent/pages/deployments/:id/hash` 对比 upload SHA-256,仅在哈希变化或本地 release 未就绪时下载 ZIP,避免重复拉取完整配置与部署包。
- 收敛 Pages 部署包读取路径:`upload` 域新增 `GetActiveUpload` / `OpenStoredUpload` / `ActiveUploadHash` 门面,Pages 业务不再直接调用 `repository.GetActiveUploadByID` 或 `upload/storage.OpenStoredObject`。
- 修复节点详情 OpenResty 连接数与吞吐显示为「—」:节点可观测 API 将 OpenResty 观测数据合并进 `metric_snapshots`;指标文案改为「请求/分钟」(近 60 秒窗口),连接数为 0 时正常显示 0。
- 修复仪表盘「24 小时请求趋势」摘要误显示当前小时请求量/错误量:改为汇总近 24 小时总量。
+69
View File
@@ -4316,6 +4316,64 @@ const docTemplate = `{
}
}
},
"/api/v1/agent/pages/deployments/{deployment_id}/hash": {
"get": {
"security": [
{
"AgentTokenAuth": []
}
],
"description": "返回 upload 框架记录的 SHA-256 哈希,供 Agent 对比本地缓存并按需拉取部署包",
"produces": [
"application/json"
],
"tags": [
"openflare-agent"
],
"summary": "查询 Pages 部署包哈希",
"parameters": [
{
"type": "integer",
"description": "部署 ID",
"name": "deployment_id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.Any"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/protocol.PagesDeploymentHashResponse"
}
}
}
]
}
},
"400": {
"description": "参数错误",
"schema": {
"$ref": "#/definitions/response.Any"
}
},
"401": {
"description": "Token 无效",
"schema": {
"$ref": "#/definitions/response.Any"
}
}
}
}
},
"/api/v1/agent/pages/deployments/{deployment_id}/package": {
"get": {
"security": [
@@ -16634,6 +16692,17 @@ const docTemplate = `{
}
}
},
"protocol.PagesDeploymentHashResponse": {
"type": "object",
"properties": {
"deployment_id": {
"type": "integer"
},
"hash": {
"type": "string"
}
}
},
"protocol.RelayConfig": {
"type": "object",
"properties": {
+69
View File
@@ -4309,6 +4309,64 @@
}
}
},
"/api/v1/agent/pages/deployments/{deployment_id}/hash": {
"get": {
"security": [
{
"AgentTokenAuth": []
}
],
"description": "返回 upload 框架记录的 SHA-256 哈希,供 Agent 对比本地缓存并按需拉取部署包",
"produces": [
"application/json"
],
"tags": [
"openflare-agent"
],
"summary": "查询 Pages 部署包哈希",
"parameters": [
{
"type": "integer",
"description": "部署 ID",
"name": "deployment_id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.Any"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/protocol.PagesDeploymentHashResponse"
}
}
}
]
}
},
"400": {
"description": "参数错误",
"schema": {
"$ref": "#/definitions/response.Any"
}
},
"401": {
"description": "Token 无效",
"schema": {
"$ref": "#/definitions/response.Any"
}
}
}
}
},
"/api/v1/agent/pages/deployments/{deployment_id}/package": {
"get": {
"security": [
@@ -16627,6 +16685,17 @@
}
}
},
"protocol.PagesDeploymentHashResponse": {
"type": "object",
"properties": {
"deployment_id": {
"type": "integer"
},
"hash": {
"type": "string"
}
}
},
"protocol.RelayConfig": {
"type": "object",
"properties": {
+41
View File
@@ -2588,6 +2588,13 @@ definitions:
relay_node_id:
type: string
type: object
protocol.PagesDeploymentHashResponse:
properties:
deployment_id:
type: integer
hash:
type: string
type: object
protocol.RelayConfig:
properties:
auth_token:
@@ -6502,6 +6509,40 @@ paths:
summary: 注册或发现 Agent 节点
tags:
- openflare-agent
/api/v1/agent/pages/deployments/{deployment_id}/hash:
get:
description: 返回 upload 框架记录的 SHA-256 哈希,供 Agent 对比本地缓存并按需拉取部署包
parameters:
- description: 部署 ID
in: path
name: deployment_id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/response.Any'
- properties:
data:
$ref: '#/definitions/protocol.PagesDeploymentHashResponse'
type: object
"400":
description: 参数错误
schema:
$ref: '#/definitions/response.Any'
"401":
description: Token 无效
schema:
$ref: '#/definitions/response.Any'
security:
- AgentTokenAuth: []
summary: 查询 Pages 部署包哈希
tags:
- openflare-agent
/api/v1/agent/pages/deployments/{deployment_id}/package:
get:
description: 流式下载指定部署的静态资源压缩包,供 Agent 边缘分发