Exemple #1
0
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)
Exemple #2
0
def start_network_impl(context, ordererType, tlsEnabled=True):
    assert ordererType in config_util.ORDERER_TYPES, "Unknown network type '%s'" % ordererType
    curpath = os.path.realpath('.')

    context.composeFile = ["%s/docker-compose/docker-compose-%s.yml" % (curpath, ordererType)]
    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
    if tlsEnabled:
        common_util.enableTls(context, tlsEnabled)

    compose_impl(context, context.composeFile, projectName=context.projectName)