Files
full/README.md
2026-08-10 11:42:45 +08:00

71 lines
2.4 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.
# BSM Infra Full
BSM 后端服务 Go workspace包含 19 个独立业务模块和一个统一端口运行的 all 聚合模块。Go 版本为 1.26.5。
## 快速开始
Windows
go work sync
./scripts/verify-workspace.ps1
Linux/macOS
go work sync
./scripts/verify-workspace.sh
运行独立服务:
cd module/base/passport
go run ./cmd/main
运行聚合服务:
cd all
go run ./cmd/main --workspace=default
all 默认读取 all/etc/default_<runtime>.yaml。指定 --workspace=tenant01 时,开发模式读取 all/etc/tenant01_dev.yaml。workspace 仅允许字母、数字、下划线和连字符,最长 64 个字符。
## 模块
| 领域 | 模块 |
| --- | --- |
| module/base | ads、cloud、cms、feedback、fts、initial、logs、mgt、passport、sender |
| module/ec | address、mall、market、order |
| module/finance | wallet |
| module/social | feed、group、relation |
| all | 聚合 15 个 base/ec/finance 服务,统一提供 gRPC、grpc-gateway 和 Gin HTTP |
Services 配置决定 all 启用哪些服务BSM_SERVICES 环境变量可临时覆盖,例如 passport,order,wallet。
## 配置安全
仓库内 YAML 仅为结构示例,凭据使用 CHANGE_ME。部署时必须通过密钥管理或发布系统注入真实值禁止提交密码、令牌、私钥和云密钥。
生产环境至少应替换全部 CHANGE_ME关闭公网数据库/Redis/etcd评估关闭 gRPC reflection保持 mgt.InitRootUser=false并在入口层启用 TLS 和访问控制。
## 常用脚本
| 脚本 | 用途 |
| --- | --- |
| scripts/verify-workspace.ps1 | Windowsgofmt、go vet、go test |
| scripts/verify-workspace.sh | Linux/macOSgofmt、go vet、go test |
| scripts/build-all-linux.sh | 构建 Linux amd64 独立服务 |
| scripts/generate-protobuf.sh | 重新生成 protobuf |
| scripts/update-all.sh | 更新全部依赖,执行后必须审阅差异 |
## 文档
- [Wiki 索引](wiki/README.md)
- [系统架构](wiki/architecture.md)
- [开发与运维](wiki/operations.md)
- [审计报告](wiki/audit-2026-08-10.md)
## 开发约定
- 新模块必须加入 go.work不得提交本机绝对路径 replace。
- 模块保留独立 cmd/main通过 service.Expose 接入 all。
- 默认测试不得访问网络或真实基础设施;集成测试使用 integration build tag。
- protobuf 全限定名称必须跨模块唯一。
- 提交前运行 workspace 验证脚本和 git diff --check。