PyInventory/deployment/django/entrypoint.sh

47 wiersze
814 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 "${PROJECT_PACKAGE_NAME}>=${PROJECT_VERSION}"
)
fi
2020-10-26 17:00:02 +00:00
(
set -x
./manage.py collectstatic --noinput
./manage.py migrate
su django -c "/usr/local/bin/gunicorn --config /django/gunicorn.conf.py wsgi"
2020-11-22 12:39:00 +00:00
2020-11-22 11:45:50 +00:00
echo "gunicorn terminated with exit code: $?"
2020-10-26 17:00:02 +00:00
sleep 3
exit 1
)
exit 2