med/entrypoint.sh

32 lines
973 B
Bash
Raw Normal View History

2020-02-02 17:22:28 +00:00
#!/bin/bash
2020-02-09 13:18:39 +00:00
# This will launch the Django project as a fastcgi socket
# then Apache or NGINX will be able to use that socket
2020-02-11 20:39:08 +00:00
# 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
2020-02-02 17:22:28 +00:00
python manage.py makemigrations
2020-02-09 13:18:39 +00:00
# Wait for database
2020-02-02 22:13:39 +00:00
sleep 2
2020-02-09 13:18:39 +00:00
2020-02-02 17:22:28 +00:00
python manage.py migrate
2020-02-09 14:29:05 +00:00
python manage.py collectstatic --no-input
2020-02-02 17:22:28 +00:00
2020-02-09 14:26:34 +00:00
# harakiri parameter respawns processes taking more than 20 seconds
# max-requests parameter respawns processes after serving 5000 requests
# vacuum parameter cleans up when stopped
2020-02-10 16:51:49 +00:00
uwsgi --chdir="$(pwd)" \
--module=med.wsgi:application \
--env DJANGO_SETTINGS_MODULE=med.settings \
--master \
--pidfile="$(pwd)/uwsgi.pid" \
--socket="$(pwd)/uwsgi.sock" \
--processes=5 \
--chmod-socket=600 \
--harakiri=20 \
--max-requests=5000 \
--vacuum \
--daemonize="$(pwd)/uwsgi.log" \
2020-05-12 15:43:14 +00:00
--protocol=fastcgi