Skip to content

Commit

Permalink
Adding health check for backup gateway (#8297)
Browse files Browse the repository at this point in the history
* Adding health check for backup gateway

Signed-off-by: Arvinth C <[email protected]>

* Health check log

Signed-off-by: Arvinth C <[email protected]>

* Addinf root ca in seperate file for backup gateway

Signed-off-by: Arvinth C <[email protected]>

* Addinf root ca in seperate file for backup gateway

Signed-off-by: Arvinth C <[email protected]>

* trigger build

Signed-off-by: Arvinth C <[email protected]>

* Pipeline fix

Signed-off-by: Arvinth C <[email protected]>

---------

Signed-off-by: Arvinth C <[email protected]>
  • Loading branch information
ArvinthC3000 authored and anees-progress committed Nov 30, 2023
1 parent dd55cc4 commit 87558ff
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions components/backup-gateway/habitat/config/root-ca.crt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{cfg.tls.root_cert_contents}}
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 -o /dev/null -s -w %{http_code}"
curlOpts="$curlOpts --cert {{pkg.svc_config_path}}/public.crt"
curlOpts="$curlOpts --key {{pkg.svc_config_path}}/private.key"
curlOpts="$curlOpts --cacert {{pkg.svc_config_path}}/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 "health check status code: $output"
if [[ "$res" != "0" ]]; then
echo "health check curl command returned exit code $res:"
echo "$output"
exit 2
fi
1 change: 1 addition & 0 deletions components/backup-gateway/habitat/plan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pkg_deps=(
chef/automate-platform-tools
)


pkg_exports=(
[port]=service.port
)
Expand Down

0 comments on commit 87558ff

Please sign in to comment.