Skip to content

Chore(#80): develop 브랜치 기반 AWS EC2 통합 CD 구축 - #83

Merged
pearseona merged 2 commits into
developfrom
chore/80-be-cd
Aug 8, 2026
Merged

Chore(#80): develop 브랜치 기반 AWS EC2 통합 CD 구축#83
pearseona merged 2 commits into
developfrom
chore/80-be-cd

Conversation

@pearseona

@pearseona pearseona commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

📋 작업 내용

  • develop 브랜치의 Backend CI 성공 후 실행되는 CD 워크플로를 추가했습니다.
  • GitHub OIDC와 AWS SSM Run Command를 이용해 운영 EC2에 배포하도록 구성했습니다.
  • EC2에서 Backend 이미지만 빌드하고 spring-backend 컨테이너만 교체하도록 구현했습니다.
  • Actuator 헬스체크, 실패 시 이전 버전 롤백, BE·AI 공용 배포 잠금을 적용했습니다.
  • PostgreSQL, RabbitMQ, Redis, FastAPI AI 컨테이너이 배포 중 교체되지 않았는지 검증합니다.

🧪 테스트 결과

  • ./gradlew test --no-daemon 통과
  • docker compose --env-file .env.example config --quiet 통과
  • bash -n scripts/deploy-backend.sh 통과
  • git diff --check 통과

🔗 관련 이슈

✅ 체크리스트

  • 관련 이슈를 연결했습니다.
  • 구현 범위와 변경 이유를 설명했습니다.
  • 로컬 테스트를 통과했습니다.
  • API 변경 사항을 Swagger에 반영했습니다.
  • DB 변경 사항과 마이그레이션을 포함했습니다.
  • 민감 정보가 코드·로그·테스트 데이터에 포함되지 않았습니다.
  • 프론트엔드에 영향을 주는 응답 스키마 또는 Enum 변경을 공유했습니다.
  • 병합 전 작업 브랜치를 삭제하지 않았습니다.

Summary by CodeRabbit

  • Chores
    • Added automated backend deployments following successful development-branch checks.
    • Improved deployment reliability with configuration validation, health monitoring, and serialized releases.
    • Added safeguards to prevent incomplete deployments and automatically restore the previous working version when deployment issues occur.
    • Backend services now verify dependency stability during updates, helping maintain availability and reduce disruption.

@pearseona pearseona self-assigned this Aug 8, 2026
@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@pearseona, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 51 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 7f3d0d7f-5ee5-4b01-8074-435557605c84

📥 Commits

Reviewing files that changed from the base of the PR and between 699a9c4 and 2434659.

📒 Files selected for processing (2)
  • .github/workflows/backend-cd.yml
  • scripts/deploy-backend.sh
📝 Walkthrough

Walkthrough

The pull request adds a GitHub Actions backend deployment workflow. It uses AWS OIDC and SSM to run a deployment script on EC2. The script validates the target commit, replaces only the backend, checks health and dependency containers, and rolls back failed deployments.

Changes

Backend deployment

Layer / File(s) Summary
CI-triggered deployment orchestration
.github/workflows/backend-cd.yml
The workflow runs after successful develop CI pushes, configures AWS credentials through OIDC, sends the commit SHA through SSM, and fails when the remote command does not succeed.
Deployment preconditions and target selection
scripts/deploy-backend.sh
The script validates the SHA, locks deployments, rejects dirty repositories, records rollback metadata, and fast-forwards develop to the requested commit.
Backend-only replacement and health validation
scripts/deploy-backend.sh
The script validates Compose and dependency containers, rebuilds only the Spring backend, starts it without dependencies, and checks actuator health.
Failure rollback and dependency preservation
scripts/deploy-backend.sh
The script restores the previous commit and image after failure, verifies rollback health, and rejects deployments that recreate dependency containers.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant GitHubActions
  participant AWS
  participant EC2
  participant DeployScript
  GitHubActions->>AWS: Configure OIDC credentials
  GitHubActions->>AWS: Send commit SHA through SSM
  AWS->>EC2: Execute deployment command
  EC2->>DeployScript: Run backend deployment
  DeployScript->>DeployScript: Validate, deploy, and health-check backend
  DeployScript-->>AWS: Return command status and output
  AWS-->>GitHubActions: Provide final deployment status
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: establishing AWS EC2 continuous deployment based on the develop branch.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/80-be-cd

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/backend-cd.yml:
- Around line 63-66: Replace the aws ssm wait command-executed invocation and
its || true in the deployment polling flow with explicit polling of the command
status for the full 1,500-second execution window. Continue polling non-terminal
states, exit on Success, and fail immediately on Cancelled, Failed, or TimedOut
so later steps cannot proceed after an unsuccessful deployment.

In `@scripts/deploy-backend.sh`:
- Line 35: Update the deployment flow so it checks out develop before assigning
PREVIOUS_SHA via git rev-parse HEAD. Keep the rollback state capture after
checkout, ensuring PREVIOUS_SHA always records the current develop commit.
- Around line 103-109: Update both health-check sites in
scripts/deploy-backend.sh: lines 103-109 after rollback starts the container and
lines 193-199 after deployment starts it. Derive the Compose-published backend
port from the running container/configuration instead of hardcoding 8080, and
use that port in each health-check URL so both checks honor SPRING_PORT.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 95df7b77-3dba-424a-8e3d-00cf309734a2

📥 Commits

Reviewing files that changed from the base of the PR and between 4564984 and 699a9c4.

📒 Files selected for processing (2)
  • .github/workflows/backend-cd.yml
  • scripts/deploy-backend.sh

Comment thread .github/workflows/backend-cd.yml Outdated
Comment thread scripts/deploy-backend.sh
Comment thread scripts/deploy-backend.sh Outdated
@pearseona
pearseona merged commit dcf0918 into develop Aug 8, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant