Docker healthcheck for Flask app with Celery
With docker-compose it can be done the next way
flask_app:
...
healthcheck:
test: wget --spider --quiet http://localhost:8080/-/health
celery_worker:
...
command: celery worker --app app.celeryapp -n worker@%h --loglevel INFO
healthcheck:
test: celery inspect ping --app app.celeryapp -d worker@$$HOSTNAME
Where /-/health
is just a simple route
@app.route("/-/health")
def health():
return 'ok'