config = list() config.append("tickTime={}".format( os.environ['ZOOKEEPER_TICK_TIME'] )) config.append("dataDir={}".format( data_dir )) config.append("clientPort={}".format( client_port )) config.append("initLimit={}".format( os.environ['ZOOKEEPER_INIT_LIMIT'] )) config.append("syncLimit={}".format( os.environ['ZOOKEEPER_SYNC_LIMIT'] )) for service_def in parsed_input: config.append("{}={}:2888:3888".format( re.sub(r"(.*)(\.\d)", r"server\2", service_def['Service']['ID']), service_def['Service']['Address'] )) ## ## PROGRAM CONFIGURATION AND SERVICE START: ## config_data = "\n".join( config ) LOG.info( "Zookeeper config is: \n{}".format(config_data) ) Utils.write_text( config_data, config_path ) Utils.write_text( str(int(server_index)+1), myid_path ) LOG.info( 'Config written to: {}'.format( config_path ) ) LOG.info( 'myid written to: {}'.format( myid_path ) ) LOG.info( 'Starting {}...'.format( service_name ) ) start_status = Utils.start_service( service_name ) if not start_status['Success']: LOG.error( "Starting {} failed with exit code {}.".format( service_name, start_status['ExitCode'] ) ) exit(101) ## ## DONE: ## LOG.info( 'Yay - DONE \o/.' )
config.append("--work_dir={}".format( os.environ['MESOS_SLAVE_WORK_DIR'] ) ) config.append("--master=zk://{}{}".format( zk_str, os.environ['MESOS_ZK_PATH'] ) ) config.append("--containerizers=docker,mesos" ) config.append("--executor_registration_timeout=5mins" ) else: LOG.error( 'Unknown Mesos node type: {}'.format( os.environ['MESOS_NODE_TYPE'] ) ) if len( config ) > 0: ## ## PROGRAM CONFIGURATION AND SERVICE START: ## config_data = "\n".join( config ) LOG.info( "Mesos {} config is: \n{}".format(os.environ['MESOS_NODE_TYPE'], config_data) ) Utils.write_text(config_data, config_path) LOG.info( 'Config written to: {}'.format( config_path ) ) LOG.info( 'Starting Mesos {}...'.format( os.environ['MESOS_NODE_TYPE'] ) ) start_status = Utils.start_service( service_name ) if not start_status['Success']: LOG.error( "Starting {} failed with exit code {}.".format( service_name, start_status['ExitCode'] ) ) exit(101) ## ## CONSUL SERVICES: ## consul_service = { "service": { "id": "{}-{}".format( service_name, os.environ['SERVER_INDEX'] ), "name": service_name,