ln-730-devops-setup

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

ln-730-devops-setup

ln-730-devops-setup

Type: L2 Domain Coordinator Category: 7XX Project Bootstrap Parent: ln-700-project-bootstrap
Coordinates DevOps infrastructure setup by delegating to specialized workers.

类型: L2 领域协调器 分类: 7XX 项目初始化引导 父级: ln-700-project-bootstrap
通过委派给专业的工作组件来协调DevOps基础设施的搭建。

Purpose & Scope

目标与范围

Orchestrates the complete DevOps setup for a project:
  • Does: Auto-detect stack, delegate to workers, verify configuration
  • Does NOT: Generate files directly (delegates to ln-731, ln-732, ln-733)

编排项目的完整DevOps搭建流程:
  • 负责内容:自动检测技术栈、委派给工作组件、验证配置
  • 不负责内容:直接生成文件(委派给ln-731、ln-732、ln-733)

Overview

概述

AspectDetails
InputProject directory with source code
OutputDocker, CI/CD, environment configuration
Workersln-731 (Docker), ln-732 (CI/CD), ln-733 (Environment)
ModeAuto-detect (no user prompts)

方面详情
输入包含源代码的项目目录
输出Docker、CI/CD、环境配置
工作组件ln-731(Docker)、ln-732(CI/CD)、ln-733(环境)
模式自动检测(无用户提示)

Supported Stacks

支持的技术栈

ComponentOption 1Option 2
FrontendReact/Vite + Nginx-
Backend.NET 8/9Python (FastAPI/Django)
DatabasePostgreSQL-
CI/CDGitHub Actions-

组件选项1选项2
前端React/Vite + Nginx-
后端.NET 8/9Python(FastAPI/Django)
数据库PostgreSQL-
CI/CDGitHub Actions-

Workflow

工作流程

Phase 1: Pre-flight Validation

阶段1:预启动验证

Check required tools and project structure:
  • Verify Docker is installed (
    docker --version
    )
  • Verify docker-compose is available
  • Check for existing DevOps files (warn if overwriting)
Output: Validation report or STOP with instructions
检查所需工具和项目结构:
  • 验证Docker已安装(
    docker --version
  • 验证docker-compose可用
  • 检查是否存在现有DevOps文件(若将覆盖则发出警告)
输出:验证报告或停止并给出操作说明

Phase 2: Project Analysis (Auto-detect)

阶段2:项目分析(自动检测)

Detect project stack automatically:
DetectionMethodFiles to Check
FrontendPackage.json presence
src/frontend/package.json
,
package.json
Backend .NET.csproj/.sln presence
*.sln
,
src/**/*.csproj
Backend Pythonrequirements.txt/pyproject.toml
requirements.txt
,
pyproject.toml
DatabaseConnection strings in code
appsettings.json
,
.env.example
Existing CI/CDWorkflow files
.github/workflows/
,
azure-pipelines.yml
Version Detection:
  • Node.js: Read from
    package.json
    engines or use
    node -v
  • .NET: Read from
    *.csproj
    TargetFramework
  • Python: Read from
    pyproject.toml
    or
    runtime.txt
  • PostgreSQL: Default to latest stable (17)
Output: Stack configuration object with detected versions
自动检测项目技术栈:
检测项方法需检查的文件
前端检查是否存在Package.json
src/frontend/package.json
,
package.json
后端 .NET检查是否存在.csproj/.sln
*.sln
,
src/**/*.csproj
后端 Python检查是否存在requirements.txt/pyproject.toml
requirements.txt
,
pyproject.toml
数据库检查代码中的连接字符串
appsettings.json
,
.env.example
现有CI/CD检查工作流文件
.github/workflows/
,
azure-pipelines.yml
版本检测:
  • Node.js: 从
    package.json
    的engines字段读取,或使用
    node -v
    获取
  • .NET: 从
    *.csproj
    的TargetFramework字段读取
  • Python: 从
    pyproject.toml
    runtime.txt
    读取
  • PostgreSQL: 默认使用最新稳定版(17)
输出: 包含检测到的版本的技术栈配置对象

Phase 3: Worker Delegation

阶段3:工作组件委派

Delegate to workers in parallel (independent tasks):
ln-730 (Coordinator)
    |
    +---> ln-731-docker-generator (via Task tool)
    |         Input: stack config, versions
    |         Output: Dockerfile.*, docker-compose.yml, .dockerignore
    |
    +---> ln-732-cicd-generator (via Task tool)
    |         Input: stack config, detected commands
    |         Output: .github/workflows/ci.yml
    |
    +---> ln-733-env-configurator (via Task tool)
              Input: detected environment variables
              Output: .env.example, .env.development, .gitignore updates
Error Handling:
  • If worker fails, log error and continue with others
  • Report all failures at the end
  • Suggest manual fixes for failed components
并行委派给工作组件(任务相互独立):
ln-730 (Coordinator)
    |
    +---> ln-731-docker-generator (via Task tool)
    |         Input: stack config, versions
    |         Output: Dockerfile.*, docker-compose.yml, .dockerignore
    |
    +---> ln-732-cicd-generator (via Task tool)
    |         Input: stack config, detected commands
    |         Output: .github/workflows/ci.yml
    |
    +---> ln-733-env-configurator (via Task tool)
              Input: detected environment variables
              Output: .env.example, .env.development, .gitignore updates
错误处理:
  • 若某个工作组件失败,记录错误并继续执行其他组件
  • 在流程结束时报告所有失败情况
  • 为失败的组件提供手动修复建议

Phase 4: Configuration Verification

阶段4:配置验证

Verify generated configuration:
  • Run
    docker-compose config
    to validate syntax
  • Check all referenced files exist
  • Verify no secrets in committed files
Output: Verification report
验证生成的配置:
  • 运行
    docker-compose config
    验证语法正确性
  • 检查所有引用的文件是否存在
  • 验证提交的文件中不包含敏感信息
输出: 验证报告

Phase 5: Completion Report

阶段5:完成报告

Generate summary:
  • List all created files
  • Show detected stack configuration
  • Provide next steps for user

生成总结:
  • 列出所有已创建的文件
  • 展示检测到的技术栈配置
  • 为用户提供后续步骤

Generated Files

生成的文件

Docker (ln-731)

Docker (ln-731)

  • Dockerfile.frontend
    - Multi-stage build for frontend
  • Dockerfile.backend
    - Multi-stage build for backend
  • docker-compose.yml
    - Service orchestration
  • docker-compose.override.yml
    - Development overrides (optional)
  • .dockerignore
    - Build context exclusions
  • Dockerfile.frontend
    - 前端多阶段构建文件
  • Dockerfile.backend
    - 后端多阶段构建文件
  • docker-compose.yml
    - 服务编排文件
  • docker-compose.override.yml
    - 开发环境覆盖配置(可选)
  • .dockerignore
    - 构建上下文排除规则

CI/CD (ln-732)

CI/CD (ln-732)

  • .github/workflows/ci.yml
    - Main CI pipeline
  • .github/workflows/ci.yml
    - 主CI流水线文件

Environment (ln-733)

环境 (ln-733)

  • .env.example
    - Template with all variables
  • .env.development
    - Development defaults
  • .env.production
    - Production template (placeholders)
  • .gitignore
    updates - Secrets protection

  • .env.example
    - 包含所有变量的模板文件
  • .env.development
    - 开发环境默认配置
  • .env.production
    - 生产环境模板(占位符)
  • .gitignore
    更新 - 敏感信息保护

Critical Notes

重要说明

  1. Auto-detect Only: No interactive prompts. Uses detected values or sensible defaults.
  2. Idempotent: Check file existence before creation. Warn before overwriting.
  3. Parallel Execution: Workers are independent, can run in parallel.
  4. Error Recovery: Continue on partial failures, report all issues at end.
  5. Version Pinning: Use detected versions, not hardcoded values.

  1. 仅自动检测:无交互式提示,使用检测到的值或合理默认值。
  2. 幂等性:创建文件前检查是否已存在,覆盖前发出警告。
  3. 并行执行:工作组件相互独立,可并行运行。
  4. 错误恢复:部分失败时继续执行,在流程结束时报告所有问题。
  5. 版本固定:使用检测到的版本,而非硬编码值。

Definition of Done

完成标准

  • Pre-flight validation passed
  • Stack auto-detected successfully
  • All workers completed (or failures documented)
  • docker-compose config
    validates successfully
  • No secrets in generated files
  • Completion report displayed

Version: 1.1.0 Last Updated: 2026-01-10
  • 预启动验证通过
  • 技术栈自动检测成功
  • 所有工作组件执行完成(或已记录失败情况)
  • docker-compose config
    验证通过
  • 生成的文件中无敏感信息
  • 显示完成报告

版本: 1.1.0 最后更新时间: 2026-01-10