Skip to content

feat: prod API EC2 호스트 지표를 Node Exporter로 수집 - #96

Open
Hexeong wants to merge 1 commit into
mainfrom
Hexeong/feat-prod-api-ec2-node-exporter
Open

Hexeong wants to merge 1 commit into
mainfrom
Hexeong/feat-prod-api-ec2-node-exporter

Conversation

@Hexeong

@Hexeong Hexeong commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

관련 이슈

  • #93의 prod 배포 단계입니다.
  • 선행 PR #95는 스쿼시 머지됐고, stage L4 결과에서 Redis 보존, Prometheus 수집, Grafana Node Exporter Full 대시보드 패널 조회를 확인했습니다.
  • 작업 추적용 참조: resolves: #93 (prod L4까지 확인한 뒤 이슈를 완료합니다.)

작업 내용

  • prod API EC2의 Node Exporter를 활성화합니다. node_exporter_managed = true를 유지해 추후 비활성화 시 exporter만 정리하고 Redis를 보존합니다.
  • #95의 스쿼시 머지 커밋 db85b594 위로 브랜치를 재정렬했습니다. main 대비 diff는 environment/prod/main.tf의 활성화 두 줄뿐입니다.
  • exporter는 prod 사설 IP 172.31.56.245:9100에서 수신하며, 실제 보안 그룹의 9100 ingress는 모니터링 EC2 172.31.47.7/32만 허용합니다.

의도 (L2)

prod replace module.prod_stack.module.app.null_resource.update_side_infra

stage 변경 없음. EC2 교체와 보안 그룹 변경도 없습니다.

검증 결과 (L1 ~ L3)

  • 최신 main db85b594 기준 로컬 scripts/verify/verify.sh all --expect .verify/expect.txt: PASS 24 / FAIL 0 / SKIPPED 0.
  • L2 plan은 prod update_side_infra 1건 교체만 확인했습니다. stage는 변경 대상이 아닙니다.
  • stage 선행 적용의 Terraform Apply는 성공했으며 Redis 컨테이너 ID와 TTL 키가 유지됐고, Grafana에서 CPU·RAM·디스크 패널 값이 반환됐습니다.

런타임 확인 체크리스트 (L4)

  • 대상: prod API EC2 / 확인: SSM에서 docker ps --filter name=node-exporter, docker inspect 재시작 정책 / 기대 결과: exporter 실행 중, restart=always.
  • 대상: prod API EC2 / 확인: curl -fsS http://172.31.56.245:9100/metrics / 기대 결과: CPU·메모리·파일시스템·네트워크 node_* 지표 반환.
  • 대상: 모니터링 EC2 / 확인: Prometheus up{job="solid-connection-server-node-exporter"} 및 node_* 시계열, Grafana Node Exporter Full의 prod job/node 선택과 CPU·RAM·디스크 패널 / 기대 결과: up=1, 최신 호스트 지표 표시.
  • 대상: prod 기존 수집 / 확인: Actuator 활성 슬롯과 Redis target, Loki의 Spring 로그, Alloy 상태 / 기대 결과: 기존 수집 유지.
  • 대상: prod Redis / 확인: apply 직전 docker inspect -f '{{.Id}}' redis와 docker exec redis redis-cli SET node-exporter-prod-l4-93 ok EX 3600, apply 직후 ID 및 GET 재확인 / 기대 결과: 컨테이너 ID와 테스트 키 유지.
  • 대상: prod exporter / 확인: gzip /metrics 응답 크기, 10초 scrape 기준 월 AZ 간 전송량 / 기대 결과: 실측값과 feat: stage·prod API EC2 호스트 지표를 Node Exporter로 수집 #93 비용 추정 갱신.

롤백 절차

  • 이 PR 전체를 revert하지 않습니다. prod에서 node_exporter_managed가 기본값 false로 돌아가면 이전 스크립트의 docker rm -f redis와 docker compose down이 Redis 익명 볼륨 데이터를 끊을 수 있고, Node Exporter가 orphan으로 남을 수 있습니다.
  • 수정 PR에서 environment/prod/main.tf의 node_exporter_enabled = false로 바꾸고 node_exporter_managed = true는 유지합니다. L2 plan에서 prod update_side_infra만 교체되는지 확인한 뒤 일반 CI apply로 배포하고, Redis ID·TTL 키 보존과 exporter 종료를 검증합니다.

특이 사항

  • update_side_infra 교체 시 SSM 스크립트가 Compose 설정을 검증하고 Node Exporter 이미지를 먼저 받은 뒤 변경된 서비스만 반영합니다. Alloy는 마운트된 설정을 다시 읽도록 재시작합니다.
  • 모니터링 EC2의 실행 중 Prometheus 설정에는 이미 prod 사설 IP target이 들어 있습니다. prod 적용 전에는 해당 target이 down인 것이 정상입니다.

리뷰 요구사항 (선택)

  • prod plan의 단일 교체, Redis 보존 경로, 롤백 절차를 중점 확인해 주세요.

@coderabbitai

coderabbitai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 3 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between db85b59 and b8d9ce2.

Files selected for processing: 1

  • environment/prod/main.tf
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@Hexeong Hexeong self-assigned this Nov 18, 2026

lsy1307 commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

prod에서도 같은 side-infra 스크립트를 사용하므로 #95의 Redis 강제 재생성 문제가 적용됩니다. prod 배포 전에 #95의 수정이 이 브랜치에 반영됐는지 확인하고, stage에서 Node Exporter를 켜고 끄는 동안 Redis 컨테이너와 테스트 키가 유지되는지 검증해주세요. #95 인라인 리뷰

lsy1307 commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Redis 강제 재생성 수정이 prod 브랜치에도 반영된 것을 확인했습니다. main으로 대상을 바꾸기 전에 PR 본문의 verify-expect 블록을 아래처럼 열고 닫는 백틱을 각각 3개로 고쳐주세요. 현재는 각각 1개라 Terraform CI의 extract-expect가 의도를 읽지 못합니다.

prod replace module.prod_stack.module.app.null_resource.update_side_infra

stage L4 완료 후 main을 대상으로 실행한 plan에서 prod 교체 1건을 확인하면 됩니다.

@Hexeong
Hexeong force-pushed the Hexeong/feat-prod-api-ec2-node-exporter branch from b87e405 to b8d9ce2 Compare November 19, 2026 06:19
@Hexeong
Hexeong changed the base branch from Hexeong/feat-stage-prod-api-ec2-node-exporter to main November 19, 2026 06:20
@Hexeong
Hexeong marked this pull request as ready for review November 19, 2026 06:20
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-19T06:21:45.859814Z b8d9ce2 Draft marked ready
🔒 Security Review ✅ Completed 2026-11-19T06:23:37.322084Z b8d9ce2 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Terraform Plan: prod

Plan: 1 to add, 0 to change, 1 to destroy.

리소스 변경: delete 0, replace 1, move-update 0, move 0, import-update 0, import 0, create 0, update 0

action address
🟠 replace module.prod_stack.module.app.null_resource.update_side_infra

⚠️ delete/replace 가 포함되어 있습니다. 의도한 변경인지 반드시 확인하세요.

의도 대조 (PR 본문 verify-expect): ✅ 일치

전체 plan 결과는 보안을 위해 댓글에 포함되지 않습니다. 워크플로우 실행 아티팩트를 확인하세요.

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants