From b928f8dc209cd8ce8ac97ace31d593fb0ddce65d Mon Sep 17 00:00:00 2001 From: proffapt Date: Mon, 1 Jul 2024 09:00:26 +0530 Subject: [PATCH] feat(cd): added healthcheck step in pipeline --- .github/workflows/deploy-ntfy-do.yaml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.github/workflows/deploy-ntfy-do.yaml b/.github/workflows/deploy-ntfy-do.yaml index f10a0e2..ffc1dbc 100644 --- a/.github/workflows/deploy-ntfy-do.yaml +++ b/.github/workflows/deploy-ntfy-do.yaml @@ -139,3 +139,23 @@ jobs: cd "${PROJECT_DIR}/" sudo docker compose down sudo docker compose up -d + + healthcheck: + name: Healthcheck Stage + needs: deploy + runs-on: ubuntu-latest + + steps: + - name: Check for the health of Naarad + run: | + while true; do + result=$(curl -s -kX GET https://naarad.metakgp.org/v1/health | jq '.healthy') + + if [ "$result" = "true" ]; then + echo "Health check passed. Service is healthy." + break + else + echo "Service not healthy yet. Retrying in 5 seconds..." + sleep 5 + fi + done