Skip to content

Conversation

@katejhee
Copy link
Collaborator

@katejhee katejhee commented Jul 1, 2025

✅ 체크리스트: CICD 구축 및 자동 배포 설정
• CI/CD 워크플로우 구성
• GitHub Actions를 사용하여 dev 브랜치에 push / PR 시 자동으로 빌드 및 배포되도록 설정
• dev.build.yml 및 dev.deploy.yml 생성
• Docker 기반 빌드 및 이미지 푸시
• Gradle 빌드 후 Docker 이미지 생성
• Docker Hub로 이미지 푸시 (katekwak/bookmark-app:latest)
• EC2 서버 자동 배포 설정
• Docker Hub에서 이미지 pull 후 컨테이너 실행
• .env 파일을 통한 환경변수 주입
• 기존 컨테이너 중지 및 제거 후 재실행 처리 포함
• Gradle 캐시 설정
• GitHub Actions에서 빌드 속도 향상을 위한 Gradle 캐시 설정
• .env 환경변수 구성 및 외부화
• RDS(MySQL) 접속을 위한 환경변수 설정 (DB_URL, DB_USERNAME, DB_PASSWORD)
• .env는 Git에 커밋되지 않도록 설정
• EC2 서버 timezone 설정 (Asia/Seoul)
• HTTPS 서빙을 위한 Caddy 설정
• Caddy 설치 및 HTTP → HTTPS 자동 리디렉션 구성 완료
• 코드 풀 기반 배포 제거
• EC2 서버에서 git pull 방식 제거하고, 오직 Docker Hub 이미지 기반 배포로 전환

@katejhee katejhee requested review from choes0101, jj0526 and seola12e July 1, 2025 18:23
Copy link
Collaborator

@choes0101 choes0101 left a comment

Choose a reason for hiding this comment

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

작업 잘 해주셨습니다. 코멘트 남겨두었으니, 확인하시고 변경 부탁드립니다!

.env Outdated
Comment on lines 1 to 3
DB_URL=jdbc:mysql://bookmark-db.cpcgeg8icg9s.ap-southeast-2.rds.amazonaws.com:3306/bookmark
DB_USERNAME=admin
DB_PASSWORD=bookmark12
Copy link
Collaborator

Choose a reason for hiding this comment

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

.env 파일은 Git에 커밋되지 않는 게 좋습니다!
보통 환경변수에는 민감한 내용이 포함될 수 있어서, .gitignore에 추가하고 Git 기록에서 제거해두면 더 안전할 것 같아요.
이미 커밋된 상태라서 비밀번호도 한 번 변경해두면 좋을 것 같습니다!
작업 잘 해주셔서 감사합니다 :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

.gitignore 로 옮기고 비밀번호도 한 번 변경해두었습니다!

Copy link
Collaborator

@seola12e seola12e left a comment

Choose a reason for hiding this comment

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

민감한 정보 secrets로 빼신 거랑, .env 파일 내리고 .gitignore에 추가한 것 좋은 것 같습니다!
작업하시느라 수고하셨습니다!

Copy link
Collaborator

@jj0526 jj0526 left a comment

Choose a reason for hiding this comment

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

처음 맡으셔서 어려우셨을텐데 수고하셨어요 몇가지 코멘트 남겼습니다~

아, 그리고 이슈랑 PR 제목, 내용 모두 컨벤션과 템플릿 보고 수정 부탁드려요!

on:
push:
branches: [ dev ]
pull_request:
Copy link
Collaborator

Choose a reason for hiding this comment

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

PR 단계에서 바로 배포되면 위험해요

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

on:
push:
branches: [ dev ]
pull_request:
branches: [ dev ]
여기서
on:
push:
branches: [ dev ]
이렇게 pull_request를 없애면 될까요?

@@ -0,0 +1,28 @@
name: Deploy to EC2
Copy link
Collaborator

Choose a reason for hiding this comment

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

배포는 build가 확실히 완료된 이후에 진행되어야하는데 확인 부탁드려요

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

제 코드에서 deploy 부분에 needs:build만 추가하면 문제 없을까요?

@@ -0,0 +1,48 @@
name: Build and Push to DockerHub
Copy link
Collaborator

Choose a reason for hiding this comment

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

파일 이름을 build-dev.yml같은 형식으로 해주는게 한눈에 보기 편해보여요

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

넵 수정하겠습니다.

Copy link
Collaborator

@jj0526 jj0526 Jul 4, 2025

Choose a reason for hiding this comment

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

수정된 사항이 없는데 위 작성해주신 코멘트들을 먼저 반영하신 뒤에 리뷰를 다시 요청해주시면 더 좋을 것 같습니다!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

수정했는데 아직 안올렸어요! 위에 말씀하심 부분들에 대해서 확실해지고 한번혹은 두번안에 커밋하겠습니당

import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloController {
Copy link
Collaborator

Choose a reason for hiding this comment

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

해당 컨트롤러는 삭제 부탁드려요

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

배포 확인전 확인해보려고 만든건데 잘 작동하는 것을 확인했어요! 그러면 삭제해도 되는것일까요?

Copy link
Collaborator

Choose a reason for hiding this comment

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

네~ 해당 컨트롤러는 서비스에 필요하지 않아서 삭제해야돼요

나와야 Outdated
Copy link
Collaborator

Choose a reason for hiding this comment

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

지금 확인했는데 해당 파일은 무슨용도인가요?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

어라 저도 지금 봐서 다시 확인하겠습니다

Copy link
Collaborator

@jj0526 jj0526 left a comment

Choose a reason for hiding this comment

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

코멘트 확인 부탁드려요

.env Outdated
@@ -0,0 +1,3 @@
DB_URL=jdbc:mysql://bookmark-db.cpcgeg8icg9s.ap-southeast-2.rds.amazonaws.com:3306/bookmark
DB_USERNAME=admin
DB_PASSWORD=bookmarkbe1
Copy link
Collaborator

Choose a reason for hiding this comment

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

해당 내용들은 커밋되면 안돼요 해킹되면 과금될수도 있어요 ㅠㅠ

Copy link
Collaborator

@jj0526 jj0526 left a comment

Choose a reason for hiding this comment

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

위에 나눴던 내용중 여러개가 반영이 안된거같아요 확인 부탁해요
그리고 커밋메세지도 다 바꿔주세요

Copy link
Collaborator

@jj0526 jj0526 left a comment

Choose a reason for hiding this comment

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

제가 남긴 내용 아니여도 다시 한번 찾아보고 고쳐주세요~ 제가 놓친게 있을수 있어요
그리고 커밋 메세지 전체랑 PR 템플릿 등등 컨벤션에 따라 부탁해요

Copy link
Collaborator

Choose a reason for hiding this comment

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

어떤걸 수정하셨나요?


jobs:
deploy:
needs: build
Copy link
Collaborator

@jj0526 jj0526 Jul 4, 2025

Choose a reason for hiding this comment

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

job 이름이 필요한지 아니면 워크플로우 이름이 필요한지 한번 확인 부탁해요 저도 확실하지가 않아요

username: ${{ secrets.EC2_USER }}
key: ${{ secrets.EC2_KEY }}
script: |
sudo timedatectl set-timezone Asia/Seoul
Copy link
Collaborator

Choose a reason for hiding this comment

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

이 부분은 서버 시간을 배포할때마다 바꾸는거라 확인 부탁드려요

Copy link
Collaborator

@jj0526 jj0526 left a comment

Choose a reason for hiding this comment

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

커밋메세지랑 pr 템플릿 같은 부분들 컨벤션 보고 수정 부탁해요

Copy link
Collaborator

@jj0526 jj0526 left a comment

Choose a reason for hiding this comment

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

pr 템플릿이랑 커밋메세지 등 컨벤션 확인 부탁하고 수정부탁해요

@katejhee katejhee added the Feat New feature or request label Jul 7, 2025
@katejhee katejhee changed the title Chore #1 CICD 구축 Feat #1 CICD 구축 Jul 7, 2025
@katejhee katejhee added Chore Routine tasks or maintenance that do not modify application behavior and removed Feat New feature or request labels Jul 7, 2025
@katejhee katejhee changed the title Feat #1 CICD 구축 Chore #1 CICD 구축 Jul 7, 2025
@katejhee katejhee closed this Jul 7, 2025
@jj0526 jj0526 assigned jj0526 and katejhee and unassigned jj0526 Jul 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Chore Routine tasks or maintenance that do not modify application behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants