-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathentrypoint.sh
executable file
·23 lines (20 loc) · 1 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
#!/bin/bash
# copy example settings.py into place only if it doesn't already exist
# this allows production to maintain it's own unique settings.py
if [ ! -f clusterCAD/settings.py ]; then
echo "settings.py not found, copying in example file"
cp clusterCAD/example_settings.py clusterCAD/settings.py
else
echo "existing settings.py file found, delete this first if you want to use the example version"
fi
python3 manage.py migrate --noinput
python3 manage.py collectstatic --noinput
# if we are in production, start 5 gunicorn workers without
# reload, if we are in development start only two, with reload
if grep --quiet "DEBUG = True" clusterCAD/settings.py; then
echo "starting development gunicorn"
/usr/local/bin/gunicorn clusterCAD.wsgi:application -w 2 -b :8000 --reload -t 120 --graceful-timeout 120 --limit-request-line 0
else
echo "starting production gunicorn"
/usr/local/bin/gunicorn clusterCAD.wsgi:application -w 5 -b :8000 -t 120 --graceful-timeout 120 --limit-request-line 0
fi