-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathentrypoint.sh
executable file
·34 lines (30 loc) · 1.13 KB
/
entrypoint.sh
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/bash
mkdir -p logs
touch ./logs/gunicorn.log
touch ./logs/gunicorn-access.log
tail -n 0 -f ./logs/gunicorn*.log &
SETTINGS_FILE="/settings.py"
if [ -f "$SETTINGS_FILE" ]
then
echo "using runtime settings from $SETTINGS_FILE."
ln -s $SETTINGS_FILE ./src/hbscorez/settings_runtime.py
export DJANGO_SETTINGS_MODULE=hbscorez.settings_runtime
fi
export PYTHONUNBUFFERED=1
pipenv run ./src/manage.py migrate || { echo "could not apply migrations. stopping startup.. "; exit 5; }
pipenv run ./src/manage.py correct_data || { echo "could not correct_data. stopping startup.. "; exit 6; }
if [[ -z "${GUNICORN_WORKERS}" ]]; then
echo "no gunicorn workers specified -> running with dev server"
exec pipenv run ./src/manage.py runserver 0.0.0.0:8000 "$@"
else
pipenv run ./src/manage.py collectstatic --noinput
exec pipenv run gunicorn hbscorez.wsgi:application \
--chdir src \
--name hbscorez_django \
--bind 0.0.0.0:8000 \
--workers "$GUNICORN_WORKERS" \
--log-level=info \
--log-file=../logs/gunicorn.log \
--access-logfile=../logs/gunicorn-access.log \
"$@"
fi