def start_server(options): """ Start CherryPy server """ from desktop.lib.wsgiserver import CherryPyWSGIServer as Server from django.core.handlers.wsgi import WSGIHandler # Translogger wraps a WSGI app with Apache-style combined logging. server = Server( (options['host'], int(options['port'])), WSGIHandler(), int(options['threads']), options['server_name'] ) if options['ssl_certificate'] and options['ssl_private_key']: server.ssl_certificate = options['ssl_certificate'] server.ssl_private_key = options['ssl_private_key'] server.ssl_cipher_list = options['ssl_cipher_list'] ssl_password = conf.get_ssl_password() if ssl_password: server.ssl_password_cb = lambda *unused: ssl_password try: server.bind_server() drop_privileges_if_necessary(options) server.listen_and_loop() except KeyboardInterrupt: server.stop()
def start_server(options): """ Start CherryPy server """ from desktop.lib.wsgiserver import CherryPyWSGIServer as Server from desktop.lib.wsgiserver import SSLConnection from django.core.handlers.wsgi import WSGIHandler # Translogger wraps a WSGI app with Apache-style combined logging. server = Server((options['host'], int(options['port'])), WSGIHandler(), int(options['threads']), options['server_name']) if options['ssl_certificate'] and options['ssl_private_key']: server.ssl_certificate = options['ssl_certificate'] server.ssl_private_key = options['ssl_private_key'] if options['ssl_certificate_chain']: server.ssl_certificate_chain = options['ssl_certificate_chain'] server.ssl_cipher_list = options['ssl_cipher_list'] server.ssl_no_renegotiation = options['ssl_no_renegotiation'] ssl_password = conf.get_ssl_password() if ssl_password: server.ssl_password_cb = lambda *unused: ssl_password try: server.bind_server() drop_privileges_if_necessary(options) if isinstance(server.socket, SSLConnection): ciphers = server.socket.get_cipher_list() logging.info("List of enabled ciphers: {}".format( ':'.join(ciphers))) server.listen_and_loop() except KeyboardInterrupt: server.stop()
def runcelery(*args, **options): #CeleryCommand().handle_argv(['worker', '--app=desktop.celery', '--concurrency=1', '--loglevel=DEBUG']) opts = ['runcelery', 'worker', '--app=' + options['app'], '--concurrency=' + str(options['concurrency']), '--loglevel=' + options['loglevel']] drop_privileges_if_necessary(CELERY_OPTIONS) if conf.DEV.get(): autoreload.main(celery_main, (opts,)) else: celery_main(opts) LOG.error("Failed to exec '%s' with argument '%s'" % args) sys.exit(-1)
def runcelery(*args, **options): #CeleryCommand().handle_argv(['worker', '--app=desktop.celery', '--concurrency=1', '--loglevel=DEBUG']) opts = [ 'runcelery', 'worker', '--app=' + options['app'], '--concurrency=' + str(options['concurrency']), '--loglevel=' + options['loglevel'] ] drop_privileges_if_necessary(CELERY_OPTIONS) if conf.DEV.get(): autoreload.main(celery_main, (opts, )) else: celery_main(opts) LOG.error("Failed to exec '%s' with argument '%s'" % args) sys.exit(-1)
def runcelery(*args, **options): # Native does not load Hue's config # CeleryCommand().handle_argv(['worker', '--app=desktop.celery', '--concurrency=1', '--loglevel=DEBUG']) opts = [ 'runcelery', 'worker', '--app=' + options['app'], '--concurrency=' + str(options['concurrency']), '--loglevel=' + options['loglevel'] ] drop_privileges_if_necessary(CELERY_OPTIONS) if conf.DEV.get(): autoreload.main(celery_main, (opts, )) else: celery_main(opts) LOG.info("Stopping command '%s'" % ' '.join(opts)) sys.exit(-1)
def start_server(options): """ Start CherryPy server """ from desktop.lib.wsgiserver import CherryPyWSGIServer as Server from django.core.handlers.wsgi import WSGIHandler # Translogger wraps a WSGI app with Apache-style combined logging. server = Server( (options["host"], int(options["port"])), WSGIHandler(), int(options["threads"]), options["server_name"] ) if options["ssl_certificate"] and options["ssl_private_key"]: server.ssl_certificate = options["ssl_certificate"] server.ssl_private_key = options["ssl_private_key"] try: server.bind_server() drop_privileges_if_necessary(options) server.listen_and_loop() except KeyboardInterrupt: server.stop()
except AttributeError: pass runspawningserver() def usage(self, subcommand): return SPAWNING_SERVER_HELP def runspawningserver(): try: sock = spawning.spawning_controller.bind_socket(SPAWNING_SERVER_OPTIONS) except Exception, ex: LOG.error('Could not bind port %s: %s. Exiting' % (str(SPAWNING_SERVER_OPTIONS['port']), ex,)) return drop_privileges_if_necessary(SPAWNING_SERVER_OPTIONS) factory = SPAWNING_SERVER_OPTIONS['factory'] pos_args = ['desktop.settings'] argv_str_format = '--factory=%s %s --port %s -s %d -t %d' argv_str = argv_str_format % (SPAWNING_SERVER_OPTIONS['factory'], pos_args[0], SPAWNING_SERVER_OPTIONS['port'], SPAWNING_SERVER_OPTIONS['processes'], SPAWNING_SERVER_OPTIONS['threads']) factory_args = { 'access_log_file': SPAWNING_SERVER_OPTIONS['access_log_file'], 'args': pos_args,