-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.bash
30 lines (27 loc) · 882 Bytes
/
run.bash
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
#!/bin/bash
# Set default internal port to 5000
: "${INTERNAL_PORT:=5000}"
# Start Celery worker with log level dependent on BENTO_DEBUG
echo "[bento_wes] [entrypoint] Starting celery worker"
celery_log_level="INFO"
gunicorn_log_level="info"
if [[
"${BENTO_DEBUG}" == "true" ||
"${BENTO_DEBUG}" == "True" ||
"${BENTO_DEBUG}" == "1"
]]; then
celery_log_level="DEBUG"
gunicorn_log_level="debug"
fi
celery --app bento_wes.app worker --loglevel="${celery_log_level}" &
# Start API server
echo "[bento_wes] [entrypoint] Starting gunicorn"
# using 1 worker, multiple threads
# see https://stackoverflow.com/questions/38425620/gunicorn-workers-and-threads
gunicorn bento_wes.app:application \
--log-level "${gunicorn_log_level}" \
--timeout 660 \
--workers 1 \
--worker-class 'gevent' \
--threads "$(( 2 * $(nproc --all) + 1))" \
--bind "0.0.0.0:${INTERNAL_PORT}"