-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathuserve
executable file
·61 lines (55 loc) · 1.2 KB
/
userve
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
#!/bin/bash
set -e
set -u
development=true
module="mokacms.wsgi"
pyhome=""
uwsgi="uwsgi"
function usage() {
def_msg=""
echo ${1-$def_msg}
echo "$0 [-p] [-m <module>] [-H <virtual_env>] <ini_file>"
echo
echo "-p : disable development options (reload, etc) and enable multiprocessing"
echo "-m : wsgi module to run. defaults to 'mokacms.wsgi'"
echo "-H : path to the virtualenv. If omitted, \$VIRTUAL_ENV is used (if any)."
echo "-u : uwsgi binary (default: search in \$PATH)."
exit ${2-0}
}
[ -z $VIRTUAL_ENV ] || pyhome="--pyhome $VIRTUAL_ENV"
while getopts ":u:pm:H:h" opt; do
case $opt in
p)
development=false
;;
m)
module=$OPTARG
;;
H)
pyhome="--pyhome $OPTARG"
;;
h)
usage "Serve MokaCMS using uWSGI"
;;
u)
uwsgi="$OPTARG"
;;
\?)
echo "Invalid option -$OPTARG" >&2
exit 100
;;
:)
echo "Option -$OPTARG requires an argument" >&2
exit 101
;;
esac
done
[ $# -lt $OPTIND ] && usage "Missing ini file."
ini=$(realpath ${!OPTIND})
opts="--ini $ini --module $module $pyhome --single-interpreter --lazy"
if $development; then
opts="$opts --py-auto-reload 1 --disable-logging --touch-reload $ini"
fi
cmd="$uwsgi $opts"
echo "Starting uWSGI: $cmd"
USERVE_PASTE_INI="$ini" $cmd