Skip to content

[Chore] 이미지 변환 AWS 인프라 구성 (#186) - #187

Open
hwistlezz wants to merge 21 commits into
feat/#184/webp-image-workerfrom
chore/#186/image-transform-infra
Open

hwistlezz wants to merge 21 commits into
feat/#184/webp-image-workerfrom
chore/#186/image-transform-infra

Conversation

@hwistlezz

@hwistlezz hwistlezz commented Aug 27, 2026

Copy link
Copy Markdown
Member

🔥 작업 내용 (What)

이미지 변환에 필요한 S3·SQS·Lambda와 배포 절차를 AWS SAM으로 관리하도록 추가했습니다. 기존 이미지 전달용 S3와 CloudFront는 그대로 사용합니다. 실제 AWS 리소스를 생성한 것은 아닙니다.


🧩 변경 사항 (Details)

  • 비공개 원본 S3, 요청·결과 SQS와 각각의 실패 큐(DLQ)를 정의했습니다.
  • Node.js 24 x86_64 Lambda에 메시지별 실패 응답과 동시 실행 제한을 적용했습니다.
  • worker와 배포 역할의 권한을 분리하고, 역할 전달 권한과 권한 상한을 검사하도록 했습니다.
  • 로그 보존 기간과 큐·DLQ·Lambda 알람을 추가했습니다. 운영 환경은 알람 수신 설정이 있어야 배포할 수 있습니다.
  • 빌드에는 AWS 인증을 사용하지 않고, 개발 환경 배포에만 GitHub OIDC를 사용합니다. 운영 workflow는 배포 파일만 생성합니다.

리뷰 반영

  • #185의 최신 변경 b459d7c를 반영했습니다.
  • worker 테스트는 worker CI에서 실행하고, 인프라 CI의 중복 npm test는 제거했습니다.
  • worker가 바뀌어도 SAM 배포 구성이 맞는지 확인해야 하므로 인프라 CI의 worker·규격 변경 감지와 package·SAM 빌드는 유지했습니다. ZIP 생성 일부는 의도적으로 중복됩니다.
  • 변경 감지 경로와 각 CI의 검증 역할이 빠지지 않도록 테스트 12개를 추가했습니다.
  • Lambda 버전은 최신 5개와 최근 30일 버전을 보관하도록 기준을 정했습니다. 사용 중인 alias, stack, 복구 대상, 직접 호출자가 참조하는 버전은 추가로 보호합니다. 수동 점검·승인은 자동 정리 도입 전까지의 임시 절차입니다. 자동 정리는 보호 대상과 권한·동시 실행 방지를 검증하는 별도 작업으로 진행하며, 이 PR에는 자동 삭제 기능이나 삭제 권한을 추가하지 않았습니다.

문서 후속 보완

  • 7449b7c에서 수동 정리가 임시 절차임을 명시했습니다. 실행 코드와 AWS 권한은 바꾸지 않았습니다.
  • 아래 전체 테스트 기록은 79bdb4b 기준이며, 이번 문서 보완은 diff 검사와 독립 검토를 진행했습니다.

테스트

  • Node.js 24에서 worker 타입 검사와 테스트 41개 통과.
  • 인프라 검사 테스트 45개 및 실제 template·배포 workflow 검사 통과.
  • 79bdb4bSAM CI에서 Linux package 생성·Sharp 로딩·SAM lint/build 통과.
  • Java 21에서 gradlew.bat build --no-daemon --max-workers=1 통과: 서버 테스트 234개, 실패·오류·건너뛴 테스트 0개.
  • git diff --check 통과. 이번 로컬 환경에서는 actionlint를 별도로 실행하지 않았습니다.

📸 스크린샷

화면 변경은 없습니다.


⚠️ 주의 사항 (Caution)

  • #185를 기반으로 한 PR입니다. 선행 PR 병합 후 develop 기준 Java CI도 확인해야 합니다.
  • 기존 전달용 S3와 CloudFront는 이름을 참조하며 이 stack에서 생성하거나 변경하지 않습니다.
  • 기록한 SHA-256은 검증한 worker ZIP의 값이며 SAM이 재패키징한 ZIP의 체크섬과는 다릅니다.
  • 원본 접근 권한, 실제 알림 수신, Lambda 성능, 업로드부터 결과 저장까지의 통합 시험은 AWS 적용 단계에서 확인해야 합니다.
  • 실제 AWS 배포·오래된 버전 삭제·이미지 작업 발급 활성화는 하지 않았습니다.

🔗 관련 이슈

Closes #186

선행 PR: #185


✅ 체크리스트

  • worker·인프라 테스트
  • 최신 커밋의 SAM lint/build CI
  • 코드 리뷰에서 확인한 중복 테스트와 버전 보관 기준 반영
  • 최신 커밋의 서버 전체 빌드 확인
  • 실제 AWS 환경 통합 테스트

@coderabbitai

coderabbitai Bot commented Aug 27, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (2)
  • develop
  • main

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 05b99f6e-b6c8-482f-a561-139adaf4a6e7

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@gichanGim gichanGim left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

수고하셨습니다~~ 몇가지 코멘트 남겨놓았으니 확인 한번 해주시면 감사할 것 같습니다!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ci-image-pipeline-infra.yml이 worker 테스트랑 ZIP 빌드까지 다 하고 있는데, ci-image-transform-worker.yml이랑 트리거 경로(worker/, media-specs/)가 겹쳐서 worker 코드만 고쳐도 두 워크플로가 같은 npm test랑 package:lambda를 각각 돌리는 것 같습니다.

인프라 CI는 infra/media/** 에서만 돌게 하고 worker 쪽은 기존 워크플로에 맡기거나, 반대로 하나로 합치는 게 어떨까요?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

같은 테스트를 두 번 돌리던 부분은 제거했습니다!
다만 테스트가 통과해도 배포 파일을 만드는 과정에서 문제가 생길 수 있어서, ZIP 생성과 SAM 검증은 남겨뒀습니다.

Comment thread infra/media/template.yaml
Role: !GetAtt ImageTransformFunctionRole.Arn
Architectures:
- x86_64
AutoPublishAlias: live

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

alias로 버전 관리하시는 거 롤백에 좋을 것 같은데, 오래된 버전 정리 계획이 있는지 궁금합니다!

AutoPublishAlias를 쓰면 배포할 때마다 새 Lambda 버전이 published되고, 명시적으로 지우지 않으면 계속 쌓이는 걸로 알고 있어서, dev에서 자주 배포하면 나중에 계정 코드 스토리지를 넘을수도 있을 것 같습니다.

README "장애와 rollback" 절에 몇 개까지 보관하고 어떻게 정리할지 한 줄 정도 있으면나중에 헷갈리지 않을 것 같아요!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

문제 생겼을 때 이전 버전으로 돌아갈 수 있도록 최신 5개와 최근 30일 버전은 남기려고 합니다.
사용 중이거나 복구에 필요한 버전도 지우지 않도록 README에 적었습니다.

매번 수동으로 정리하는 건 번거로워서, 나중에 자동 정리는 별도 작업으로 추가하려고 합니다.

@gichanGim
gichanGim force-pushed the chore/#186/image-transform-infra branch from 437dde1 to dd94616 Compare September 9, 2026 00:26
@gichanGim
gichanGim force-pushed the feat/#184/webp-image-worker branch from 5aa9956 to a988a8b Compare September 9, 2026 00:26
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