コード例 #1
0
ファイル: server.py プロジェクト: feitianyiren/appscale
def main():
    file_io.set_logging_format()
    logging.getLogger().setLevel(logging.INFO)

    zk_ips = appscale_info.get_zk_node_ips()
    zk_client = KazooClient(hosts=','.join(zk_ips))
    zk_client.start()

    deployment_config = DeploymentConfig(zk_client)
    projects_manager = GlobalProjectsManager(zk_client)
    thread_pool = ThreadPoolExecutor(MAX_BACKGROUND_WORKERS)
    source_manager = SourceManager(zk_client, thread_pool)
    source_manager.configure_automatic_fetch(projects_manager)
    monit_operator = MonitOperator()

    options.define('private_ip', appscale_info.get_private_ip())
    options.define('syslog_server', appscale_info.get_headnode_ip())
    options.define('db_proxy', appscale_info.get_db_proxy())
    options.define('tq_proxy', appscale_info.get_tq_proxy())
    options.define('secret', appscale_info.get_secret())

    routing_client = RoutingClient(zk_client, options.private_ip,
                                   options.secret)
    instance_manager = InstanceManager(zk_client, monit_operator,
                                       routing_client, projects_manager,
                                       deployment_config, source_manager,
                                       options.syslog_server, thread_pool,
                                       options.private_ip)
    instance_manager.start()

    logger.info('Starting AppManager')

    io_loop = IOLoop.current()
    io_loop.run_sync(instance_manager.populate_api_servers)
    io_loop.start()
コード例 #2
0
ファイル: blobstore.py プロジェクト: sjones4/appscale
def main():
    global datastore_path
    global deployment_config

    logging.basicConfig(format=LOG_FORMAT, level=logging.INFO)

    parser = argparse.ArgumentParser()
    parser.add_argument('-p',
                        '--port',
                        type=int,
                        default=DEFAULT_PORT,
                        required=True,
                        help="The blobstore server's port")
    parser.add_argument('-d',
                        '--datastore-path',
                        required=True,
                        help='The location of the datastore server')
    args = parser.parse_args()

    datastore_path = args.datastore_path
    zk_ips = appscale_info.get_zk_node_ips()
    zk_client = KazooClient(hosts=','.join(zk_ips))
    zk_client.start()
    deployment_config = DeploymentConfig(zk_client)
    setup_env()

    register_location(zk_client, appscale_info.get_private_ip(), args.port)

    http_server = tornado.httpserver.HTTPServer(
        Application(), max_buffer_size=MAX_REQUEST_BUFF_SIZE, xheaders=True)

    http_server.listen(args.port)

    logger.info('Starting BlobServer on {}'.format(args.port))
    tornado.ioloop.IOLoop.instance().start()
コード例 #3
0
ファイル: blobstore.py プロジェクト: sgwd/appscale
def main():
  global datastore_path
  global deployment_config

  logging.basicConfig(format=LOG_FORMAT, level=logging.INFO)

  parser = argparse.ArgumentParser()
  parser.add_argument('-p', '--port', type=int, default=DEFAULT_PORT,
                      required=True, help="The blobstore server's port")
  parser.add_argument('-d', '--datastore-path', required=True,
                      help='The location of the datastore server')
  args = parser.parse_args()

  datastore_path = args.datastore_path
  deployment_config = DeploymentConfig(appscale_info.get_zk_locations_string())
  setup_env()

  http_server = tornado.httpserver.HTTPServer(
    Application(), max_buffer_size=MAX_REQUEST_BUFF_SIZE)

  http_server.listen(args.port)

  acc = appscale_info.get_appcontroller_client()
  acc.add_routing_for_blob_server()

  logging.info('Starting BlobServer on {}'.format(args.port))
  tornado.ioloop.IOLoop.instance().start()
コード例 #4
0
def main():
    global datastore_path
    global deployment_config

    logging.basicConfig(format=LOG_FORMAT, level=logging.INFO)

    parser = argparse.ArgumentParser()
    parser.add_argument('-p',
                        '--port',
                        type=int,
                        default=DEFAULT_PORT,
                        required=True,
                        help="The blobstore server's port")
    parser.add_argument('-d',
                        '--datastore-path',
                        required=True,
                        help='The location of the datastore server')
    args = parser.parse_args()

    datastore_path = args.datastore_path
    zk_ips = appscale_info.get_zk_node_ips()
    zk_client = KazooClient(hosts=','.join(zk_ips))
    zk_client.start()
    deployment_config = DeploymentConfig(zk_client)
    setup_env()

    http_server = tornado.httpserver.HTTPServer(
        Application(), max_buffer_size=MAX_REQUEST_BUFF_SIZE, xheaders=True)

    http_server.listen(args.port)

    # Make sure this server is accessible from each of the load balancers.
    secret = appscale_info.get_secret()
    for load_balancer in appscale_info.get_load_balancer_ips():
        acc = AppControllerClient(load_balancer, secret)
        acc.add_routing_for_blob_server()

    logger.info('Starting BlobServer on {}'.format(args.port))
    tornado.ioloop.IOLoop.instance().start()
コード例 #5
0
    for ii in REQUIRED_CONFIG_FIELDS:
        try:
            if config[ii]:
                pass
        except KeyError:
            logging.error("Unable to find " + str(ii) + " in configuration")
            return False
    return True


################################
# MAIN
################################
if __name__ == "__main__":
    file_io.set_logging_format()
    deployment_config = DeploymentConfig(
        appscale_info.get_zk_locations_string())

    INTERNAL_IP = appscale_info.get_private_ip()
    SERVER = SOAPpy.SOAPServer((INTERNAL_IP, constants.APP_MANAGER_PORT))

    SERVER.registerFunction(start_app)
    SERVER.registerFunction(stop_app)
    SERVER.registerFunction(stop_app_instance)

    while 1:
        try:
            SERVER.serve_forever()
        except SSL.SSLError:
            pass
コード例 #6
0
        except BadConfigurationException as error:
            raise HTTPError(HTTPCodes.BAD_REQUEST, error.message)


################################
# MAIN
################################
if __name__ == "__main__":
    file_io.set_logging_format()
    logging.getLogger().setLevel(logging.INFO)

    zk_ips = appscale_info.get_zk_node_ips()
    zk_client = KazooClient(hosts=','.join(zk_ips))
    zk_client.start()

    deployment_config = DeploymentConfig(zk_client)
    projects_manager = GlobalProjectsManager(zk_client)
    thread_pool = ThreadPoolExecutor(MAX_BACKGROUND_WORKERS)
    source_manager = SourceManager(zk_client, thread_pool)
    source_manager.configure_automatic_fetch(projects_manager)

    options.define('private_ip', appscale_info.get_private_ip())
    options.define('syslog_server', appscale_info.get_headnode_ip())
    options.define('db_proxy', appscale_info.get_db_proxy())
    options.define('tq_proxy', appscale_info.get_tq_proxy())
    options.define('secret', appscale_info.get_secret())

    running_instances = recover_state(zk_client)
    PeriodicCallback(stop_failed_instances,
                     INSTANCE_CLEANUP_INTERVAL * 1000).start()
コード例 #7
0
        description="Creates Cassandra's Monit configuration files")
    parser.add_argument('--local-ip',
                        required=True,
                        help='The private IP address of this machine.')
    parser.add_argument('--master-ip',
                        required=True,
                        help='The private IP address of the database master.')
    parser.add_argument('--zk-locations',
                        required=False,
                        help='The location of Zookeeper.')
    args = parser.parse_args()
    zk_locations = args.zk_locations if args.zk_locations else \
      appscale_info.get_zk_locations_string()
    zk_client = KazooClient(hosts=zk_locations)
    zk_client.start()
    deployment_config = DeploymentConfig(zk_client)
    cassandra_config = deployment_config.get_config('cassandra')
    if 'num_tokens' not in cassandra_config:
        raise InvalidConfig('num_tokens not specified in deployment config.')
    num_tokens = cassandra_config['num_tokens']

    replacements = {
        'APPSCALE-LOCAL': args.local_ip,
        'APPSCALE-MASTER': args.master_ip,
        'APPSCALE-NUM-TOKENS': num_tokens
    }

    for filename in ('cassandra.yaml', 'cassandra-env.sh'):
        dest_file_path = os.path.join(CASSANDRA_INSTALL_DIR, 'cassandra',
                                      'conf', filename)
        contents = pkgutil.get_data('appscale.datastore.cassandra_env',
コード例 #8
0
if __name__ == "__main__":
    parser = argparse.ArgumentParser(
        description="Creates Cassandra's Monit configuration files")
    parser.add_argument('--local-ip',
                        required=True,
                        help='The private IP address of this machine.')
    parser.add_argument('--master-ip',
                        required=True,
                        help='The private IP address of the database master.')
    parser.add_argument('--zk-locations',
                        required=False,
                        help='The location of Zookeeper.')
    args = parser.parse_args()
    zk_locations = args.zk_locations if args.zk_locations else \
      appscale_info.get_zk_locations_string()
    deployment_config = DeploymentConfig(zk_locations)
    cassandra_config = deployment_config.get_config('cassandra')
    if 'num_tokens' not in cassandra_config:
        raise InvalidConfig('num_tokens not specified in deployment config.')
    num_tokens = cassandra_config['num_tokens']

    replacements = {
        'APPSCALE-LOCAL': args.local_ip,
        'APPSCALE-MASTER': args.master_ip,
        'APPSCALE-NUM-TOKENS': num_tokens
    }

    for filename in ('cassandra.yaml', 'cassandra-env.sh'):
        dest_file_path = os.path.join(CASSANDRA_INSTALL_DIR, 'cassandra',
                                      'conf', filename)
        contents = pkgutil.get_data('appscale.datastore.cassandra_env',