Exemplo n.º 1
0
def main():
    service.prepare_service(sys.argv)

    gmr.TextGuruMeditation.setup_autorun(version)

    # Enable object backporting via the conductor
    base.MagnumObject.indirection_api = base.MagnumObjectIndirectionAPI()

    app = api_app.load_app()

    # Setup OSprofiler for WSGI service
    profiler.setup('magnum-api', CONF.host)

    # SSL configuration
    use_ssl = CONF.api.enabled_ssl

    # Create the WSGI server and start it
    host, port = CONF.api.host, CONF.api.port

    LOG.info(_LI('Starting server in PID %s'), os.getpid())
    LOG.debug("Configuration:")
    CONF.log_opt_values(LOG, logging.DEBUG)

    LOG.info(_LI('Serving on %(proto)s://%(host)s:%(port)s'),
             dict(proto="https" if use_ssl else "http", host=host, port=port))

    serving.run_simple(host, port, app,
                       ssl_context=_get_ssl_configs(use_ssl))
Exemplo n.º 2
0
def main():
    service.prepare_service(sys.argv)

    gmr.TextGuruMeditation.setup_autorun(version)

    # Enable object backporting via the conductor
    base.MagnumObject.indirection_api = base.MagnumObjectIndirectionAPI()

    app = api_app.load_app()

    # Setup OSprofiler for WSGI service
    profiler.setup('magnum-api', CONF.host)

    # SSL configuration
    use_ssl = CONF.api.enabled_ssl

    # Create the WSGI server and start it
    host, port = CONF.api.host, CONF.api.port

    LOG.info(_LI('Starting server in PID %s'), os.getpid())
    LOG.debug("Configuration:")
    CONF.log_opt_values(LOG, logging.DEBUG)

    LOG.info(_LI('Serving on %(proto)s://%(host)s:%(port)s'),
             dict(proto="https" if use_ssl else "http", host=host, port=port))

    workers = CONF.api.workers
    if not workers:
        workers = processutils.get_worker_count()
    LOG.info(_LI('Server will handle each request in a new process up to'
                 ' %s concurrent processes'), workers)
    serving.run_simple(host, port, app, processes=workers,
                       ssl_context=_get_ssl_configs(use_ssl))
Exemplo n.º 3
0
def main():
    service.prepare_service(sys.argv)

    gmr.TextGuruMeditation.setup_autorun(version)

    # Enable object backporting via the conductor
    base.MagnumObject.indirection_api = base.MagnumObjectIndirectionAPI()

    app = api_app.load_app()

    # Setup OSprofiler for WSGI service
    profiler.setup('magnum-api', CONF.host)

    # SSL configuration
    use_ssl = CONF.api.enabled_ssl

    # Create the WSGI server and start it
    host, port = CONF.api.host, CONF.api.port

    LOG.info('Starting server in PID %s' % os.getpid())
    LOG.debug("Configuration:")
    CONF.log_opt_values(LOG, logging.DEBUG)

    LOG.info('Serving on %(proto)s://%(host)s:%(port)s' %
             dict(proto="https" if use_ssl else "http", host=host, port=port))

    workers = CONF.api.workers
    if not workers:
        workers = processutils.get_worker_count()
    LOG.info('Server will handle each request in a new process up to'
             ' %s concurrent processes' % workers)
    serving.run_simple(host, port, app, processes=workers,
                       ssl_context=_get_ssl_configs(use_ssl))
Exemplo n.º 4
0
def main():
    service.prepare_service(sys.argv)

    gmr.TextGuruMeditation.setup_autorun(version)

    # Enable object backporting via the conductor
    base.MagnumObject.indirection_api = base.MagnumObjectIndirectionAPI()

    app = api_app.load_app()

    # SSL configuration
    use_ssl = CONF.api.enabled_ssl

    # Create the WSGI server and start it
    host, port = CONF.api.host, CONF.api.port

    LOG.info(_LI('Starting server in PID %s'), os.getpid())
    LOG.debug("Configuration:")
    CONF.log_opt_values(LOG, logging.DEBUG)

    LOG.info(_LI('Serving on %(proto)s://%(host)s:%(port)s'),
             dict(proto="https" if use_ssl else "http", host=host, port=port))

    serving.run_simple(host, port, app,
                       ssl_context=_get_ssl_configs(use_ssl))
Exemplo n.º 5
0
    def setUp(self):
        self.addCleanup(self.remove_files)
        super(TestHeathcheck, self).setUp()

        # Create Temporary file
        self.tempdir = self.useFixture(fixtures.TempDir()).path
        paste_ini = "magnum/tests/unit/api/controllers/auth-paste.ini"

        # Read current file and create new one
        config = ConfigParser.RawConfigParser()
        config.read(self.get_path(paste_ini))
        config.set('filter:healthcheck', 'disable_by_file_path',
                   self.tempdir + "/disable")
        with open(self.tempdir + "/paste.ini", 'wt') as configfile:
            config.write(configfile)

        # Set config and create app
        cfg.CONF.set_override("api_paste_config",
                              self.tempdir + "/paste.ini",
                              group="api")
        self.app = webtest.TestApp(app.load_app())
Exemplo n.º 6
0
    def setUp(self):
        self.addCleanup(self.remove_files)
        super(TestHeathcheck, self).setUp()

        # Create Temporary file
        self.tempdir = self.useFixture(fixtures.TempDir()).path
        paste_ini = "magnum/tests/unit/api/controllers/auth-paste.ini"

        # Read current file and create new one
        config = ConfigParser.RawConfigParser()
        config.read(self.get_path(paste_ini))
        config.set('filter:healthcheck',
                   'disable_by_file_path',
                   self.tempdir + "/disable")
        with open(self.tempdir + "/paste.ini", 'wt') as configfile:
            config.write(configfile)

        # Set config and create app
        cfg.CONF.set_override("api_paste_config",
                              self.tempdir + "/paste.ini",
                              group="api")
        self.app = webtest.TestApp(app.load_app())
Exemplo n.º 7
0
def main():
    service.prepare_service(sys.argv)

    gmr.TextGuruMeditation.setup_autorun(version)

    # Enable object backporting via the conductor
    base.MagnumObject.indirection_api = base.MagnumObjectIndirectionAPI()

    app = api_app.load_app()

    # Create the WSGI server and start it
    host, port = cfg.CONF.api.host, cfg.CONF.api.port
    srv = simple_server.make_server(host, port, app)

    LOG.info(_LI('Starting server in PID %s'), os.getpid())
    LOG.debug("Configuration:")
    cfg.CONF.log_opt_values(LOG, logging.DEBUG)

    LOG.info(_LI('serving on http://%(host)s:%(port)s'),
             dict(host=host, port=port))

    srv.serve_forever()
Exemplo n.º 8
0
 def make_app(self, paste_file):
     file_name = self.get_path(paste_file)
     cfg.CONF.set_override("api_paste_config", file_name, group="api")
     return webtest.TestApp(app.load_app())