@@ -12,29 +12,61 @@ ${SCRIPTPATH}/wait_for_db.sh
12
12
13
13
# fixtures_dir=${FIXTURES_DIR:-/app/fixtures}
14
14
15
- uwsgi_port=${UWSGI_PORT:- 8000}
16
- uwsgi_processes=${UWSGI_PROCESSES:- 4}
17
- uwsgi_threads=${UWSGI_THREADS:- 8}
18
- uwsgi_http_timeout=${UWSGI_HTTP_TIMEOUT:- 120}
19
-
20
15
# Apply database migrations
21
16
>&2 echo " Apply database migrations"
22
17
python src/manage.py migrate
23
18
24
- # Start server
19
+ # #
20
+ # uWSGI settings
21
+ # #
22
+
23
+ # --- Basic Application Configuration
24
+ export UWSGI_MODULE=" open_inwoner.wsgi"
25
+ export UWSGI_CHDIR=" src"
26
+ export UWSGI_STATIC_MAP=" /static=/app/static /media=/app/media"
27
+
28
+ # --- Process Management
29
+ export UWSGI_MASTER=true
30
+ export UWSGI_PROCESSES=${UWSGI_PROCESSES:- 4}
31
+ export UWSGI_THREADS=${UWSGI_THREADS:- 8}
32
+
33
+ # Shutdown gracefully on SIGTERM (common with supervisord and k8s)
34
+ export UWSGI_DIE_ON_TERM=true
35
+
36
+ # We're not hosting multiple apps, so no isolation required
37
+ export UWSGI_SINGLE_INTERPRETER=true
38
+
39
+ # Enable Python threading
40
+ export UWSGI_ENABLE_THREADS=true
41
+
42
+ # --- HTTP Server Settings
43
+ export UWSGI_HTTP=${UWSGI_PORT:- 8000}
44
+ export UWSGI_HTTP_TIMEOUT=${UWSGI_HTTP_TIMEOUT:- 120}
45
+ export UWSGI_HTTP_KEEPALIVE=true
46
+
47
+ # --- 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}
69
+
70
+ # Start Server
25
71
>&2 echo " Starting server"
26
- exec uwsgi \
27
- --die-on-term \
28
- --http :$uwsgi_port \
29
- --http-keepalive \
30
- --http-timeout $uwsgi_http_timeout \
31
- --module open_inwoner.wsgi \
32
- --static-map /static=/app/static \
33
- --static-map /media=/app/media \
34
- --chdir src \
35
- --enable-threads \
36
- --processes $uwsgi_processes \
37
- --threads $uwsgi_threads \
38
- --post-buffering=8192 \
39
- --buffer-size=65535
40
- # processes & threads are needed for concurrency without nginx sitting inbetween
72
+ exec uwsgi --show-config --strict
0 commit comments