第十章:附录(Appendices)
10.1 缩略语表(Glossary of Terms)
| 缩写 | 全称 | 中文说明 |
|---|---|---|
| API | Application Programming Interface | 应用程序接口 |
| CI | Continuous Integration | 持续集成 |
| CD | Continuous Deployment | 持续部署 |
| DSL | Domain-Specific Language | 领域专用语言 |
| YAML | YAML Ain’t Markup Language | 配置文件格式 |
| RBAC | Role-Based Access Control | 基于角色的访问控制 |
| OPA | Open Policy Agent | 策略引擎 |
| SBOM | Software Bill of Materials | 软件物料清单 |
| SLA | Service Level Agreement | 服务等级协议 |
| RTO | Recovery Time Objective | 恢复时间目标 |
| RPO | Recovery Point Objective | 数据恢复点目标 |
| JWT | JSON Web Token | 用户身份认证令牌 |
| SDK | Software Development Kit | 软件开发工具包 |
| S3 | Simple Storage Service | 对象存储服务协议 |
| GA | General Availability | 正式可用版本 |
| MVP | Minimum Viable Product | 最小可行产品 |
| KPI | Key Performance Indicator | 关键绩效指标 |
| DAG | Directed Acyclic Graph | 有向无环图 |
| WASM | WebAssembly | 浏览器可执行二进制格式 |
| CLI | Command Line Interface | 命令行接口 |
| ORM | Object-Relational Mapping | 对象关系映射 |
| E2E | End-to-End | 端到端测试 |
| CDN | Content Delivery Network | 内容分发网络 |
| KMS | Key Management Service | 密钥管理系统 |
10.2 YAML Pipeline 示例(Pipeline DSL Reference)
version: 1
name: Full Build & Deploy
trigger:
on:
push: ["main"]
tag: ["v*"]
env:
BUILD_MODE: release
REGISTRY: registry.example.com
stages:
- name: build
runs_on: docker-runner
steps:
- checkout
- run: go build -o bin/app ./cmd
- cache:
path: ~/.cache/go-build
- artifact: upload
path: bin/app
name: binary
- name: test
needs: [build]
steps:
- run: go test ./... -v
- name: package
needs: [test]
steps:
- run: docker build -t ${{ env.REGISTRY }}/app:${{ git.tag }} .
- run: docker push ${{ env.REGISTRY }}/app:${{ git.tag }}
- name: deploy
approval: maintainers
needs: [package]
steps:
- k8s.deploy:
file: k8s/deployment.yaml
image: ${{ env.REGISTRY }}/app:${{ git.tag }}
namespace: prod
支持的关键字
| 关键字 | 类型 | 说明 |
|---|---|---|
trigger | object | 触发条件(push, tag) |
env | map | 全局环境变量 |
stages | array | 阶段列表 |
runs_on | string | Runner 类型 |
steps | array | 任务步骤 |
cache | object | 缓存目录 |
artifact | object | 制品上传下载 |
approval | string | 审批角色 |
needs | array | 依赖阶段 |
k8s.deploy | object | K8s 部署指令 |
10.3 API Schema(OpenAPI Snippet)
openapi: 3.1.0
info:
title: DeployLite API
version: 1.0.0
paths:
/projects:
get:
summary: 获取项目列表
responses:
"200":
description: OK
content:
application/json:
schema:
type: object
properties:
total:
type: integer
items:
type: array
items:
$ref: "#/components/schemas/Project"
/pipelines/{id}/run:
post:
summary: 触发流水线运行
parameters:
- name: id
in: path
required: true
schema: { type: integer }
responses:
"201":
description: Created
components:
schemas:
Project:
type: object
properties:
id: { type: integer }
name: { type: string }
repo_url: { type: string }
created_at: { type: string, format: date-time }
10.4 数据库表结构定义(Database Schema)
表 1:projects
CREATE TABLE projects (
id SERIAL PRIMARY KEY,
name VARCHAR(128) NOT NULL,
repo_url TEXT NOT NULL,
description TEXT,
owner_id BIGINT NOT NULL,
created_at TIMESTAMP DEFAULT NOW(),
updated_at TIMESTAMP DEFAULT NOW()
);
表 2:pipelines
CREATE TABLE pipelines (
id SERIAL PRIMARY KEY,
project_id BIGINT REFERENCES projects(id),
yaml TEXT NOT NULL,
status VARCHAR(20) DEFAULT 'pending',
started_at TIMESTAMP,
finished_at TIMESTAMP,
created_by BIGINT,
logs_url TEXT
);
表 3:runners
CREATE TABLE runners (
id SERIAL PRIMARY KEY,
name VARCHAR(128),
token TEXT,
status VARCHAR(20) DEFAULT 'offline',
last_heartbeat TIMESTAMP,
capacity INT DEFAULT 1,
region VARCHAR(64)
);
表 4:artifacts
CREATE TABLE artifacts (
id SERIAL PRIMARY KEY,
project_id BIGINT REFERENCES projects(id),
name VARCHAR(128),
version VARCHAR(64),
storage_path TEXT,
hash CHAR(64),
size BIGINT,
created_at TIMESTAMP DEFAULT NOW()
);
表 5:policies
CREATE TABLE policies (
id SERIAL PRIMARY KEY,
name VARCHAR(128),
type VARCHAR(32),
content TEXT,
enabled BOOLEAN DEFAULT TRUE,
created_at TIMESTAMP DEFAULT NOW()
);
表 6:audit_logs
CREATE TABLE audit_logs (
id BIGSERIAL PRIMARY KEY,
actor_id BIGINT,
action VARCHAR(128),
resource_type VARCHAR(64),
resource_id BIGINT,
status VARCHAR(32),
timestamp TIMESTAMP DEFAULT NOW(),
trace_id UUID
);
10.5 配置文件示例(Configuration Reference)
server:
host: 0.0.0.0
port: 8080
log_level: info
enable_tls: true
database:
driver: postgres
dsn: postgres://user:pass@db:5432/deploylite?sslmode=disable
redis:
addr: redis:6379
db: 0
storage:
provider: s3
endpoint: http://minio:9000
access_key: minio
secret_key: minio123
bucket: deploylite-artifacts
security:
jwt_secret: "changeme"
admin_user: "admin"
admin_password: "admin123"
runner:
concurrency: 5
labels: ["docker", "x86_64"]
metrics:
enable: true
endpoint: /metrics
10.6 CLI 命令参考(DeployLite CLI)
| 命令 | 说明 |
|---|---|
dlctl init | 初始化配置 |
dlctl run | 手动触发构建 |
dlctl runner register | 注册 Runner |
dlctl pipeline list | 查看流水线 |
dlctl artifact ls | 查看制品 |
dlctl artifact download <id> | 下载文件 |
dlctl policy reload | 热加载策略 |
dlctl status | 查看系统状态 |
10.7 角色与权限表(RBAC Definition)
| 角色 | 权限 |
|---|---|
| Owner | 全权限、成员管理、策略修改 |
| Maintainer | 部署、审批、配置环境 |
| Developer | 构建、查看日志、上传制品 |
| Viewer | 只读访问 |
| Auditor | 审计日志查看权限 |
10.8 日志格式规范(Logging Format Specification)
{
"time": "2025-10-22T14:02:11Z",
"level": "info",
"module": "pipeline",
"trace_id": "a7c3e8c2",
"pipeline_id": 4021,
"message": "stage build completed in 42.3s",
"fields": {
"runner": "runner-01",
"status": "success"
}
}
日志级别定义
| 级别 | 用途 |
|---|---|
| TRACE | 详细调试信息 |
| DEBUG | 调试 |
| INFO | 常规运行信息 |
| WARN | 可恢复异常 |
| ERROR | 错误事件 |
| FATAL | 程序终止 |
10.9 部署模板示例(Deployment Template)
apiVersion: apps/v1
kind: Deployment
metadata:
name: app-deploylite
spec:
replicas: 3
selector:
matchLabels:
app: app-deploylite
template:
metadata:
labels:
app: app-deploylite
spec:
containers:
- name: app
image: registry.example.com/app:v1.0.0
ports:
- containerPort: 8080
envFrom:
- configMapRef:
name: app-config
10.10 Plugin Manifest 参考(Plugin Manifest)
name: notify-slack
version: 1.0.0
type: notify
entrypoint: "plugins/notify/slack/main.go"
inputs:
- name: webhook
type: string
- name: message
type: string
outputs:
- name: status
type: string
10.11 License(开源协议)
AGPL-3.0 License
Copyright (C) 2025 DeployLite
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License, version 3.
You must make the source code available to users who interact with it
over a network.
For commercial usage (SaaS or OEM), please contact: legal@deploylite.io
10.12 文档维护策略(Documentation Maintenance Plan)
- 版本控制: 所有 PRD 与文档存储在 Git 仓库
/docs/; - 变更日志: 每次发布更新
/CHANGELOG.md; - 自动生成: API 文档、CLI 文档通过 Swagger 与 Cobra 自动生成;
- 社区同步: 官方文档站(docs.deploylite.io)每日构建;
- 国际化: 提供中文 + 英文双语版本;
- 存档策略: 每季度打包归档 PDF + Markdown;
- 版本命名: 文档与代码版本同步(v1.0, v2.0, …)。
10.13 版本记录(Version History)
| 版本 | 日期 | 内容 |
|---|---|---|
| 0.1.0 | 2025-01 | MVP 架构与 CLI 原型 |
| 1.0.0 | 2025-05 | Beta 发布,支持多 Runner |
| 2.0.0 | 2025-10 | SaaS 多租户版发布 |
| 3.0.0 | 2026-05 | 智能部署 + 插件生态版 |
| 3.1.0 | 2026-12 | 企业旗舰版,全面监控 |
| 4.0.0 | 2027-06 | 自动化 AI 运维版 |
第十章总结:
本附录章节为整个产品提供了实施层的可操作依据与技术元数据定义。
包括:
- Schema、配置、模板、日志规范;
- 完整的 API / 数据结构;
- 法律与开源声明;
- 可追踪文档体系。
DeployLite 至此形成了一个完整的 从理念 → 架构 → 产品 → 工程 → 运营 → 生态 的闭环体系。
最终总结
DeployLite 的核心使命:
“让任何开发者都能一键完成从代码到上线的最后一公里。”
它是一套融合 轻量化、可扩展、安全可控、智能可演进 的现代化 CI/CD 平台,
未来可衍生成:
- 开源自托管版(DevOps 自用);
- SaaS 商业版(企业级多租户 CI/CD);
- AI 增强版(智能构建 + 异常预测 + 自动恢复)。
继续阅读
探索更多技术文章
浏览归档,发现更多关于系统设计、工具链和工程实践的内容。