# GIS Actions 本地部署 GIS Actions 是套件的本地执行引擎,跑在你的机器上。 ## 前提条件 - **Python 3.10+**(验证:`python3 --version`) - **Docker**(验证:`docker ps`) - Linux:`apt install docker.io` 或 `yum install docker` - Windows/Mac:安装 Docker Desktop - 能访问 `registry.mercator.cn`(拉取 gis-base 镜像) ## 安装 目前 gis-actions 以源码形式提供,从 git 仓库获取: ```bash git clone https://git.mercator.cn/AgentGIS/gis-actions.git cd gis-actions ``` Linux 用户也可使用 .deb 包(见 `packaging/deb/` 目录)。 ## 配置 创建 `config.json`: ```json { "worker": { "id": "my-machine-001", "capabilities": ["gis-operations"] }, "scheduler": { "url": "https://suites.mercator.cn", "poll_interval": 5, "heartbeat_interval": 30 }, "auth": { "api_key": "mk_xxxxxxxxxxxxxxxxxxxx" } } ``` API Key 从 [https://auth.mercator.cn](https://auth.mercator.cn) 获取。 ## 启动 ```bash python3 -m gis_actions --config config.json ``` 启动后自动连接调度中心,注册自身,开始等待任务。 ## 验证 日志中应看到: ``` Worker xxx started, polling https://suites.mercator.cn every 5s Worker registered successfully ``` ## 进程管理 - **Linux**:建议使用 systemd 或 supervisor 托管,开机自启 - **Windows**:建议注册为 Windows Service - **macOS**:建议使用 launchd ## 停止 按 `Ctrl+C` 停止。脚本包自动清理,不留痕迹。 ## 数据流向 ``` 你本地的 SHP/GeoJSON/TIFF 文件 │ ▼ GIS Actions(你的机器) │ ← 从调度中心拉取任务 │ ← 下载套件脚本包 │ ← docker run gis-base + 套件脚本 │ → 结果写入 /tmp/output/ ▼ 结果文件(你的机器) ```