feat(infra): initialize production Terraform and server deployment setup#48
Merged
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.
개요
apps/server의 컨테이너화 배포 체계를 구축하고, 프로덕션 환경의 AWS 배포를 위한 기초 인프라(Terraform) 설정을 정의합니다.작업 내용
1. 백엔드 서버 헬스체크 API 구현
apps/server/src/health/health.controller.ts,apps/server/src/app.module.ts/healthAPI 엔드포인트를 신규 생성하고 헬스체크를 위해 API Throttle 제한을 바이패스하도록@SkipThrottle()데코레이터를 적용했습니다.2. 모노레포 로컬 패키지 인라인을 위한 Webpack 빌드 설정
apps/server/webpack.config.js,apps/server/package.json@dookmark/*와 같은 공유 라이브러리를 상대 경로로 참조할 때 런타임에서 모듈 로드 에러가 나는 문제를 해결하기 위해, 빌드 시 해당 패키지 소스 코드를 빌드 결과물(dist/main.js) 내부에 인라인화하는 Webpack 설정을 도입했습니다.3. 배포용 Dockerfile 추가 (ARM64 Graviton 타겟)
apps/server/Dockerfilenode:22.13.0-slim기반의 멀티스테이지 Dockerfile을 작성했습니다. Prisma ORM 구동에 필요한 OpenSSL과 외부 아웃바운드 API용 보안 인증서를 설치하도록 설정했습니다.4. 프로덕션 환경의 Terraform 백엔드 및 프로바이더 설정
infra/terraform/envs/prod/provider.tf,infra/terraform/envs/prod/versions.tfap-northeast-2)에 리소스를 배포하기 위한 Terraform 기초 환경을 구성했습니다. 협업 및 상태 관리를 위한 원격 상태 백엔드(S3) 설정을 완료했으며, Terraform 1.11+ 정식 스펙인use_lockfile = true를 사용하여 별도의 DynamoDB 잠금 테이블 없이 S3 네이티브 파일 잠금 메커니즘을 사용하도록 최적화했습니다.검증 결과
pnpm --filter server build) 로컬 통과tsc --noEmit통과biome check(또는lint/format) 통과비고
docs/guides/terraform-s3-backend-locking.md에 보완해 두었으며, 이를 통해 버킷을 선제 생성해야 테라폼 실행이 가능합니다.