Add dev environment

pull/43/head
Baohua Yang 2017-05-04 22:15:51 +08:00
parent dde79239dc
commit f3bdbd9a1f
5 changed files with 129 additions and 4 deletions

View File

@ -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.

View File

@ -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

View File

@ -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:

View File

@ -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:

View File

@ -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