This commit is contained in:
anlicheng 2026-05-08 00:06:30 +08:00
parent 94739a8a12
commit 2184149976
2 changed files with 10 additions and 8 deletions

View File

@ -94,7 +94,7 @@ HTTP body 必须是 JSON object。`http_protocol` 会使用 `json:decode/1` 解
| 字段 | JSON 类型 | 必填 | 说明 | | 字段 | JSON 类型 | 必填 | 说明 |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| `uuid` | string | 是 | 目标 efka 所属主机 UUID。服务端用它查找 `iot_host` 进程,不会下发到 efka。 | | `uuid` | string | 是 | 目标 efka 所属主机 UUID。服务端用它查找 `iot_host` 进程,不会下发到 efka。 |
| `task_id` | integer | 是 | 部署任务 ID。会进入内部命令的 `task_id` 字段,用于关联部署结果和部署日志流。 | | `task_id` | non-negative integer | 是 | 部署任务 ID。会进入内部命令的 `task_id` 字段,用于关联部署结果和部署日志流。 |
| `config` | object | 是 | 容器创建配置。会被校验并转换成内部部署参数 map。 | | `config` | object | 是 | 容器创建配置。会被校验并转换成内部部署参数 map。 |
顶层没有 `timeout` 字段。当前 HTTP handler 等待 efka command response 的超时时间固定为 10 秒。 顶层没有 `timeout` 字段。当前 HTTP handler 等待 efka command response 的超时时间固定为 10 秒。
@ -130,8 +130,8 @@ HTTP body 必须是 JSON object。`http_protocol` 会使用 `json:decode/1` 解
| `devices` | string[] | `[]` | 设备映射列表,格式见后文。 | | `devices` | string[] | `[]` | 设备映射列表,格式见后文。 |
| `mem_limit` | string | `0` | 内存上限,解析成字节数。 | | `mem_limit` | string | `0` | 内存上限,解析成字节数。 |
| `mem_reservation` | string | `0` | 内存软限制,解析成字节数。 | | `mem_reservation` | string | `0` | 内存软限制,解析成字节数。 |
| `cpu_shares` | integer | `0` | Docker CPU shares。 | | `cpu_shares` | non-negative integer | `0` | Docker CPU shares。 |
| `cpus` | number | `0` | CPU 数量,转换成 nano cpus。 | | `cpus` | non-negative number | `0` | CPU 数量,转换成 nano cpus。 |
| `ulimits` | object string:string | `[]` | ulimit 配置,格式见后文。 | | `ulimits` | object string:string | `[]` | ulimit 配置,格式见后文。 |
| `sysctls` | object string:string | `{}` | sysctl 配置。key/value 都必须是 string。 | | `sysctls` | object string:string | `{}` | sysctl 配置。key/value 都必须是 string。 |
| `tmpfs` | string[] | `{}` | tmpfs mount 配置,格式见后文。 | | `tmpfs` | string[] | `{}` | tmpfs mount 配置,格式见后文。 |
@ -154,7 +154,7 @@ HTTP body 必须是 JSON object。`http_protocol` 会使用 `json:decode/1` 解
第一层在 `container_handler` 第一层在 `container_handler`
- `uuid` 必须是 binary。 - `uuid` 必须是 binary。
- `task_id` 必须是 integer。 - `task_id` 必须是非负 integer。
- `config` 必须是 map。 - `config` 必须是 map。
第二层在 `docker_container_builder:deploy_request/2` 第二层在 `docker_container_builder:deploy_request/2`
@ -162,6 +162,7 @@ HTTP body 必须是 JSON object。`http_protocol` 会使用 `json:decode/1` 解
- 先拒绝不支持的 `ports``container_dir` 字段。 - 先拒绝不支持的 `ports``container_dir` 字段。
- 检查必填字段是否存在。 - 检查必填字段是否存在。
- 检查已知字段类型。 - 检查已知字段类型。
- 检查 `healthcheck` 内部字段类型,避免无效嵌套字段进入构造阶段。
- 构造内部部署 map。 - 构造内部部署 map。
- 对需要解析的字段做格式解析例如端口、volume、size、duration、ulimit。 - 对需要解析的字段做格式解析例如端口、volume、size、duration、ulimit。
@ -467,10 +468,10 @@ HTTP handler 最多等待 10 秒。超时返回 HTTP 504其他参数或执行
| 字段 | JSON 类型 | 默认值 | 说明 | | 字段 | JSON 类型 | 默认值 | 说明 |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| `test` | any | `[]` | 当前只要求 `healthcheck` 的 key 是 string不单独校验 `test` 类型;建议传 string array。 | | `test` | string[] | `[]` | Docker healthcheck test 参数列表。 |
| `interval` | string 或 integer | `"0s"` | string 会解析时间单位integer 直接视为纳秒。 | | `interval` | string 或 non-negative integer | `"0s"` | string 会解析时间单位integer 直接视为纳秒。 |
| `timeout` | string 或 integer | `"0s"` | string 会解析时间单位integer 直接视为纳秒。 | | `timeout` | string 或 non-negative integer | `"0s"` | string 会解析时间单位integer 直接视为纳秒。 |
| `retries` | integer | `0` | 当前构造阶段直接取值;建议传非负整数。 | | `retries` | non-negative integer | `0` | Docker healthcheck 重试次数。 |
时间单位: 时间单位:

View File

@ -82,6 +82,7 @@
- `activate`:如果 `efka` 已经是 `activated`,直接回复 `ok`;否则重新发送 `auth_request`,等待鉴权结果后再回复该 command。 - `activate`:如果 `efka` 已经是 `activated`,直接回复 `ok`;否则重新发送 `auth_request`,等待鉴权结果后再回复该 command。
- `deactivate``efka` 进入 `restricted` 状态,并回复 `ok` - `deactivate``efka` 进入 `restricted` 状态,并回复 `ok`
- `iot` 侧会异步提交 auth command 并等待对应 `Ref``command_response`,再向 `/host/activate` HTTP 调用方返回结果;等待超时为 10 秒,超时返回 `timeout`,无效响应返回 `invalid response`
## 容器管理命令 ## 容器管理命令