构建:改用预构建的 Agent Runtime 镜像
This commit is contained in:
29
README.md
29
README.md
@@ -11,7 +11,7 @@
|
|||||||
## 本地启动
|
## 本地启动
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker compose -f docker-compose.yml build agent-runtime
|
docker build -t smart-factory-agent-runtime:0.1.0 -f sandbox/Dockerfile sandbox
|
||||||
docker compose up -d postgres
|
docker compose up -d postgres
|
||||||
mvn -q -f server/pom.xml spring-boot:run
|
mvn -q -f server/pom.xml spring-boot:run
|
||||||
npm --prefix web-ui install
|
npm --prefix web-ui install
|
||||||
@@ -32,27 +32,42 @@ $env:APP_MASTER_KEY = '<使用独立生成的高强度密钥>'
|
|||||||
## Docker Compose 部署
|
## Docker Compose 部署
|
||||||
|
|
||||||
部署包含 Nginx 前端、Spring Boot 后端、Agent Runtime 镜像和 PostgreSQL。Agent Runtime
|
部署包含 Nginx 前端、Spring Boot 后端、Agent Runtime 镜像和 PostgreSQL。Agent Runtime
|
||||||
不是常驻 API 服务:`agent-runtime` 服务完成镜像构建后会以状态码 0 退出,后端再通过 Docker
|
不是常驻 API 服务:镜像在开发机预先构建并导入服务器,服务器上的 `agent-runtime` 服务只校验
|
||||||
Socket 为每个 Agent Session 动态创建隔离容器。
|
镜像存在,随后以状态码 0 退出;后端再通过 Docker Socket 为每个 Agent Session 动态创建隔离容器。
|
||||||
|
|
||||||
1. 复制环境变量模板并替换其中的三个必填密码/密钥;生产环境建议使用密码管理系统生成随机值。
|
1. 在开发机构建并导出 Agent Runtime 镜像:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker build -t smart-factory-agent-runtime:0.1.0 -f sandbox/Dockerfile sandbox
|
||||||
|
docker save -o smart-factory-agent-runtime-0.1.0.tar smart-factory-agent-runtime:0.1.0
|
||||||
|
```
|
||||||
|
|
||||||
|
将 Tar 文件传到服务器后导入。Compose 设置了 `pull_policy: never`,若镜像不存在会直接报错,
|
||||||
|
不会在服务器自动拉取或构建:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker load -i smart-factory-agent-runtime-0.1.0.tar
|
||||||
|
docker image inspect smart-factory-agent-runtime:0.1.0
|
||||||
|
```
|
||||||
|
|
||||||
|
2. 复制环境变量模板并替换其中的三个必填密码/密钥;生产环境建议使用密码管理系统生成随机值。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cp .env.example .env
|
cp .env.example .env
|
||||||
```
|
```
|
||||||
|
|
||||||
2. 确认 `MANUAGENT_DATA_ROOT` 是 Docker 宿主机上的绝对路径。这个路径会以完全相同的路径挂载到
|
3. 确认 `MANUAGENT_DATA_ROOT` 是 Docker 宿主机上的绝对路径。这个路径会以完全相同的路径挂载到
|
||||||
后端容器,供动态 Agent Runtime 继续挂载项目材料、工作目录和产物。Linux 默认值为
|
后端容器,供动态 Agent Runtime 继续挂载项目材料、工作目录和产物。Linux 默认值为
|
||||||
`/srv/manuagent/data`。
|
`/srv/manuagent/data`。
|
||||||
|
|
||||||
3. 构建并启动完整服务:
|
4. 构建前后端并启动完整服务:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker compose -f docker-compose.yml up -d --build
|
docker compose -f docker-compose.yml up -d --build
|
||||||
docker compose -f docker-compose.yml ps
|
docker compose -f docker-compose.yml ps
|
||||||
```
|
```
|
||||||
|
|
||||||
4. 打开 <http://127.0.0.1:5173>,使用 `.env` 中的 `APP_ADMIN_USERNAME` 和
|
5. 打开 <http://127.0.0.1:5173>,使用 `.env` 中的 `APP_ADMIN_USERNAME` 和
|
||||||
`APP_ADMIN_PASSWORD` 登录。查看日志或停止服务:
|
`APP_ADMIN_PASSWORD` 登录。查看日志或停止服务:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
@@ -21,13 +21,12 @@ services:
|
|||||||
retries: 20
|
retries: 20
|
||||||
start_period: 10s
|
start_period: 10s
|
||||||
|
|
||||||
# 此服务负责构建并登记 AgentScope 使用的 Runtime 镜像。
|
# 此服务负责校验并登记 AgentScope 使用的 Runtime 镜像。
|
||||||
|
# Runtime 镜像在开发机预先构建并导入服务器;此服务只校验镜像存在,不在服务器构建或拉取。
|
||||||
# 它成功退出后,后端会通过 Docker Socket 按 Session 动态创建真正执行任务的 Runtime 容器。
|
# 它成功退出后,后端会通过 Docker Socket 按 Session 动态创建真正执行任务的 Runtime 容器。
|
||||||
agent-runtime:
|
agent-runtime:
|
||||||
image: ${AGENT_RUNTIME_IMAGE:-smart-factory-agent-runtime:0.1.0}
|
image: ${AGENT_RUNTIME_IMAGE:-smart-factory-agent-runtime:0.1.0}
|
||||||
build:
|
pull_policy: never
|
||||||
context: ./sandbox
|
|
||||||
dockerfile: Dockerfile
|
|
||||||
command: ["/bin/true"]
|
command: ["/bin/true"]
|
||||||
restart: "no"
|
restart: "no"
|
||||||
networks:
|
networks:
|
||||||
|
|||||||
Reference in New Issue
Block a user