docs: document live Component preview workflow
Explain the wasmeld dev watch-build-package-deploy loop, isolated development service IDs, hash revisions, failure retention, cleanup behavior, and command options. Document the inactive-revision DELETE endpoint and the switch-before-unregister safety rule.
This commit is contained in:
@@ -56,6 +56,24 @@ cd console
|
|||||||
npm run dev
|
npm run dev
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## 组件开发
|
||||||
|
|
||||||
|
Console 启动后,使用开发模式监听组件源码和本地 WIT `replace`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cargo run -p wasmeld-package --bin wasmeld -- \
|
||||||
|
dev components/echo/Cargo.toml --locked
|
||||||
|
```
|
||||||
|
|
||||||
|
首次构建和每次源码变化都会自动完成 WIT 同步、Debug 编译、打包、注册和 Deployment
|
||||||
|
切换。默认使用 `echo-dev` 这类独立服务 ID,并根据 Component 内容生成
|
||||||
|
`0.1.0-dev.h<hash>` Revision,不会覆盖正式服务。新版本构建、校验或启动失败时,上一
|
||||||
|
版本继续运行;切换成功后旧开发 Revision 会被注销并释放。
|
||||||
|
|
||||||
|
管理面每 5 秒刷新一次,可以直接在调用面板预览新版本。只构建并部署一次可使用
|
||||||
|
`--once`;其它选项包括 `--id`、`--console`、`--release` 和 `--poll-ms`。管理 API
|
||||||
|
地址也可通过 `WASMELD_CONSOLE` 设置。
|
||||||
|
|
||||||
构建组件:
|
构建组件:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ WIT Registry 路由。
|
|||||||
| `POST` | `/api/v1/runtime/restart` | 重建 Runtime,并重新创建活动 Deployment 的 Actor |
|
| `POST` | `/api/v1/runtime/restart` | 重建 Runtime,并重新创建活动 Deployment 的 Actor |
|
||||||
| `GET` | `/api/v1/services` | 服务版本及精确 Host Capability 列表 |
|
| `GET` | `/api/v1/services` | 服务版本及精确 Host Capability 列表 |
|
||||||
| `POST` | `/api/v1/services` | multipart 上传单个 `package` 字段(`.wasmpkg`) |
|
| `POST` | `/api/v1/services` | multipart 上传单个 `package` 字段(`.wasmpkg`) |
|
||||||
|
| `DELETE` | `/api/v1/services/{id}/{revision}` | 注销非活动 Revision 并删除制品 |
|
||||||
| `POST` | `/api/v1/services/{id}/{revision}/start` | 启动 Actor |
|
| `POST` | `/api/v1/services/{id}/{revision}/start` | 启动 Actor |
|
||||||
| `POST` | `/api/v1/services/{id}/{revision}/stop` | 停止 Actor |
|
| `POST` | `/api/v1/services/{id}/{revision}/stop` | 停止 Actor |
|
||||||
| `POST` | `/api/v1/services/{id}/{revision}/restart` | 重启 Actor |
|
| `POST` | `/api/v1/services/{id}/{revision}/restart` | 重启 Actor |
|
||||||
@@ -73,6 +74,9 @@ WIT Registry 路由。
|
|||||||
| `GET` | `/api/v1/wit/packages/{namespace}/{name}/{version}` | WIT 包元数据 |
|
| `GET` | `/api/v1/wit/packages/{namespace}/{name}/{version}` | WIT 包元数据 |
|
||||||
| `GET` | `/api/v1/wit/packages/{namespace}/{name}/{version}/content` | 下载 WIT 包 |
|
| `GET` | `/api/v1/wit/packages/{namespace}/{name}/{version}/content` | 下载 WIT 包 |
|
||||||
|
|
||||||
|
活动 Deployment 不能直接注销。开发工具会先完成新 Revision 的编译、注册和切换,
|
||||||
|
再注销上一份开发 Revision,因此失败的构建不会影响当前可调用版本。
|
||||||
|
|
||||||
激活已注册版本:
|
激活已注册版本:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
Reference in New Issue
Block a user