Add WSGI support for octavia api
Make the octavia.api.app module work with web servers running on WSGI. Take uwsgi for an example: uwsgi --socket /tmp/octavia.sock \ --pythonpath /home/devstack/octavia/octavia/api \ --module "app:setup_app()" \ --pidfile /tmp/octavia.pid --vacuum \ --daemonize /var/log/octavia/octavia.log Change-Id: I3282da1191965e8d83c8bf74ef1a1285673a6987
This commit is contained in:
parent
1efa2f6435
commit
2e379269fb
|
@ -16,6 +16,7 @@ import pecan
|
||||||
|
|
||||||
from octavia.api import config as app_config
|
from octavia.api import config as app_config
|
||||||
from octavia.api.v1 import hooks
|
from octavia.api.v1 import hooks
|
||||||
|
from octavia.common import service as octavia_service
|
||||||
|
|
||||||
|
|
||||||
def get_pecan_config():
|
def get_pecan_config():
|
||||||
|
@ -24,8 +25,10 @@ def get_pecan_config():
|
||||||
return pecan.configuration.conf_from_file(filename)
|
return pecan.configuration.conf_from_file(filename)
|
||||||
|
|
||||||
|
|
||||||
def setup_app(pecan_config=None, debug=False):
|
def setup_app(pecan_config=None, debug=False, argv=None):
|
||||||
"""Creates and returns a pecan wsgi app."""
|
"""Creates and returns a pecan wsgi app."""
|
||||||
|
octavia_service.prepare_service(argv)
|
||||||
|
|
||||||
app_hooks = [hooks.ContextHook()]
|
app_hooks = [hooks.ContextHook()]
|
||||||
|
|
||||||
if not pecan_config:
|
if not pecan_config:
|
||||||
|
|
|
@ -22,7 +22,6 @@ from oslo_log import log as logging
|
||||||
from oslo_reports import guru_meditation_report as gmr
|
from oslo_reports import guru_meditation_report as gmr
|
||||||
|
|
||||||
from octavia.api import app as api_app
|
from octavia.api import app as api_app
|
||||||
from octavia.common import service as octavia_service
|
|
||||||
from octavia.i18n import _LI
|
from octavia.i18n import _LI
|
||||||
from octavia import version
|
from octavia import version
|
||||||
|
|
||||||
|
@ -31,11 +30,9 @@ LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
octavia_service.prepare_service(sys.argv)
|
|
||||||
|
|
||||||
gmr.TextGuruMeditation.setup_autorun(version)
|
gmr.TextGuruMeditation.setup_autorun(version)
|
||||||
|
|
||||||
app = api_app.setup_app()
|
app = api_app.setup_app(argv=sys.argv)
|
||||||
|
|
||||||
host, port = cfg.CONF.bind_host, cfg.CONF.bind_port
|
host, port = cfg.CONF.bind_host, cfg.CONF.bind_port
|
||||||
LOG.info(_LI("Starting API server on %(host)s:%(port)s"),
|
LOG.info(_LI("Starting API server on %(host)s:%(port)s"),
|
||||||
|
|
Loading…
Reference in New Issue