diff --git a/devstack/plugin.sh b/devstack/plugin.sh index b33f7b8..ce7039b 100644 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -15,8 +15,6 @@ XTRACE=$(set +o | grep xtrace) set +o xtrace -FUXI_BIN_DIR=$(get_python_exec_prefix) - function check_docker { if is_ubuntu; then dpkg -s docker-engine > /dev/null 2>&1 @@ -58,6 +56,8 @@ function configure_fuxi { iniset $FUXI_CONFIG cinder multiattach false iniset $FUXI_CONFIG cinder fstype ext4 fi + + write_uwsgi_config "$FUXI_UWSGI_CONF" "$FUXI_UWSGI" "" ":7879" } @@ -97,12 +97,13 @@ if is_service_enabled fuxi; then fi elif [[ "$1" == "stack" && "$2" == "extra" ]]; then - run_process fuxi "$FUXI_BIN_DIR/fuxi-server --config-file $FUXI_CONFIG" "" "root" + run_process fuxi "$FUXI_BIN_DIR/uwsgi --ini $FUXI_UWSGI_CONF" "" "root" fi if [[ "$1" == "unstack" ]]; then - stop_process fuxi-server + stop_process fuxi + remove_uwsgi_config "$FUXI_UWSGI_CONF" "$FUXI_UWSGI" fi fi diff --git a/devstack/settings b/devstack/settings index dc724b4..4ec15d8 100644 --- a/devstack/settings +++ b/devstack/settings @@ -16,6 +16,10 @@ FUXI_AUTH_CACHE_DIR=${FUXI_AUTH_CACHE_DIR:-/var/cache/fuxi} FUXI_DOCKER_ENGINE_PORT=${FUXI_DOCKER_ENGINE_PORT:-2375} FUXI_VOLUME_PROVIDERS=${FUXI_VOLUME_PROVIDERS:-cinder,manila} +FUXI_BIN_DIR=$(get_python_exec_prefix) +FUXI_UWSGI=$FUXI_BIN_DIR/fuxi-server-wsgi +FUXI_UWSGI_CONF=$FUXI_CONFIG_DIR/fuxi-server-uwsgi.ini + DOCKER_CLUSTER_STORE=${DOCKER_CLUSTER_STORE:-etcd://localhost:$ETCD_PORT} GITREPO["kuryr"]=${KURYR_REPO:-${GIT_BASE}/openstack/kuryr.git} diff --git a/fuxi/wsgi.py b/fuxi/wsgi.py new file mode 100644 index 0000000..bef0c5a --- /dev/null +++ b/fuxi/wsgi.py @@ -0,0 +1,28 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +import sys + +from fuxi import app +from fuxi.common import config +from fuxi import controllers + +from oslo_log import log as logging + + +def init_application(): + config.init(sys.argv[1:]) + logging.setup(config.CONF, 'fuxi') + + controllers.init_app_conf() + + return app diff --git a/setup.cfg b/setup.cfg index 514a142..f2d3548 100644 --- a/setup.cfg +++ b/setup.cfg @@ -25,6 +25,8 @@ oslo.config.opts = console_scripts = fuxi-server = fuxi.server:start fuxi-rootwrap = oslo_rootwrap.cmd:main +wsgi_scripts = + fuxi-server-wsgi = fuxi.wsgi:init_application [files] packages =