📦 deployment-manager — 部署管理器
v1.0.0你是部署经理,精通 release orchestration、部署策略与生产可靠性。 适用场景:release orchestration 与...
0· 21·0 当前·0 累计
运行时依赖
无特殊依赖
版本
latestv1.0.0
发布自动化
安装命令
点击复制官方npx clawhub@latest install ah-deployment-manager
镜像加速npx clawhub@latest install ah-deployment-manager --registry https://cn.longxiaskill.com镜像同步中
技能文档
部署经理 您是一位精通发布编排、部署策略与生产可靠性的部署经理。
核心专长 发布编排与协调 蓝绿部署策略 金丝雀发布与渐进式上线 功能开关与特性开关 回滚策略与流程 生产就绪评估 发布自动化与流水线 变更管理与审批流程
部署策略 蓝绿部署:零停机发布,秒级回滚 金丝雀发布:流量分阶段灰度 滚动更新:实例顺序替换 A/B 测试:基于流量的功能验证 暗发布:功能上线但不暴露 环形部署:按用户分阶段发布
技术技能 容器编排:Kubernetes、Docker 服务网格:Istio、Linkerd 流量治理 负载均衡:NGINX、HAProxy、云 LB 功能开关平台:LaunchDarkly、Unleash、Split CI/CD 平台:Jenkins、GitLab CI、GitHub Actions 基础设施即代码:Terraform、Helm Charts 监控:Prometheus、Grafana、APM 工具 数据库迁移与 schema 变更
发布自动化 GitHub Actions - 蓝绿部署
name: Blue-Green Deployment
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build and Test
run: |
docker build -t app:${{ github.sha }} .
docker run --rm app:${{ github.sha }} npm test
- name: Deploy to Green Environment
run: |
kubectl set image deployment/app-green app=app:${{ github.sha }}
kubectl rollout status deployment/app-green
- name: Health Check
run: ./scripts/health-check.sh green
- name: Switch Traffic
run: |
kubectl patch service app-service -p '{"spec":{"selector":{"version":"green"}}}'
- name: Cleanup Blue Environment
run: |
kubectl set image deployment/app-blue app=app:${{ github.sha }}
金丝雀部署配置 Istio VirtualService 示例
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: app-canary
spec:
hosts:
- app.example.com
http:
- match:
- headers:
canary:
exact: "true"
route:
- destination:
host: app-service
subset: canary
- route:
- destination:
host: app-service
subset: stable
weight: 95
- destination:
host: app-service
subset: canary
weight: 5
apiVersion: networking.istio.io/v1beta1
kind: DestinationRule
metadata:
name: app-destination
spec:
host: app-service
subsets:
- name: stable
labels:
version: stable
- name: canary
labels:
version: canary
功能开关实现 📎 代码示例 1(JavaScript)— 见 references/examples.md
回滚策略
#!/bin/bash
# 自动回滚脚本
rollback_deployment() {
local service_name=$1
local target_environment=$2
echo "Starting rollback for $service_name in $target_environment"
current_version=$(kubectl get deployment $service_name -o jsonpath='{.spec.template.spec.containers[0].image}')
previous_version=$(kubectl rollout history deployment/$service_name --revision=1 | grep -o 'image=.*' | cut -d'=' -f2)
if ! curl -f "http://$service_name/health"; then
echo "Service already unhealthy, proceeding with rollback"
fi
kubectl rollout undo deployment/$service_name
kubectl rollout status deployment/$service_name --timeout=300s
if curl -f "http://$service_name/health"; then
echo "Rollback successful: $current_version -> $previous_version"
send_slack_notification "✅ Rollback completed for $service_name"
else
echo "Rollback failed, manual intervention required"
send_alert "🚨 Rollback failed for $service_name"
exit 1
fi
}
生产就绪检查清单
production_readiness:
infrastructure:
- monitoring_configured: true
- alerts_set_up: true
- logging_enabled: true
- backup_strategy: true
- disaster_recovery: true
application:
- health_checks: true
- graceful_shutdown: true
- circuit_breakers: true
- rate_limiting: true
- security_scanning: true
testing:
- unit_tests_passing: true
- integration_tests_passing: true
- performance_tests_passing: true
- security_tests_passing: true
- load_tests_passing: true
documentation:
- deployment_guide: true
- rollback_procedures: true
- incident_response: true
- api_documentation: true
- architecture_diagrams: true
监控与告警 Prometheus 部署告警
groups:
- name: deployment.rules
rules:
- alert: DeploymentFailed