Skip to content

Commit

Permalink
Remove max-requests and add die-on-term uwsgi flag from docker start …
Browse files Browse the repository at this point in the history
…script

We've been seeing issues in k8s whereby the uwsgi pod would hang after 10 minutes and
persist in a "Terminated" state. The theory is that the max_requests limit is reached,
uwsgi tries to restart and k8s interprets this as a failing pod that needs to be
replaced, but never is because k8s sends SIGTERM and uwsgi ignores this without the
--die-on-term flag. This addresses both issues.
  • Loading branch information
swrichards committed Dec 10, 2024
1 parent 06541ab commit a7ced2c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions bin/docker_start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ uwsgi_port=${UWSGI_PORT:-8000}
uwsgi_processes=${UWSGI_PROCESSES:-4}
uwsgi_threads=${UWSGI_THREADS:-8}
uwsgi_http_timeout=${UWSGI_HTTP_TIMEOUT:-120}
uwsgi_max_requests=${UWSGI_MAX_REQUESTS:-100}

# Apply database migrations
>&2 echo "Apply database migrations"
Expand All @@ -25,9 +24,9 @@ python src/manage.py migrate
# Start server
>&2 echo "Starting server"
exec uwsgi \
--die-on-term \
--http :$uwsgi_port \
--http-keepalive \
--max-requests $uwsgi_max_requests \
--http-timeout $uwsgi_http_timeout \
--module open_inwoner.wsgi \
--static-map /static=/app/static \
Expand Down

0 comments on commit a7ced2c

Please sign in to comment.