feat: agent distribution via AIOps backend + install script

- Serve agent binaries from /agent/aiops-agent-linux-{amd64,arm64}
- One-line install: curl -fsSL http://server:8080/agent/install.sh | bash
- Auto-detects arch (x86_64/aarch64), creates systemd service
- GET /agent/arch returns version + download URLs

Signed-off-by: Logan.Li
This commit is contained in:
attacker committed 2026-06-14 21:33:08 +08:00
1 parent ac0b8e75c0
commit 85bc2a8e05
4 files changed
+151

No files matched your search

+16
View File
@@ -20,6 +20,22 @@ func Register(r *gin.Engine, db *gorm.DB, log *zap.Logger, cfg *config.Config) {
c.JSON(200, gin.H{"status": "ok"})
})
// Agent 二进制下载 + 一键安装脚本(无需鉴权,方便 curl|bash)
r.Static("/agent/bin", "./agent/bin")
r.StaticFile("/agent/install.sh", "./agent/deploy/install.sh")
r.StaticFile("/agent/aiops-agent-linux-amd64", "./agent/bin/aiops-agent-linux-amd64")
r.StaticFile("/agent/aiops-agent-linux-arm64", "./agent/bin/aiops-agent-linux-arm64")
r.GET("/agent/arch", func(c *gin.Context) {
c.JSON(200, gin.H{
"version": "1.0.0",
"downloads": gin.H{
"amd64": "/agent/aiops-agent-linux-amd64",
"arm64": "/agent/aiops-agent-linux-arm64",
},
"install": "curl -fsSL http://<server>:8080/agent/install.sh | bash -s -- --server http://<server>:8080 --token <token>",
})
})
// WebSocket终端 (token via query param)
webShellHandler := handlers.NewWebShellHandler(db)
r.GET("/ws/terminal", webShellHandler.Terminal)