def start_conductr_haproxy(): log = logging.getLogger(__name__) bundle_name = 'conductr-haproxy' configuration_name = 'conductr-haproxy-dev-mode' log.info('Deploying bundle {} with configuration {}'.format(bundle_name, configuration_name)) conduct_main.run(['load', bundle_name, configuration_name, '--disable-instructions'], configure_logging=False) conduct_main.run(['run', bundle_name, '--disable-instructions'], configure_logging=False)
def start_proxy(nr_of_containers): log = logging.getLogger(__name__) bundle_name = 'conductr-haproxy' configuration_name = 'conductr-haproxy-dev-mode' log.info(headline('Starting HAProxy')) log.info('Deploying bundle {} with configuration {}'.format(bundle_name, configuration_name)) conduct_main.run(['load', bundle_name, configuration_name, '--disable-instructions'], configure_logging=False) conduct_main.run(['run', bundle_name, '--scale', str(nr_of_containers), '--disable-instructions'], configure_logging=False)
def start(self): if major_version(self.image_version) == 1: pass else: log = logging.getLogger(__name__) log.info(headline('Starting visualization feature')) visualizer = select_bintray_uri('visualizer', self.version_args) log.info('Deploying bundle %s..' % visualizer['bundle']) conduct_main.run(['load', visualizer['bundle'], '--disable-instructions'], configure_logging=False) conduct_main.run(['run', visualizer['name'], '--disable-instructions'], configure_logging=False)
def start(self): log = logging.getLogger(__name__) log.info(headline('Starting monitoring feature')) bundle_repo = '' if self.version_args and self.version_args[0] == 'snapshot': bundle_repo = 'lightbend/commercial-monitoring/' grafana = select_bintray_uri('cinnamon-grafana', self.version_args, bundle_repo) log.info('Deploying bundle %s..' % grafana['bundle']) conduct_main.run(['load', grafana['bundle'], '--disable-instructions'], configure_logging=False) conduct_main.run(['run', grafana['name'], '--disable-instructions'], configure_logging=False)
def start(self): if major_version(self.image_version) == 1: pass else: log = logging.getLogger(__name__) log.info(headline('Starting logging feature based on eslite')) eslite = select_bintray_uri('eslite', self.version_args) log.info('Deploying bundle %s..' % eslite['bundle']) conduct_main.run(['load', eslite['bundle'], '--disable-instructions'], configure_logging=False) conduct_main.run(['run', eslite['name'], '--disable-instructions'], configure_logging=False)
def start(self): if major_version(self.image_version) == 1: pass else: log = logging.getLogger(__name__) log.info(headline('Starting logging feature based on eslite')) eslite = select_bintray_uri('eslite', self.version_args) log.info('Deploying bundle %s..' % eslite['bundle']) load_command = ['load', eslite['bundle'], '--disable-instructions'] + \ parse_offline_mode_arg(self.offline_mode) conduct_main.run(load_command, configure_logging=False) conduct_main.run(['run', eslite['name'], '--disable-instructions'], configure_logging=False)
def start(self): if major_version(self.image_version) == 1: pass else: log = logging.getLogger(__name__) log.info( headline( 'Starting logging feature based on elasticsearch and kibana' )) log.info( 'conductr-kibana bundle is packaged as a Docker image. Checking Docker requirements..' ) docker.validate_docker_vm(docker.vm_type()) log.info('Docker is installed and configured correctly.') elasticsearch = select_bintray_uri('conductr-elasticsearch', self.version_args) log.info('Deploying bundle %s..' % elasticsearch['bundle']) elasticsearch_load_command = ['load', elasticsearch['bundle'], '--disable-instructions'] + \ parse_offline_mode_arg(self.offline_mode) conduct_main.run(elasticsearch_load_command, configure_logging=False) conduct_main.run( ['run', elasticsearch['name'], '--disable-instructions'], configure_logging=False) kibana = select_bintray_uri('conductr-kibana', self.version_args) log.info('Deploying bundle %s..' % kibana['bundle']) kibana_load_command = ['load', kibana['bundle'], '--disable-instructions'] + \ parse_offline_mode_arg(self.offline_mode) conduct_main.run(kibana_load_command, configure_logging=False) conduct_main.run([ 'run', kibana['name'], '--disable-instructions', '--wait-timeout', '600' ], configure_logging=False)
def log_run_attempt(args, run_result, feature_results, feature_provided): """ Logs the run attempt. This method will be called after the completion of run method and when all the features has been started. :param args: args parsed from the input arguments :param run_result: the result from calling sandbox_run_jvm.run() - instance of sandbox_run_jvm.SandboxRunResult :param feature_results: the feature result :param feature_provided: the values provided by all started features :return: """ log = logging.getLogger(__name__) log.info(h1('Summary')) log.info(h2('ConductR')) log.info('ConductR has been started:') plural_core = 's' if len(run_result.core_addrs) > 1 else '' log.info(' core instance{} on {}'.format(plural_core, ', '.join(str(i) for i in run_result.core_addrs))) plural_agent = 's' if len(run_result.agent_addrs) > 1 else '' log.info(' agent instance{} on {}'.format(plural_agent, ', '.join(str(i) for i in run_result.agent_addrs))) log.info('ConductR service locator has been started on:') log.info(' {}:{}'.format(run_result.host, DEFAULT_SERVICE_LOCATOR_PORT)) log.info(h2('Proxy')) if FEATURE_PROVIDE_PROXYING in feature_provided: log.info('HAProxy has been started') log.info('By default, your bundles are accessible on:') log.info(' {}:{}'.format(run_result.host, args.bundle_http_port)) else: log.info('HAProxy has not been started') log.info('To enable proxying ensure Docker is running and restart the sandbox') if feature_results: log.info(h2('Features')) log.info('The following feature related bundles have been started:') for feature_result in feature_results: if FEATURE_PROVIDE_PROXYING in feature_provided: uri = '{}:{}'.format(run_result.host, feature_result.port) else: uri = '{}:{}/services/{}'.format(run_result.host, DEFAULT_SERVICE_LOCATOR_PORT, feature_result.name) log.info(' {} on {}'.format(feature_result.name, uri)) log.info(h2('Bundles')) log.info('Check latest bundle status with:') log.info(' conduct info') log.info('Current bundle status:') conduct_main.run(['info', '--host', run_result.host], configure_logging=False)
def start(self): log = logging.getLogger(__name__) log.info(headline('Starting monitoring feature')) bundle_repo = 'lightbend/commercial-monitoring/' if self.version_args and self.version_args[0] == 'snapshot' \ else '' bundle_name = 'cinnamon-grafana' if major_version( self.image_version) == 1 else 'cinnamon-grafana-docker' grafana = select_bintray_uri(bundle_name, self.version_args, bundle_repo) log.info('Deploying bundle %s..' % grafana['bundle']) load_command = ['load', grafana['bundle'], '--disable-instructions'] + \ parse_offline_mode_arg(self.offline_mode) conduct_main.run(load_command, configure_logging=False) conduct_main.run([ 'run', grafana['name'], '--disable-instructions', '--wait-timeout', '600' ], configure_logging=False)
def print_result(container_names, is_started, no_wait, wait_timeout, image_version): if not no_wait: log = logging.getLogger(__name__) if is_started: log.info(headline('Summary')) log.info('ConductR has been started') plural_string = 's' if len(container_names) > 1 else '' log.info('Check resource consumption of Docker container{} that run the ConductR node{} with:' .format(plural_string, plural_string)) log.info(' docker stats {}'.format(' '.join(container_names))) log.info('Check current bundle status with:') log.info(' conduct info') if major_version(image_version) != 1: log.info('Bundle status:') conduct_main.run(['info'], configure_logging=False) else: log.info(headline('Summary')) log.error('ConductR has not been started within {} seconds.'.format(wait_timeout)) log.error('Set the env CONDUCTR_SANDBOX_WAIT_RETRY_INTERVAL to increase the wait timeout.')
def start(self): if major_version(self.image_version) == 1: pass else: log = logging.getLogger(__name__) log.info(headline('Starting logging feature based on elasticsearch and kibana')) elasticsearch = select_bintray_uri('conductr-elasticsearch', self.version_args) log.info('Deploying bundle %s..' % elasticsearch['bundle']) conduct_main.run(['load', elasticsearch['bundle'], '--disable-instructions'], configure_logging=False) conduct_main.run(['run', elasticsearch['name'], '--disable-instructions'], configure_logging=False) kibana = select_bintray_uri('conductr-kibana', self.version_args) log.info('Deploying bundle %s..' % kibana['bundle']) conduct_main.run(['load', kibana['bundle'], '--disable-instructions'], configure_logging=False) conduct_main.run(['run', kibana['name'], '--disable-instructions'], configure_logging=False)
def log_run_attempt(args, run_result, is_started, wait_timeout): """ Logs the run attempt. This method will be called after the completion of run method and when all the features has been started. :param args: args parsed from the input arguments :param run_result: the result from calling sandbox_run_jvm.run() - instance of sandbox_run_jvm.SandboxRunResult :param is_started: sets to true if sandbox is started :param wait_timeout: the amount of timeout waiting for sandbox to be started :return: """ log = logging.getLogger(__name__) if not args.no_wait: if is_started: log.info(headline('Summary')) log.info('ConductR has been started:') nr_instance_core = len(run_result.core_pids) plural_core = 's' if nr_instance_core > 1 else '' log.info(' core: {} instance{}'.format(nr_instance_core, plural_core)) nr_instance_agent = len(run_result.agent_pids) plural_agents = 's' if nr_instance_agent > 1 else '' log.info(' agent: {} instance{}'.format(nr_instance_agent, plural_agents)) log.info('Check current bundle status with:') log.info(' conduct info') conduct_main.run(['info', '--host', run_result.host], configure_logging=False) else: log.info(headline('Summary')) log.error( 'ConductR has not been started within {} seconds.'.format( wait_timeout)) log.error( 'Set the env CONDUCTR_SANDBOX_WAIT_RETRY_INTERVAL to increase the wait timeout.' )
def main_method(): from conductr_cli import conduct_main conduct_main.run()