Example #1
0
def main():
    if Config.setup_logger():
        _setup_logger()
    else:
        logging.basicConfig(level=logging.INFO)

    args = _args()

    Config.set_access_key(args.access_key)
    Config.set_secret_key(args.secret_key)
    Config.set_api_url(args.url)

    process_manager.init()

    plugins.load()

    log.info('API URL %s', Config.api_url())

    client = EventClient(Config.api_url(),
                         auth=Config.api_auth(),
                         workers=args.workers,
                         agent_id=args.agent_id)
    events = _gather_events()

    log.info("Subscribing to %s", events)

    for startup in get_type_list(LIFECYCLE):
        startup.on_startup()

    client.run(events)
    sys.exit(0)
Example #2
0
def main():
    if Config.setup_logger():
        _setup_logger()
    else:
        logging.basicConfig(level=logging.INFO)

    args = _args()

    Config.set_access_key(args.access_key)
    Config.set_secret_key(args.secret_key)
    Config.set_api_url(args.url)

    process_manager.init()

    plugins.load()

    log.info('API URL %s', Config.api_url())

    client = EventClient(Config.api_url(), auth=Config.api_auth(),
                         workers=args.workers, agent_id=args.agent_id)
    events = _gather_events()

    log.info("Subscribing to %s", events)

    for startup in get_type_list(LIFECYCLE):
        startup.on_startup()

    client.run(events)
    sys.exit(0)
Example #3
0
def _args():
    parser = argparse.ArgumentParser(add_help=True)

    parser.add_argument("--access-key", default=Config.access_key(),
                        help='Default value from CATTLE_ACCESS_KEY')
    parser.add_argument("--secret-key", default=Config.secret_key(),
                        help='Default value from CATTLE_SECRET_KEY')
    parser.add_argument("--url", default=Config.api_url(),
                        help='Default value from CATTLE_URL')
    parser.add_argument("--workers", default=Config.workers(),
                        help='Default value from CATTLE_WORKERS')
    parser.add_argument("--agent-id")

    return parser.parse_args()
Example #4
0
def _args():
    parser = argparse.ArgumentParser(add_help=True)

    parser.add_argument("--access-key", default=Config.access_key(),
                        help='Default value from CATTLE_ACCESS_KEY')
    parser.add_argument("--secret-key", default=Config.secret_key(),
                        help='Default value from CATTLE_SECRET_KEY')
    parser.add_argument("--url", default=Config.api_url(),
                        help='Default value from CATTLE_URL')
    parser.add_argument("--workers", default=Config.workers(),
                        help='Default value from CATTLE_WORKERS')
    parser.add_argument("--agent-id")

    return parser.parse_args()
Example #5
0
    def on_startup(self):
        env = dict(os.environ)
        env['HOST_API_CATTLE_ACCESS_KEY'] = Config.access_key()
        env['HOST_API_CATTLE_SECRET_KEY'] = Config.secret_key()

        url = 'http://{0}:{1}'.format(Config.cadvisor_ip(),
                                      Config.cadvisor_port())

        background([
            'host-api', '-cadvisor-url', url, '-logtostderr=true', '-ip',
            Config.host_api_ip(), '-port',
            str(Config.host_api_port()), '-auth=true', '-host-uuid',
            DockerConfig.docker_uuid(), '-public-key',
            Config.jwt_public_key_file(), '-cattle-url',
            Config.api_url(), '-cattle-state-dir',
            Config.container_state_dir()
        ],
                   env=env)
Example #6
0
    def on_startup(self):
        env = dict(os.environ)
        env['HOST_API_CATTLE_ACCESS_KEY'] = Config.access_key()
        env['HOST_API_CATTLE_SECRET_KEY'] = Config.secret_key()

        url = 'http://{0}:{1}'.format(Config.cadvisor_ip(),
                                      Config.cadvisor_port())

        background(['host-api',
                    '-cadvisor-url',  url,
                    '-logtostderr=true',
                    '-ip', Config.host_api_ip(),
                    '-port', str(Config.host_api_port()),
                    '-auth=true',
                    '-host-uuid', DockerConfig.docker_uuid(),
                    '-public-key', Config.jwt_public_key_file(),
                    '-cattle-url', Config.api_url(),
                    '-cattle-state-dir', Config.container_state_dir()],
                   env=env)