blue-green-deployment by aj-geddes/useful-ai-prompts
npx skills add https://github.com/aj-geddes/useful-ai-prompts --skill blue-green-deployment使用蓝绿部署模式部署应用程序,以维护两个相同的生产环境,从而实现即时流量切换和快速回滚能力。
最小工作示例:
# blue-green-setup.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: blue-green-config
namespace: production
data:
switch-traffic.sh: |
#!/bin/bash
set -euo pipefail
CURRENT_ACTIVE="${1:-blue}"
TARGET="${2:-green}"
ALB_ARN="arn:aws:elasticloadbalancing:us-east-1:123456789012:loadbalancer/app/myapp-alb/1234567890abcdef"
echo "Switching traffic from $CURRENT_ACTIVE to $TARGET..."
# Get target group ARNs
BLUE_TG=$(aws elbv2 describe-target-groups \
--load-balancer-arn "$ALB_ARN" \
--query "TargetGroups[?Tags[?Key=='Name' && Value=='blue']].TargetGroupArn" \
--output text)
GREEN_TG=$(aws elbv2 describe-target-groups \
--load-balancer-arn "$ALB_ARN" \
// ... (完整实现请参阅参考指南)
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
references/ 目录中的详细实现:
| 指南 | 内容 |
|---|---|
| 使用负载均衡器的蓝绿部署 | 使用负载均衡器的蓝绿部署 |
| 蓝绿部署回滚脚本 | 蓝绿部署回滚脚本 |
| 监控与验证 | 监控与验证 |
每周安装量
108
代码仓库
GitHub 星标数
126
首次出现
2026年1月21日
安全审计
安装于
opencode91
gemini-cli90
codex87
claude-code83
cursor82
github-copilot75
Deploy applications using blue-green deployment patterns to maintain two identical production environments, enabling instant traffic switching and rapid rollback capabilities.
Minimal working example:
# blue-green-setup.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: blue-green-config
namespace: production
data:
switch-traffic.sh: |
#!/bin/bash
set -euo pipefail
CURRENT_ACTIVE="${1:-blue}"
TARGET="${2:-green}"
ALB_ARN="arn:aws:elasticloadbalancing:us-east-1:123456789012:loadbalancer/app/myapp-alb/1234567890abcdef"
echo "Switching traffic from $CURRENT_ACTIVE to $TARGET..."
# Get target group ARNs
BLUE_TG=$(aws elbv2 describe-target-groups \
--load-balancer-arn "$ALB_ARN" \
--query "TargetGroups[?Tags[?Key=='Name' && Value=='blue']].TargetGroupArn" \
--output text)
GREEN_TG=$(aws elbv2 describe-target-groups \
--load-balancer-arn "$ALB_ARN" \
// ... (see reference guides for full implementation)
Detailed implementations in the references/ directory:
| Guide | Contents |
|---|---|
| Blue-Green with Load Balancer | Blue-Green with Load Balancer |
| Blue-Green Rollback Script | Blue-Green Rollback Script |
| Monitoring and Validation | Monitoring and Validation |
Weekly Installs
108
Repository
GitHub Stars
126
First Seen
Jan 21, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode91
gemini-cli90
codex87
claude-code83
cursor82
github-copilot75