feat: openresty状态上报

This commit is contained in:
ryan
2026-03-12 15:09:34 +08:00
parent ecc71428e4
commit 42ca18681c
26 changed files with 1232 additions and 165 deletions
+162 -2
View File
@@ -783,6 +783,53 @@ const docTemplate = `{
}
}
},
"/api/nodes/{id}/agent-release": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"Nodes"
],
"summary": "Check latest agent release for node",
"parameters": [
{
"type": "integer",
"description": "Node ID",
"name": "id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "stable or preview",
"name": "channel",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": true
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "object",
"additionalProperties": true
}
}
}
}
},
"/api/nodes/{id}/agent-update": {
"post": {
"security": [
@@ -824,6 +871,47 @@ const docTemplate = `{
}
}
},
"/api/nodes/{id}/openresty-restart": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"Nodes"
],
"summary": "Request openresty restart on node",
"parameters": [
{
"type": "integer",
"description": "Node ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": true
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "object",
"additionalProperties": true
}
}
}
}
},
"/api/option/": {
"get": {
"produces": [
@@ -1257,6 +1345,72 @@ const docTemplate = `{
}
}
}
},
"/api/update/manual-upgrade": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Update"
],
"summary": "Confirm upgrade with previously uploaded server binary",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": true
}
}
}
}
},
"/api/update/manual-upload": {
"post": {
"consumes": [
"multipart/form-data"
],
"produces": [
"application/json"
],
"tags": [
"Update"
],
"summary": "Upload server binary and inspect version before upgrade",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": true
}
}
}
}
},
"/api/update/upgrade": {
"post": {
"produces": [
"application/json"
],
"tags": [
"Update"
],
"summary": "Upgrade server binary from latest GitHub release",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": true
}
}
}
}
}
},
"definitions": {
@@ -1294,6 +1448,12 @@ const docTemplate = `{
},
"node_id": {
"type": "string"
},
"openresty_message": {
"type": "string"
},
"openresty_status": {
"type": "string"
}
}
},
@@ -1429,8 +1589,8 @@ var SwaggerInfo = &swag.Spec{
Description: "ATSFlare Server 管理端与 Agent API 文档。",
InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate,
//LeftDelim: "{{",
//RightDelim: "}}",
LeftDelim: "{{",
RightDelim: "}}",
}
func init() {
+160
View File
@@ -780,6 +780,53 @@
}
}
},
"/api/nodes/{id}/agent-release": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"Nodes"
],
"summary": "Check latest agent release for node",
"parameters": [
{
"type": "integer",
"description": "Node ID",
"name": "id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "stable or preview",
"name": "channel",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": true
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "object",
"additionalProperties": true
}
}
}
}
},
"/api/nodes/{id}/agent-update": {
"post": {
"security": [
@@ -821,6 +868,47 @@
}
}
},
"/api/nodes/{id}/openresty-restart": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"Nodes"
],
"summary": "Request openresty restart on node",
"parameters": [
{
"type": "integer",
"description": "Node ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": true
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "object",
"additionalProperties": true
}
}
}
}
},
"/api/option/": {
"get": {
"produces": [
@@ -1254,6 +1342,72 @@
}
}
}
},
"/api/update/manual-upgrade": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Update"
],
"summary": "Confirm upgrade with previously uploaded server binary",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": true
}
}
}
}
},
"/api/update/manual-upload": {
"post": {
"consumes": [
"multipart/form-data"
],
"produces": [
"application/json"
],
"tags": [
"Update"
],
"summary": "Upload server binary and inspect version before upgrade",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": true
}
}
}
}
},
"/api/update/upgrade": {
"post": {
"produces": [
"application/json"
],
"tags": [
"Update"
],
"summary": "Upgrade server binary from latest GitHub release",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": true
}
}
}
}
}
},
"definitions": {
@@ -1291,6 +1445,12 @@
},
"node_id": {
"type": "string"
},
"openresty_message": {
"type": "string"
},
"openresty_status": {
"type": "string"
}
}
},
+103
View File
@@ -23,6 +23,10 @@ definitions:
type: string
node_id:
type: string
openresty_message:
type: string
openresty_status:
type: string
type: object
service.ApplyLogPayload:
properties:
@@ -546,6 +550,36 @@ paths:
summary: Update node
tags:
- Nodes
/api/nodes/{id}/agent-release:
get:
parameters:
- description: Node ID
in: path
name: id
required: true
type: integer
- description: stable or preview
in: query
name: channel
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties: true
type: object
"400":
description: Bad Request
schema:
additionalProperties: true
type: object
security:
- BearerAuth: []
summary: Check latest agent release for node
tags:
- Nodes
/api/nodes/{id}/agent-update:
post:
parameters:
@@ -572,6 +606,32 @@ paths:
summary: Request agent self-update on node
tags:
- Nodes
/api/nodes/{id}/openresty-restart:
post:
parameters:
- description: Node ID
in: path
name: id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties: true
type: object
"400":
description: Bad Request
schema:
additionalProperties: true
type: object
security:
- BearerAuth: []
summary: Request openresty restart on node
tags:
- Nodes
/api/nodes/bootstrap-token:
get:
produces:
@@ -880,6 +940,49 @@ paths:
summary: Get latest GitHub release
tags:
- Update
/api/update/manual-upgrade:
post:
consumes:
- application/json
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties: true
type: object
summary: Confirm upgrade with previously uploaded server binary
tags:
- Update
/api/update/manual-upload:
post:
consumes:
- multipart/form-data
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties: true
type: object
summary: Upload server binary and inspect version before upgrade
tags:
- Update
/api/update/upgrade:
post:
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties: true
type: object
summary: Upgrade server binary from latest GitHub release
tags:
- Update
schemes:
- http
- https