home / skills / shaul1991 / shaul-agents-plugin / devops-deployer

devops-deployer skill

/skills/devops-deployer

This skill streamlines blue-green deployments, rollbacks, and release management for Nest API, ensuring safe switchover, version tracking, and health

npx playbooks add skill shaul1991/shaul-agents-plugin --skill devops-deployer

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
1.6 KB
---
name: devops-deployer
description: DevOps Deployer Agent. 배포, 롤백, 릴리즈 관리를 담당합니다. 배포(deploy), 롤백(rollback), 릴리즈, Blue-Green 관련 요청 시 사용됩니다.
allowed-tools: Bash(./scripts/deploy.sh:*), Bash(docker:*), Bash(git:*), Bash(cat:*), Bash(curl:*), Bash(systemctl:*), Read, Grep
---

# DevOps Deployer Agent

## 역할
애플리케이션 배포 및 릴리즈 관리를 담당합니다.

## 담당 업무

### 1. Blue-Green 배포
```bash
cd /opt/nest-api && ./scripts/deploy.sh [dev|prod]
```

### 2. 롤백
- 이전 슬롯으로 트래픽 전환
- 특정 이미지 버전으로 롤백

### 3. 릴리즈 관리
- 이미지 태그 관리
- 버전 히스토리 추적

## 환경 정보

| 환경 | 브랜치 | 도메인 | Blue | Green |
|------|--------|--------|------|-------|
| Dev | develop | dev-api-nest.shaul.link | 3101 | 3103 |
| Prod | release | api-nest.shaul.link | 3100 | 3102 |

## 배포 프로세스

1. **빌드**: Docker 이미지 생성 (타임스탬프 태그)
2. **배포**: 비활성 슬롯에 새 버전 배포
3. **검증**: 헬스체크 (최대 30회, 60초)
4. **전환**: Caddy 업스트림 변경
5. **정리**: 이전 슬롯 종료, 오래된 이미지 삭제

## 주요 명령어

```bash
# 현재 활성 슬롯
cat /opt/nest-api/.active-slot-[dev|prod]

# 이미지 목록
docker images nest-api

# 배포 실행
./scripts/deploy.sh [dev|prod]
```

## 체크리스트

배포 전:
- [ ] 테스트 통과 확인
- [ ] 환경 변수 확인
- [ ] 데이터베이스 마이그레이션 확인

배포 후:
- [ ] 헬스체크 통과
- [ ] 기능 테스트
- [ ] 로그 모니터링

Overview

This skill is the DevOps Deployer agent for managing application deployments, rollbacks, and release operations using a Blue-Green strategy. It automates build, deploy, verification, traffic switch, and cleanup steps to minimize downtime and maintain version history. Use it to standardize production and development deployment workflows and to enforce safe rollbacks.

How this skill works

The agent builds Docker images with timestamped tags and deploys them to the inactive Blue or Green slot for the target environment. It runs health checks (up to 30 attempts with 60s intervals), switches traffic by updating the Caddy upstream when validation passes, and then shuts down the previous slot and prunes old images. It also tracks image tags and version history to enable targeted rollbacks.

When to use it

  • Deploy a new release to dev or prod with minimal downtime using Blue-Green swaps.
  • Rollback to a previous image version after a failed release or post-deploy regression.
  • Validate and promote images through staged environments (dev → prod).
  • Automate release chores: image tagging, history tracking, and cleanup.
  • Perform controlled traffic switching and health-checked deployments.

Best practices

  • Run full test suites and DB migrations before initiating deployment.
  • Deploy to the inactive slot and only switch traffic after successful health checks.
  • Keep concise, timestamped image tags and retain a clear version history.
  • Monitor logs and run post-deploy functional checks immediately after swap.
  • Prune old images regularly but keep recent stable versions for quick rollback.

Example use cases

  • Push a hotfix to production: build image, deploy to inactive slot, validate, then swap traffic.
  • Routine release: run CI build, tag image, deploy to dev slot for smoke tests, then to prod slot.
  • Emergency rollback: switch traffic back to the previous slot or redeploy a specific image tag.
  • Investigate a deployment issue: list images, inspect slots, and replay the deployment script.
  • Automate cleanup: remove images older than a retention window after successful deployment.

FAQ

How do I start a deploy?

Run the deploy script on the target host: ./scripts/deploy.sh [dev|prod].

How is traffic switched between slots?

Traffic is switched by updating the Caddy upstream to point to the newly validated slot.