Skip to content

[정수영] sprint11#220

Open
sooyoungbabo wants to merge 42 commits intocodeit-bootcamp-nodejs:정수영from
sooyoungbabo:정수영-sprint11

Hidden character warning

The head ref may contain hidden characters: "\uc815\uc218\uc601-sprint11"
Open

[정수영] sprint11#220
sooyoungbabo wants to merge 42 commits intocodeit-bootcamp-nodejs:정수영from
sooyoungbabo:정수영-sprint11

Conversation

@sooyoungbabo
Copy link
Collaborator

@sooyoungbabo sooyoungbabo commented Feb 15, 2026

미션 목표

  • GitHub Actions로 테스트, 배포 자동화
  • Docker 이미지 만들기

요구사항

GitHub Actions 활용:

/.github/workflows/test.yml, deploy_AWS.yml

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

Docker 이미지 만들기

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

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

제출

  • Github actions는 .github/workflows/ 폴더에 저장해서 제출
  • Docker 관련 파일들은 프로젝트 폴더 최상위에 저장

스크린샷

docker image list
image

docker container list
image

docker volume list
image

user3의 3번째 이미지 upload (REST Client)
image

docker volume 내 user3의 이미지 목록
image

멘토에게

  • 미션10에서 이미지 upload 저장을 AWS S3에 하도록 수정했는데, 이번 미션11에서는 docker volume에 저장해야 해서, NODE_ENV='production'이면 전자를, 'development'이면 후자를 하도록 분기하였습니다.
    • src/service/image.service.ts
    • src/storage/image.storage.ts

@sooyoungbabo sooyoungbabo self-assigned this Feb 15, 2026
@sooyoungbabo sooyoungbabo added the 매운맛🔥 뒤는 없습니다. 그냥 필터 없이 말해주세요. 책임은 제가 집니다. label Feb 15, 2026
Copy link
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 파이프라인 구축 미션 수행하시느라 고생 많으셨습니다! 🚀

이번 미션에서 가장 인상 깊었던 점은 메모리 부족이라는 제약 사항을 파악하고 무작정 빌드를 시도하기보다 로컬 빌드물을 활용하는 방향으로 전략을 세우신 점입니다. 실무에서도 인프라 비용과 자원은 늘 한정되어 있기에, 수영님처럼 문제 원인을 파악하고 대안을 찾는 능력이 매우 중요합니다.

스프린트 미션 진행하시느라 정말 수고 많으셨고 남은 연휴 잘 보내시길 바라겠습니다. LGTM 🍀

Comment on lines +17 to +18
postgres:
image: postgres:17 # PostgreSQL 15 버전 사용
Copy link
Collaborator

Choose a reason for hiding this comment

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

주석에는 15 버전을 사용한다고 적혀있는데 실제로는 17버전을 사용하고계시네요!
뭐가 맞는걸까요??

Comment on lines +32 to +49
env:
# PostgreSQL 연결 정보 (Prisma가 이 값을 사용하여 DB 접속)
DATABASE_URL: postgres://postgres:postgres@localhost:5432/testdb

# API 기본 주소 및 포트 (예: supertest 등에서 사용)
BASE_URL: http://localhost:3000
PORT: 3000
NODE_ENV: test

# JWT 서명을 위한 시크릿 키 (테스트용 더미 값)
JWT_ACCESS_TOKEN_SECRET: your-secret-key
JWT_REFRESH_TOKEN_SECRET: your-refresh-secret-key

# AWS 관련 설정 - 실제 AWS 리소스를 사용하는 경우에는 Secrets로 값 주입 필요
AWS_REGION: ap-northeast-2
AWS_ACCESS_KEY_ID: aws-access-key # 실제 키를 넣으면 안 됨 (테스트용 더미 값)
AWS_SECRET_ACCESS_KEY: aws-secret-access-key # 실제 키를 넣으면 안 됨
AWS_BUCKET_NAME: panda-market
Copy link
Collaborator

Choose a reason for hiding this comment

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

secrets 값을 직접 주입하지않고 env섹션에서 한 번 정의해서 사용하셨네요! 좋습니다

Comment on lines +20 to +27
script: |
cd /6-sprint-mission # EC2 인스턴스 내 프로젝트 경로로 진입
git pull origin 정수영-sprint11 # 코드 최신화
npm ci --omit=dev
# npm run build # EC2 메모리 부족으로 로컬에서 build한 것 사용
npm run prisma:deploy # 예: prisma migrate deploy로 마이그레이션 적용하기
pm2 reload mission11 # PM2로 재실행
echo "Deployment successful!"
Copy link
Collaborator

Choose a reason for hiding this comment

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

지금도 충분히 잘 작성하셨지만 pm2 reload 부분에서 발생할 수 있는 예외 상황을 고려해보면 더 좋은 스크립트가 될 것 같습니다.

PM2 프로세스 부재 시 에러 처리

작성하신 pm2 reload mission11 명령은 현재 mission11이라는 이름으로 돌아가고 있는 프로세스가 없을 경우 에러를 발생시키며 전체 배포 프로세스를 멈추게 합니다. 처음 배포하거나 프로세스가 죽어있을때를 대비하여 아래와 같이 개선해보시면 좋을거같습니다.

pm2 reload mission11 || pm2 start dist/main.js --name mission11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

매운맛🔥 뒤는 없습니다. 그냥 필터 없이 말해주세요. 책임은 제가 집니다.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants