OCR Health check 알림 추가
All checks were successful
API Health Check / health-check (push) Successful in 3s
All checks were successful
API Health Check / health-check (push) Successful in 3s
This commit is contained in:
@@ -2,7 +2,7 @@ name: API Health Check
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '* * * * *'
|
- cron: "* * * * *"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
health-check:
|
health-check:
|
||||||
@@ -32,4 +32,3 @@ jobs:
|
|||||||
curl -i -X POST -H 'Content-Type: application/json' -d '{"text": "## 🚨 API 상태 확인 실패\n**엔드포인트:** `http://172.16.10.176:8888/health/API`\n\nAPI가 5번의 시도에 응답하지 않습니다. 확인이 필요합니다."}' ${{ secrets.MATTERMOST_WEBHOOK }}
|
curl -i -X POST -H 'Content-Type: application/json' -d '{"text": "## 🚨 API 상태 확인 실패\n**엔드포인트:** `http://172.16.10.176:8888/health/API`\n\nAPI가 5번의 시도에 응답하지 않습니다. 확인이 필요합니다."}' ${{ secrets.MATTERMOST_WEBHOOK }}
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
34
.gitea/workflows/ocr_health_check.yml
Normal file
34
.gitea/workflows/ocr_health_check.yml
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
name: API Health Check
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: "* * * * *"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
health-check:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check API Health and Notify on Failure
|
||||||
|
run: |
|
||||||
|
success=false
|
||||||
|
for i in $(seq 1 5); do
|
||||||
|
response=$(curl -s -o /dev/null -w "%{http_code}" http://172.16.10.176:8890/health/API)
|
||||||
|
content=$(curl -s http://172.16.10.176:8890/health/API)
|
||||||
|
|
||||||
|
if [ "$response" -eq 200 ] && echo "$content" | grep -q "ok"; then
|
||||||
|
echo "API is healthy (Attempt $i)."
|
||||||
|
success=true
|
||||||
|
break
|
||||||
|
else
|
||||||
|
echo "API health check failed (Attempt $i). HTTP Status: $response, Content: $content"
|
||||||
|
if [ $i -lt 5 ]; then
|
||||||
|
sleep 10 # Wait for 10 seconds before retrying
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "$success" = "false" ]; then
|
||||||
|
echo "API health check failed after 5 attempts. Sending notification to Mattermost."
|
||||||
|
curl -i -X POST -H 'Content-Type: application/json' -d '{"text": "## 🚨 API 상태 확인 실패\n**엔드포인트:** `http://172.16.10.176:8890/health/API`\n\nAPI가 5번의 시도에 응답하지 않습니다. 확인이 필요합니다."}' ${{ secrets.MATTERMOST_WEBHOOK }}
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user