File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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}'"
Original file line number Diff line number Diff 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}'"
You can’t perform that action at this time.
0 commit comments