-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstart.sh
29 lines (26 loc) · 6.15 KB
/
start.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
set -ev
export COMPOSE_PROJECT_NAME=supplychain
export ORDERER_CA=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/supplychain.com/orderers/orderer.supplychain.com/msp/tlscacerts/tlsca.supplychain.com-cert.pem
docker-compose -f docker-compose.yml down
docker-compose -f docker-compose.yml up -d
sleep 10
# creating channel
docker exec cli peer channel create -o orderer.supplychain.com:7050 -c supplychainchannel -f /etc/hyperledger/configtx/channel.tx --tls --cafile $ORDERER_CA
# joining peers to channels
sleep 15
docker exec -e "CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/warehouse.supplychain.com/peers/peer0.warehouse.supplychain.com/tls/ca.crt" -e "CORE_PEER_ADDRESS=peer0.warehouse.supplychain.com:7051" -e "CORE_PEER_LOCALMSPID=warehouseMSP" -e "CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/warehouse.supplychain.com/users/[email protected]/msp" cli peer channel join -b supplychainchannel.block --tls --cafile $ORDERER_CA
docker exec -e "CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/collection.supplychain.com/peers/peer0.collection.supplychain.com/tls/ca.crt" -e "CORE_PEER_ADDRESS=peer0.collection.supplychain.com:7051" -e "CORE_PEER_LOCALMSPID=collectionMSP" -e "CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/collection.supplychain.com/users/[email protected]/msp" cli peer channel join -b supplychainchannel.block --tls --cafile $ORDERER_CA
docker exec -e "CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/customer.supplychain.com/peers/peer0.customer.supplychain.com/tls/ca.crt" -e "CORE_PEER_ADDRESS=peer0.customer.supplychain.com:7051" -e "CORE_PEER_LOCALMSPID=customerMSP" -e "CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/customer.supplychain.com/users/[email protected]/msp" cli peer channel join -b supplychainchannel.block --tls --cafile $ORDERER_CA
# installing and instatiating chaincode
docker exec -e "CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/warehouse.supplychain.com/peers/peer0.warehouse.supplychain.com/tls/ca.crt" -e "CORE_PEER_LOCALMSPID=warehouseMSP" -e "CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/warehouse.supplychain.com/users/[email protected]/msp" cli peer chaincode install -o orderer.supplychain.com:7050 -n sc -v 0 -p "github.com/supplychain" --tls --cafile $ORDERER_CA
docker exec -e "CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/collection.supplychain.com/peers/peer0.collection.supplychain.com/tls/ca.crt" -e "CORE_PEER_ADDRESS=peer0.collection.supplychain.com:7051" -e "CORE_PEER_LOCALMSPID=collectionMSP" -e "CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/collection.supplychain.com/users/[email protected]/msp" cli peer chaincode install -n sc -v 0 -p "github.com/supplychain" --tls --cafile $ORDERER_CA
docker exec -e "CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/customer.supplychain.com/peers/peer0.customer.supplychain.com/tls/ca.crt" -e "CORE_PEER_ADDRESS=peer0.customer.supplychain.com:7051" -e "CORE_PEER_LOCALMSPID=customerMSP" -e "CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/customer.supplychain.com/users/[email protected]/msp" cli peer chaincode install -n sc -v 0 -p "github.com/supplychain" --tls --cafile $ORDERER_CA
docker exec -e "CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/warehouse.supplychain.com/peers/peer0.warehouse.supplychain.com/tls/ca.crt" -e "CORE_PEER_LOCALMSPID=warehouseMSP" -e "CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/warehouse.supplychain.com/users/[email protected]/msp" cli peer chaincode instantiate -o orderer.supplychain.com:7050 -C supplychainchannel -n sc -v 0 -c '{"Args":[""]}' -P "OR ('warehouseMSP.member','collectionMSP.member','customerMSP.member')" --tls --cafile $ORDERER_CA
#docker exec -e "CORE_PEER_LOCALMSPID=collectionMSP" -e "CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/collection.supplychain.com/users/[email protected]/msp" cli peer chaincode instantiate -o orderer.supplychain.com:7050 -C supplychainchannel -n sc -v 0 -c '{"Args":[""]}' -P "OR ('warehouseMSP.member','collectionMSP.member','customerMSP.member')" --tls --cafile $ORDERER_CA
#docker exec -e "CORE_PEER_ADDRESS=peer0.collection.supplychain.com:7051" -e "CORE_PEER_LOCALMSPID=collectionMSP" -e "CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/collection.supplychain.com/users/[email protected]/msp" cli peer chaincode instantiate -o orderer.supplychain.com:7050 -C supplychainchannel -n sc -v 0 -c '{"Args":[""]}' -P "OR ('warehouseMSP.member','collectionMSP.member')"
#sleep 10
#docker exec cli peer chaincode invoke -C supplychainchannel -n sc -c '{"function":"recordPackage","Args":["1","status","here"]}'
#sleep 5
#docker exec -e "CORE_PEER_ADDRESS=peer0.collection.supplychain.com:7051" -e "CORE_PEER_LOCALMSPID=collectionMSP" -e "CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/collection.supplychain.com/users/[email protected]/msp" cli peer chaincode invoke -C supplychainchannel -n sc -c '{"function":"recordPackage","Args":["2","status","here"]}'
#sleep 5
#docker exec -e "CORE_PEER_LOCALMSPID=customerMSP" -e "CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/customer.supplychain.com/users/[email protected]/msp" cli peer chaincode query -C supplychainchannel -n sc -c '{"function":"queryPackage","Args":["2"]}'