-
Notifications
You must be signed in to change notification settings - Fork 0
Hacks
James Taylor edited this page Feb 8, 2021
·
9 revisions
docker run --name microfab --rm -v ${PWD}:/local:ro -p 8080:8080 -e MICROFAB_CONFIG ibmcom/ibp-microfab
Create admin msp folder (inside home directory of microfab container- docker command tbc!)
mkdir -p msp/admincerts msp/cacerts msp/keystore msp/signcerts && curl -s http://console.127-0-0-1.nip.io:8080/ak/api/v1/components | jq -c -r '.[] | select(.id | contains("sampleorgadmin")) | .cert, .ca, .private_key' | split -a 1 -l 1 && find . -type f -name "x[abc]" -exec sh -c "base64 -d {} > {}.out" \; && mv xa.out msp/admincerts/sampleorgadmin.pem && mv xb.out msp/cacerts/ca.pem && mv xc.out msp/keystore/cert_sk && cp msp/admincerts/sampleorgadmin.pem msp/signcerts/sampleorgadmin.pem && rm x[abc]
docker exec -it -w /home/ibp-user /microfab /bin/sh -c 'mkdir -p msp/admincerts msp/cacerts msp/keystore msp/signcerts && curl -s http://console.127-0-0-1.nip.io:8080/ak/api/v1/components | jq -c -r ".[] | select(.id | contains(\"sampleorgadmin\")) | .cert, .ca, .private_key" | split -a 1 -l 1 && find . -type f -name "x[abc]" -exec sh -c "base64 -d {} > {}.out" \; && mv xa.out msp/admincerts/sampleorgadmin.pem && mv xb.out msp/cacerts/ca.pem && mv xc.out msp/keystore/cert_sk && cp msp/admincerts/sampleorgadmin.pem msp/signcerts/sampleorgadmin.pem && rm x[abc]'
sampleorgadmin.env file:
CORE_PEER_LOCALMSPID=SampleOrgMSP
CORE_PEER_MSPCONFIGPATH=/home/ibp-user/msp
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
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"
}'