diff --git a/neutron/server/__init__.py b/neutron/server/__init__.py index 312a65c4d3d..ac4bc91d767 100644 --- a/neutron/server/__init__.py +++ b/neutron/server/__init__.py @@ -22,9 +22,10 @@ from oslo_config import cfg from neutron._i18n import _ from neutron.common import config +from neutron.common import profiler -def boot_server(server_func): +def _init_configuration(): # the configuration will be read into the cfg.CONF global data structure config.init(sys.argv[1:]) config.setup_logging() @@ -33,9 +34,19 @@ def boot_server(server_func): sys.exit(_("ERROR: Unable to find configuration file via the default" " search paths (~/.neutron/, ~/, /etc/neutron/, /etc/) and" " the '--config-file' option!")) + + +def boot_server(server_func): + _init_configuration() try: server_func() except KeyboardInterrupt: pass except RuntimeError as e: sys.exit(_("ERROR: %s") % e) + + +def get_application(): + _init_configuration() + profiler.setup('neutron-server', cfg.CONF.host) + return config.load_paste_app('neutron') diff --git a/releasenotes/notes/add-wsgi-script-support-e611fa5b5c2043a5.yaml b/releasenotes/notes/add-wsgi-script-support-e611fa5b5c2043a5.yaml new file mode 100644 index 00000000000..27802cac399 --- /dev/null +++ b/releasenotes/notes/add-wsgi-script-support-e611fa5b5c2043a5.yaml @@ -0,0 +1,7 @@ +--- +prelude: > + This release adds support for running Neutron API component with a ``mod_wsgi`` + compatible web server. +features: + - Neutron API can now be managed by a ``mod_wsgi`` compatible web server (e.g. + ``apache2`` (``httpd``), ``nginx``, etc.) diff --git a/setup.cfg b/setup.cfg index 8424510cc71..f6aaed9c053 100644 --- a/setup.cfg +++ b/setup.cfg @@ -41,6 +41,8 @@ scripts = bin/neutron-rootwrap-xen-dom0 [entry_points] +wsgi_scripts = + neutron-api = neutron.server:get_application console_scripts = neutron-db-manage = neutron.db.migration.cli:main neutron-debug = neutron.debug.shell:main