Skip to content

Commit

Permalink
adding back procps for pgrep
Browse files Browse the repository at this point in the history
  • Loading branch information
ssadhu-sl committed Nov 25, 2024
1 parent a6daf28 commit fe294d7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 23 deletions.
2 changes: 1 addition & 1 deletion request-processor/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ENV GIT_COMMIT=$GIT_COMMIT
RUN pip install --no-cache-dir cython

RUN apt update && apt install -y --no-install-recommends \
gcc g++ make git libc-dev curl proj-bin libproj-dev \
gcc g++ make git libc-dev curl proj-bin libproj-dev procps\
gdal-bin gdal-data awscli postgresql-client jq && \
rm -rf /var/lib/apt/lists/*

Expand Down
41 changes: 19 additions & 22 deletions request-processor/docker-healthcheck.sh
Original file line number Diff line number Diff line change
@@ -1,33 +1,30 @@
# Checks health by checking worker process is running along with connectivity checks of SQS and Postgres

# Prevent exit on error code
set -e

# Check Celery process is running
pgrep celery
#pgrep celery > /dev/null 2> /dev/null

pgrep celery > /dev/null 2> /dev/null
exit_code=$?

# Check SQS queue exists
aws sqs get-queue-url --queue-name celery
#if aws sqs get-queue-url --queue-name celery > /dev/null 2> /dev/null
#then
# sqs_status="HEALTHY"
#else
# sqs_status="HEALTHY"; #Passing the status as healthy in all scenarios
#fi
if aws sqs get-queue-url --queue-name celery > /dev/null 2> /dev/null
then
sqs_status="HEALTHY"
else
sqs_status="UNHEALTHY";
exit_code=1;
fi

# Check Postgres DB is ready
pg_isready -d "$DATABASE_URL"
#if pg_isready -d "$DATABASE_URL" > /dev/null 2> /dev/null
#then
# pg_status="HEALTHY"
#else
# pg_status="UNHEALTHY";
#fi
if pg_isready -d "$DATABASE_URL" > /dev/null 2> /dev/null
then
pg_status="HEALTHY"
else
pg_status="UNHEALTHY";
exit_code=1;
fi

# Provide JSON output
#jq ".version=\"$GIT_COMMIT\" | (.dependencies[] | select(.name==\"request-db\")).status=\"$pg_status\" | (.dependencies[] | select(.name==\"sqs\")).status=\"$sqs_status\"" healthcheck-output-template.json
jq ".version=\"$GIT_COMMIT\" | (.dependencies[] | select(.name==\"request-db\")).status=\"$pg_status\" | (.dependencies[] | select(.name==\"sqs\")).status=\"$sqs_status\"" healthcheck-output-template.json

exit $exit_code

# Note use of > /dev/null 2> /dev/null which suppresses stout and stderr
# Note use of > /dev/null 2> /dev/null which suppresses stout and stderr

0 comments on commit fe294d7

Please sign in to comment.