Skip to content

Commit

Permalink
Adding health check for backup gateway
Browse files Browse the repository at this point in the history
Signed-off-by: Arvinth C <[email protected]>
  • Loading branch information
ArvinthC3000 committed Nov 21, 2023
1 parent ceb18d4 commit a4d68ce
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions components/backup-gateway/habitat/hooks/health-check
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!{{pkgPathFor "core/bash"}}/bin/bash

exec 2>&1

curlOpts="-sS --fail --max-time 2"
curlOpts="$curlOpts --cert {{pkg.svc_config_path}}/public.crt"
curlOpts="$curlOpts --key {{pkg.svc_config_path}}/private.key"
curlOpts="$curlOpts --cacert /hab/svc/automate-gateway/config/root_ca.crt"
curlOpts="$curlOpts --resolve backup-gateway:{{cfg.service.port}}:127.0.0.1"
curlOpts="$curlOpts --noproxy backup-gateway"

# shellcheck disable=SC2086
output=$(curl $curlOpts https://backup-gateway:{{cfg.service.port}}/minio/health/ready 2>&1)
res=$?
echo "$output"
if [[ "$res" != "0" ]]; then
echo "health check curl command returned exit code $res:"
echo "$output"
exit 2
fi

0 comments on commit a4d68ce

Please sign in to comment.