Skip to content

Commit 6729f22

Browse files
committed
feat: Promethus target을 public 엔드포인트가 아닌 private IP로 수정
1 parent 8977b28 commit 6729f22

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

.github/workflows/dev-cd.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,12 @@ jobs:
194194
195195
if [ "$UPSTREAM_PORT" = "8080" ]; then NEW_MGMT_PORT=8081; else NEW_MGMT_PORT=9081; fi
196196
197+
PRIVATE_IP=$(ssh -i deploy_key.pem -o StrictHostKeyChecking=no \
198+
"${{ secrets.DEV_USERNAME }}@${{ secrets.DEV_HOST }}" \
199+
"curl -sf http://169.254.169.254/latest/meta-data/local-ipv4")
200+
197201
ssh -i monitoring_key.pem -o StrictHostKeyChecking=no \
198202
"${{ secrets.MONITORING_USERNAME }}@${{ secrets.MONITORING_HOST }}" \
199-
"echo '[{\"targets\":[\"${{ secrets.DEV_HOST }}:${NEW_MGMT_PORT}\"]}]' \
203+
"echo '[{\"targets\":[\"${PRIVATE_IP}:${NEW_MGMT_PORT}\"]}]' \
200204
| tee ~/solid-connection-monitor/prometheus/targets/stage.json > /dev/null \
201-
&& echo 'Prometheus target updated: ${{ secrets.DEV_HOST }}:${NEW_MGMT_PORT}'"
205+
&& echo 'Prometheus target updated: ${PRIVATE_IP}:${NEW_MGMT_PORT}'"

.github/workflows/prod-cd.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,12 @@ jobs:
205205
206206
if [ "$UPSTREAM_PORT" = "8080" ]; then NEW_MGMT_PORT=8081; else NEW_MGMT_PORT=9081; fi
207207
208+
PRIVATE_IP=$(ssh -i deploy_key.pem -o StrictHostKeyChecking=no \
209+
"${{ secrets.USERNAME }}@${{ secrets.HOST }}" \
210+
"curl -sf http://169.254.169.254/latest/meta-data/local-ipv4")
211+
208212
ssh -i monitoring_key.pem -o StrictHostKeyChecking=no \
209213
"${{ secrets.MONITORING_USERNAME }}@${{ secrets.MONITORING_HOST }}" \
210-
"echo '[{\"targets\":[\"${{ secrets.HOST }}:${NEW_MGMT_PORT}\"]}]' \
214+
"echo '[{\"targets\":[\"${PRIVATE_IP}:${NEW_MGMT_PORT}\"]}]' \
211215
| tee ~/solid-connection-monitor/prometheus/targets/prod.json > /dev/null \
212-
&& echo 'Prometheus target updated: ${{ secrets.HOST }}:${NEW_MGMT_PORT}'"
216+
&& echo 'Prometheus target updated: ${PRIVATE_IP}:${NEW_MGMT_PORT}'"

0 commit comments

Comments
 (0)