Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
22 changes: 20 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,4 @@ chrono = { version = "0.4.42" }
async-backtrace = { version = "0.2.7" }
uniffi = { version = "0.31.0", features = ["scaffolding-ffi-buffer-fns"] }
zip = { version = "8.4.0" }
bigdecimal = { version = "0.4.10" }
100 changes: 100 additions & 0 deletions doc/cn/DEPLOY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# MuduDB 一键部署指南

在纯净 Ubuntu 24.04 环境中一键完成依赖安装、编译、启动、测试。

## 快速开始

```bash
# 1. 安装系统依赖 + Rust 工具链
bash script/shell/install_deps.sh

# 2. 编译全部组件并打包示例应用
bash script/shell/build_all.sh

# 3. 启动服务器并运行 CRUD 测试
bash script/shell/run_test.sh
```

三步全部通过即部署成功。

## 环境要求

- Ubuntu 24.04 LTS (x86_64)
- Linux 内核 5.1+,需启用 `CONFIG_IO_URING=y`
- 8GB+ 内存, 20GB+ 磁盘
- 外网访问 (下载 Rust 工具链和依赖)

### 检查 io_uring 支持

```bash
# 内核版本
uname -r # 必须 ≥ 5.1

# io_uring 是否可用
grep io_uring /proc/filesystems && echo "io_uring OK" || echo "NOT supported"

# memlock 限制 (io_uring 需要锁定内存)
ulimit -l # 建议 ≥ 65536 或 unlimited
```

### Docker 环境

如果在 Docker 中运行,需要 `--privileged` 以访问宿主机内核的 io_uring:

```bash
docker run --privileged -v /path/to/repo:/mududb_p:ro ubuntu:24.04 ...
```

或使用更精细的权限:
```bash
docker run --cap-add CAP_SYS_ADMIN --ulimit memlock=-1:-1 ...
```

## 脚本说明

### `script/shell/install_deps.sh`

安装运行 MuduDB 所需的全部依赖:

| 类别 | 内容 |
|------|------|
| 系统包 | python3, pip, python-is-python3, build-essential, curl, liburing-dev, clang, libclang-dev, llvm-dev, pkgconf, iproute2 |
| Rust | nightly 工具链 + rustfmt + wasm32-wasip2 target |
| Python | toml, tomli-w |
| 工具 | cargo-make |

### `script/shell/build_all.sh`

编译并安装全部组件:

1. `cargo build --release` — 编译 34 个 crate
2. 安装二进制文件到 `~/.cargo/bin/` (mudud, mcli, mpk, mgen, mtp)
3. 编译 wallet 示例应用,生成 `.mpk` 包

### `script/shell/run_test.sh`

启动 MuduDB 服务器并执行 CRUD 测试:

- 自动创建临时数据目录和配置文件
- 启动 mudud 服务器 (HTTP 8300 / TCP 9527)
- 安装 wallet 示例应用
- 测试 CREATE / READ / UPDATE / INVOKE / DELETE
- 测试结束后自动清理

### `script/shell/debug_test.sh`

带诊断信息的集成测试,输出更详细的日志和中间状态。

## 一键运行全部

```bash
#!/bin/bash
set -euo pipefail
bash script/shell/install_deps.sh
source "$HOME/.cargo/env"
bash script/shell/build_all.sh
mkdir -p "$HOME/.mududb"
bash script/shell/run_test.sh
bash script/shell/debug_test.sh
echo "All tests passed."
```
24 changes: 12 additions & 12 deletions example/game-backend/package/package.desc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,9 @@
"game_backend": [
{
"module_name": "game_backend",
"proc_name": "command",
"proc_name": "event",
"param_desc": {
"fields": [
{
"dat_type": {
"id": "Binary",
"param": null
},
"name": "message"
}
]
"fields": []
},
"return_desc": {
"fields": [
Expand All @@ -29,9 +21,17 @@
},
{
"module_name": "game_backend",
"proc_name": "event",
"proc_name": "command",
"param_desc": {
"fields": []
"fields": [
{
"dat_type": {
"id": "Binary",
"param": null
},
"name": "message"
}
]
},
"return_desc": {
"fields": [
Expand Down
Loading
Loading