diff --git a/Dockerfile b/Dockerfile index c8a922f5..b5bd1207 100644 --- a/Dockerfile +++ b/Dockerfile @@ -59,6 +59,7 @@ ENV DEBUG="True" ENV SECRET_KEY="change-me-in-production" ENV PORT="8000" ENV WORKERS="2" +ENV CELERY_WORKERS="2" ENV GOOGLE_TRACKING_ID="" ENV AZURE_APPINSIGHTS_IKEY="" diff --git a/tools/run.sh b/tools/run.sh index 8c8da596..39fde591 100755 --- a/tools/run.sh +++ b/tools/run.sh @@ -26,4 +26,21 @@ if [[ -n "${ADMIN_USERNAME}" ]] && [[ -n "${ADMIN_PASSWORD}" ]] && [[ -n "${ADMI fi echo "Starting django" -gunicorn --bind="0.0.0.0:${PORT:-8000}" --workers="${WORKERS:-4}" app.wsgi --timeout 300 +# gunicorn --bind="0.0.0.0:${PORT:-8000}" --workers="${WORKERS:-4}" app.wsgi --timeout 300 +gunicorn --bind="0.0.0.0:${PORT:-8000}" --workers="${WORKERS:-1}" app.wsgi --timeout=300 & +gunicorn_pid="$!" + +celery --app=app worker --loglevel=INFO --concurrency="${CELERY_WORKERS:-1}" & +celery_pid="$!" + +while :; do + if [[ ! -e "/proc/${celery_pid}" ]]; then + echo "celery crashed" >&2 + exit 1 + elif [[ ! -e "/proc/${gunicorn_pid}" ]]; then + echo "gunicorn crashed" >&2 + exit 2 + else + sleep 10 + fi +done \ No newline at end of file