Skip to content

Commit

Permalink
o/p the error in healthcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
ssadhu-sl committed Nov 25, 2024
1 parent 48b3fec commit 09aab99
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
8 changes: 7 additions & 1 deletion request-processor/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
#!/bin/sh
set -e
echo "${DATABASE_URL}"
celery --config celeryconfig -A tasks worker -l INFO -P eventlet --concurrency ${CELERY_WORKER_CONCURRENCY:-1}
celery --config celeryconfig -A tasks worker -l INFO -P eventlet --concurrency ${CELERY_WORKER_CONCURRENCY:-1} &

# Run the healthcheck script in the background
./docker-healthcheck.sh &

# Wait for Celery worker to finish
wait
13 changes: 11 additions & 2 deletions request-processor/docker-healthcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,20 @@
pgrep celery > /dev/null 2> /dev/null
exit_code=$?

if [ $exit_code -eq 0 ]; then
echo "Celery process is running"
else
echo "Celery process is NOT running"
exit_code=1
fi

# Check SQS queue exists
if aws sqs get-queue-url --queue-name celery > /dev/null 2> /dev/null
if aws sqs get-queue-url --queue-name celery;
then
echo "SQS Queue 'celery' is healthy and exists."
sqs_status="HEALTHY"
else
echo "SQS Queue 'celery' is unhealthy or does not exists."
sqs_status="UNHEALTHY";
exit_code=1;
fi
Expand All @@ -27,4 +36,4 @@ jq ".version=\"$GIT_COMMIT\" | (.dependencies[] | select(.name==\"request-db\"))

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 09aab99

Please sign in to comment.