PyInventory/deployment/django/entrypoint.sh

45 wiersze
753 B
Bash
Czysty Zwykły widok Historia

2020-10-26 17:00:02 +00:00
#!/bin/sh
set -e
restart_error_handler() {
(
echo "Restart ${0} in 3 sec..."
sleep 1
echo "Restart ${0} in 2 sec..."
sleep 1
echo "Restart ${0} in 1 sec..."
sleep 1
)
exec ${0}
}
trap restart_error_handler 0
echo "_______________________________________________________________________"
echo "$(date +%c) - ${0}"
if [ -d "/dist/" ] ; then
(
set -x
pip3 install -U /dist/*.whl
)
else
(
set -x
pip3 install -U "${PYTHON_PACKAGE_NAME}"
)
fi
2020-10-26 17:00:02 +00:00
(
set -x
./manage.py collectstatic --noinput
./manage.py migrate
2020-11-22 11:45:50 +00:00
gunicorn wsgi --bind "$(hostname):8000"
echo "gunicorn terminated with exit code: $?"
2020-10-26 17:00:02 +00:00
sleep 3
exit 1
)
exit 2