Skip to content

Commit

Permalink
added health check retry
Browse files Browse the repository at this point in the history
Signed-off-by: Vivek Shankar <vshankar@progress.com>
  • Loading branch information
vivekshankar1 committed Sep 6, 2024
1 parent 7682375 commit 5df37cf
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 16 deletions.
20 changes: 13 additions & 7 deletions components/automate-cs-nginx/habitat/hooks/health-check
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,16 @@ curlOpts="$curlOpts --key {{pkg.svc_config_path}}/service.key"

# This gets routed to erchef which does a "deep" health check
# shellcheck disable=SC2086
output=$({{pkgPathFor "core/curl"}}/bin/curl $curlOpts "https://automate-cs-nginx:{{cfg.service.port}}/_status")
res=$?
if [ "0" != "$res" ]; then
echo "health check curl command returned exit code ${res}:"
echo "$output"
exit 2
fi

for i in $(seq 1 5);
do
output=$({{pkgPathFor "core/curl"}}/bin/curl $curlOpts "https://automate-cs-nginx:{{cfg.service.port}}/_status")
res=$?
if [ "0" = "$res" ]; then
exit 0
fi
done

echo "health check curl command returned exit code ${res}:"
echo "$output"
exit $res
22 changes: 15 additions & 7 deletions components/automate-cs-oc-erchef/habitat/hooks/health-check
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,18 @@ curlOpts="$curlOpts --cacert {{pkg.svc_config_path}}/root_ca.crt"
curlOpts="$curlOpts --resolve automate-cs-oc-erchef:{{cfg.network.port}}:127.0.0.1"
curlOpts="$curlOpts --noproxy automate-cs-oc-erchef"
# shellcheck disable=SC2086
output=$({{pkgPathFor "core/curl"}}/bin/curl $curlOpts "https://automate-cs-oc-erchef:{{cfg.network.port}}/_status")
res=$?
if [ "0" != "$res" ]; then
echo "health check curl command returned exit code ${res}:"
echo "$output"
exit 2
fi

for i in $(seq 1 5);
do
output=$({{pkgPathFor "core/curl"}}/bin/curl $curlOpts "https://automate-cs-oc-erchef:{{cfg.network.port}}/_status")
res=$?
if [ "0" = "$res" ]; then
exit 0
fi
done

echo "health check curl command returned exit code ${res}:"
echo "$output"
exit $res

# chef automate config show should hae port 5432
4 changes: 2 additions & 2 deletions components/automate-pg-gateway/habitat/config/haproxy.conf
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ backend automate_postgresql
{{~#if ../cfg.resolvers.nameservers }}
server-template {{node.address}} 8 {{node.address}}:{{node.port}} check resolvers pgdns init-addr none resolve-prefer ipv4
{{else}}
server {{node.address}} {{node.address}}:5432 check maxconn 350 check port 6432
server {{node.address}} {{node.address}}:5432 maxconn 350 check port 6432
{{~/if}}
{{else}}
server {{node.address}} {{node.address}}:5432 check maxconn 350 check port 6432
server {{node.address}} {{node.address}}:5432 maxconn 350 check port 6432
{{~/if}}
{{~/each}}
{{else~}}
Expand Down

0 comments on commit 5df37cf

Please sign in to comment.