Skip to content

Commit 092b445

Browse files
committed
fix(ci/cd): Adjust Slack notification author name and include health endpoint in security constants
1 parent b312b0d commit 092b445

2 files changed

Lines changed: 18 additions & 5 deletions

File tree

.github/workflows/cicd-light-sail-prod.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,18 +180,20 @@ jobs:
180180
echo "[5/9] Health check http://127.0.0.1:${TARGET_PORT}${HEALTHCHECK_PATH}"
181181
ok=0
182182
for i in $(seq 1 ${HEALTHCHECK_RETRY}); do
183-
if curl -fsS --max-time ${HEALTHCHECK_TIMEOUT} "http://127.0.0.1:${TARGET_PORT}${HEALTHCHECK_PATH}" >/dev/null 2>&1; then
184-
ok=1; break
185-
fi
186-
echo " retry $i/${HEALTHCHECK_RETRY}..."
183+
code=$(curl -s -o /dev/null -w "%{http_code}" --max-time ${HEALTHCHECK_TIMEOUT} \
184+
"http://127.0.0.1:${TARGET_PORT}${HEALTHCHECK_PATH}")
185+
if [ "$code" -ge 200 ] && [ "$code" -lt 400 ]; then
186+
ok=1; break
187+
fi
188+
echo " retry $i/${HEALTHCHECK_RETRY} (code=$code)"
187189
sleep 3
188190
done
189191
if [ "$ok" -ne 1 ]; then
190192
echo "[!] Health check failed. Rollback."
191193
sudo docker logs --tail 200 "${TARGET_NAME}" || true
192194
sudo docker stop "${TARGET_NAME}" || true
193195
sudo docker rm "${TARGET_NAME}" || true
194-
exit 1
196+
exit 1
195197
fi
196198
197199
echo "[6/9] Switch upstream to ${TARGET_PORT}"

src/main/resources/application-local.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,17 @@ spring:
6161
max-idle: 8
6262
min-idle: 2
6363

64+
management:
65+
endpoints:
66+
web:
67+
exposure:
68+
include: health,info
69+
endpoint:
70+
health:
71+
show-details: never
72+
probes:
73+
enabled: true
74+
6475
#MyBatis
6576
mybatis:
6677
type-aliases-package: com.dreamypatisiel.devdevdev.domain.repository

0 commit comments

Comments
 (0)