-
Notifications
You must be signed in to change notification settings - Fork 14
/
start-service-prod.sh
39 lines (31 loc) · 1.14 KB
/
start-service-prod.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
#!/bin/bash
# check the gunicorn config params
#
if [ -z ${SERVER_HOST+x} ]; then
SERVER_HOST=0.0.0.0;
echo "SERVER_HOST is unset -- setting to default: $SERVER_HOST";
fi
if [ -z ${SERVER_PORT+x} ]; then
SERVER_PORT=5000;
echo "SERVER_PORT is unset -- setting to default: $SERVER_PORT";
fi
if [ -z ${SERVER_WORKERS+x} ]; then
SERVER_WORKERS=1;
echo "SERVER_WORKERS is unset -- setting to default: $SERVER_WORKERS";
fi
if [ -z ${SERVER_THREADS+x} ]; then
SERVER_THREADS=1;
echo "SERVER_THREADS is unset -- setting to default: $SERVER_THREADS";
fi
if [ -z ${SERVER_WORKER_TIMEOUT+x} ]; then
SERVER_WORKER_TIMEOUT=3600;
echo "SERVER_WORKER_TIMEOUT is unset -- setting to default (sec): $SERVER_WORKER_TIMEOUT";
fi
SERVER_ACCESS_LOG_FORMAT="%(t)s [ACCESSS] %(h)s \"%(r)s\" %(s)s \"%(f)s\" \"%(a)s\""
# start the server
#
echo "Starting up Flask app using gunicorn server ..."
gunicorn --bind $SERVER_HOST:$SERVER_PORT --workers=$SERVER_WORKERS --threads=$SERVER_THREADS --timeout=$SERVER_WORKER_TIMEOUT \
--access-logformat="$SERVER_ACCESS_LOG_FORMAT" --access-logfile=- --log-file=- --log-level info \
--config /cat/config.py \
wsgi