Skip to content

Commit

Permalink
Fix celery beat healthchecks (#1836)
Browse files Browse the repository at this point in the history
* fix celery beat healthchecks

* fix prebuilt docker compose
  • Loading branch information
sainak authored Jan 18, 2024
1 parent a5c790c commit 20fc591
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
1 change: 0 additions & 1 deletion docker-compose.pre-built.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,3 @@ services:
depends_on:
- db
- redis
- celery-beat
1 change: 1 addition & 0 deletions scripts/celery_beat-ecs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@ done
python manage.py migrate --noinput
python manage.py load_redis_index

touch /tmp/healthy

celery --app=config.celery_app beat --loglevel=info
1 change: 1 addition & 0 deletions scripts/celery_beat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ done
python manage.py migrate --noinput
python manage.py load_redis_index

touch /tmp/healthy

export NEW_RELIC_CONFIG_FILE=/etc/newrelic.ini
newrelic-admin run-program celery --app=config.celery_app beat --loglevel=info
7 changes: 6 additions & 1 deletion scripts/healthcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
CONTAINER_ROLE=$(cat /tmp/container-role)
if [[ "$CONTAINER_ROLE" = "api" ]]; then
curl -fsS http://localhost:9000/ping/ || exit 1
elif [[ "$CONTAINER_ROLE" == celery* ]]; then
elif [[ "$CONTAINER_ROLE" == "celery-worker" ]]; then
celery -A config.celery_app inspect ping -d celery@$HOSTNAME || exit 1
elif [[ "$CONTAINER_ROLE" == "celery-beat" ]]; then
ls /tmp/healthy || exit 1
else
echo "Unknown container role: $CONTAINER_ROLE"
exit 1
fi

0 comments on commit 20fc591

Please sign in to comment.