This repository has been archived by the owner on Dec 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathstart.sh
executable file
·71 lines (64 loc) · 1.73 KB
/
start.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# start.sh
export FLASK_APP=app
# export FLASK_ENV=development
export prometheus_multiproc_dir=/tmp
export ES_HOST_URL=http://lad-elasticsearch-service-aiops-prod-prometheus-scrape.cloud.paas.psi.redhat.com
# Gunicorn environment variables
GUNICORN_BIND=0.0.0.0:8088
GUNICORN_LIMIT_REQUEST_FIELD_SIZE=0
GUNICORN_LIMIT_REQUEST_LINE=0
GUNICORN_TIMEOUT=60
GUNICORN_WORKERS=2
LANG=C.UTF-8
LC_ALL=C.UTF-8
PYTHONPATH=/etc/superset:/opt/superset/work-dir:$PYTHONPATH
AD_DEMO_REPO=${AD_DEMO_REPO_OWNER}/${AD_DEMO_NAME}
AD_DEMO_NAME=${AD_DEMO_NAME}
AD_DEMO_HOME=/var/lib/ad_demo
export GUNICORN_CMD_ARGS="--workers ${GUNICORN_WORKERS} --timeout ${GUNICORN_TIMEOUT} --bind ${GUNICORN_BIND} --limit-request-line ${GUNICORN_LIMIT_REQUEST_LINE} --limit-request-field_size ${GUNICORN_LIMIT_REQUEST_FIELD_SIZE} --config=config.py"
function main(){
PROD="false"
DEVMODE="false"
while getopts "hdp" opt; do
case ${opt} in
h)
usage
exit 0
;;
d)
DEVMODE="true"
;;
p)
PROD="true"
;;
\?)
echo "Invalid option" >&2
usage
exit 1
;;
esac
done
shift "$((OPTIND-1))"
if [[ "$DEVMODE" == "true" ]] && [[ "$PROD" == "true" ]]; then
echo "Please specify only one of -p or -d "
elif [[ "$DEVMODE" == "true" ]]; then
flask run
elif [[ "$PROD" == "true" ]]; then
gunicorn "app:create_app()"
else
echo "No -d (devmode) or -p (production) mode specified"
exit 1
fi
}
function usage() {
echo
echo "Run demo app."
echo
echo "Usage: ./start.sh [-d|-p]"
echo
echo "optional arguments:"
echo " -d Run flask in devmode"
echo " -p Run flask using gunicorn in production mode."
}
main $@
exit $?