def main(argv=sys.argv):
"""Main method of the Tenant Webapp Server. This method is encapsulated in a function for packaging to allow it to be
called as a function by an external program."""
config = ConfigParser.SafeConfigParser()
config.read(common.CONFIG_FILE)
webapp_port = config.get('general', 'webapp_port')
logger.info('Starting Tenant WebApp (tornado) on port ' + webapp_port + ', use <Ctrl-C> to stop')
app = tornado.web.Application([
(r"/", MainHandler),
(r"/webapp/.*", WebAppHandler),
(r"/v2/nodes/.*", InstancesHandler),
(r'/static/(.*)', tornado.web.StaticFileHandler, {'path': "static/"}),
])
# WebApp Server TLS
server_context = tenant_templ.get_tls_context()
server_context.check_hostname = False # config.getboolean('general','tls_check_hostnames')
server_context.verify_mode = ssl.CERT_NONE # ssl.CERT_REQUIRED
# Set up server
server = tornado.httpserver.HTTPServer(app,ssl_options=server_context)
server.bind(int(webapp_port), address='0.0.0.0')
server.start(config.getint('cloud_verifier','multiprocessing_pool_num_workers'))
try:
tornado.ioloop.IOLoop.instance().start()
except KeyboardInterrupt:
tornado.ioloop.IOLoop.instance().stop()
评论列表
文章目录