diff --git a/request-processor/docker-entrypoint.sh b/request-processor/docker-entrypoint.sh index b489785..26ce4ac 100755 --- a/request-processor/docker-entrypoint.sh +++ b/request-processor/docker-entrypoint.sh @@ -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 diff --git a/request-processor/docker-healthcheck.sh b/request-processor/docker-healthcheck.sh index bbd776c..52966ef 100755 --- a/request-processor/docker-healthcheck.sh +++ b/request-processor/docker-healthcheck.sh @@ -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 @@ -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 \ No newline at end of file +# Note use of > /dev/null 2> /dev/null which suppresses stout and stderr