def bootstrapped_impl(context, ordererType, database, tlsEnabled=False, timeout=120): assert ordererType in config_util.ORDERER_TYPES, "Unknown network type '%s'" % ordererType curpath = os.path.realpath('.') # Get the correct composition file context.composeFile = ["%s/docker-compose/docker-compose-%s.yml" % (curpath, ordererType)] if database.lower() != "leveldb": context.composeFile.append("%s/docker-compose/docker-compose-%s.yml" % (curpath, database.lower())) context.composeFile.append("%s/docker-compose/docker-compose-cli.yml" % (curpath)) for composeFile in context.composeFile: assert os.path.exists(composeFile), "The docker compose file does not exist: {0}".format(composeFile) # Should TLS be enabled context.tls = tlsEnabled common_util.enableTls(context, tlsEnabled) # Perform bootstrap process context.ordererProfile = config_util.PROFILE_TYPES.get(ordererType, "SampleInsecureSolo") channelID = context.interface.SYS_CHANNEL_ID if hasattr(context, "composition"): context.projectName = context.composition.projectName else: context.projectName = str(uuid.uuid1()).replace('-','') config_util.generateCrypto(context) config_util.generateConfig(context, channelID, config_util.CHANNEL_PROFILE, context.ordererProfile) compose_impl(context, context.composeFile, projectName=context.projectName) wait_for_bootstrap_completion(context, timeout)
def bootstrapped_impl(context, networkType): assert networkType in ORDERER_TYPES, "Unknown network type '%s'" % networkType curpath = os.path.realpath('.') context.composeFile = "%s/docker-compose/docker-compose-%s.yml" % (curpath, networkType) assert os.path.exists(context.composeFile), "The docker compose file does not exist: {0}".format(context.composeFile) context.ordererProfile = PROFILE_TYPES.get(networkType, "SampleInsecureSolo") channelID = endorser_util.SYS_CHANNEL_ID projectName = str(uuid.uuid1()).replace('-','') config_util.generateCrypto(projectName) config_util.generateConfig(channelID, config_util.CHANNEL_PROFILE, context.ordererProfile, projectName) compose_impl(context, context.composeFile, projectName=projectName)
def bootstrapped_impl(context, networkType): assert networkType in ORDERER_TYPES, "Unknown network type '%s'" % networkType curpath = os.path.realpath('.') context.composeFile = "%s/docker-compose/docker-compose-%s.yml" % (curpath, networkType) assert os.path.exists(context.composeFile), "The docker compose file does not exist: {0}".format(context.composeFile) context.ordererProfile = PROFILE_TYPES.get(networkType, "SampleInsecureSolo") channelID = endorser_util.SYS_CHANNEL_ID projectName = str(uuid.uuid1()).replace('-','') config_util.generateCrypto(projectName) config_util.generateConfig(channelID, config_util.CHANNEL_PROFILE, context.ordererProfile, projectName) compose_impl(context, context.composeFile, projectName=projectName)
def add_org_impl(context, orgName, channelName): #Save original crypto.yaml file copyfile("./configs/{0}/crypto.yaml".format(context.projectName), "./configs/{0}/crypto_orig.yaml".format(context.projectName)) # Add cryptogen info for 3rd org config_util.buildCryptoFile(context, 1, 2, 0, 2, orgName=orgName) config_util.generateCrypto(context, "./configs/{0}/crypto.yaml".format(context.projectName)) config_util.generateCryptoDir(context, 1, 2, 0, 2, tlsExist=context.tlsEnabled, orgName=orgName) # Format the args for adding a new org with the orgName (TitleCase name and remove '.' for MSPID) # Example: org3.example.com (MSPID:Org3ExampleCom) update_impl(context, 'peer', channelName, args, userName='******')
def bootstrapped_impl(context, ordererType, database, tlsEnabled=False, timeout=300, ouEnabled=False, fca=False): assert ordererType in config_util.ORDERER_TYPES, "Unknown network type '%s'" % ordererType curpath = os.path.realpath('.') # Get the correct composition file context.composeFile = getCompositionFiles(context, curpath, ordererType, database, fca) # Should TLS be enabled context.tls = tlsEnabled compose_util.enableTls(context, tlsEnabled) # Perform bootstrap process context.ordererProfile = config_util.PROFILE_TYPES.get( ordererType, "SampleInsecureSolo") channelID = context.interface.SYS_CHANNEL_ID if hasattr(context, "composition"): context.projectName = context.composition.projectName elif not hasattr(context, "projectName"): context.projectName = str(uuid.uuid1()).replace('-', '') # Determine number of orderers numOrderers = 1 if ordererType == 'kafka': numOrderers = 3 # Get Configs setup if ouEnabled: config_util.buildCryptoFile(context, 2, 2, numOrderers, 2, ouEnable=ouEnabled) config_util.generateCrypto( context, "./configs/{0}/crypto.yaml".format(context.projectName)) else: config_util.generateCrypto(context) config_util.generateConfig(context, channelID, config_util.CHANNEL_PROFILE, context.ordererProfile) compose_impl(context, context.composeFile, projectName=context.projectName) wait_for_bootstrap_completion(context, timeout)
def add_org_impl(context, orgMSP, channelName): configDir = "./configs/{0}".format(context.projectName) #Save original crypto.yaml file if os.path.exists("{0}/crypto.yaml".format(configDir)): copyfile("{0}/crypto.yaml".format(configDir), "{0}/crypto_orig.yaml".format(configDir)) # Add cryptogen info for 3rd org config_util.buildCryptoFile(context, 1, 2, 0, 2, orgMSP=orgMSP) config_util.generateCrypto(context, "{0}/crypto.yaml".format(configDir)) config_util.generateCryptoDir(context, 1, 2, 0, 2, tlsExist=context.tls, orgMSP=orgMSP) args = config_util.getNewOrg(context, orgMSP, channelName) updated_config = config_util.addNewOrg(context, args, "Application", channelName) update_impl(context, 'peer', channelName, updated_config, userName='******')
def step_impl(context): config_util.generateCrypto( context, "./configs/{0}/crypto.yaml".format(context.projectName))
def step_impl(context): if not hasattr(context, "projectName"): config_util.generateCrypto(context) config_util.setupConfigs(context, TEST_CHANNEL_ID)
def step_impl(context): config_util.generateCrypto(context) config_util.setupConfigs(context, TEST_CHANNEL_ID)