0001-debian-switch-to-uwsgi-13060.patch
debian/control | ||
---|---|---|
27 | 27 |
python-django-tenant-schemas, |
28 | 28 |
python-psycopg2, |
29 | 29 |
python-django-mellon, |
30 |
gunicorn |
|
30 |
uwsgi, |
|
31 |
uwsgi-plugin-python |
|
31 | 32 |
Recommends: nginx, graphicsmagick |
32 | 33 |
Suggests: postgresql |
33 | 34 |
Description: Fargo Document Box |
debian/fargo.init | ||
---|---|---|
16 | 16 |
PATH=/sbin:/usr/sbin:/bin:/usr/bin |
17 | 17 |
DESC="Document Box" |
18 | 18 |
NAME=fargo |
19 |
DAEMON=/usr/bin/gunicorn
|
|
19 |
DAEMON=/usr/bin/uwsgi
|
|
20 | 20 |
RUN_DIR=/run/$NAME |
21 | 21 |
PIDFILE=$RUN_DIR/$NAME.pid |
22 | 22 |
LOG_DIR=/var/log/$NAME |
23 | 23 |
SCRIPTNAME=/etc/init.d/$NAME |
24 | 24 |
BIND=unix:$RUN_DIR/$NAME.sock |
25 |
WORKERS=5 |
|
26 |
TIMEOUT=30 |
|
27 | 25 | |
28 | 26 |
FARGO_SETTINGS_FILE=/usr/lib/$NAME/debian_config.py |
29 | 27 |
MANAGE_SCRIPT="/usr/bin/$NAME-manage" |
... | ... | |
37 | 35 |
# Read configuration variable file if it is present |
38 | 36 |
[ -r /etc/default/$NAME ] && . /etc/default/$NAME |
39 | 37 | |
40 |
DAEMON_ARGS=${DAEMON_ARGS:-"--pid $PIDFILE \ |
|
41 |
--user $USER --group $GROUP \ |
|
42 |
--daemon \ |
|
43 |
--access-logfile $LOG_DIR/gunicorn-access.log \ |
|
44 |
--log-file $LOG_DIR/gunicorn-error.log \ |
|
45 |
--bind=$BIND \ |
|
46 |
--workers=$WORKERS \ |
|
47 |
--worker-class=sync \ |
|
48 |
--timeout=$TIMEOUT \ |
|
49 |
--name $NAME \ |
|
50 |
$NAME.wsgi:application"} |
|
38 |
DAEMON_ARGS=${DAEMON_ARGS:-"--pidfile=$PIDFILE |
|
39 |
--uid $USER --gid $GROUP |
|
40 |
--ini /etc/$NAME/uwsgi.ini |
|
41 |
--daemonize /var/log/uwsgi.$NAME.log"} |
|
51 | 42 | |
52 | 43 |
# Load the VERBOSE setting and other rcS variables |
53 | 44 |
. /lib/init/vars.sh |
... | ... | |
73 | 64 |
# 0 if daemon has been started |
74 | 65 |
# 1 if daemon was already running |
75 | 66 |
# 2 if daemon could not be started |
76 |
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \ |
|
77 |
|| return 1 |
|
78 |
start-stop-daemon --start --quiet --exec $DAEMON -- \ |
|
67 |
start-stop-daemon --start --quiet --user $USER --exec $DAEMON -- \ |
|
79 | 68 |
$DAEMON_ARGS \ |
80 | 69 |
|| return 2 |
81 | 70 |
} |
... | ... | |
90 | 79 |
# 1 if daemon was already stopped |
91 | 80 |
# 2 if daemon could not be stopped |
92 | 81 |
# other if a failure occurred |
93 |
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE |
|
94 |
RETVAL="$?" |
|
95 |
[ "$RETVAL" = 2 ] && return 2 |
|
96 |
# Wait for children to finish too if this is a daemon that forks |
|
97 |
# and if the daemon is only ever run from this initscript. |
|
98 |
# If the above conditions are not satisfied then add some other code |
|
99 |
# that waits for the process to drop all resources that could be |
|
100 |
# needed by services started subsequently. A last resort is to |
|
101 |
# sleep for some time. |
|
102 |
start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON |
|
103 |
[ "$?" = 2 ] && return 2 |
|
104 |
# Many daemons don't delete their pidfiles when they exit. |
|
82 |
$DAEMON --stop $PIDFILE |
|
105 | 83 |
rm -f $PIDFILE |
106 |
return "$RETVAL"
|
|
84 |
return 0 # hopefully
|
|
107 | 85 |
} |
108 | 86 | |
109 | 87 |
# |
110 | 88 |
# Function that sends a SIGHUP to the daemon/service |
111 | 89 |
# |
112 | 90 |
do_reload() { |
113 |
# |
|
114 |
# If the daemon can reload its configuration without |
|
115 |
# restarting (for example, when it is sent a SIGHUP), |
|
116 |
# then implement that here. |
|
117 |
# |
|
118 |
start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name `basename $DAEMON` |
|
91 |
$DAEMON --reload $PIDFILE |
|
119 | 92 |
return 0 |
120 | 93 |
} |
121 | 94 | |
... | ... | |
131 | 104 |
log_action_msg "done" |
132 | 105 |
} |
133 | 106 | |
134 | ||
135 | 107 |
case "$1" in |
136 | 108 |
start) |
137 | 109 |
log_daemon_msg "Starting $DESC " "$NAME" |
... | ... | |
152 | 124 |
esac |
153 | 125 |
;; |
154 | 126 |
status) |
155 |
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? |
|
127 |
status_of_proc -p $PIDFILE "$DAEMON" "$NAME" && exit 0 || exit $?
|
|
156 | 128 |
;; |
157 | 129 |
reload|force-reload) |
158 | 130 |
# |
debian/fargo.install | ||
---|---|---|
1 | 1 |
debian/fargo-manage /usr/bin |
2 | 2 |
debian/fargo.service /lib/systemd/system |
3 | 3 |
debian/settings.py /etc/fargo |
4 |
debian/uwsgi.ini /etc/fargo |
|
4 | 5 |
debian/debian_config.py /usr/lib/fargo/ |
debian/fargo.service | ||
---|---|---|
1 | 1 |
[Unit] |
2 | 2 |
Description=Fargo |
3 |
After=network.target postgresql.service |
|
3 |
After=network.target syslog.target postgresql.service
|
|
4 | 4 |
Wants=postgresql.service |
5 | 5 | |
6 | 6 |
[Service] |
... | ... | |
10 | 10 |
Group=%p |
11 | 11 |
ExecStartPre=/usr/bin/fargo-manage migrate_schemas --noinput |
12 | 12 |
ExecStartPre=/usr/bin/fargo-manage collectstatic --noinput |
13 |
ExecStart=/usr/bin/gunicorn \ |
|
14 |
--bind unix:/run/%p/%p.sock \ |
|
15 |
--worker-class=sync \ |
|
16 |
--workers 5 \ |
|
17 |
--timeout=30 \ |
|
18 |
--name %p \ |
|
19 |
%p.wsgi:application |
|
13 |
ExecStart=/usr/bin/uwsgi --ini /etc/%p/uwsgi.ini |
|
20 | 14 |
ExecReload=/bin/kill -HUP $MAINPID |
15 |
KillSignal=SIGQUIT |
|
21 | 16 |
TimeoutStartSec=0 |
22 | 17 |
PrivateTmp=true |
23 | 18 |
Restart=on-failure |
24 | 19 |
RuntimeDirectory=fargo |
20 |
Type=notify |
|
21 |
StandardError=syslog |
|
22 |
NotifyAccess=all |
|
25 | 23 | |
26 | 24 |
[Install] |
27 | 25 |
WantedBy=multi-user.target |
debian/uwsgi.ini | ||
---|---|---|
1 |
[uwsgi] |
|
2 |
auto-procname = true |
|
3 |
procname-prefix-spaced = fargo |
|
4 | ||
5 |
plugin = python |
|
6 |
module = fargo.wsgi:application |
|
7 | ||
8 |
http-socket = /run/fargo/fargo.sock |
|
9 |
chmod-socket = 666 |
|
10 |
vacuum = true |
|
11 | ||
12 |
master = true |
|
13 |
processes = 5 |
|
14 |
harakiri = 120 |
|
15 |
enable-threads = true |
|
16 | ||
17 |
buffer-size = 32768 |
|
18 | ||
19 |
py-tracebacker = /run/fargo/py-tracebacker.sock. |
|
20 |
stats = /run/fargo/stats.sock |
|
21 | ||
22 |
ignore-sigpipe = true |
|
23 | ||
24 |
if-file = /etc/fargo/uwsgi-local.ini |
|
25 |
include = /etc/fargo/uwsgi-local.ini |
|
26 |
endif = |
|
0 |
- |