- Add comprehensive docs/ directory with standardized structure - Include architecture specification and contract documents - Add prompt templates for development workflows - Establish M1 deliverables as frozen specifications Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2.0 KiB
2.0 KiB
仓库布局规范 v1.0
1. 双仓库策略
每个服务对应两个 Gitea 仓库:
| 仓库 | 内容 | CI/CD 角色 |
|---|---|---|
| {service-name} | 应用代码 + Dockerfile + Gitea CI workflow | CI:编译/测试/构建镜像/推送 Harbor |
| {service-name}-deploy | Kustomize 部署清单 | CD:ArgoCD 监听此仓库 |
2. 命名映射关系
以 order-service 为例:
| 资源 | 命名 |
|---|---|
| 应用仓库 | order-service |
| 部署仓库 | order-service-deploy |
| Maven groupId | com.{company}.order |
| Maven artifactId | order-service(父)/ order-domain / order-application / ... |
| Java 包根 | com.{company}.order |
| Docker 镜像 | harbor.{domain}/{org}/order-service:{git-sha-short} |
| K8s Namespace | {env}(dev / staging / prod) |
| K8s Deployment | order-service |
| K8s Service | order-service |
| ArgoCD Application | order-service-dev / order-service-staging / order-service-prod |
3. 模板仓库初始化脚本
模板仓库名:java-service-template
初始化命令: ./init.sh --name order-service --group com.example.order --org myteam
脚本执行的替换清单:
- 目录名:tmpl-* → order-service-*
- pom.xml:groupId, artifactId, name
- Java 包名:com.example.tmpl → com.example.order
- Dockerfile:镜像名
- Kustomize:image, app label
- Gitea CI workflow:镜像推送路径
- ArgoCD Application 名
4. 部署仓库结构
{service-name}-deploy/ ├── base/ │ ├── kustomization.yaml │ ├── deployment.yaml │ ├── service.yaml │ ├── configmap.yaml │ └── hpa.yaml └── overlays/ ├── dev/ │ ├── kustomization.yaml # image tag 在此修改 │ └── patch-resources.yaml # 资源配额覆盖 ├── staging/ │ ├── kustomization.yaml │ └── patch-resources.yaml └── prod/ ├── kustomization.yaml ├── patch-resources.yaml └── patch-replicas.yaml # 生产副本数