chore(ci): main 푸시 시 이미지 빌드 후 EC2 배포 자동화 #79 - #96
Open
tlgms wants to merge 1 commit into
Open
Conversation
기존 수동 이미지 빌드 워크플로를 배포까지 이어지는 CD 파이프라인으로 확장한다. - main 푸시와 workflow_dispatch에서 실행 - 롤백/추적을 위해 커밋 SHA 태그를 함께 푸시 - EC2에 SSH로 접속해 docker compose pull/up 후 /actuator/health 확인 - 접속 정보는 secrets/vars로 분리하고 미설정 시 deploy 잡을 건너뜀 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one) (1)
🚫 Excluded labels (none allowed) (2)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Team Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
kusuri12-09
approved these changes
Sep 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
deploy.yml,workflow_dispatch전용)를 빌드 → 푸시 → 배포 → 헬스체크로 이어지는 CD 파이프라인으로 확장합니다.main푸시 시 자동 실행되며, EC2에 SSH로 접속해docker compose pull && up -d후/actuator/health를 확인합니다.Related Issue
Important
#79 는 @wlyoon921 님께 할당되어 있습니다. 요청을 받아 먼저 초안을 올렸으니, 의도와 다른 부분이 있으면 편하게 되돌리거나 가져가주세요.
Scope
.github/workflows/deploy.yml1개 파일Change Type
접속 정보를 몰라 전부 미설정 상태로 두었습니다. 아래를 채워야 실제 배포가 동작합니다.
DEPLOY_HOSTS가 비어 있으면 deploy 잡을 통째로 건너뛰므로, 설정 전까지main푸시가 빨갛게 실패하지는 않습니다. (이미지 빌드/푸시는 설정 없이도 동작합니다.)Settings → Secrets and variables → Actions → Secrets
DEPLOY_SSH_KEYDEPLOY_KNOWN_HOSTSssh-keyscan <host>출력을 EC2 3대분 합친 값Settings → Secrets and variables → Actions → Variables
DEPLOY_HOSTS["10.0.1.10", "10.0.1.11", "10.0.1.12"]DEPLOY_USERubuntuDEPLOY_PATHdocker-compose.yml이 있는 디렉터리/opt/entrydsmHEALTHCHECK_URLhttp://localhost:8080/actuator/health설계 메모
EC2에서 재빌드하지 않고 GHCR 이미지를 pull 합니다.
#79 본문에는 "EC2에서 Docker 이미지를 다시 빌드"라고 되어 있지만, 이미
deploy.yml이 GHCR로 푸시하고docker-compose.yml이ghcr.io/entrydsm/entrydsm-*:latest를 참조하는 구조라 그대로 이었습니다. EC2에서 Bazel 모노레포를 빌드하면 시간과 메모리 부담이 큽니다. 의도가 달랐다면 알려주세요.커밋 SHA 태그를 함께 푸시합니다.
지금은
:latest만 올라가서 롤백도 추적도 불가능합니다.:<sha>를 추가해 특정 커밋으로 되돌릴 수 있게 했습니다. compose는 그대로:latest를 봅니다.헬스체크는 EC2 안에서 실행합니다.
러너에서 EC2로 직접 HTTP를 쏘면 보안 그룹을 열어야 하므로, SSH로 들어가
curl localhost:8080을 호출합니다. 컨테이너 기동을 기다리기 위해 5초 간격 30회(최대 150초) 재시도합니다.호스트 3대는 matrix로 병렬 처리하고
fail-fast: false입니다.한 대가 실패해도 나머지는 계속 진행합니다. 순차 배포(롤링)가 필요하면
max-parallel: 1을 추가하면 됩니다.Risk
Warning
이 워크플로의 deploy 잡은 한 번도 실행된 적이 없습니다. EC2와 시크릿에 접근할 수 없어 검증이 불가능했습니다. YAML 문법과 잡 구조만 확인한 상태이며, 첫 실행은 반드시
workflow_dispatch로 수동 실행해 확인해주세요./actuator/health노출 여부(전 서비스include: health,info+ probes 활성 확인)docker compose동작, 헬스체크 응답, 배포 경로그 외 짚어둘 점
main푸시 시 테스트를 다시 돌리지 않습니다. 브랜치 보호로 PR 단계에서 CI(chore(ci): PR 단위 Bazel 빌드/테스트 자동화 #93 #95)를 required check로 걸어두는 것을 전제로 합니다.:latest를 pull 하는 방식이라 배포 시점에 따라 이미지가 달라질 수 있습니다. 완전한 재현성이 필요하면docker-compose.yml을:${TAG:-latest}로 바꾸고 SHA를 넘기는 방식이 낫습니다. 지금은 범위 밖으로 두었습니다.Checklist
🤖 Generated with Claude Code