@@ -26,46 +26,38 @@ export UWSGI_CHDIR="src"
26
26
export UWSGI_STATIC_MAP=" /static=/app/static /media=/app/media"
27
27
28
28
# --- Process Management
29
- export UWSGI_MASTER=true
29
+ # Allow for better worker coordination and graceful shutdowns for unresponsive workers
30
+ export UWSGI_MASTER=1
30
31
export UWSGI_PROCESSES=${UWSGI_PROCESSES:- 4}
31
32
export UWSGI_THREADS=${UWSGI_THREADS:- 8}
32
33
33
- # Shutdown gracefully on SIGTERM (common with supervisord and k8s)
34
- export UWSGI_DIE_ON_TERM=true
34
+ # Shutdown gracefully on SIGTERM, which is used by both Docker and k8s to stop containers
35
+ export UWSGI_DIE_ON_TERM=1
35
36
36
- # We're not hosting multiple apps, so no isolation required
37
- export UWSGI_SINGLE_INTERPRETER=true
37
+ # We're not hosting multiple apps, so no interpreter isolation should be required
38
+ export UWSGI_SINGLE_INTERPRETER=1
38
39
39
- # Enable Python threading
40
- export UWSGI_ENABLE_THREADS=true
40
+ # Enable Python threading support
41
+ export UWSGI_ENABLE_THREADS=1
41
42
42
- # --- HTTP Server Settings
43
+ # --- HTTP Settings
44
+ # Use http rather than wsgi protocol (also note that UWSGI_PORT is not a native uwsgi option).
43
45
export UWSGI_HTTP=${UWSGI_PORT:- 8000}
46
+ export UWSGI_HTTP_KEEPALIVE=${UWSGI_HTTP_KEEPALIVE:- 1}
44
47
export UWSGI_HTTP_TIMEOUT=${UWSGI_HTTP_TIMEOUT:- 120}
45
- export UWSGI_HTTP_KEEPALIVE=true
48
+
49
+ # Hard-kill requests after 125 seconds (slightly longer than the default timeout)
50
+ export UWSGI_HARAKIRI=${UWSGI_HARAKIRI:- 125}
51
+
52
+ # Periodically recycle workers
53
+ export UWSGI_MAX_REQUESTS=${UWSGI_MAX_REQUESTS:- 100}
46
54
47
55
# --- Request Handling
48
- # Buffer size for POST requests
49
- export UWSGI_POST_BUFFERING=8192
50
-
51
- # Internal buffer size
52
- export UWSGI_BUFFER_SIZE=65535
53
-
54
- # --- Worker Lifecycle
55
- # Make UWSGI_MAX_REQUESTS explicitly opt-in
56
- if [ -n " ${UWSGI_MAX_REQUESTS+x} " ]; then
57
- if [ " $UWSGI_MAX_REQUESTS " -gt 1 ] 2> /dev/null; then
58
- export UWSGI_MAX_REQUESTS
59
- else
60
- echo " Warning: UWSGI_MAX_REQUESTS must be greater than 1. The variable will be unset."
61
- unset UWSGI_MAX_REQUESTS
62
- fi
63
- else
64
- unset UWSGI_MAX_REQUESTS
65
- fi
66
-
67
- # Hard-kill requests after 60 seconds
68
- export UWSGI_HARAKIRI=${UWSGI_HARAKIRI:- 60}
56
+ # Buffer size for POST requests (in bytes)
57
+ export UWSGI_POST_BUFFERING=${UWSGI_POST_BUFFERING:- 8192}
58
+
59
+ # Internal buffer size (in bytes)
60
+ export UWSGI_BUFFER_SIZE=${UWSGI_BUFFER_SIZE:- 65535}
69
61
70
62
# Start Server
71
63
>&2 echo " Starting server"
0 commit comments