Skip to content

Commit

Permalink
Adding better healthcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
bitbyt3r committed Aug 13, 2023
1 parent 3bdc904 commit 40c5e3d
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions healthcheck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

# This provides simple health checks for use in docker/k8s/etc.
# Pass the task run by this container and it will exit non-zero if something is wrong
# I.e. ./healthcheck.sh uber
set -e

# If no arguments are passed grab the current CMD from the entrypoint
CMD="${1:-$(cat /proc/1/cmdline | strings -1 | tail -1)}"

if [ "$CMD" = 'uber' ]; then
curl --fail http://$HOST:$PORT/uber/devtools/health
elif [ "$CMD" = 'celery-beat' ]; then
# Beat seems to do a good job of dying when things go wrong.
# If you know a good way to test its health please put it here.
exit 0
elif [ "$CMD" = 'celery-worker' ]; then
cd /app
/app/env/bin/celery --config celeryconf inspect ping -d celery@$(cat /etc/hostname)
fi

0 comments on commit 40c5e3d

Please sign in to comment.