Skip to content
James Taylor edited this page Feb 5, 2021 · 9 revisions

microfab

Running peer commands

docker run --name microfab --rm -v ${PWD}:/local:ro -p 8080:8080 -e MICROFAB_CONFIG ibmcom/ibp-microfab

sampleorg.env file:

CORE_PEER_LOCALMSPID=SampleOrgMSP
CORE_PEER_MSPCONFIGPATH=/opt/microfab/data/peer-sampleorg/msp
CORE_PEER_ADDRESS=sampleorgpeer-api.127-0-0-1.nip.io:8080

sampleorgadmin.env file:

CORE_PEER_LOCALMSPID=SampleOrgMSP???
CORE_PEER_MSPCONFIGPATH=/opt/microfab/data/???
CORE_PEER_ADDRESS=sampleorgpeer-api.127-0-0-1.nip.io:8080

List channels:

docker exec -it --env-file sampleorg.env microfab /opt/fabric/bin/peer channel list

Install chaincode:

docker exec -it --env-file sampleorgadmin.env microfab /opt/fabric/bin/peer lifecycle chaincode install /local/fabcarcc.tgz

Oh... without admin...

Error: chaincode install failed with status: 500 - Failed to authorize invocation due to failed ACL check: Failed verifying that proposal's creator satisfies local MSP principal during channelless check policy with policy [Admins]: [The identity is not an admin under this MSP [SampleOrgMSP]: The identity does not contain OU [ADMIN], MSP: [SampleOrgMSP]]

Unstable fabric

Running microfab with the latest Fabric binaries (tbc)

In the fabric repo...

TARGET=linux-amd64 RELEASE=unstable ./ci/scripts/create_binary_package.sh

Should create hyperledger-fabric-linux-amd64-unstable.tar.gz (and cause a mess because the script moves things!)

Untar the contents in a fabric-unstable directory where you want to run microfab.

Add the ca release to the fabric-unstable directory...

curl -sSL https://github.com/hyperledger/fabric-ca/releases/download/v1.4.9/hyperledger-fabric-ca-linux-amd64-1.4.9.tar.gz | tar xzf - -C ${PWD}/fabric-unstable

Edit core.yaml if required, e.g. add

peer:
    gateway:
        enabled: true
# ...

ledger:
  # ...
  snapshots:
    # Path on the file system where peer will store ledger snapshots
    rootDir: /opt/microfab/data/snapshots

Set the MICROFAB_CONFIG environment variable and start microfab with...

docker run --name microfab --rm -v ${PWD}/fabric-unstable:/opt/fabric:ro -p 8080:8080 -e MICROFAB_CONFIG ibmcom/ibp-microfab

Or for moar orgs...

export MICROFAB_CONFIG='{
    "ordering_organization": {
        "name": "Orderer"
    },
    "endorsing_organizations":[
        {
            "name": "Org1"
        },
        {
            "name": "Org2"
        },
        {
            "name": "Org3"
        }
    ],
    "channels":[
        {
            "name": "mychannel",
            "endorsing_organizations":[
                "Org1",
                "Org2",
                "Org3"
            ]
        }
    ],
    "capability_level":"V2_0"
}'

Clone this wiki locally