feat: Blue/Green 배포 시 Prometheus 스크랩 타겟 자동 업데이트#763
Conversation
|
Warning Review limit reached
More reviews will be available in 41 minutes and 19 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more credits in the billing tab to continue. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
Walkthrough
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/dev-cd.yml:
- Around line 186-199: The SSH commands connecting to both DEV_HOST and
MONITORING_HOST use StrictHostKeyChecking=no which disables host key
verification and creates a MITM vulnerability. Remove the -o
StrictHostKeyChecking=no option from both SSH commands (the one connecting to
DEV_USERNAME@DEV_HOST and the one connecting to
MONITORING_USERNAME@MONITORING_HOST), and instead populate the known_hosts file
with the host keys of these servers beforehand in the workflow, or use -o
StrictHostKeyChecking=accept-new to securely accept new host keys on first
connection while still verifying them on subsequent connections.
- Around line 192-195: The current PRIVATE_IP extraction using `hostname -I |
awk '{print $1}'` is non-deterministic and can select incorrect IP addresses in
multi-NIC or Docker bridge environments by blindly taking the first IP. Replace
this approach with a routing-based method that extracts the actual source IP
address that would be used for outgoing connections, such as using `ip route get
1 | awk '{print $(NF-2);exit}'` or similar command that determines the IP based
on the system's routing table. Apply the same fix to both the dev and prod
deployment steps.
- Around line 186-191: Remove the unsafe fallback value `|| echo 9080` from the
UPSTREAM_PORT assignment and add explicit validation to ensure the port is one
of the expected values (8080 or 9080). After assigning UPSTREAM_PORT from the
ssh command, add a validation check that confirms the port is either "8080" or
"9080" and exits with an error message if it is neither of these expected
values. Apply the same validation approach to any similar port detection logic
in the prod deployment step to maintain consistency and safety across
environments.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 89c1e56d-916f-48cd-8414-7dede6ec20e7
📒 Files selected for processing (2)
.github/workflows/dev-cd.yml.github/workflows/prod-cd.yml
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d5f44767b5
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
528b78a to
e2503e1
Compare
관련 이슈
작업 내용
Blue/Green 슬롯 전환 완료 후 monitoring 서버의 Prometheus 타겟 파일을 자동으로 갱신하는 스텝을 CD 워크플로우에 추가했습니다.
prod-cd.yml: nginx 전환 완료 후prod.json타겟 파일 업데이트 스텝 추가dev-cd.yml: nginx 전환 완료 후stage.json타겟 파일 업데이트 스텝 추가동작 방식
upstream.conf에서 현재 활성 포트 확인 → management 포트 결정 (blue: 8081 / green: 9081)HOST/DEV_HOST시크릿의 퍼블릭 IP와 결정된 management 포트로 타겟 JSON 파일(prod.json/stage.json) 갱신타겟 파일 경로는
~/solid-connection-monitor/prometheus/targets/로, docker-compose 볼륨 마운트(./prometheus:/etc/prometheus)에 의해 컨테이너 내부/etc/prometheus/targets/에 반영됩니다.특이 사항
MONITORING_HOST,MONITORING_USERNAME,MONITORING_PRIVATE_KEY)를 사용합니다.HOST/DEV_HOST시크릿을 그대로 활용하므로 별도 SSH로 IP를 조회하지 않습니다.sudo없이 파일 쓰기가 가능합니다.file_sd_configs방식은 타겟 파일 변경을 주기적으로 감지하므로, 파일 갱신 후 별도 reload 없이 자동 반영됩니다.