Skip to content

Conversation

@Gyuhyeok99
Copy link
Contributor

관련 이슈

작업 내용

문제

운영 서버에서 Grafana 메트릭이 수집되지 않는 문제

원인

운영 서버의 Docker 컨테이너에서 8081 포트(메트릭 엔드포인트)가 외부로 노출되지 않음

환경 차이

Stage: network_mode: host 사용 → 모든 포트 자동 노출
운영: bridge 네트워크 사용 → 포트 매핑 필요하나 8081 포트 누락

monitor 서버에서 테스트

curl http://api.stage.solid-connection.com:8081/actuator/prometheus  # 성공
curl http://api.solid-connection.com:8081/actuator/prometheus        # 실패 Connection refused
스크린샷 2025-10-30 오후 11 23 23 스크린샷 2025-10-30 오후 11 23 36

해결

docker-compose.prod.yml에 8081 포트 매핑 추가
스크린샷 2025-10-30 오후 11 31 39

특이 사항

리뷰 요구사항 (선택)

현재 Stage와 운영의 네트워크 모드가 다릅니다!

  • Stage: host 모드
  • 운영: bridge 모드

환경 일관성을 위해 Stage도 bridge + 포트 매핑 방식으로 통일하는 것이 좋을 것 같긴한데 인스턴스 사양이 너무 낮아서 일부로 그렇게 설정한 히스토리가 있는지 모르겠습니다..

영서님이 작업하셨어서 물어볼 수가 없네요.. 어떻게 생각하시나요?

@Gyuhyeok99 Gyuhyeok99 self-assigned this Oct 30, 2025
@Gyuhyeok99 Gyuhyeok99 requested a review from wibaek as a code owner October 30, 2025 14:33
@Gyuhyeok99 Gyuhyeok99 added the 버그 Something isn't working label Oct 30, 2025
@coderabbitai
Copy link

coderabbitai bot commented Oct 30, 2025

Walkthrough

  1. docker-compose.prod.yml 변경: solid-connection-server 서비스에 호스트 포트 8081을 컨테이너 포트 8081로 매핑하는 포트 노출 설정이 추가되었습니다.
  2. docker-compose.dev.yml 변경: redis, redis-exporter, solid-connection-dev 서비스에서 network_mode: host 설정이 제거되었습니다.
  3. docker-compose.dev.yml 변경: redis-exporter의 REDIS_ADDRlocalhost:6379에서 redis:6379로 변경되었습니다.
  4. docker-compose.dev.yml 변경: solid-connection-dev에 호스트 포트 8081을 컨테이너 포트 8081로 매핑하는 포트 노출 설정이 추가되었습니다.
  5. docker-compose.dev.yml 변경: solid-connection-dev에 SPRING_DATA_REDIS_HOST=redisSPRING_DATA_REDIS_PORT=6379 환경 변수가 추가되었습니다.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • 확인 포인트: 8081 포트가 다른 서비스와 충돌하지 않는지 확인하세요.
  • 확인 포인트: network_mode: host 제거로 인한 네트워크 동작 변화(특히 로컬 개발에서의 접근성)를 검토하세요.
  • 확인 포인트: redis-exporter와 애플리케이션이 redis 호스트로 올바르게 이름 해석되는지(네트워크/서비스 이름) 확인하세요.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Out of Scope Changes Check ❓ Inconclusive 변경사항 중 일부를 검토하면 다음과 같습니다. 1) docker-compose.prod.yml의 포트 8081 매핑: 이슈 #540을 직접 해결하는 핵심 변경 ✅ 2) docker-compose.dev.yml의 변경사항 (network_mode 제거, REDIS_ADDR 업데이트, 포트 매핑, 환경 변수 추가): PR 제목과 설명은 운영 환경 수정에 초점을 두고 있으나, 개발 환경의 광범위한 변경이 함께 포함되어 있습니다. 이 개발 환경 변경사항들의 구체적인 필요성과 테스트 여부가 PR 설명에서 명확하지 않습니다. docker-compose.dev.yml의 변경사항들(network_mode 제거, 환경 변수 추가)에 대해 다음을 확인하는 것을 권장합니다: 1) 이러한 변경이 #540 해결을 위해 필수인지 아니면 환경 일관성을 위한 추가 개선사항인지 명확히 할 것. 2) 개발 환경에서 테스트 완료 여부 및 기존 기능 동작 확인. 3) PR 설명에 개발 환경 변경의 목적을 명시할 것.
✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed 제목 "fix: 운영환경 8081 포트 설정 추가"는 Pull Request의 주요 변경사항인 프로덕션 환경에서 8081 포트 매핑 추가를 정확히 반영합니다. 그러나 raw_summary에 따르면 docker-compose.dev.yml에도 network_mode 제거, 환경 변수 추가, 포트 매핑 등 상당한 변경사항이 있으며, 이는 제목에서 언급되지 않았습니다. 제목이 프로덕션 환경의 주요 수정사항을 명확히 전달하지만, 개발 환경의 변경사항들을 포함하지 않아 변경사항의 전체 범위를 완전히 대표하지는 못합니다.
Linked Issues Check ✅ Passed 연결된 이슈 #540의 핵심 요구사항인 운영 환경의 메트릭 수집 문제 해결에 대해 변경사항들을 검토한 결과는 다음과 같습니다. 1) docker-compose.prod.yml에 8081 포트 매핑 추가로 /actuator/prometheus 엔드포인트 접근 가능 ✅ 2) Docker 네트워크 설정 수정 ✅ 3) 환경 불일치 문제 인식 및 논의 ✅. 모든 코드 레벨 요구사항이 충족되었으며, PR 설명에서 환경 일관성에 대한 제안까지 제시되어 있습니다.
Description Check ✅ Passed 제공된 PR 설명은 필수 템플릿 섹션을 충분히 충족하고 있습니다. 관련 이슈(#540)가 명시되었고, 작업 내용은 문제 상황, 원인, 환경 차이, 검증 결과, 해결 방안을 상세히 설명했으며, 리뷰 요구사항은 단계(Stage)와 운영(Production) 간의 네트워크 모드 불일치에 대한 고민을 잘 제시했습니다. 특이 사항 섹션만 비어있으나, 이는 선택적 부분이므로 전체적으로 설명의 품질과 완성도는 양호합니다.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 784fad9 and dfd4769.

📒 Files selected for processing (1)
  • docker-compose.dev.yml (2 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: whqtker
Repo: solid-connection/solid-connect-server PR: 481
File: docs/infra-config/nginx.conf:36-36
Timestamp: 2025-08-25T10:59:42.734Z
Learning: When using network_mode: host in Docker Compose, containers share the host's network namespace, so nginx proxy_pass should target localhost:PORT instead of container service names like solid-connection-server:PORT.
📚 Learning: 2025-08-25T10:59:42.734Z
Learnt from: whqtker
Repo: solid-connection/solid-connect-server PR: 481
File: docs/infra-config/nginx.conf:36-36
Timestamp: 2025-08-25T10:59:42.734Z
Learning: When using network_mode: host in Docker Compose, containers share the host's network namespace, so nginx proxy_pass should target localhost:PORT instead of container service names like solid-connection-server:PORT.

Applied to files:

  • docker-compose.dev.yml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (1)
docker-compose.dev.yml (1)

16-16: 브릿지 네트워크 변경사항은 올바르게 적용되었습니다

제공된 docker-compose.dev.yml의 변경사항들이 일관되고 정확하게 구성되었음을 확인했습니다.

검증된 변경사항:

  1. Line 16 - Redis 서비스명 기반 연결 (localhost:6379redis:6379)

    • 브릿지 모드에서 Docker 내장 DNS가 서비스명을 자동 해석하므로 올바른 설정입니다.
  2. Line 27 - 메트릭 포트 매핑 (8081:8081)

    • Prometheus 메트릭 엔드포인트가 정상적으로 노출됩니다.
  3. Lines 30-31 - Redis 연결 환경변수

    • Spring 애플리케이션이 브릿지 네트워크 환경에서 Redis 서비스에 명시적으로 연결하도록 설정되어 있습니다.

추가 확인사항:

alloy 서비스는 메트릭 수집이 아닌 로그 수집에만 구성되어 있습니다. alloy의 config.alloy 파일은 Loki 기반 로그 포워딩만 담당하며, solid-connection-dev의 8081 포트로 접근하지 않습니다. 따라서 포트 매핑 추가는 외부 모니터링 도구나 향후 용도를 위한 올바른 설정입니다.

코드 변경사항에 대한 추가 조정은 필요하지 않습니다.

Likely an incorrect or invalid review comment.


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 and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
docker-compose.prod.yml (1)

25-27: 선택사항: 포트 용도 명시 주석 추가

metrics endpoint의 목적을 명확히 하기 위해 간단한 주석을 추가하는 것을 고려해보세요. 이는 향후 유지보수 시 포트의 용도를 명확히 합니다.

    ports:
      - "8080:8080"
+     - "8081:8081"  # Prometheus metrics endpoint (/actuator/prometheus)
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e4ff858 and 784fad9.

📒 Files selected for processing (1)
  • docker-compose.prod.yml (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-08-25T10:59:42.734Z
Learnt from: whqtker
PR: solid-connection/solid-connect-server#481
File: docs/infra-config/nginx.conf:36-36
Timestamp: 2025-08-25T10:59:42.734Z
Learning: When using network_mode: host in Docker Compose, containers share the host's network namespace, so nginx proxy_pass should target localhost:PORT instead of container service names like solid-connection-server:PORT.

Applied to files:

  • docker-compose.prod.yml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (1)
docker-compose.prod.yml (1)

27-27: metrics endpoint 포트 매핑 추가 — 문제 해결을 위한 필요한 변경

포트 8081 매핑이 추가되어 production 환경에서 Prometheus metrics endpoint를 접근 가능하게 만들었습니다. 이는 PR #540의 Grafana 메트릭 수집 문제를 직접 해결하는 변경입니다.

변경 사항:

  1. solid-connection-server 서비스에 - "8081:8081" 포트 매핑 추가
  2. bridge network 모드에서 metrics 엔드포인트를 호스트로 노출
  3. 기존 8080 포트 매핑과 동일한 패턴으로 구성

다음을 확인해주세요:

  • 컨테이너 내 Spring Boot actuator가 실제로 포트 8081에서 metrics를 제공하는지 확인
  • curl http://localhost:8081/actuator/prometheus 호출이 production에서 정상 작동하는지 검증
  • Stage 환경과의 일관성 확인 (stage도 8081 포트가 열려있는지 확인)

@sukangpunch
Copy link
Contributor

sukangpunch commented Oct 31, 2025

관련 이슈

작업 내용

문제

운영 서버에서 Grafana 메트릭이 수집되지 않는 문제

원인

운영 서버의 Docker 컨테이너에서 8081 포트(메트릭 엔드포인트)가 외부로 노출되지 않음

환경 차이

Stage: network_mode: host 사용 → 모든 포트 자동 노출 운영: bridge 네트워크 사용 → 포트 매핑 필요하나 8081 포트 누락

monitor 서버에서 테스트

curl http://api.stage.solid-connection.com:8081/actuator/prometheus  # 성공
curl http://api.solid-connection.com:8081/actuator/prometheus        # 실패 Connection refused

스크린샷 2025-10-30 오후 11 23 23 스크린샷 2025-10-30 오후 11 23 36

해결

docker-compose.prod.yml에 8081 포트 매핑 추가 스크린샷 2025-10-30 오후 11 31 39

특이 사항

리뷰 요구사항 (선택)

현재 Stage와 운영의 네트워크 모드가 다릅니다!

  • Stage: host 모드
  • 운영: bridge 모드

환경 일관성을 위해 Stage도 bridge + 포트 매핑 방식으로 통일하는 것이 좋을 것 같긴한데 인스턴스 사양이 너무 낮아서 일부로 그렇게 설정한 히스토리가 있는지 모르겠습니다..

영서님이 작업하셨어서 물어볼 수가 없네요.. 어떻게 생각하시나요?

저도 stage도 bridge 방식으로 통일하는게 좋은 것 같습니다
bridge 가 오버헤드를 발생 시킬 것 같진 않습니다!

@sukangpunch sukangpunch reopened this Oct 31, 2025
Copy link
Contributor

@Hexeong Hexeong left a comment

Choose a reason for hiding this comment

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

제가 아는 바로는 bridge모드로 실행할 경우, 네트워크 격리 때문에 추가 오버헤드가 생기는 걸로 알고 있습니다만 그리 크지 않다고 알고 있습니다! 그렇기에 저는 네트워크 격리로 인한 오버헤드가 그리 크지 않다면 네트워크 격리로 인한 보안 등에서의 장점이 더 좋게 느껴지네요! stage환경도 bridge모드로 일치시키는 건 저는 찬성입니다!

Copy link
Contributor

@Hexeong Hexeong left a comment

Choose a reason for hiding this comment

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

확인했습니다! 수고 많으셨어용

@Gyuhyeok99 Gyuhyeok99 merged commit 568e6f1 into solid-connection:develop Nov 3, 2025
2 checks passed
Gyuhyeok99 added a commit that referenced this pull request Nov 4, 2025
fix: PostRepository & CommentRepository의 일부 메서드의 정렬 순서 오류 해결 (#522) 
refactor: 이메일 유니크키 제거
refactor: 엔티티가 BaseEntity를 상속하도록 (#524) 
fix: BaseEntity 관련 마이그레이션 파일 수정 (#530) 
feat: 멘토 승격 api 구현 (#532) 
fix: 대학교 중복 오류 수정 (#510) 
refactor: 불필요한 로그 삭제 (#543)
fix: 운영환경 8081 포트 설정 추가 (#542) 
fix: dev환경 디비명 변경 (#546)
refactor: 불필요한 로그 삭제 (#547) 
refactor: 학기를 테이블로 관리하도록 변경 (#526) 
refactor: 모의지원 시 지원한 대학 정보 응답 추가 (#539)
@Gyuhyeok99 Gyuhyeok99 mentioned this pull request Nov 4, 2025
@Gyuhyeok99 Gyuhyeok99 deleted the fix/540-docker-ports branch November 9, 2025 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

버그 Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: prod 그라파나 메트릭 수집 문제 오류

3 participants