diff --git a/bin/reddwarf-server b/bin/reddwarf-server index 9c8b43fe86..46b8a5980b 100755 --- a/bin/reddwarf-server +++ b/bin/reddwarf-server @@ -47,6 +47,8 @@ extra_opts = [ dest='fork'), openstack_cfg.StrOpt('pid-file', default='.pid'), + openstack_cfg.StrOpt('override-logfile', + default=None), ] CONF = cfg.CONF @@ -56,8 +58,11 @@ CONF.register_cli_opts(extra_opts) def run_server(): try: get_db_api().configure_db(CONF) - server = wsgi.WSGIService('reddwarf', CONF.bind_port or 8779) - launcher = service.launch(server) + conf_file = CONF.find_file(CONF.api_paste_config) + launcher = wsgi.launch('reddwarf', CONF.bind_port or 8779, conf_file) + + + launcher.wait() except RuntimeError as error: import traceback @@ -67,6 +72,10 @@ def run_server(): if __name__ == '__main__': cfg.parse_args(sys.argv) + if CONF.override_logfile: + CONF.use_stderr = False + CONF.log_file = CONF.override_logfile + logging.setup(None) if CONF.fork: diff --git a/bin/start_server.sh b/bin/start_server.sh index bfba17e71e..dc353185b1 100755 --- a/bin/start_server.sh +++ b/bin/start_server.sh @@ -14,5 +14,5 @@ run bin/reddwarf-manage \ reddwarf_test.sqlite mysql fake run bin/reddwarf-server \ --fork --config-file=etc/reddwarf/reddwarf.conf.test \ - repo_path=reddwarf_test.sqlite $@ + $@ diff --git a/etc/reddwarf/api-paste.ini.test b/etc/reddwarf/api-paste.ini.test new file mode 100644 index 0000000000..edc97ee718 --- /dev/null +++ b/etc/reddwarf/api-paste.ini.test @@ -0,0 +1,42 @@ +[composite:reddwarf] +use = call:reddwarf.common.wsgi:versioned_urlmap +/: versions +/v1.0: reddwarfapi + +[app:versions] +paste.app_factory = reddwarf.versions:app_factory + +[pipeline:reddwarfapi] +pipeline = faultwrapper tokenauth authorization contextwrapper extensions reddwarfapp +#pipeline = debug extensions reddwarfapp + +[filter:extensions] +paste.filter_factory = reddwarf.common.extensions:factory + +[filter:tokenauth] +paste.filter_factory = reddwarf.tests.fakes.keystone:filter_factory +service_protocol = http +service_host = 127.0.0.1 +service_port = 5000 +auth_host = 127.0.0.1 +auth_port = 35357 +auth_protocol = http +auth_uri = http://127.0.0.1:5000/ +admin_token = be19c524ddc92109a224 +signing_dir = /tmp/keystone-signing-reddwarf + +[filter:authorization] +paste.filter_factory = reddwarf.common.auth:AuthorizationMiddleware.factory + +[filter:contextwrapper] +paste.filter_factory = reddwarf.common.wsgi:ContextMiddleware.factory + +[filter:faultwrapper] +paste.filter_factory = reddwarf.common.wsgi:FaultWrapper.factory + +[app:reddwarfapp] +paste.app_factory = reddwarf.common.api:app_factory + +#Add this filter to log request and response for debugging +[filter:debug] +paste.filter_factory = reddwarf.common.wsgi:Debug diff --git a/etc/reddwarf/reddwarf.conf.test b/etc/reddwarf/reddwarf.conf.test index f1c2b9ebad..11362b147d 100644 --- a/etc/reddwarf/reddwarf.conf.test +++ b/etc/reddwarf/reddwarf.conf.test @@ -97,6 +97,8 @@ notifier_queue_port = 5672 notifier_queue_virtual_host = / notifier_queue_transport = memory +api_paste_config=api-paste.ini.test + [composite:reddwarf] use = call:reddwarf.common.wsgi:versioned_urlmap /: versions @@ -141,3 +143,4 @@ paste.app_factory = reddwarf.common.api:app_factory #Add this filter to log request and response for debugging [filter:debug] paste.filter_factory = reddwarf.common.wsgi:Debug +