Skip to content

[이보라] Sprint11#161

Open
bobo-128 wants to merge 12 commits into
codeit-bootcamp-nodejs:이보라from
bobo-128:sprint11
Open

[이보라] Sprint11#161
bobo-128 wants to merge 12 commits into
codeit-bootcamp-nodejs:이보라from
bobo-128:sprint11

Conversation

@bobo-128
Copy link
Copy Markdown

요구사항

Github Actions 활용

  • 브랜치에 pull request가 발생하면 테스트를 실행하는 액션을 구현해 주세요.
  • main 브랜치에 push가 발생하면 AWS 배포를 진행하는 액션을 구현해 주세요.
  • 개인 Github 리포지터리에서 Actions 동작을 확인해 보세요.

Docker 이미지 만들기

다음을 만족하는 Dockerfile과 docker-compose.yaml을 작성해 주세요.

  • Express 서버를 실행하는 Dockerfile을 작성해 주세요.
  • Express 서버가 파일 업로드를 처리하는 폴더는 Docker의 Volume을 활용하도록 구현해 주세요.
  • 데이터베이스는 Postgres 이미지를 사용해 연결하도록 구현해 주세요.
  • 실행된 Express 서버 컨테이너는 호스트 머신에서 3000번 포트로 접근 가능하도록 구현해 주세요.

멘토에게

  • 셀프 코드 리뷰를 통해 질문 이어가겠습니다.

Copy link
Copy Markdown
Collaborator

@KWANHYEONGLEE KWANHYEONGLEE left a comment

Choose a reason for hiding this comment

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

로컬 개발 환경의 컨테이너화부터 CI/CD파이프라인까지 완수하시느라 정말 수고 많으셨습니다 👏
특히 작성하신 docker-compose 에서 healthcheck를 활용해 DB의 상태를 확인하고 서버를 띄우는 부분이 인상적이었습니다!
스프린트 미션 진행하시느라 정말 수고 많으셨습니다. LGTM 🍀

Comment thread docker-compose.yaml
Comment on lines +36 to +38
depends_on:
db:
condition: service_healthy # DB가 완전히 준비된 후 앱 실행
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

단순히 depends_on만 사용한것이 아니라 헬스체크까지 진행하신점 너무 좋습니다! 👍

Comment thread docker-compose.yaml

services:
db:
image: postgres:latest
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

최신 버전(latest)의 postgres 이미지를 이용하고 계시네요!
지금은 문제없이 잘 돌아갈 수 있으나 추후에 이미지 버전이 업데이트되었을 때 오류가 발생할 수 있습니다.
그렇기때문에 되도록이면 RDS의 postgresql 버전을 명시해서 작성해주시는게 좋습니다. (ex. postgres:15)

( pr-test.yaml 파일에서는 정확한 버전을 명시하셔서 잘 사용하고 계시네요!)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

넵!

Comment thread docker-compose.yaml
Comment on lines +29 to +33
environment:
- DATABASE_URL=${DATABASE_URL}
- JWT_ACCESS_TOKEN_SECRET=${JWT_ACCESS_TOKEN_SECRET}
- PORT=${PORT}
- NODE_ENV=${NODE_ENV}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

환경변수를 이용하여 진행하신 점 좋네요!!

Comment on lines +26 to +31
# DB가 준비될 때까지 기다리는 헬스 체크
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

👍👍👍👍

Comment on lines +37 to +50
script: |
cd ~/7-sprint-mission
git pull origin main

cd sprint11
npm install
npx prisma generate
npx prisma migrate deploy
npm run build

# PM2로 서버 재시작
pm2 reload all || pm2 start dist/main.js --name "my-app"

echo "배포가 완료되었습니다!"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

만약 새로운 폴더를 새로 만들어서 작업을 진행하게되면 (ex. sprint 12, sprint 13...)
작성하신 스크립트로는 새로운 코드가 서버에 적용되지 않을거같은데 어떻게 해결할 수 있을까요?? 🤔

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

새로운 폴더에 맞춰서 스크립트를 변경하면 되지 않을까요?!😭.. 현재는 새 미션마다 폴더를 새로 생성해서 작업중이라 저렇게 했었습니다! ㅠㅠ

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.

2 participants