-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathentrypoint.sh
More file actions
34 lines (29 loc) · 967 Bytes
/
Copy pathentrypoint.sh
File metadata and controls
34 lines (29 loc) · 967 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/sh
# Common boot for every Django container: web, task-worker, task-scheduler.
# Apply migrations first so workers don't race the schema. Then dispatch:
# - no argv → web (uWSGI)
# - any argv → exec it (worker / scheduler / one-off command)
set -e
python manage.py migrate --noinput
if [ "$#" -gt 0 ]; then
exec "$@"
fi
# Ensure the uWSGI logfile exists so tail -F doesn't print a spurious warning.
touch /var/log/uwsgi.log
# Stream uWSGI logs to stdout for `docker logs`.
tail -F /var/log/uwsgi.log &
exec uwsgi --http :80 \
--wsgi-file /app/website/wsgi.py \
--master \
--processes 4 \
--threads 2 \
--enable-threads \
--py-call-uwsgi-fork-hooks \
--uid nobody \
--gid nogroup \
--static-map ${DJANGO_STATIC_URL}=${DJANGO_STATIC_ROOT} \
--static-map ${DJANGO_MEDIA_URL}=${DJANGO_MEDIA_ROOT} \
--logto /var/log/uwsgi.log \
--log-date \
--log-4xx \
--log-5xx