-
Notifications
You must be signed in to change notification settings - Fork 55
Expand file tree
/
Copy pathwebserver-entrypoint.sh
More file actions
32 lines (27 loc) · 936 Bytes
/
webserver-entrypoint.sh
File metadata and controls
32 lines (27 loc) · 936 Bytes
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
#!/usr/bin/env bash
set -e
CORE_COUNT=$(grep ^cpu\\scores /proc/cpuinfo | uniq | awk '{print $4}')
WORKERS=${GUNICORN_WORKERS:-$(($CORE_COUNT))}
THREADS=${GUNICORN_THREADS:-$((2 * $WORKERS))}
TIMEOUT=${GUNICORN_TIMEOUT:-500}
KEEPALIVE=${GUNICORN_KEEPALIVE:-300}
SOCKET=unix:/etc/openresty/monitorizer.gunicorn.sock
python3 -m monitorizer.manage migrate
python3 -m monitorizer.configure
python3 -m monitorizer.manage collectstatic --no-input
mkdir -p /var/log/openresty/ /etc/openresty/conf.d/
python3 -m monitorizer.manage openresty_template --gateway $SOCKET > /etc/openresty/conf.d/server.conf
openresty -t
service openresty start
openresty -s reload
gunicorn monitorizer.server.wsgi:application\
-b $SOCKET\
--capture-output\
--enable-stdio-inheritance\
--workers $WORKERS\
--threads $THREADS\
--keep-alive $KEEPALIVE\
--worker-class gthread\
--error-logfile '-'\
--max-requests 20000\
--timeout $TIMEOUT $@