Align package and executable names with workspace directories
Verify databases and deploy Aster VM / verify-and-deploy (push) Successful in 15m7s
Verify databases and deploy Aster VM / verify-and-deploy (push) Successful in 15m7s
This commit is contained in:
@@ -11,7 +11,7 @@ Server ─→ Core
|
||||
└─────→ Storage
|
||||
```
|
||||
|
||||
Core 与 Storage 互不依赖。HTTP、Tokio、SQLx、数据库、网络和后续浏览器能力属于宿主,不进入零外部依赖的 aster-core。源码包导航见 [crates](../../crates/README.md)。
|
||||
Core 与 Storage 互不依赖。HTTP、Tokio、SQLx、数据库、网络和后续浏览器能力属于宿主,不进入零外部依赖的 core。源码包导航见 [crates](../../crates/README.md)。
|
||||
|
||||
| 组件 | 当前职责 | 全局契约 |
|
||||
| --- | --- | --- |
|
||||
|
||||
@@ -8,14 +8,14 @@
|
||||
|
||||
```sh
|
||||
cargo build --workspace --locked
|
||||
cargo run -p aster-cli -- bootstrap
|
||||
cargo run -p cli -- bootstrap
|
||||
```
|
||||
|
||||
bootstrap 创建两个 Record,输出 runtime=EndorObject、type_system=disabled、objects_distinct=true 和 heap_objects=2,显式释放后输出 released heap_objects=0。它不读取数据库配置,因此无效 DATABASE_URL 也不影响该命令。
|
||||
|
||||
```sh
|
||||
cargo run -p aster-cli -- metadata put project 'Aster VM'
|
||||
cargo run -p aster-cli -- metadata get project
|
||||
cargo run -p cli -- metadata put project 'Aster VM'
|
||||
cargo run -p cli -- metadata get project
|
||||
```
|
||||
|
||||
每次 metadata 命令读取宿主存储配置、连接、操作并关闭连接池;缺失键显示 (missing)。命令和退出码的源码位置见 [cli/src](../../crates/cli/src/README.md)。
|
||||
@@ -23,7 +23,7 @@ cargo run -p aster-cli -- metadata get project
|
||||
## HTTP 宿主
|
||||
|
||||
```sh
|
||||
cargo run -p aster-server
|
||||
cargo run -p server
|
||||
curl --fail http://127.0.0.1:8080/health
|
||||
curl --fail http://127.0.0.1:8080/bootstrap
|
||||
```
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
## 镜像与独立运行
|
||||
|
||||
Dockerfile 的 source 阶段复制 Cargo 工作区及脚本;ci 阶段安装远端检查工具,build 阶段构建 aster-server 和 aster,runtime 阶段使用 Debian slim、UID 10001、/data 工作目录及 HTTP 健康检查。
|
||||
Dockerfile 的 source 阶段复制 Cargo 工作区及脚本;ci 阶段安装远端检查工具,build 阶段构建 server 和 cli,runtime 阶段使用 Debian slim、UID 10001、/data 工作目录及 HTTP 健康检查。
|
||||
|
||||
指定环境的 SQLite 方案:
|
||||
|
||||
@@ -12,7 +12,7 @@ Dockerfile 的 source 阶段复制 Cargo 工作区及脚本;ci 阶段安装远
|
||||
cp .env.example .env
|
||||
docker compose up --build -d
|
||||
curl --fail http://127.0.0.1:8080/health
|
||||
docker compose exec aster aster metadata put project 'Aster VM'
|
||||
docker compose exec aster cli metadata put project 'Aster VM'
|
||||
```
|
||||
|
||||
默认 docker-compose.yml 只向应用提供 SQLITE_PATH,使用 aster-sqlite 命名卷;不透传 DATABASE_URL。down 保留数据,down -v 会删除卷。
|
||||
@@ -21,7 +21,7 @@ docker compose exec aster aster metadata put project 'Aster VM'
|
||||
|
||||
```sh
|
||||
docker compose -f docker-compose.postgres.yml up --build -d
|
||||
docker compose -f docker-compose.postgres.yml exec aster aster metadata get project
|
||||
docker compose -f docker-compose.postgres.yml exec aster cli metadata get project
|
||||
```
|
||||
|
||||
仅使用该 Compose 文件,不与默认 SQLite 文件叠加。此方案使用 aster-postgres 命名卷、PostgreSQL 17;数据库不发布宿主端口。两个独立方案不要同时占用相同应用端口。内部示例连接禁用 TLS,跨不可信网络使用 PostgreSQL TLS 验证。
|
||||
@@ -38,6 +38,8 @@ docker compose -f docker-compose.postgres.yml exec aster aster metadata get proj
|
||||
|
||||
## 生产目录与数据
|
||||
|
||||
Cargo 包名为 core/storage/cli/server,core 的 Rust 库名为 endor_core,可执行文件为 cli/server。Compose 应用服务名 aster、数据库名、卷和生产路径是已有部署资源标识,运行命令为该服务中的 cli;包改名无需迁移这些数据或重建数据库。
|
||||
|
||||
| 路径 | 用途 |
|
||||
| --- | --- |
|
||||
| /opt/endorphin-aster-vm/releases/<sha>/ | 固定版本的 compose.yml 与 release.env |
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
```sh
|
||||
sh scripts/check.sh
|
||||
cargo test -p aster-storage --test postgres --locked -- --ignored
|
||||
cargo test -p storage --test postgres --locked -- --ignored
|
||||
python3 scripts/smoke.py
|
||||
```
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ Python 代码中的 `def greet(name): ...` 创建的是语言函数。函数需
|
||||
CPython 的 `len`、`print` 等宿主实现的内建函数则通过 C 函数入口调用。Endor 使用 Rust,所以命名为 `EndorNativeFunctionObject`,不把 C 写入名称。
|
||||
|
||||
```rust
|
||||
use aster_core::{EndorNativeFunctionObject, Value, Vm, VmError};
|
||||
use endor_core::{EndorNativeFunctionObject, Value, Vm, VmError};
|
||||
|
||||
fn echo(arguments: &[Value]) -> Result<Value, VmError> {
|
||||
match arguments {
|
||||
@@ -58,9 +58,9 @@ Native 函数和语言函数均通过 `Vm::call(&mut self, ...)` 调用。语言
|
||||
| Complex | 复数记录 | 实部与虚部各自的 Integer、Decimal、Rational 或 BinaryFloat 表示 |
|
||||
|
||||
```rust
|
||||
use aster_core::{EndorNumber, Value};
|
||||
use endor_core::{EndorNumber, Value};
|
||||
|
||||
fn main() -> Result<(), aster_core::VmError> {
|
||||
fn main() -> Result<(), endor_core::VmError> {
|
||||
let id = EndorNumber::integer("1234567890123456789012345678901234567890")?;
|
||||
let amount = EndorNumber::decimal("12345678901234567890.000100")?;
|
||||
let ratio = EndorNumber::rational("1", "3")?;
|
||||
@@ -105,9 +105,9 @@ print(read()) # updated
|
||||
`read` 与 `write` 必须引用同一个变量位置。若各自复制一份 `x` 的初始值,write 重新赋值后 read 就看不到变化。Cell 是这个共享位置:函数持有 Cell,Cell 持有当前值。外层函数返回后,Cell 仍被闭包持有。
|
||||
|
||||
```rust
|
||||
use aster_core::{Value, Vm};
|
||||
use endor_core::{Value, Vm};
|
||||
|
||||
fn main() -> Result<(), aster_core::VmError> {
|
||||
fn main() -> Result<(), endor_core::VmError> {
|
||||
let mut vm = Vm::new()?;
|
||||
let cell = vm.new_cell(None)?; // 空槽,不是 Nil。
|
||||
vm.cell_set(cell, Value::Text("first".into()))?;
|
||||
|
||||
@@ -94,9 +94,9 @@ Vm::execute(code, globals)
|
||||
## 最小示例
|
||||
|
||||
```rust
|
||||
use aster_core::{CodeLayout, EndorCode, Instruction, Opcode, Value, Vm};
|
||||
use endor_core::{CodeLayout, EndorCode, Instruction, Opcode, Value, Vm};
|
||||
|
||||
fn main() -> Result<(), aster_core::VmError> {
|
||||
fn main() -> Result<(), endor_core::VmError> {
|
||||
let mut vm = Vm::new()?;
|
||||
let globals = vm.new_dict()?;
|
||||
let code = EndorCode::from_instructions(
|
||||
|
||||
Reference in New Issue
Block a user