From d5f44767b58bfa08776ee3c379a71ec2d0b707d7 Mon Sep 17 00:00:00 2001 From: Hexeong <123macanic@naver.com> Date: Wed, 17 Jun 2026 15:47:22 +0900 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20CD=20=EA=B3=BC=EC=A0=95=EC=97=90?= =?UTF-8?q?=EC=84=9C=20=EB=B8=94=EB=A3=A8/=EA=B7=B8=EB=A6=B0=20=ED=99=98?= =?UTF-8?q?=EA=B2=BD=20=EB=B3=80=ED=99=94=EC=97=90=20=EB=94=B0=EB=A5=B8=20?= =?UTF-8?q?Promethus=20actuator=20port=20=EB=8F=99=EC=A0=81=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/dev-cd.yml | 21 +++++++++++++++++++++ .github/workflows/prod-cd.yml | 21 +++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/.github/workflows/dev-cd.yml b/.github/workflows/dev-cd.yml index 745fc4d93..b6ec19d1a 100644 --- a/.github/workflows/dev-cd.yml +++ b/.github/workflows/dev-cd.yml @@ -177,3 +177,24 @@ jobs: echo "Deployment complete. Active: ${NEW_SLOT}(${NEW_PORT})" ' + + - name: Update Prometheus scrape target (stage) + run: | + echo "${{ secrets.MONITORING_PRIVATE_KEY }}" > monitoring_key.pem + chmod 600 monitoring_key.pem + + UPSTREAM_PORT=$(ssh -i deploy_key.pem -o StrictHostKeyChecking=no \ + "${{ secrets.DEV_USERNAME }}@${{ secrets.DEV_HOST }}" \ + "grep -oE 'server 127\.0\.0\.1:[0-9]+' /etc/nginx/conf.d/upstream.conf 2>/dev/null | grep -oE '[0-9]+$' || echo 9080") + + if [ "$UPSTREAM_PORT" = "8080" ]; then NEW_MGMT_PORT=8081; else NEW_MGMT_PORT=9081; fi + + PRIVATE_IP=$(ssh -i deploy_key.pem -o StrictHostKeyChecking=no \ + "${{ secrets.DEV_USERNAME }}@${{ secrets.DEV_HOST }}" \ + "hostname -I | awk '{print \$1}'") + + ssh -i monitoring_key.pem -o StrictHostKeyChecking=no \ + "${{ secrets.MONITORING_USERNAME }}@${{ secrets.MONITORING_HOST }}" \ + "echo '[{\"targets\":[\"${PRIVATE_IP}:${NEW_MGMT_PORT}\"]}]' \ + | tee ~/solid-connection-monitor/prometheus/targets/stage.json > /dev/null \ + && echo 'Prometheus target updated: ${PRIVATE_IP}:${NEW_MGMT_PORT}'" diff --git a/.github/workflows/prod-cd.yml b/.github/workflows/prod-cd.yml index 919491ac7..810a99ca3 100644 --- a/.github/workflows/prod-cd.yml +++ b/.github/workflows/prod-cd.yml @@ -188,3 +188,24 @@ jobs: echo "Deployment complete. Active: ${NEW_SLOT}(${NEW_PORT})" ' + + - name: Update Prometheus scrape target (prod) + run: | + echo "${{ secrets.MONITORING_PRIVATE_KEY }}" > monitoring_key.pem + chmod 600 monitoring_key.pem + + UPSTREAM_PORT=$(ssh -i deploy_key.pem -o StrictHostKeyChecking=no \ + "${{ secrets.USERNAME }}@${{ secrets.HOST }}" \ + "grep -oE 'server 127\.0\.0\.1:[0-9]+' /etc/nginx/conf.d/upstream.conf 2>/dev/null | grep -oE '[0-9]+$' || echo 9080") + + if [ "$UPSTREAM_PORT" = "8080" ]; then NEW_MGMT_PORT=8081; else NEW_MGMT_PORT=9081; fi + + PRIVATE_IP=$(ssh -i deploy_key.pem -o StrictHostKeyChecking=no \ + "${{ secrets.USERNAME }}@${{ secrets.HOST }}" \ + "hostname -I | awk '{print \$1}'") + + ssh -i monitoring_key.pem -o StrictHostKeyChecking=no \ + "${{ secrets.MONITORING_USERNAME }}@${{ secrets.MONITORING_HOST }}" \ + "echo '[{\"targets\":[\"${PRIVATE_IP}:${NEW_MGMT_PORT}\"]}]' \ + | tee ~/solid-connection-monitor/prometheus/targets/prod.json > /dev/null \ + && echo 'Prometheus target updated: ${PRIVATE_IP}:${NEW_MGMT_PORT}'" From 25666ff19aac67ae230923bf83012d1e6044578c Mon Sep 17 00:00:00 2001 From: Hexeong <123macanic@naver.com> Date: Wed, 17 Jun 2026 15:54:06 +0900 Subject: [PATCH 2/3] =?UTF-8?q?refactor:=20hostname=20-I=20SSH=20=ED=98=B8?= =?UTF-8?q?=EC=B6=9C=20=EB=A1=9C=EC=A7=81=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/dev-cd.yml | 8 ++------ .github/workflows/prod-cd.yml | 8 ++------ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/.github/workflows/dev-cd.yml b/.github/workflows/dev-cd.yml index b6ec19d1a..6a5c0c8e6 100644 --- a/.github/workflows/dev-cd.yml +++ b/.github/workflows/dev-cd.yml @@ -189,12 +189,8 @@ jobs: if [ "$UPSTREAM_PORT" = "8080" ]; then NEW_MGMT_PORT=8081; else NEW_MGMT_PORT=9081; fi - PRIVATE_IP=$(ssh -i deploy_key.pem -o StrictHostKeyChecking=no \ - "${{ secrets.DEV_USERNAME }}@${{ secrets.DEV_HOST }}" \ - "hostname -I | awk '{print \$1}'") - ssh -i monitoring_key.pem -o StrictHostKeyChecking=no \ "${{ secrets.MONITORING_USERNAME }}@${{ secrets.MONITORING_HOST }}" \ - "echo '[{\"targets\":[\"${PRIVATE_IP}:${NEW_MGMT_PORT}\"]}]' \ + "echo '[{\"targets\":[\"${{ secrets.DEV_HOST }}:${NEW_MGMT_PORT}\"]}]' \ | tee ~/solid-connection-monitor/prometheus/targets/stage.json > /dev/null \ - && echo 'Prometheus target updated: ${PRIVATE_IP}:${NEW_MGMT_PORT}'" + && echo 'Prometheus target updated: ${{ secrets.DEV_HOST }}:${NEW_MGMT_PORT}'" diff --git a/.github/workflows/prod-cd.yml b/.github/workflows/prod-cd.yml index 810a99ca3..db182f16b 100644 --- a/.github/workflows/prod-cd.yml +++ b/.github/workflows/prod-cd.yml @@ -200,12 +200,8 @@ jobs: if [ "$UPSTREAM_PORT" = "8080" ]; then NEW_MGMT_PORT=8081; else NEW_MGMT_PORT=9081; fi - PRIVATE_IP=$(ssh -i deploy_key.pem -o StrictHostKeyChecking=no \ - "${{ secrets.USERNAME }}@${{ secrets.HOST }}" \ - "hostname -I | awk '{print \$1}'") - ssh -i monitoring_key.pem -o StrictHostKeyChecking=no \ "${{ secrets.MONITORING_USERNAME }}@${{ secrets.MONITORING_HOST }}" \ - "echo '[{\"targets\":[\"${PRIVATE_IP}:${NEW_MGMT_PORT}\"]}]' \ + "echo '[{\"targets\":[\"${{ secrets.HOST }}:${NEW_MGMT_PORT}\"]}]' \ | tee ~/solid-connection-monitor/prometheus/targets/prod.json > /dev/null \ - && echo 'Prometheus target updated: ${PRIVATE_IP}:${NEW_MGMT_PORT}'" + && echo 'Prometheus target updated: ${{ secrets.HOST }}:${NEW_MGMT_PORT}'" From e2503e1decf5da2eae951d99928821889ff0bd6f Mon Sep 17 00:00:00 2001 From: Hexeong <123macanic@naver.com> Date: Wed, 17 Jun 2026 16:07:00 +0900 Subject: [PATCH 3/3] =?UTF-8?q?fix:=20=ED=8C=8C=EC=8B=B1=20=EA=B2=B0?= =?UTF-8?q?=EA=B3=BC=EA=B0=80=208080/9080=EC=9D=B4=20=EC=95=84=EB=8B=8C=20?= =?UTF-8?q?=EA=B2=BD=EC=9A=B0=20=EB=AA=85=EC=8B=9C=EC=A0=81=20=EC=8B=A4?= =?UTF-8?q?=ED=8C=A8=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/dev-cd.yml | 7 ++++++- .github/workflows/prod-cd.yml | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dev-cd.yml b/.github/workflows/dev-cd.yml index 6a5c0c8e6..7942d0fd0 100644 --- a/.github/workflows/dev-cd.yml +++ b/.github/workflows/dev-cd.yml @@ -185,7 +185,12 @@ jobs: UPSTREAM_PORT=$(ssh -i deploy_key.pem -o StrictHostKeyChecking=no \ "${{ secrets.DEV_USERNAME }}@${{ secrets.DEV_HOST }}" \ - "grep -oE 'server 127\.0\.0\.1:[0-9]+' /etc/nginx/conf.d/upstream.conf 2>/dev/null | grep -oE '[0-9]+$' || echo 9080") + "grep -oE 'server 127\.0\.0\.1:[0-9]+' /etc/nginx/conf.d/upstream.conf 2>/dev/null | grep -oE '[0-9]+$'") + + if [ "$UPSTREAM_PORT" != "8080" ] && [ "$UPSTREAM_PORT" != "9080" ]; then + echo "Unexpected UPSTREAM_PORT: '${UPSTREAM_PORT}'" >&2 + exit 1 + fi if [ "$UPSTREAM_PORT" = "8080" ]; then NEW_MGMT_PORT=8081; else NEW_MGMT_PORT=9081; fi diff --git a/.github/workflows/prod-cd.yml b/.github/workflows/prod-cd.yml index db182f16b..03025ab5f 100644 --- a/.github/workflows/prod-cd.yml +++ b/.github/workflows/prod-cd.yml @@ -196,7 +196,12 @@ jobs: UPSTREAM_PORT=$(ssh -i deploy_key.pem -o StrictHostKeyChecking=no \ "${{ secrets.USERNAME }}@${{ secrets.HOST }}" \ - "grep -oE 'server 127\.0\.0\.1:[0-9]+' /etc/nginx/conf.d/upstream.conf 2>/dev/null | grep -oE '[0-9]+$' || echo 9080") + "grep -oE 'server 127\.0\.0\.1:[0-9]+' /etc/nginx/conf.d/upstream.conf 2>/dev/null | grep -oE '[0-9]+$'") + + if [ "$UPSTREAM_PORT" != "8080" ] && [ "$UPSTREAM_PORT" != "9080" ]; then + echo "Unexpected UPSTREAM_PORT: '${UPSTREAM_PORT}'" >&2 + exit 1 + fi if [ "$UPSTREAM_PORT" = "8080" ]; then NEW_MGMT_PORT=8081; else NEW_MGMT_PORT=9081; fi