django-helpdeskmig/standalone/entrypoint.sh

28 lines
853 B
Bash
Raw Normal View History

#!/bin/bash
2023-09-25 22:30:51 +02:00
# Install extra deps from /opt/extra-deps.txt if it exists
if [ -f /opt/extra-dependencies.txt ]; then
pip install -r /opt/extra-dependencies.txt
fi
cd /opt/django-helpdesk/standalone/
if python manage.py showmigrations | grep '\[ \]\|^[a-z]' | grep '[ ]' -B 1; then
python manage.py migrate --noinput # Apply database migrations
fi
# Starting cron to check emails
printenv > /etc/env
env | awk -F= '{printf "export %s=\"%s\"\n", $1, $2}' > /etc/env
cron &&
# Start Gunicorn processes
echo Starting Gunicorn.
exec gunicorn standalone.config.wsgi:application \
--name django-helpdesk \
--bind 0.0.0.0:${GUNICORN_PORT:-"8000"} \
--workers ${GUNICORN_NUM_WORKERS:-"6"} \
--timeout ${GUNICORN_TIMEOUT:-"60"} \
--preload \
--log-level=debug \
--log-file=- \
--access-logfile=- \
"$@"