Exemplo n.º 1
0
def bootstrapped_impl(context, ordererType, database, tlsEnabled=False, timeout=300):
    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
    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
    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)
Exemplo n.º 2
0
def bootstrap_fca_impl(context, tlsEnabled=False):
    # Should TLS be enabled
    context.tls = tlsEnabled
    compose_util.enableTls(context, tlsEnabled)
    context = config_util.setCAConfig(context)
    compose_impl(context, ["docker-compose/docker-compose-preca.yml"],
                 context.projectName)
Exemplo n.º 3
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 = getCompositionFiles(context, curpath, ordererType)

    if not hasattr(context, "projectName"):
        context.projectName = None

    # Should TLS be enabled
    context.tls = tlsEnabled
    compose_util.enableTls(context, tlsEnabled, projectName=context.projectName)

    compose_impl(context, context.composeFile, projectName=context.projectName)
Exemplo n.º 4
0
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)
Exemplo n.º 5
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:
        compose_util.enableTls(context, tlsEnabled)

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