From 90f9fac6a92c58a9fbf02bb6d4320c6e6d485beb Mon Sep 17 00:00:00 2001 From: Houzhong Xu Date: Sun, 28 Sep 2025 05:53:01 +0000 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0README=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E4=BB=A5=E5=8F=8D=E6=98=A0=E5=BD=93=E5=89=8D=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E7=BB=93=E6=9E=84=E5=92=8CGitOps=E5=8E=9F=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 65 +++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 46 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index cc7ceb1..9ef9b3b 100644 --- a/README.md +++ b/README.md @@ -25,17 +25,43 @@ mgmt/ ├── configuration/ # Ansible 配置管理 │ ├── inventories/ # 主机清单 │ ├── playbooks/ # 剧本 -│ ├── roles/ # 角色 +│ ├── templates/ # 模板文件 │ └── group_vars/ # 组变量 -├── monitoring/ # 监控配置 -├── scripts/ # 自动化脚本 -│ ├── setup/ # 环境设置脚本 -│ └── utilities/ # 实用工具脚本 -├── mgmt.sh # 项目管理主脚本 -└── Makefile # 项目管理命令 +├── jobs/ # Nomad 作业定义 +│ ├── consul/ # Consul 集群配置 +│ └── podman/ # Podman 相关作业 +├── configs/ # 配置文件 +│ ├── nomad-master.hcl # Nomad 主节点配置 +│ └── nomad-ash3c.hcl # Nomad 客户端配置 +├── docs/ # 文档 +├── security/ # 安全配置 +│ ├── certificates/ # 证书文件 +│ └── policies/ # 安全策略 +├── tools/ # 工具和实用程序 +├── playbooks/ # 核心Ansible剧本 +└── Makefile # 项目管理命令 ``` -**注意:** 项目已从 Docker Swarm 迁移到 Nomad + Podman,原有的 swarm 目录已不再使用。 +**注意:** 项目已从 Docker Swarm 迁移到 Nomad + Podman,原有的 swarm 目录已不再使用。所有中间过程脚本和测试文件已清理,保留核心配置文件以符合GitOps原则。 + +## 🔄 GitOps 原则 + +本项目遵循 GitOps 工作流,确保基础设施状态与 Git 仓库中的代码保持一致: + +- **声明式配置**: 所有基础设施和应用程序配置都以声明式方式存储在 Git 中 +- **版本控制和审计**: 所有变更都通过 Git 提交,提供完整的变更历史和审计跟踪 +- **自动化同步**: 通过 CI/CD 流水线自动将 Git 中的变更应用到实际环境 +- **状态收敛**: 系统会持续监控实际状态,并自动修复任何与期望状态的偏差 + +### GitOps 工作流程 + +1. **声明期望状态**: 在 Git 中定义基础设施和应用程序的期望状态 +2. **提交变更**: 通过 Git 提交来应用变更 +3. **自动同步**: CI/CD 系统检测到变更并自动应用到环境 +4. **状态验证**: 系统验证实际状态与期望状态一致 +5. **监控和告警**: 持续监控状态并在出现偏差时发出告警 + +这种工作流确保了环境的一致性、可重复性和可靠性,同时提供了完整的变更历史和回滚能力。 ## 🚀 快速开始 @@ -80,7 +106,7 @@ cd tofu/environments/dev && tofu apply ```bash # 部署 Consul 集群 -nomad run /root/mgmt/consul-cluster-nomad.nomad +nomad run /root/mgmt/jobs/consul/consul-cluster.nomad # 查看 Nomad 任务 nomad job status @@ -93,14 +119,14 @@ nomad node status | 命令 | 描述 | |------|------| -| `./mgmt.sh status` | 显示项目状态总览 | -| `./mgmt.sh deploy` | 快速部署所有服务 | -| `./mgmt.sh cleanup` | 清理所有部署的服务 | -| `./mgmt.sh tofu ` | OpenTofu 管理命令 | +| `make status` | 显示项目状态总览 | +| `make deploy` | 快速部署所有服务 | +| `make cleanup` | 清理所有部署的服务 | +| `cd tofu/environments/dev && tofu ` | OpenTofu 管理命令 | | `nomad job status` | 查看 Nomad 任务状态 | | `nomad node status` | 查看 Nomad 节点状态 | | `podman ps` | 查看运行中的容器 | -| `scripts/setup/setup-opentofu.sh help` | OpenTofu 设置帮助 | +| `ansible-playbook playbooks/configure-nomad-clients.yml` | 配置 Nomad 客户端 | ## 🌩️ 支持的云服务商 @@ -191,11 +217,12 @@ nomad node status ## 📚 文档 -- [架构概览](docs/architecture/project-overview.md) -- [部署指南](docs/runbooks/deployment-guide.md) -- [运维手册](docs/runbooks/operations-guide.md) -- [故障排除](docs/runbooks/troubleshooting.md) -- [API 文档](docs/api/README.md) +- [Consul集群故障排除](docs/consul-cluster-troubleshooting.md) +- [磁盘管理](docs/disk-management.md) +- [Nomad NFS设置](docs/nomad-nfs-setup.md) +- [Consul-Terraform集成](docs/setup/consul-terraform-integration.md) +- [OCI凭据设置](docs/setup/oci-credentials-setup.md) +- [Oracle云设置](docs/setup/oracle-cloud-setup.md) ## 🤝 贡献指南