-
Notifications
You must be signed in to change notification settings - Fork 1
/
runapp.sh
executable file
·81 lines (64 loc) · 2.05 KB
/
runapp.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
72
73
74
75
76
77
78
79
80
#!/bin/bash
#Bash Script to act as an entrypoint to help us decide if we want to debug the app or run the app
SCRIPT_NAME=$(basename "$0")
function production_run() {
gunicorn -c $APP_CONFIG $APP_MODULE
}
function determine_python_version() {
echo "determine python vers"
}
function simple_format_msg_echo() {
echo "$(date) ${SCRIPT_NAME} ${1}"
}
function check_debug_address() {
temp_debug_address=${DEBUG_ADDRESS}
if [ -z "$DEBUG_ADDRESS" ]
then
temp_debug_address='0.0.0.0'
fi
echo $temp_debug_address
}
function check_flask_port() {
temp_flask_port=${FLASK_PORT}
if [ -z "$FLASK_PORT" ]
then
temp_flask_port=8080
fi
echo $temp_flask_port
}
simple_format_msg_echo "Starting Entrypoint Script"
if [ ! -z "$REMOTE_DEBUG" ] && [ "$REMOTE_DEBUG" = "true" ]
then
simple_format_msg_echo "Remote Debugging Enabled for Application Entry"
DEBUG_ADDRESS=$(check_debug_address)
simple_format_msg_echo "Debug Address: ${DEBUG_ADDRESS}"
if [ -z "$DEBUG_PORT" ]
then
simple_format_msg_echo "Debug Port not provided"
simple_format_msg_echo "Will run gunicorn provided option"
production_run
fi
export FLASK_HOST=${DEBUG_ADDRESS}
export FLASK_PORT=$(check_flask_port)
simple_format_msg_echo "Flask Host: ${FLASK_HOST}"
simple_format_msg_echo "Flask Port: ${FLASK_PORT}"
simple_format_msg_echo "Debug Port: ${DEBUG_PORT}"
simple_format_msg_echo "Debug Address: ${DEBUG_ADDRESS}"
python3 ./runapp.py
elif [ -n "$ODO_DEBUG" ] && [ "$ODO_DEBUG" = "true" ]
then
simple_format_msg_echo "ODO Debugging Enabled for Application Entry"
if [ -z "$DEBUG_PORT" ]
then
simple_format_msg_echo "Debug Port not provided"
simple_format_msg_echo "Will run gunicorn provided option"
production_run
else
export FLASK_HOST=$(check_debug_address)
export FLASK_PORT=$DEBUG_PORT
python3 ./runapp.py
fi
else
simple_format_msg_echo "No Debugging Enabled for Application Entry"
production_run
fi