From 775ec6424b747bcbed66ea3088f369375c2eea41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Kucharczyk?= Date: Sun, 1 Oct 2023 19:57:15 +0200 Subject: [PATCH] Try to shutdown container gracefully and faster --- entrypoint.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 13196d5..3ec572c 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -7,5 +7,13 @@ poetry run python manage.py migrate echo "Collect static files" poetry run python manage.py collectstatic --clear --no-input +_term() { + echo "Caught SIGTERM signal!" + kill -SIGTERM "$gunicorn_pid" +} +trap _term SIGTERM + echo "Starting app" -poetry run python -m gunicorn --bind 0.0.0.0:8001 timetracker.asgi:application -k uvicorn.workers.UvicornWorker --access-logfile - --error-logfile - +poetry run python -m gunicorn --bind 0.0.0.0:8001 timetracker.asgi:application -k uvicorn.workers.UvicornWorker --access-logfile - --error-logfile - & gunicorn_pid=$! + +wait "$gunicorn_pid"