Skip to content

Commit

Permalink
fix: healthcheck 로직 스크립트로 분리
Browse files Browse the repository at this point in the history
  • Loading branch information
robinjoon committed Sep 12, 2024
1 parent dd91f7b commit 1a66805
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 26 deletions.
28 changes: 2 additions & 26 deletions .github/workflows/backend_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,7 @@ jobs:
runs-on: [ self-hosted, devel-up-prod-a ] # 헬스 체크 방식 고민
steps:
- name: ♻️ Send Helth Check Request
run: |
for i in {1..10}; do
response=$(curl -s -o /dev/null -w "%{http_code}" http://localhost/health)
echo "Attempt $i: Response Code $response"
if [ "$i" -eq 10 ] && [ "$response" -ne 200 ]; then
echo "Health check failed after 10 attempts."
exit 1
fi
sleep 10
done
echo "Health check passed."
run: chmod u+x ./scripts/healthcheck.sh && ./scripts/healthcheck.sh


deployToB:
Expand Down Expand Up @@ -121,19 +109,7 @@ jobs:
runs-on: [ self-hosted, devel-up-prod-b ] # 헬스 체크 방식 고민
steps:
- name: ♻️ Send Helth Check Request
run: |
for i in {1..10}; do
response=$(curl -s -o /dev/null -w "%{http_code}" http://localhost/health)
echo "Attempt $i: Response Code $response"
if [ "$i" -eq 10 ] && [ "$response" -ne 200 ]; then
echo "Health check failed after 10 attempts."
exit 1
fi
sleep 10
done
echo "Health check passed."
run: chmod u+x ./scripts/healthcheck.sh && ./scripts/healthcheck.sh

# slack-notify_success:
# runs-on: ubuntu-latest
Expand Down
12 changes: 12 additions & 0 deletions backend/scripts/healthcheck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
for i in {1..10}; do
response=$(curl -s -o /dev/null -w "%{http_code}" http://localhost/health)
echo "Attempt $i: Response Code $response"

if [ "$i" -eq 10 ] && [ "$response" -ne 200 ]; then
echo "Health check failed after 10 attempts."
exit 1
fi

sleep 10
done
echo "Health check passed."

0 comments on commit 1a66805

Please sign in to comment.