deployment-patterns
Official部署工作流、CI/CD流水线模式、Docker容器化、健康检查、回滚策略以及Web应用程序的生产就绪检查清单。
What this skill does
When applied, it prepends a system prompt before your request is sent — no extra calls and no change to how you are billed beyond the added tokens.
--- name: deployment-patterns description: 部署工作流、CI/CD流水线模式、Docker容器化、健康检查、回滚策略以及Web应用程序的生产就绪检查清单。 origin: ECC --- # 部署模式 生产环境部署工作流和 CI/CD 最佳实践。 ## 何时启用 * 设置 CI/CD 流水线时 * 将应用容器化(Docker)时 * 规划部署策略(蓝绿、金丝雀、滚动)时 * 实现健康检查和就绪探针时 * 准备生产发布时 * 配置环境特定设置时 ## 部署策略 ### 滚动部署(默认) 逐步替换实例——在发布过程中,新旧版本同时运行。 ``` 实例 1: v1 → v2 (首次更新) 实例 2: v1 (仍在运行 v1) 实例 3: v1 (仍在运行 v1) 实例 1: v2 实例 2: v1 → v2 (第二次更新) 实例 3: v1 实例 1: v2 实例 2: v2 实例 3: v1 → v2 (最后更新) ``` **优点:** 零停机时间,渐进式发布 **缺点:** 两个版本同时运行——需要向后兼容的更改 **适用场景:** 标准部署,向后兼容的更改 ### 蓝绿部署 运行两个相同的环境。原子化地切换流量。 ``` Blue (v1) ← 流量 Green (v2) 空闲,运行新版本 # 验证后: Blue (v1) 空闲(转为备用状态) Green (v2) ← 流量 ``` **优点:** 即时回滚(切换回蓝色环境),切换干净利落 **缺点:** 部署期间需要双倍的基础设施 **适用场景:** 关键服务,对问题零容忍 ### 金丝雀部署 首先将一小部分流量路由到新版本。 ``` v1:95% 的流量 v2:5% 的流量(金丝雀) # 如果指标表现良好: v1:50% 的流量 v2:50% 的流量 # 最终: v2:100% 的流量 ``` **优点:** 在全量发布前,通过真实流量发现问题 **缺点:** 需要流量分割基础设施和监控 **适用场景:** 高流量服务,风险性更改,功能标志 ## Docker ### 多阶段 Dockerfile (Node.js) ```dockerfile # Stage 1: Install dependencies FROM node:22-alpine AS deps WORKDIR /app COPY package.json package-lock.json ./ RUN npm ci --production=false # Stage 2: Build FROM node:22-alpine AS builder WORKDIR /app COPY --from=deps /app/node_modules ./node_modules COPY . . RUN npm run build RUN npm prune --production # Stage 3: Production image FROM node:22-alpine AS runner WORKDIR /app RUN addgroup -g 1001 -S appgroup && adduser -S appuser -u 1001 USER appuser COPY --from=builder --chown=appuser:appgroup /app/node_modules ./node_modules COPY --from=builder --chown=appuser:appgroup /app/dist ./dist COPY --from=builder --chown=appuser:appgroup /app/package.json ./ ENV NODE_ENV=production EXPOSE 3000 HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ CMD wget --no-verbose --tries=1 --spider http://localhost:3000/health || exit 1 CMD ["node", "dist/server.js"] ``` ### 多阶段 Dockerfile (Go) ```dockerfile FROM golang:1.22-alpine AS builder WORKDIR /app COPY go.mod go.sum ./ RUN go mod d
Use this skill
Add a "skill" field with the skill’s ID to your chat completion request. It is applied server-side before your prompt is sent — no extra calls.
{
"model": "gpt-4o-mini",
"skill": "imp-b6ceb56d-78fe-497a-8e87-e4ba476bf74f",
"messages": [{ "role": "user", "content": "…" }]
}Install the skill, enable it in your dashboard and (optionally) limit it to specific models. It then applies automatically to every matching request — with no "skill" field to send each time.
Set it up in your dashboardMore skills
Delegate coding work to Codex, Claude Code, or OpenCode as background workers; not simple edits or read-only code lookup.
Create, edit, audit, tidy, validate, or restructure AgentSkills and SKILL.md files.
Search and analyze your own session logs (older/parent conversations) using jq.
Create, view, edit, delete, search, move, or export Apple Notes via the memo CLI on macOS.
Diagnose OpenClaw Android, iOS, or macOS node pairing, QR/setup code, route, auth, and connection failures.
Set up and use 1Password CLI for sign-in, desktop integration, and reading or injecting secrets.
List, add, edit, complete, or delete Apple Reminders and reminder lists via remindctl.
Create, search, and manage Bear notes via grizzly CLI.