def start_island_server(should_setup_only): from tornado.httpserver import HTTPServer from tornado.ioloop import IOLoop from tornado.wsgi import WSGIContainer mongo_url = os.environ.get('MONGO_URL', env_singleton.env.get_mongo_url()) wait_for_mongo_db_server(mongo_url) assert_mongo_db_version(mongo_url) populate_exporter_list() app = init_app(mongo_url) crt_path = str(Path(MONKEY_ISLAND_ABS_PATH, 'cc', 'server.crt')) key_path = str(Path(MONKEY_ISLAND_ABS_PATH, 'cc', 'server.key')) setup() if should_setup_only: logger.warning("Setup only flag passed. Exiting.") return if env_singleton.env.is_debug(): app.run(host='0.0.0.0', debug=True, ssl_context=(crt_path, key_path)) else: http_server = HTTPServer(WSGIContainer(app), ssl_options={ 'certfile': os.environ.get('SERVER_CRT', crt_path), 'keyfile': os.environ.get('SERVER_KEY', key_path) }) http_server.listen(env_singleton.env.get_island_port()) log_init_info() IOLoop.instance().start()
def start_island_server(should_setup_only): mongo_url = os.environ.get('MONGO_URL', env_singleton.env.get_mongo_url()) wait_for_mongo_db_server(mongo_url) assert_mongo_db_version(mongo_url) populate_exporter_list() app = init_app(mongo_url) crt_path = str(Path(MONKEY_ISLAND_ABS_PATH, 'cc', 'server.crt')) key_path = str(Path(MONKEY_ISLAND_ABS_PATH, 'cc', 'server.key')) setup() if should_setup_only: logger.warning("Setup only flag passed. Exiting.") return if env_singleton.env.is_debug(): app.run(host='0.0.0.0', debug=True, ssl_context=(crt_path, key_path)) else: http_server = WSGIServer( ('0.0.0.0', env_singleton.env.get_island_port()), app, certfile=os.environ.get('SERVER_CRT', crt_path), keyfile=os.environ.get('SERVER_KEY', key_path)) log_init_info() http_server.serve_forever()