1
0
mirror of https://gitlab.crans.org/mediatek/med.git synced 2024-11-26 18:07:10 +00:00
med/entrypoint.sh
2020-09-23 17:37:55 +02:00

27 lines
986 B
Bash
Executable File

#!/bin/bash
# This will launch the Django project as a fastcgi socket
# then Apache or NGINX will be able to use that socket
# Option "-i" will be only available in Django 3.0+, but it does not support Python 3.5
#python manage.py compilemessages -i ".tox" -i "venv"
python manage.py compilemessages
# Wait for database (docker)
sleep 2
python manage.py migrate
python manage.py collectstatic --no-input
# harakiri parameter respawns processes taking more than 20 seconds
# max-requests parameter respawns processes after serving 5000 requests
# vacuum parameter cleans up when stopped
uwsgi --socket "$(pwd)/uwsgi.sock" --chmod-socket=600 --master --plugins python3 \
--module med.wsgi:application --env DJANGO_SETTINGS_MODULE=med.settings \
--processes 4 --harakiri=20 --max-requests=5000 --vacuum \
--static-map /static="$(pwd)/static"
#uwsgi --chdir="$(pwd)" \
# --pidfile="$(pwd)/uwsgi.pid" \
# --daemonize="$(pwd)/uwsgi.log" \
# --protocol=fastcgi