Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,15 @@ trap log_failure EXIT

<% if p('cc.use_status_check') %>
# Use /internal/v4/status readiness endpoint
HOST=<%= p('cc.nginx.ip').empty? ? discover_external_ip : p('cc.nginx.ip') %>
PORT=9021
PROTOCOL="http"
READINESS_URL="${PROTOCOL}://${HOST}:${PORT}/internal/v4/status"
READINESS_URL="http://127.0.0.1:9021/internal/v4/status"

last_ok_response=$(date +%s)

while true; do
set +e
readiness_code=$(curl --fail -sS -o /dev/null -w "%{http_code}" --max-time 2 -A "ccng_monit_http_healthcheck" "${READINESS_URL}")
set -e
status=$?
set -e

now=$(date +%s)
elapsed=$((now - last_ok_response))
Expand All @@ -60,7 +57,7 @@ while true; do

if [[ "$readiness_code" == "503" ]]; then
echo "$(date --rfc-3339=ns) ccng_monit_http_healthcheck: readiness endpoint returned 503 (unhealthy), exiting to trigger restart"
exit $status
exit 1
elif [[ "$readiness_code" == "429" ]]; then
echo "$(date --rfc-3339=ns) ccng_monit_http_healthcheck: readiness endpoint returned 429 (busy), not restarting"
# Do not exit, just log and continue
Expand Down
2 changes: 1 addition & 1 deletion jobs/cloud_controller_ng/templates/nginx.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ limit_req_zone $http_authorization zone=<%= zone['name'] %>:10m rate=<%= zone['l
<% if p('cc.use_status_check') %>
# This block handles the /internal/v4/status endpoint for health checks, which is called by ccng_monit_http_healthcheck.
server {
listen 9021;
listen 127.0.0.1:9021;
Comment thread
stephanme marked this conversation as resolved.
Resolved
server_name _;
server_name_in_redirect off;

Expand Down
Loading