mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-01 06:36:38 +08:00
feat: add OperationSetting component and integrate into settings page
- Introduced OperationSetting component for managing agent configurations. - Updated settings page to include a new tab for operation settings. - Implemented functionality to fetch and update agent parameters such as heartbeat interval, sync interval, and auto-update settings. docs: enhance deployment documentation for agent installation - Added detailed instructions for agent installation using a script. - Included examples for using discovery and agent tokens. - Updated sections on global discovery tokens and agent auto-update features. docs: revise design and development guidelines for V3 - Updated design document to reflect the current state and goals for V3. - Clarified development guidelines to focus on operational experience improvements. ci: add GitHub Actions workflow for agent releases - Created a new workflow to automate the release of agent binaries on GitHub. - Configured the workflow to build binaries for multiple platforms and publish them as releases. feat: implement self-update mechanism for agent - Added updater module to handle checking for and applying updates from GitHub releases. - Implemented logic to restart the agent after a successful update. chore: create install script for agent deployment - Developed a bash script to facilitate the installation of the ATSFlare agent. - The script supports automatic configuration and systemd service creation.
This commit is contained in:
+142
-3
@@ -1,14 +1,14 @@
|
||||
# ATSFlare 设计基线(V3 准备版)
|
||||
# ATSFlare 设计基线(V3)
|
||||
|
||||
## 1. 文档目的
|
||||
|
||||
本文档不再展开记录第一版、第二版的实施过程,只保留当前系统边界、稳定约束与第三版开始前必须确认的设计输入。
|
||||
本文档保留当前系统边界、稳定约束与第三版的设计输入。
|
||||
|
||||
当前结论:
|
||||
|
||||
* 第一版、第二版已完成并进入归档状态
|
||||
* 第三版进入实施阶段
|
||||
* 当前代码库的可运行能力,以本文档为唯一设计基线
|
||||
* 第三版开发前,如需扩展系统边界,先更新本文档,再开始编码
|
||||
|
||||
---
|
||||
|
||||
@@ -324,3 +324,142 @@ Agent 接口当前覆盖:
|
||||
* 设计文档只保留当前有效基线
|
||||
* 已完成阶段的细节以 Git 历史为准
|
||||
* 新阶段开始前,先把设计输入写清楚,再进入实现
|
||||
|
||||
---
|
||||
|
||||
## 11. 第三版设计输入
|
||||
|
||||
### 11.1 目标定位
|
||||
|
||||
第三版聚焦**运维体验优化**,不扩展系统功能边界,只提升已有能力的可操作性与可维护性。
|
||||
|
||||
### 11.2 启动设置热更新
|
||||
|
||||
当前状态:
|
||||
|
||||
* `SESSION_SECRET`、`SQLITE_PATH`、`PORT` 等启动参数通过环境变量注入
|
||||
* 变更需要重启 Server 进程
|
||||
|
||||
第三版变更:
|
||||
|
||||
* 将可热更新的运行时设置迁入 Option 表,通过设置页面管理
|
||||
* 以下设置在前端运维设置面板中可配置:
|
||||
* `AgentHeartbeatInterval`:Agent 心跳上报间隔(毫秒),默认 30000
|
||||
* `AgentSyncInterval`:Agent 配置同步间隔(毫秒),默认 30000
|
||||
* `NodeOfflineThreshold`:节点离线判定阈值(毫秒),默认 120000
|
||||
* `AgentAutoUpdate`:是否允许 Agent 自动更新(`true`/`false`),默认 `false`
|
||||
* `AgentUpdateRepo`:Agent 自动更新 GitHub 仓库地址,默认 `Rain-kl/ATSFlare`
|
||||
* 环境变量类设置(`SESSION_SECRET`、`SQLITE_PATH`、`PORT`)不迁移,保留原有方式
|
||||
* 前端在设置页面新增「运维设置」Tab
|
||||
|
||||
### 11.3 Server 下发 Agent 设置
|
||||
|
||||
当前状态:
|
||||
|
||||
* Agent 心跳请求只是单向上报,Server 不返回业务数据
|
||||
* Agent 的心跳间隔、同步间隔只在本地 `agent.json` 配置
|
||||
|
||||
第三版变更:
|
||||
|
||||
* 心跳响应新增 `agent_settings` 字段,包含 Server 端可控的运行时参数:
|
||||
* `heartbeat_interval`(毫秒)
|
||||
* `sync_interval`(毫秒)
|
||||
* `auto_update`(布尔值)
|
||||
* `update_repo`(GitHub 仓库名)
|
||||
* Agent 收到心跳响应后,动态调整本地定时器间隔
|
||||
* 当 Server 未返回 `agent_settings` 或字段为空时,Agent 保持本地值不变
|
||||
* Agent 不持久化 Server 下发的间隔值,重启后以本地 `agent.json` 为准,再由下次心跳覆盖
|
||||
|
||||
### 11.4 Agent 自我更新
|
||||
|
||||
当前状态:
|
||||
|
||||
* Agent 版本固定,更新需要运维手动替换二进制文件
|
||||
|
||||
第三版变更:
|
||||
|
||||
* Agent 在收到 `auto_update=true` 时:
|
||||
* 通过 GitHub Releases API 查询 `update_repo` 的最新 Release
|
||||
* 比较本地 `agent_version` 与远端 tag
|
||||
* 若存在更新,下载对应平台的二进制文件
|
||||
* 替换自身二进制并重启
|
||||
* 更新检查频率:每轮心跳周期结束后检查一次,不独立起定时器
|
||||
* 更新过程中不中断当前同步任务
|
||||
* 更新失败不影响正常心跳与同步
|
||||
* Agent 二进制文件命名约定:`atsflare-agent-{os}-{arch}`
|
||||
|
||||
### 11.5 Agent 一键部署
|
||||
|
||||
当前状态:
|
||||
|
||||
* Agent 需要手动编译或复制二进制并创建配置文件
|
||||
|
||||
第三版变更:
|
||||
|
||||
* 提供 `install-agent.sh` 脚本,支持以下方式部署:
|
||||
```bash
|
||||
curl -fsSL https://raw.githubusercontent.com/Rain-kl/ATSFlare/main/scripts/install-agent.sh | bash -s -- \
|
||||
--server-url http://your-server:3000 \
|
||||
--discovery-token your-token
|
||||
```
|
||||
* 脚本行为:
|
||||
* 检测平台架构(linux/amd64、linux/arm64)
|
||||
* 从 GitHub Releases 下载最新 Agent 二进制
|
||||
* 创建安装目录(默认 `/opt/atsflare-agent`)
|
||||
* 生成基础 `agent.json` 配置
|
||||
* 创建 systemd service 文件(可选)
|
||||
* 启动 Agent
|
||||
|
||||
### 11.6 GitHub Actions 内测发布
|
||||
|
||||
当前状态:
|
||||
|
||||
* 现有工作流只构建 Server 二进制和 Docker 镜像
|
||||
* Agent 二进制不在 CI 中构建
|
||||
* Alpha 标签在部分工作流中被排除
|
||||
|
||||
第三版变更:
|
||||
|
||||
* 新增 `agent-release.yml` 工作流:
|
||||
* 触发条件:推送任意 tag(包括 alpha)
|
||||
* 构建 Agent 二进制:`linux/amd64`、`linux/arm64`、`darwin/arm64`
|
||||
* 产物命名:`atsflare-agent-{os}-{arch}`
|
||||
* 上传至 GitHub Release
|
||||
* 修改现有工作流:
|
||||
* 统一 `linux-release.yml` 为同时构建 Server + Agent 二进制
|
||||
* Alpha 标签的发布标记为 prerelease
|
||||
* 安装脚本与自我更新共用同一 Release 产物
|
||||
|
||||
### 11.7 前端运维体验优化
|
||||
|
||||
当前状态:
|
||||
|
||||
* 时间字段使用纳秒整数,不够友好
|
||||
* 设置页面未包含运维类设置
|
||||
|
||||
第三版变更:
|
||||
|
||||
* 设置页面新增「运维设置」Tab,包含:
|
||||
* Agent 心跳间隔
|
||||
* Agent 同步间隔
|
||||
* 节点离线阈值
|
||||
* Agent 自动更新开关
|
||||
* Agent 更新仓库
|
||||
* 全局 Discovery Token 展示与重新生成
|
||||
* Agent 一键部署命令展示(根据当前 ServerAddress 和 DiscoveryToken 动态生成 curl 命令)
|
||||
* 节点列表页优化:
|
||||
* 时间显示改为友好的相对时间格式
|
||||
* 节点状态使用颜色标识
|
||||
|
||||
---
|
||||
|
||||
## 12. 第三版不做的范围
|
||||
|
||||
以下内容不在第三版范围内:
|
||||
|
||||
* 多租户
|
||||
* WAF、限流、Bot
|
||||
* 节点分组、差异化下发
|
||||
* 证书自动签发与续期
|
||||
* Agent 配置文件加密
|
||||
* Server 远程执行 Agent 命令
|
||||
|
||||
Reference in New Issue
Block a user