Deploy fuxi-server via uwsgi

Implements: blueprint goal-deploy-api-in-wsgi
Change-Id: Ie601c8a02c0ce7e87254cf6546ff40ae673abae9
This commit is contained in:
Hongbin Lu 2017-08-02 03:27:50 +00:00
parent b840cd652c
commit 8d759150e3
4 changed files with 39 additions and 4 deletions

View File

@ -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

View File

@ -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}

28
fuxi/wsgi.py Normal file
View File

@ -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

View File

@ -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 =