Allow running kuryr-libnetwork with uwsgi
scripts/run_kuryr.sh now understands KURYR_USE_UWSGI. If set to "True" (default) it would attempt to look for uwsgi executable and run kuryr-libnetwork with it. Number of spawned threads and processes can be controlled with KURYR_UWSGI_THREADS and KURYR_UWSGI_PROCESSES env variables. If uwsgi is not present or KURYR_USE_UWSGI is set to false the script operates as usual. Targets bp: deploy-kuryr-libnetwork-api-in-wsgi Co-Authored-By: Kirill Zaitsev <k.zaitsev@me.com> Change-Id: I821a78649ad6f07e4709fa343a0e678e4193a068
This commit is contained in:
parent
3e2891d6fc
commit
cd82675242
@ -275,7 +275,9 @@ If SSL needs to be enabled follow this step or skip to next step::
|
||||
For locally generating and testing, please refer to below link:
|
||||
http://tech.paulcz.net/2016/01/secure-docker-with-tls/
|
||||
|
||||
Run Kuryr Server from command below::
|
||||
Run Kuryr Server with the command below. If you have uwsgi installed this
|
||||
command would run Kuryr under it. You can override this behaviour by
|
||||
setting `KURYR_USE_UWSGI=False`::
|
||||
|
||||
$ sudo ./scripts/run_kuryr.sh
|
||||
|
||||
|
@ -0,0 +1,6 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
scripts/run_kuryr.sh now defaults to running api server under uwsgi. This behaviour
|
||||
can be controlled by KURYR_USE_UWSGI env variable (default True).
|
||||
In case it is set to False or uwsgi is abscent api would be run as usual.
|
@ -76,4 +76,34 @@ if [[ ! -f "${KURYR_CONFIG}" ]]; then
|
||||
echo "Done"
|
||||
fi
|
||||
|
||||
PYTHONPATH=${KURYR_HOME} python ${KURYR_HOME}/scripts/run_server.py --config-file /etc/kuryr/kuryr.conf $@
|
||||
KURYR_USE_UWSGI=${KURYR_USE_UWSGI:-True}
|
||||
KURYR_UWSGI_PROCESSES=${KURYR_UWSGI_PROCESSES:-1}
|
||||
KURYR_UWSGI_THREADS=${KURYR_UWSGI_THREADS:-1}
|
||||
|
||||
UWSGI_BIN=$(which uwsgi)
|
||||
if [[ -z "UWSGI_BIN" && $KURYR_USE_UWSGI == "True" ]]; then
|
||||
echo "Requested uwsgi usage, but no uwsgi executable is available. Falling back to run_server.py"
|
||||
echo "To suppress this message set KURYR_USE_UWSGI to False"
|
||||
KURYR_USE_UWSGI="False"
|
||||
fi
|
||||
|
||||
UWSGI_ADDITIONAL_ARGS=()
|
||||
if [[ $KURYR_USE_UWSGI == "True" ]]; then
|
||||
if [[ "$VIRTUAL_ENV" ]]; then
|
||||
UWSGI_ADDITIONAL_ARGS=( --virtualenv $VIRTUAL_ENV )
|
||||
fi
|
||||
echo "Starting uwsgi with ${KURYR_UWSGI_PROCESSES} processes and ${KURYR_UWSGI_THREADS} threads"
|
||||
$UWSGI_BIN \
|
||||
--plugins python \
|
||||
--http-socket :23750 \
|
||||
--wsgi kuryr_libnetwork.server:app \
|
||||
--python-path "${KURYR_HOME}" \
|
||||
--pyargv "--config-file ${KURYR_CONFIG}" \
|
||||
--master \
|
||||
--need-app \
|
||||
--processes "$KURYR_UWSGI_PROCESSES" \
|
||||
--threads "$KURYR_UWSGI_THREADS" \
|
||||
"${UWSGI_ADDITIONAL_ARGS[@]}"
|
||||
else
|
||||
PYTHONPATH="${KURYR_HOME}" python "${KURYR_HOME}/scripts/run_server.py" --config-file "${KURYR_CONFIG}" "$@"
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user