aws 4

[NestJs] logger + cloudwacth 연동하기

회사에서 실시간 로그 관련해서 작업을 하게 되었다. 기존 API에 로그 쌓는 것이 없었던 것... 충격!!! sentry와 연동 하기 위해서 결제 및 승인을 받아야해서... 먼저 이미 쓰고 있는 cloudwatch에 로그를 연동하려고 작업 했다. NestJS app.module.ts에서 onModuleInit (모듈의 종속성 처리 후 호출 되게 된다.) 참고 https://docs.nestjs.com/fundamentals/lifecycle-events Documentation | NestJS - A progressive Node.js framework Nest is a framework for building efficient, scalable Node.js server-side applications..

[Git Action][Docker][CD/CI][GitFlow] 구축

1. Docker Docker Build ########################################################1 # 1. 기본 이미지로 먼저 빌드를 한다. From node:16 AS builder WORKDIR /app COPY . . # 패키지를 복사한다. COPY package*.json ./ # npm 인스톨시 종속성 관련되서, force는 충돌을 우회, --legacy-peer-deps 충돌을 무시 RUN npm install --force RUN npm install rimraf -g RUN npm install -g @nestjs/cli RUN npm install bcrypt --force #build 전에 eslint, tsc확인 RUN npm run bu..

[API Logger][Cloudwatch 연동]

1. 현재 Logger 관련 구성 체크 common/middlewares/logger.middleware 존재 use(req: Request, res: Response, next: NextFunction) { res.on('finish', () => { this.logger.log( `${req.ip}, ${req.originalUrl}, ${req.method}, ${res.statusCode}`, ); }); next(); } 2. Cloud Watch 와 API Logger 구성에 대한 고찰 현재 미들웨어에서 구성을 하려고 작업 진행중 - 현재 시스템에서 많은 변화를 주는 건 부담이 될듯하여, 기존 미들웨어에서 cloudwatch로 Log 보내느 것을 구현하려고함. custom Log 기준 debu..

[AWS][Emailer] 회원 Email 전송 MSA 작업

1. Architecture 2. 실제 구현 단계 Lambda SQS : babayoEmailSQS.fifo babayo-email-dev 해당 람다는 API GATEWAY와 SQS의 통신을 위한 중간다리 역할 babayo-sqs-email-dev-handler 해당 람다는 SQS를 구독하고 있고, 메세지가 들어오면 요청에 해당되는 함수로 연결. 기존 mailer를 사용하는 Controller는 총 6가지로 * POST /user/signUp -> 회원가입 후 환영 메일 * POST /user/sendRegEmail -> 회원가입시 인증코드 메일 * POST /user/authMailing/:uid -> 이메일 재인증 메일 * POST /user/resetPasswordEmail -> rePwEmail ..