diff --git a/hyperledger/1.0/README.md b/hyperledger/1.0/README.md index a08bfff2..a79d103f 100644 --- a/hyperledger/1.0/README.md +++ b/hyperledger/1.0/README.md @@ -88,7 +88,7 @@ Use `docker exec -it fabric-cli bash` to open a bash inside container `fabric-cl Inside the container, run the following command to install a new chaincode of the example02. The chaincode will initialize two accounts: `a` and `b`, with value of `100` and `200`. ```bash -root@cli:/go/src/github.com/hyperledger/fabric# peer chaincode install -v 1.0 -n test_cc -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02 -c '{"Args":["init","a","100","b","200"]}' -o orderer0:7050 +root@cli:/go/src/github.com/hyperledger/fabric# peer chaincode install -v 1.0 -n test_cc -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02 -c '{"Args":["init","a","100","b","200"]}' ``` This will take a while, and the result may look like following. @@ -324,7 +324,7 @@ First install a chaincode named `test_cc` to `peer0`. root@cli:/go/src/github.com/hyperledger/fabric# CORE_PEER_MSPCONFIGPATH=$GOPATH/src/github.com/hyperledger/fabric/peer/crypto/peer/peer0/localMspConfig \ CORE_PEER_LOCALMSPID="Org0MSP" \ CORE_PEER_ADDRESS=peer0:7051 \ -peer chaincode install -n test_cc -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02 -v 1.0 -o orderer0:7050 +peer chaincode install -n test_cc -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02 -v 1.0 ``` This will take a while, and the result may look like following. diff --git a/hyperledger/1.0/docker-compose-dev.yml b/hyperledger/1.0/docker-compose-dev.yml new file mode 100644 index 00000000..57bd0602 --- /dev/null +++ b/hyperledger/1.0/docker-compose-dev.yml @@ -0,0 +1,81 @@ +# https://github.com/yeasy/docker-compose-files/tree/master/hyperledger +# This compose file will start a Hyperledger Fabric 1.0 MVE, including +# * ca +# * orderer +# * peer +# * sdk for testing + +# all peers will join the default testchainid channel after bootup + +version: '2.0' + +services: + ca: + image: hyperledger/fabric-ca + container_name: fabric-ca + hostname: ca + # command: /go/src/github.com/hyperledger/fabric-ca/bin/ca server start -ca testdata/ec.pem -ca-key testdata/ec-key.pem -config testdata/testconfig.json + ports: + - "8888:8888" + command: fabric-ca-server start -b admin:adminpw + + orderer0: # There can be multiple orderers + image: hyperledger/fabric-orderer + container_name: fabric-orderer0 + hostname: orderer0 + environment: + - ORDERER_GENERAL_LEDGERTYPE=ram + - ORDERER_GENERAL_BATCHTIMEOUT=10s + - ORDERER_GENERAL_MAXMESSAGECOUNT=10 + - ORDERER_GENERAL_MAXWINDOWSIZE=1000 + - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 + - ORDERER_GENERAL_LISTENPORT=7050 + - ORDERER_RAMLEDGER_HISTORY_SIZE=100 + - CONFIGTX_ORDERER_ORDERERTYPE=solo + ports: + - "7050:7050" + command: orderer + + peer0: + extends: + file: peer-dev.yml + service: peer + container_name: fabric-peer0 + hostname: peer0 + environment: + - CORE_PEER_ID=peer0 + - CORE_PEER_GOSSIP_ORGLEADER=true + - CORE_PEER_COMMITTER_LEDGER_ORDERER=orderer0:7050 + links: + - orderer0 + ports: + - 7051:7051 + depends_on: + - orderer0 + command: peer node start -o orderer0:7050 + + cli: + extends: + file: peer-dev.yml + service: peer + container_name: fabric-cli + hostname: cli + environment: + - CORE_PEER_ID=cli + - CORE_PEER_ADDRESS=peer0:7051 + #- CORE_PEER_LOCALMSPID=Org0MSP + #- CORE_PEER_COMMITTER_LEDGER_ORDERER=orderer:7050 + links: + - peer0 + - orderer0 + volumes: + - $GOPATH/src/github.com/hyperledger/:/go/src/github.com/hyperledger/ + depends_on: + - peer0 + - orderer0 + command: bash -c 'while true; do sleep 20170504; done' + +#networks: +# default: +# external: +# name: hyperledger_fabric diff --git a/hyperledger/1.0/docker-compose-new-channel.yml b/hyperledger/1.0/docker-compose-new-channel.yml index 7c3bc266..52fa83a0 100644 --- a/hyperledger/1.0/docker-compose-new-channel.yml +++ b/hyperledger/1.0/docker-compose-new-channel.yml @@ -98,7 +98,7 @@ services: depends_on: - peer0 - orderer0 - command: bash -c 'while true; do sleep 2017; done' + command: bash -c 'while true; do sleep 20170504; done' #networks: # default: diff --git a/hyperledger/1.0/docker-compose.yml b/hyperledger/1.0/docker-compose.yml index 14d98c5d..cf5bc299 100644 --- a/hyperledger/1.0/docker-compose.yml +++ b/hyperledger/1.0/docker-compose.yml @@ -71,7 +71,7 @@ services: depends_on: - peer0 - orderer0 - command: bash -c 'while true; do sleep 2017; done' + command: bash -c 'while true; do sleep 20170504; done' #networks: # default: diff --git a/hyperledger/1.0/peer-dev.yml b/hyperledger/1.0/peer-dev.yml new file mode 100644 index 00000000..e16b759a --- /dev/null +++ b/hyperledger/1.0/peer-dev.yml @@ -0,0 +1,44 @@ +# This is the default base file to config env and command +# Notice that chaincode is executed inside docker in default net mode +# https://github.com/yeasy/docker-compose-files + +# Depends on the hyperledger/fabric-peer image. + +version: '2' + +services: + peer: + image: yeasy/hyperledger-fabric + environment: + #- CORE_PEER_ID=peer0 + - CORE_PEER_ADDRESSAUTODETECT=true + - CORE_LOGGING_LEVEL=DEBUG + #- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=hyperledger_fabric # uncomment this to use specific network + #- CORE_PEER_NETWORKID=dev + - CORE_NEXT=true + - CORE_PEER_ENDORSER_ENABLED=true + - CORE_PEER_COMMITTER_ENABLED=true + - CORE_PEER_PROFILE_ENABLED=false + - CORE_PEER_GOSSIP_ORGLEADER=false # this node is the group leader, default to true + - CORE_PEER_GOSSIP_USELEADERELECTION=false # automatically run leader election, default to false + - CORE_PEER_GOSSIP_IGNORESECURITY=true + # The following setting skips the gossip handshake since we are + # are not doing mutual TLS + - CORE_PEER_GOSSIP_SKIPHANDSHAKE=true + #- CORE_PEER_COMMITTER_LEDGER_ORDERER=orderer:7050 + expose: + - "7050" # Rest + - "7051" # Grpc + - "7052" # Peer CLI + - "7053" # Peer Event + - "7054" # eCAP + - "7055" # eCAA + - "7056" # tCAP + - "7057" # eCAA + - "7058" # tlsCAP + - "7059" # tlsCAA + volumes: # docker.sock is mapped as the default CORE_VM_ENDPOINT + - /var/run/docker.sock:/var/run/docker.sock + #volumes: + # - /var/run/:/host/var/run/ + command: peer node start \ No newline at end of file