代码拉取完成,页面将自动刷新
#!/bin/bash
RED='\033[0;31m'
GREEN='\033[32;1m'
NC='\033[0m' # No Color
function database_ready() {
if [ "${DB_TYPE}" == "mysql" ]; then
if mysql -h${MYSQL_HOST:-127.0.0.1} -P${MYSQL_PORT:-3306} -u${MYSQL_USER} -p${MYSQL_PASS} -e "use ${MYSQL_DB};" >/dev/null; then
return 0 # 0 = true
fi
return 1 # 1 = false
fi
return 0
}
if [ "$1" = "debug" -o "$1" = "bash" ]; then
exec /bin/bash
elif [ "$1" = "version" ]; then
echo "${RELEASE_DESC}"
else
for i in {1..4}; do
if ! (database_ready); then
echo -e "${RED}Database not ready, will waiting${NC}"
sleep 3
else
break
fi
done
if ! (database_ready); then
echo -e "${RED}Database not ready, will exit.${NC}"
exit 1
fi
echo -e "${GREEN}Start initializing database${NC}"
if ! (python manage.py makemigrations www 2>/dev/null); then
echo -e "${RED}failed to makemigrations www${NC}"
exit 1
fi
if ! (python manage.py makemigrations console 2>/dev/null); then
echo -e "${RED}failed to makemigrations console${NC}"
exit 1
fi
if ! (python manage.py migrate >/dev/null); then
echo -e "${RED}failed to migrate${NC}"
exit 1
fi
echo -e "${GREEN}Database initialization completed${NC}"
# python upgrade.py
exec gunicorn goodrain_web.wsgi -b 0.0.0.0:${PORT:-7070} --max-requests=5000 -k gevent --reload --workers=4 --timeout=75 --log-file - --access-logfile - --error-logfile -
fi
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。