feat: 集成 Agent 服务治理(ASG)部署配置
- docker-compose.yml 新增 easyai-asg-pg 和 easyai-asg 容器,comfy-server 增加 ASG TCP 连接环境变量 - 新增 .env.ASG.sample 环境变量模板,地址统一使用容器服务名替代固定 IP - easyai-proxy.conf.sample 新增 /asg-api/ 反向代理配置 - README.md 新增 2026.3.2 更新记录及完整升级步骤 Made-with: Cursor
This commit is contained in:
@@ -2,6 +2,94 @@
|
||||
## 重要更新记录:
|
||||
|
||||
|
||||
### 2026.3.2
|
||||
|
||||
1. **新增 Agent 服务治理(ASG)模块**:新增 `easyai-asg`(Agent 服务治理)容器和独立的 `easyai-asg-pg`(PostgreSQL 18)数据库容器,用于支持 Agent 自动化治理能力。
|
||||
2. **新增 Nginx 反向代理**:在 `easyai-proxy.conf.sample` 中新增 `/asg-api/` 路径代理,用于暴露 ASG 服务的 REST API。
|
||||
3. **新增环境变量文件**:新增 `.env.ASG.sample` 文件,包含 ASG 服务所需的全部环境变量。
|
||||
4. 主服务 `comfy-server` 新增 `ASG_TCP_HOST` 和 `ASG_TCP_PORT` 环境变量,用于内部 TCP 微服务通信。
|
||||
|
||||
#### 升级步骤
|
||||
|
||||
**步骤一:更新文件**
|
||||
|
||||
将以下文件更新到最新版本:
|
||||
- `docker-compose.yml`
|
||||
- `easyai-proxy.conf.sample`
|
||||
|
||||
新增文件复制到部署目录:
|
||||
- `.env.ASG.sample` → 复制为 `.env.ASG` 并根据实际环境修改
|
||||
|
||||
**步骤二:配置 `.env.ASG`**
|
||||
|
||||
```bash
|
||||
cp .env.ASG.sample .env.ASG
|
||||
```
|
||||
|
||||
根据实际环境修改 `.env.ASG` 中的关键配置:
|
||||
```dotenv
|
||||
# PostgreSQL 连接(默认使用容器内网地址,一般无需修改)
|
||||
ASG_DATABASE_URL=postgresql://easyai:easyai2025@easyai-asg-pg:5432/agent_governance?schema=public
|
||||
ASG_POSTGRES_USER=easyai
|
||||
ASG_POSTGRES_PASSWORD=easyai2025
|
||||
|
||||
# Redis(复用主服务 Redis,使用独立 DB 隔离)
|
||||
ASG_REDIS_HOST=redis
|
||||
ASG_REDIS_PASSWORD= # 与主服务 Redis 密码保持一致
|
||||
|
||||
# 主服务连接地址(容器内网地址)
|
||||
ASG_MAIN_BACKEND_URL=http://comfy-server:3001
|
||||
# 管理员账号(用于 Agent 调用时登录获取 token)
|
||||
ASG_ADMIN_USERNAME=admin
|
||||
ASG_ADMIN_PASSWORD=123456
|
||||
```
|
||||
|
||||
**步骤三:可选,更新 Nginx 配置,暴露创建任务治理相关接口,如果你希望通过外部接口发送Agent治理任务才需要配置**
|
||||
|
||||
在 nginx 配置文件(`/etc/nginx/conf.d/easyai-proxy.conf`)中添加 ASG API 代理,具体位置参考 `easyai-proxy.conf.sample`:
|
||||
```nginx
|
||||
location /asg-api/ {
|
||||
proxy_pass http://127.0.0.1:3003/;
|
||||
proxy_read_timeout 300s;
|
||||
client_max_body_size 20M;
|
||||
proxy_redirect off;
|
||||
proxy_set_header X-Original-Prefix '/asg-api';
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header Host $host;
|
||||
}
|
||||
```
|
||||
|
||||
添加后重载 Nginx:
|
||||
```bash
|
||||
nginx -t && nginx -s reload
|
||||
```
|
||||
|
||||
**步骤四:启动服务**
|
||||
|
||||
```bash
|
||||
cd ~/easyai
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
新增容器:`easyai-asg-pg`(PostgreSQL)和 `easyai-asg`(Agent 服务治理),数据库会在首次启动时自动完成初始化和迁移。
|
||||
|
||||
**步骤五:验证**
|
||||
|
||||
```bash
|
||||
# 检查容器状态
|
||||
docker compose ps easyai-asg-pg easyai-asg
|
||||
|
||||
# 检查 ASG 服务健康状态
|
||||
curl http://127.0.0.1:3003/health
|
||||
|
||||
# 通过 Nginx 代理访问(配置 Nginx 后)
|
||||
curl https://<你的域名>/asg-api/health
|
||||
```
|
||||
|
||||
> **注意**:如果不需要 Agent 服务治理功能,可以不执行以上步骤,不影响主服务正常运行。需要开放 3003 端口(或通过 Nginx 代理访问)。
|
||||
|
||||
|
||||
### 2025.2.4
|
||||
|
||||
|
||||
Reference in New Issue
Block a user