mirror of
https://github.com/frappe/frappe_docker.git
synced 2024-12-24 11:05:29 +00:00
feat(frappe-worker): option to set gevent as gunicorn worker-class
This commit is contained in:
parent
5121e27106
commit
d37a1455b7
2
build/common/commands/gevent_patch.py
Normal file
2
build/common/commands/gevent_patch.py
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
import gevent.monkey
|
||||||
|
gevent.monkey.patch_all()
|
@ -84,17 +84,26 @@ if [ "$1" = 'start' ]; then
|
|||||||
export FRAPPE_PORT=8000
|
export FRAPPE_PORT=8000
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ -z "$WORKER_CLASS" ]]; then
|
||||||
|
export WORKER_CLASS=gthread
|
||||||
|
fi
|
||||||
|
|
||||||
|
export LOAD_CONFIG_FILE=""
|
||||||
|
if [ "$WORKER_CLASS" = "gevent" ]; then
|
||||||
|
export LOAD_CONFIG_FILE="-c /home/frappe/frappe-bench/commands/gevent_patch.py"
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ ! -z "$AUTO_MIGRATE" ]]; then
|
if [[ ! -z "$AUTO_MIGRATE" ]]; then
|
||||||
. /home/frappe/frappe-bench/env/bin/activate \
|
. /home/frappe/frappe-bench/env/bin/activate \
|
||||||
&& python /home/frappe/frappe-bench/commands/auto_migrate.py
|
&& python /home/frappe/frappe-bench/commands/auto_migrate.py
|
||||||
fi
|
fi
|
||||||
|
|
||||||
. /home/frappe/frappe-bench/env/bin/activate
|
. /home/frappe/frappe-bench/env/bin/activate
|
||||||
gunicorn -b 0.0.0.0:$FRAPPE_PORT \
|
gunicorn $LOAD_CONFIG_FILE -b 0.0.0.0:$FRAPPE_PORT \
|
||||||
--worker-tmp-dir /dev/shm \
|
--worker-tmp-dir /dev/shm \
|
||||||
--threads=4 \
|
--threads=4 \
|
||||||
--workers $WORKERS \
|
--workers $WORKERS \
|
||||||
--worker-class=gthread \
|
--worker-class=$WORKER_CLASS \
|
||||||
--log-file=- \
|
--log-file=- \
|
||||||
-t 120 frappe.app:application --preload
|
-t 120 frappe.app:application --preload
|
||||||
|
|
||||||
|
@ -65,6 +65,8 @@ RUN mkdir -p apps logs commands sites /home/frappe/backups
|
|||||||
# Setup python environment
|
# Setup python environment
|
||||||
RUN python -m venv env \
|
RUN python -m venv env \
|
||||||
&& . env/bin/activate \
|
&& . env/bin/activate \
|
||||||
|
&& pip3 install --upgrade pip \
|
||||||
|
&& pip3 install gevent \
|
||||||
&& cd apps \
|
&& cd apps \
|
||||||
&& git clone --depth 1 -o upstream https://github.com/frappe/frappe --branch ${GIT_BRANCH} \
|
&& git clone --depth 1 -o upstream https://github.com/frappe/frappe --branch ${GIT_BRANCH} \
|
||||||
&& pip3 install --no-cache-dir -e /home/frappe/frappe-bench/apps/frappe
|
&& pip3 install --no-cache-dir -e /home/frappe/frappe-bench/apps/frappe
|
||||||
|
Loading…
Reference in New Issue
Block a user