-
Notifications
You must be signed in to change notification settings - Fork 8
[6주차] 박시현 / [Chore] CI/CD 구축 #95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
lilloo04
wants to merge
19
commits into
Leets-Official:박시현/main
Choose a base branch
from
lilloo04:박시현/week6
base: 박시현/main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
The head ref may contain hidden characters: "\uBC15\uC2DC\uD604/week6"
Conversation
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.
1. 무슨 이유로 코드를 변경했나요?
EC2에 Spring Boot 애플리케이션을 자동 배포할 수 있도록 하기 위해 GitHub Actions를 활용한 CI/CD 파이프라인을 구축했습니다. 수동으로 EC2에 접속하여 JAR을 빌드하고 Docker를 실행하던 과정을 자동화함으로써, 배포 안정성과 속도를 높이고자 했습니다.
deploy.yml GitHub Actions 워크플로를 작성하여 main 브랜치에 push 시 EC2로 코드 전송 및 Docker 컨테이너 재실행이 자동으로 되도록 설정했습니다.
application.properties 파일은 EC2 환경 변수(Secrets)를 기반으로 동적으로 생성되도록 처리하여, 민감 정보를 GitHub에 직접 올리지 않도록 했습니다.
2. 어떤 위험이나 장애를 발견했나요?
배포 자동화 과정에서 다양한 이슈가 발생했으며, 각각 다음과 같이 해결했습니다:
[초기 오류] Gradle 테스트 실패로 빌드 중단
[Docker 오류] JAR 파일 경로 오류로 이미지 빌드 실패
[EC2 파일 복사 실패] .scp 명령어가 빈 압축파일을 보내거나 디렉토리 경로 접근 권한 문제 발생
[환경 변수 미지정 오류] ${jwt.secret} 등의 값이 application.properties에 정의되지 않아 런타임 실패
해결: GitHub Secrets와 EC2 환경 변수를 활용해 application.properties를 배포 시점에 동적으로 생성
3. 관련 스크린샷을 첨부해주세요.