docs: 重写 GIS Actions 部署指南
This commit is contained in:
@@ -1,60 +1,76 @@
|
||||
# GIS-Actions 本地部署指南
|
||||
# GIS Actions 本地部署指南
|
||||
|
||||
## 架构
|
||||
|
||||
gis-actions 是**本地执行器**,直接从 Gitea 下载套件包并在本地 Docker 中运行:
|
||||
GIS Actions 是**本地执行器**,从套件市场下载脚本包并在本地 Docker 中运行:
|
||||
|
||||
```
|
||||
用户 / CLI → gis-actions(本地)
|
||||
→ 下载套件包(从 Gitea)
|
||||
→ Docker 执行
|
||||
→ 结果写入本地
|
||||
用户 / Agent 指定套件 ID
|
||||
→ gis-actions(本地)
|
||||
→ 从 Suite Market 下载脚本包
|
||||
→ 解析 workflow.yaml
|
||||
→ docker run gis-base + 脚本
|
||||
→ 结果写入本地 /tmp/output/
|
||||
```
|
||||
|
||||
不再需要云端 Worker 注册、心跳、任务队列轮询。
|
||||
|
||||
## 环境要求
|
||||
|
||||
- Python 3.10+
|
||||
- Docker(用于执行容器化脚本任务)
|
||||
- Docker(用于容器化执行)
|
||||
|
||||
## 安装
|
||||
## 获取代码
|
||||
|
||||
```bash
|
||||
# 方式一:从仓库获取
|
||||
git clone https://git.mercator.cn/AgentGIS/gis-actions.git
|
||||
cd gis-actions
|
||||
pip install -r requirements.txt
|
||||
|
||||
# 方式二:待安装包发布(当前暂无可用的 pip / .deb 包)
|
||||
```
|
||||
|
||||
## 配置
|
||||
|
||||
```bash
|
||||
export GITEA_TOKEN=your_gitea_token_here
|
||||
# 设置 API Key(从 https://auth.mercator.cn 获取)
|
||||
export AGENTGIS_API_KEY=mk_xxxxxxxxxxxxx
|
||||
```
|
||||
|
||||
或创建 `worker.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"worker": { "id": "my-machine-001" },
|
||||
"scheduler": { "url": "https://suites.mercator.cn" },
|
||||
"auth": { "api_key": "***" }
|
||||
}
|
||||
```
|
||||
|
||||
## 运行套件
|
||||
|
||||
```bash
|
||||
python cli.py run /tmp/my-workdir --input package_url=https://git.mercator.cn/.../suite.tar.gz
|
||||
# 通过套件 ID 执行(推荐)
|
||||
python cli.py run /tmp/workdir --suite-id parcel-analysis --input buffer_distance=0.5
|
||||
|
||||
# 或直接指定脚本包地址
|
||||
python cli.py run /tmp/workdir --package-url https://git.mercator.cn/.../scripts.tar.gz
|
||||
```
|
||||
|
||||
## 目录结构
|
||||
|
||||
```
|
||||
gis-actions/
|
||||
├── cli.py # 命令行入口
|
||||
├── cli.py # 命令行入口(支持 --suite-id / --package-url)
|
||||
├── download_and_run.py # 下载 + 执行核心逻辑
|
||||
├── steps_executor.py # Workflow 步骤执行器
|
||||
├── docker-wrapper.sh # Docker 包装脚本
|
||||
├── steps_executor.py # workflow.yaml 步骤执行器
|
||||
├── workdir/ # 默认工作目录
|
||||
└── e2e_test.py # 端到端测试
|
||||
└── packaging/deb/ # DEB 打包结构(待完善)
|
||||
```
|
||||
|
||||
## 工作流程
|
||||
## 执行流程
|
||||
|
||||
1. cli.py run 启动执行
|
||||
2. download_and_run.run_suite() 根据 package_url 下载套件包
|
||||
3. 解压到工作目录
|
||||
4. 读取 workflow.yml,按步骤执行
|
||||
5. 脚本步骤通过 Docker 容器运行
|
||||
6. 结果输出到工作目录
|
||||
1. `cli.py run` 启动
|
||||
2. 解析套件 ID(调用 Suite Market API 获取 package_url)
|
||||
3. 下载 scripts.tar.gz → 解压到工作目录
|
||||
4. 读取 workflow.yaml,按 steps 顺序执行
|
||||
5. 每个步骤在 Docker 容器中运行(gis-base 镜像)
|
||||
6. 清理脚本目录(知识产权保护)
|
||||
7. 结果写入本地输出目录
|
||||
|
||||
Reference in New Issue
Block a user