Some checks failed
Build GDExtension / Build GDExtension (libgurt_godot.so, ubuntu-latest, linux, x86_64-unknown-linux-gnu) (push) Failing after 6m17s
Build Gurty / Build Gurty (, ubuntu-latest, linux, x86_64-unknown-linux-gnu) (push) Failing after 58s
Build GurtCA / Build GurtCA (, ubuntu-latest, linux, x86_64-unknown-linux-gnu) (push) Failing after 29m38s
Build Flumi / Build Flumi (Windows Desktop, 4.4.1, windows-latest, windows) (push) Has been cancelled
Build Flumi / Build Flumi (Linux, 4.4.1, ubuntu-latest, linux) (push) Has been cancelled
Build GDExtension / Build GDExtension (gurt_godot.dll, windows-latest, windows, x86_64-pc-windows-msvc) (push) Has been cancelled
Build GurtCA / Build GurtCA (.exe, windows-latest, windows, x86_64-pc-windows-msvc) (push) Has been cancelled
Build Gurty / Build Gurty (.exe, windows-latest, windows, x86_64-pc-windows-msvc) (push) Has been cancelled
6.2 KiB
6.2 KiB
Gurted生态系统搭建指南
本指南将帮助您完整搭建Gurted生态系统的所有组件,使其正常运行。
1. 环境准备
1.1 安装必要的工具和依赖
# 安装Rust (如果尚未安装)
choco install rustup
rustup default stable
# 安装PostgreSQL (用于DNS和搜索引擎)
choco install postgresql
# 安装mkcert (用于开发环境的TLS证书)
choco install mkcert
# 安装Godot 4.x (用于运行和开发Flumi浏览器)
# 访问 https://godotengine.org/download 下载并安装
# 安装Node.js和npm (用于前端开发)
choco install nodejs
1.2 安装本地CA证书 (仅开发环境)
mkcert -install
2. DNS系统搭建
2.1 配置PostgreSQL数据库
# 启动PostgreSQL服务
pg_ctl -D "C:\Program Files\PostgreSQL\版本\data" start
# 创建数据库和用户
psql -U postgres
CREATE DATABASE gurt_dns;
CREATE USER gurt_user WITH PASSWORD 'your_password';
GRANT ALL PRIVILEGES ON DATABASE gurt_dns TO gurt_user;
\q
2.2 配置DNS服务器
cd d:\Projects\Rust\leonwww\dns
cp config.template.toml config.toml
编辑config.toml文件,配置数据库连接等信息:
[database]
url = "postgres://gurt_user:your_password@localhost/gurt_dns"
[server]
address = "127.0.0.1"
port = 4877
2.3 运行DNS服务器
cd d:\Projects\Rust\leonwww\dns
cargo run
DNS服务器现在应该运行在http://127.0.0.1:4877
3. GurtCA证书颁发机构搭建
3.1 编译GurtCA
cd d:\Projects\Rust\leonwww\protocol\gurtca
cargo build --release
3.2 获取CA证书
要使用GurtCA,首先需要获取CA证书。注意:GurtCA工具需要使用lw://协议的URL:
cd d:\Projects\Rust\leonwww\protocol\gurtca\target\release
# 使用默认的lw://dns.root CA URL
./gurtca get-ca --output ./ca.crt
# 或者指定自定义的CA URL
./gurtca get-ca --ca-url lw://your-ca-server --output ./ca.crt
重要说明:
- GurtCA工具需要使用lw://协议的URL(不支持http://或https://)
- 默认CA URL是lw://dns.root
- 如果连接失败,工具会尝试通过HTTP引导服务器(默认是http://10.0.0.138:8876)获取CA证书
- 您可能需要确保本地运行的DNS服务器可以解析这些地址
3.3 请求域名证书
要为您的域名请求证书:
cd d:\Projects\Rust\leonwww\protocol\gurtca\target\release
./gurtca request yourdomain.web --output ./certs
按照提示完成DNS挑战验证。
4. GURT协议服务器设置
4.1 生成TLS证书
开发环境:
cd d:\Projects\Rust\leonwww\protocol\cli
mkcert localhost 127.0.0.1 ::1
生产环境:
使用GurtCA获取证书:
cd d:\Projects\Rust\leonwww\protocol\gurtca\target\release
./gurtca request yourdomain.web --output ./certs
按照提示完成DNS验证挑战。
4.2 配置Gurty CLI
cd d:\Projects\Rust\leonwww\protocol\cli
cp gurty.template.toml gurty.toml
编辑gurty.toml文件以适应您的环境。
4.3 启动GURT服务器
cd d:\Projects\Rust\leonwww\protocol\cli
# 使用自签名证书(开发环境)
gurty serve --cert localhost+2.pem --key localhost+2-key.pem --config gurty.toml
# 或使用CA颁发的证书(生产环境)
gurty serve --cert ./certs/yourdomain.web.crt --key ./certs/yourdomain.web.key --config gurty.toml
5. 搜索引擎搭建
5.1 配置搜索引擎数据库
psql -U postgres
CREATE DATABASE gurt_search;
GRANT ALL PRIVILEGES ON DATABASE gurt_search TO gurt_user;
\q
5.2 配置搜索引擎
cd d:\Projects\Rust\leonwww\search-engine
cp config.template.toml config.toml
编辑config.toml文件,配置数据库连接和其他参数:
[database]
url = "postgres://gurt_user:your_password@localhost/gurt_search"
[server]
address = "127.0.0.1"
port = 4879
cert_path = "certs/t.crt"
key_path = "certs/t.key"
5.3 运行搜索引擎
cd d:\Projects\Rust\leonwww\search-engine
cargo run
搜索引擎现在应该运行在lw://127.0.0.1:4879
6. Flumi浏览器设置
6.1 编译和运行Flumi
- 启动Godot引擎
- 导入
d:\Projects\Rust\leonwww\flumi项目 - 构建并运行项目
6.2 配置Flumi连接到本地服务器
在Flumi浏览器中,您可以访问以下地址测试各个组件:
- DNS服务器: http://127.0.0.1:4877
- GURT服务器: lw://localhost:4878
- 搜索引擎: lw://127.0.0.1:4879
7. 开发流程
如果您修改了协议库或GDExtension,需要重新构建GDExtension:
cd d:\Projects\Rust\leonwww\protocol\gdextension
./build.sh
cp -r ./addon d:\Projects\Rust\leonwww\flumi\addons\gurt-protocol\
8. 完整生态系统的组件关系
- DNS系统: 管理域名解析,允许用户注册自定义TLD域名
- GurtCA: 颁发TLS证书,确保通信安全
- GURT协议库: 提供协议实现,被CLI和浏览器使用
- Gurty CLI: 用于设置和管理GURT服务器
- Flumi浏览器: 访问GURT网络的客户端工具
- Ringle搜索引擎: 索引和搜索GURT网络内容
9. 测试
使用tests目录中的示例文件来测试GURT协议的各种功能:
# 在GURT服务器中提供测试文件
cd d:\Projects\Rust\leonwww\protocol\cli
gurty serve --root ../tests --cert localhost+2.pem --key localhost+2-key.pem
然后在Flumi浏览器中访问:lw://localhost:4878/index.html
10. 部署建议
对于生产环境部署,建议使用Docker容器:
DNS服务器部署
cd d:\Projects\Rust\leonwww\dns
docker-compose up -d
搜索引擎部署
cd d:\Projects\Rust\leonwww\search-engine
docker-compose up -d
11. 常见问题解答
11.1 TLS证书问题
- 确保正确安装了CA证书
- 检查证书路径是否正确配置
- 验证证书是否在有效期内
11.2 数据库连接问题
- 确认PostgreSQL服务正在运行
- 检查数据库连接字符串是否正确
- 验证用户权限设置是否正确
11.3 网络连接问题
- 检查防火墙设置
- 验证端口是否已正确配置
- 确保所有组件使用相同的协议版本
按照本指南,您应该能够成功搭建完整的Gurted生态系统。如果遇到任何问题,请参考各组件的README文件获取更详细的信息。