Files
wasmeld/crates/wasmeld-console/README.md
T
Maofeng 12992186a9 feat(console): add runtime management and WIT Registry
- embed wasmeld-runtime behind an Axum management API
- persist service metadata, metrics, and events with Toasty and libSQL
- register immutable component artifacts with platform-owned limits
- publish, list, inspect, and download binary WIT package versions
- verify Runtime lifecycle, persistence, Registry immutability, and transitive fetch
2026-07-27 05:01:26 +08:00

66 lines
2.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Wasmeld Console
`wasmeld-console``wasmeld-runtime` 的本地 HTTP 管理适配器。它负责:
- 接收 `.wasmpkg`,校验并保存 `component.wasm` 与运行时 manifest
- 发布、查询和下载不可变的二进制 WIT Package
- 启动、停止和重启内嵌的 `wasmeld-runtime`
- 启动、停止和重启常驻 Actor
- 转发二进制调用
- 暴露调用计数、状态和最近事件
Wasm 制品保存在本地文件系统。服务 manifest、调用计数和最近 256 条事件通过
[Toasty](https://github.com/tokio-rs/toasty) 写入本地 libSQL 数据库,默认路径是
`var/wasmeld/console.db`
`wasmeld-console` 启动时会在同一进程内创建 `wasmeld-runtime`、加载 Wasmtime Engine
并重新注册已保存的 Component。Runtime 停止后 Console HTTP 和数据库仍然在线;
再次启动 Runtime 会重新注册 Component,但 Actor 内存不做快照,服务运行状态统一
恢复为 `stopped`
## 启动
`wasmeld-console` 需要 Rust 1.95 或更高版本;Wasm 组件继续使用项目约定的 Rust 1.90
工具链构建。
```bash
cargo +stable run -p wasmeld-console
```
默认监听 `127.0.0.1:8080`
可用环境变量:
- `WASMELD_ADDR`
- `WASMELD_ARTIFACT_DIR`
- `WASMELD_DATABASE_PATH`
- `WASMELD_WIT_REGISTRY_DIR`
- `WASMELD_ALLOWED_ORIGINS`,多个 Origin 使用逗号分隔
- `RUST_LOG`
## API
| 方法 | 路径 | 用途 |
| --- | --- | --- |
| `GET` | `/healthz` | 健康检查 |
| `GET` | `/api/v1/runtime` | Runtime 状态 |
| `POST` | `/api/v1/runtime/start` | 启动 Runtime 并重新注册受管 Component |
| `POST` | `/api/v1/runtime/stop` | 停止 Runtime 并释放所有 Actor |
| `POST` | `/api/v1/runtime/restart` | 重建 Runtime,服务恢复为停止状态 |
| `GET` | `/api/v1/services` | 服务版本列表 |
| `POST` | `/api/v1/services` | multipart 上传单个 `package` 字段(`.wasmpkg` |
| `POST` | `/api/v1/services/{id}/{revision}/start` | 启动 Actor |
| `POST` | `/api/v1/services/{id}/{revision}/stop` | 停止 Actor |
| `POST` | `/api/v1/services/{id}/{revision}/restart` | 重启 Actor |
| `POST` | `/api/v1/services/{id}/{revision}/invoke` | Base64 二进制调用 |
| `GET` | `/api/v1/events` | 最近 256 条持久化事件 |
| `GET` | `/api/v1/wit/packages` | WIT 包版本列表 |
| `POST` | `/api/v1/wit/packages` | multipart 发布单个二进制 WIT `package` 字段 |
| `GET` | `/api/v1/wit/packages/{namespace}/{name}/{version}` | WIT 包元数据 |
| `GET` | `/api/v1/wit/packages/{namespace}/{name}/{version}/content` | 下载 WIT 包 |
组件包的构建与格式说明见
[`docs/design/wasmeld-component-package.md`](../../docs/design/wasmeld-component-package.md)。
WIT 依赖、Registry 和本地 replace 说明见
[`docs/design/wit-package-management.md`](../../docs/design/wit-package-management.md)。