Update scripts
parent
2d9d25f5eb
commit
2c2ac23684
|
@ -1,24 +0,0 @@
|
|||
# yeasy/hyperledger-fabric-peer:dev
|
||||
# Dockerfile for developing Hyperledger peer image. This actually follow
|
||||
# yeasy/hyperledger-fabric-peer image and add local source code to build the
|
||||
# fabric binaries.
|
||||
# Data is stored under /var/hyperledger/db and /var/hyperledger/production
|
||||
|
||||
FROM yeasy/hyperledger-fabric-base:latest
|
||||
LABEL maintainer "Baohua Yang <yeasy.github.com>"
|
||||
|
||||
EXPOSE 7051
|
||||
|
||||
# ENV CORE_PEER_MSPCONFIGPATH $FABRIC_CFG_PATH/msp
|
||||
|
||||
COPY $GOPATH/src/github.com/hyperledger/fabric /go/src/github.com/hyperledger/
|
||||
|
||||
# install fabric peer and copy sampleconfigs
|
||||
RUN cd $FABRIC_ROOT/peer \
|
||||
&& CGO_CFLAGS=" " go install -ldflags "$LD_FLAGS -linkmode external -extldflags '-static -lpthread'" \
|
||||
&& go clean
|
||||
|
||||
# This will start with joining the default chain "testchainid"
|
||||
# Use `peer node start --peer-defaultchain=false` will join no channel by default.
|
||||
# Then need to manually create a chain with `peer channel create -c test_chain`, then join with `peer channel join -b test_chain.block`.
|
||||
CMD ["peer","node","start"]
|
|
@ -18,7 +18,6 @@ all:
|
|||
sleep 1
|
||||
|
||||
make qscc
|
||||
sleep 1
|
||||
|
||||
make stop
|
||||
|
||||
|
@ -39,17 +38,16 @@ dev:
|
|||
sleep 1
|
||||
|
||||
make qscc
|
||||
sleep 1
|
||||
|
||||
make dev_stop
|
||||
|
||||
ready:
|
||||
make stop
|
||||
make start
|
||||
sleep 3
|
||||
sleep 2
|
||||
|
||||
make init
|
||||
sleep 3
|
||||
sleep 2
|
||||
|
||||
make test_cc
|
||||
@echo "Now the fabric network is ready to play"
|
||||
|
|
|
@ -5,14 +5,11 @@ all:
|
|||
@echo "Please make sure u have setup Docker and pulled images by 'make setup'."
|
||||
sleep 2
|
||||
|
||||
@echo "Stop potential running network first"
|
||||
make stop
|
||||
|
||||
make start
|
||||
sleep 1
|
||||
@echo "Restarting network..."
|
||||
make restart
|
||||
|
||||
make init
|
||||
sleep 3
|
||||
sleep 2
|
||||
|
||||
make test_cc
|
||||
sleep 1
|
||||
|
@ -21,7 +18,6 @@ all:
|
|||
sleep 1
|
||||
|
||||
make qscc
|
||||
sleep 1
|
||||
|
||||
make stop
|
||||
|
||||
|
@ -29,23 +25,29 @@ dev:
|
|||
@echo "Please make sure u have setup Docker and pulled images by 'make setup'."
|
||||
sleep 2
|
||||
|
||||
@echo "Stop potential running dev network first"
|
||||
make dev_stop
|
||||
@echo "Restarting dev network..."
|
||||
make dev_restart
|
||||
|
||||
make dev_start
|
||||
sleep 5
|
||||
make dev_init
|
||||
sleep 2
|
||||
|
||||
make test_peer0
|
||||
sleep 1
|
||||
|
||||
make lscc
|
||||
sleep 1
|
||||
|
||||
make qscc
|
||||
|
||||
make dev_stop
|
||||
|
||||
ready:
|
||||
make stop
|
||||
make start
|
||||
sleep 3
|
||||
sleep 2
|
||||
|
||||
make init
|
||||
sleep 3
|
||||
sleep 2
|
||||
|
||||
make test_cc
|
||||
@echo "Now the fabric network is ready to play"
|
||||
|
@ -82,6 +84,8 @@ stop: # stop the fabric network
|
|||
@echo "Stop the fabric network"
|
||||
docker-compose -f ${COMPOSE_FILE} down # Stop a fabric network
|
||||
|
||||
restart: stop start
|
||||
|
||||
clean: # clean up environment
|
||||
@echo "Clean all images and containers"
|
||||
bash scripts/clean_env.sh
|
||||
|
@ -99,7 +103,13 @@ dev_start: # start fabric network for dev
|
|||
@echo "Start a fabric network with 1 peer for dev"
|
||||
docker-compose -f ${COMPOSE_DEV_FILE} up -d
|
||||
|
||||
dev_init: # initialize the fabric network
|
||||
@echo "Install and instantiate cc example02 on the fabric dev network"
|
||||
docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/initialize_peer0.sh"
|
||||
|
||||
dev_stop: # stop the fabric network for dev
|
||||
@echo "Stop the fabric network with 1 peer for dev"
|
||||
docker-compose -f ${COMPOSE_DEV_FILE} down
|
||||
|
||||
dev_restart: dev_stop dev_start
|
||||
|
||||
|
|
|
@ -0,0 +1,133 @@
|
|||
# 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:
|
||||
ca-base:
|
||||
#image: hyperledger/fabric-ca
|
||||
image: yeasy/hyperledger-fabric-ca:1.0.0
|
||||
#image: hyperledger/fabric-ca:x86_64-1.0.0
|
||||
environment:
|
||||
- FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
|
||||
- FABRIC_CA_SERVER_TLS_ENABLED=true
|
||||
|
||||
orderer-base:
|
||||
image: yeasy/hyperledger-fabric-orderer:1.0.0
|
||||
#image: hyperledger/fabric-orderer:x86_64-1.0.0
|
||||
environment:
|
||||
- ORDERER_GENERAL_LOGLEVEL=DEBUG
|
||||
- ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
|
||||
- ORDERER_GENERAL_GENESISMETHOD=file
|
||||
- ORDERER_GENERAL_GENESISFILE=/var/hyperledger/orderer/orderer.genesis.block
|
||||
- ORDERER_GENERAL_LOCALMSPID=OrdererMSP
|
||||
- ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp
|
||||
- ORDERER_GENERAL_LEDGERTYPE=file
|
||||
- ORDERER_GENERAL_BATCHTIMEOUT=2s
|
||||
- ORDERER_GENERAL_MAXMESSAGECOUNT=10
|
||||
- ORDERER_GENERAL_MAXWINDOWSIZE=1000
|
||||
- ORDERER_GENERAL_LISTENPORT=7050
|
||||
#- ORDERER_RAMLEDGER_HISTORY_SIZE=100 #only useful when use ram ledger
|
||||
# enabled TLS
|
||||
- ORDERER_GENERAL_TLS_ENABLED=true
|
||||
- ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key
|
||||
- ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt
|
||||
- ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt]
|
||||
expose:
|
||||
- "7050" #
|
||||
command: orderer start
|
||||
|
||||
peer-base:
|
||||
image: yeasy/hyperledger-fabric-peer:1.0.0
|
||||
#image: hyperledger/fabric-peer:x86_64-1.0.0
|
||||
environment:
|
||||
#- CORE_PEER_ID=peer0
|
||||
- CORE_PEER_ADDRESSAUTODETECT=false
|
||||
- CORE_LOGGING_LEVEL=DEBUG
|
||||
- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=10_default # uncomment this to use specific network
|
||||
#- CORE_PEER_NETWORKID=dev
|
||||
- CORE_PEER_GOSSIP_USELEADERELECTION=true
|
||||
- CORE_PEER_GOSSIP_ORGLEADER=false # this node is the group leader, default to false
|
||||
- CORE_PEER_PROFILE_ENABLED=false
|
||||
- CORE_PEER_TLS_ENABLED=true
|
||||
- CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/tls/server.crt
|
||||
- CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/tls/server.key
|
||||
- CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/tls/ca.crt
|
||||
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
|
||||
|
||||
peer-base-dev:
|
||||
image: yeasy/hyperledger-fabric:1.0.0
|
||||
environment:
|
||||
#- CORE_PEER_ID=peer0
|
||||
- CORE_PEER_ADDRESSAUTODETECT=false
|
||||
- CORE_LOGGING_LEVEL=DEBUG
|
||||
- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=10_default # uncomment this to use specific network
|
||||
#- CORE_PEER_NETWORKID=dev
|
||||
- CORE_PEER_GOSSIP_USELEADERELECTION=true
|
||||
- CORE_PEER_GOSSIP_ORGLEADER=false # this node is the group leader, default to false
|
||||
- CORE_PEER_PROFILE_ENABLED=false
|
||||
- CORE_PEER_TLS_ENABLED=true
|
||||
- CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/tls/server.crt
|
||||
- CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/tls/server.key
|
||||
- CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/tls/ca.crt
|
||||
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: bash -c 'bash /tmp/peer_build.sh; peer node start'
|
||||
|
||||
cli-base:
|
||||
image: yeasy/hyperledger-fabric:1.0.0
|
||||
#image: hyperledger/fabric-tools:x86_64-1.0.0
|
||||
tty: true
|
||||
environment:
|
||||
#- GOPATH=/opt/gopath
|
||||
- CORE_LOGGING_LEVEL=DEBUG
|
||||
- CORE_PEER_TLS_ENABLED=true # to enable TLS, change to true
|
||||
- ORDERER_CA=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
|
||||
- CHANNEL_NAME:="businesschannel"
|
||||
volumes:
|
||||
#- ./scripts:/opt/gopath/src/github.com/hyperledger/fabric/peer/scripts/
|
||||
- ./scripts:/tmp/scripts
|
||||
- ./e2e_cli/channel-artifacts:/tmp/channel-artifacts
|
||||
- ./e2e_cli/configtx.yaml:/etc/hyperledger/fabric/configtx.yaml
|
||||
- ./e2e_cli/crypto-config.yaml:/etc/hyperledger/fabric/crypto-config.yaml
|
||||
- ./e2e_cli/crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto
|
||||
- ./e2e_cli/examples:/opt/gopath/src/github.com/hyperledger/fabric/examples
|
||||
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
|
||||
command: bash -c 'while true; do sleep 20170504; done'
|
||||
|
||||
couchdb-base:
|
||||
#container_name: couchdb0
|
||||
image: hyperledger/fabric-couchdb:x86-64-1.0.0
|
||||
# Comment/Uncomment the port mapping if you want to hide/expose the CouchDB service,
|
||||
# for example map it to utilize Fauxton User Interface in dev environments.
|
|
@ -9,7 +9,7 @@ version: '2.0'
|
|||
|
||||
services:
|
||||
ca:
|
||||
image: hyperledger/fabric-ca
|
||||
image: yeasy/hyperledger-fabric-ca:1.0.1
|
||||
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
|
||||
|
@ -45,7 +45,7 @@ services:
|
|||
cli:
|
||||
container_name: fabric-cli
|
||||
hostname: fabric-cli
|
||||
image: hyperledger/fabric-tools
|
||||
image: yeasy/hyperledger-fabric:1.0.1
|
||||
tty: true
|
||||
environment:
|
||||
- CORE_PEER_ID=fabric-cli
|
||||
|
@ -83,7 +83,7 @@ services:
|
|||
event-listener:
|
||||
container_name: fabric-event-listener
|
||||
hostname: fabric-event-listener
|
||||
image: hyperledger/fabric-tools
|
||||
image: yeasy/hyperledger-fabric:1.0.1
|
||||
tty: true
|
||||
environment:
|
||||
- CORE_PEER_ID=fabric-event-listener
|
||||
|
|
|
@ -8,10 +8,15 @@
|
|||
version: '2.0'
|
||||
|
||||
services:
|
||||
ca:
|
||||
ca.org1.example.com:
|
||||
extends:
|
||||
file: docker-compose-base.yaml
|
||||
service: ca
|
||||
service: ca.org1.example.com
|
||||
|
||||
ca.org2.example.com:
|
||||
extends:
|
||||
file: docker-compose-base.yaml
|
||||
service: ca.org2.example.com
|
||||
|
||||
cli:
|
||||
extends:
|
||||
|
@ -23,6 +28,8 @@ services:
|
|||
file: docker-compose-base.yaml
|
||||
service: orderer.example.com
|
||||
|
||||
|
||||
|
||||
peer0.org1.example.com:
|
||||
extends:
|
||||
file: docker-compose-base.yaml
|
||||
|
|
|
@ -12,18 +12,46 @@
|
|||
version: '2' # v3 does not support 'extends' yet
|
||||
|
||||
services:
|
||||
ca:
|
||||
image: yeasy/hyperledger-fabric-ca:1.0.0
|
||||
container_name: fabric-ca
|
||||
hostname: fabric-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
|
||||
ca.org1.example.com:
|
||||
#image: yeasy/hyperledger-fabric-ca:1.0.0
|
||||
#image: hyperledger/fabric-ca:x86_64-1.0.0
|
||||
extends:
|
||||
file: base.yaml
|
||||
service: ca-base
|
||||
container_name: ca.org1.example.com
|
||||
hostname: ca.org1.example.com
|
||||
environment:
|
||||
- FABRIC_CA_SERVER_CA_NAME=ca-org1
|
||||
- FABRIC_CA_SERVER_TLS_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.org1.example.com-cert.pem
|
||||
- FABRIC_CA_SERVER_TLS_KEYFILE=/etc/hyperledger/fabric-ca-server-config/c843d3f021118963ce5d340e95286e8869bb7bd051454cd4166aa2887a2ad451_sk
|
||||
ports:
|
||||
- "7054:7054"
|
||||
command: fabric-ca-server start -b admin:adminpw
|
||||
volumes:
|
||||
- ./e2e_cli/crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/fabric-ca-server-config
|
||||
command: sh -c 'fabric-ca-server start --ca.certfile /etc/hyperledger/fabric-ca-server-config/ca.org1.example.com-cert.pem --ca.keyfile /etc/hyperledger/fabric-ca-server-config/c843d3f021118963ce5d340e95286e8869bb7bd051454cd4166aa2887a2ad451_sk -b admin:adminpw -d'
|
||||
|
||||
ca.org2.example.com:
|
||||
#image: yeasy/hyperledger-fabric-ca:1.0.0
|
||||
#image: hyperledger/fabric-ca:x86_64-1.0.0
|
||||
extends:
|
||||
file: base.yaml
|
||||
service: ca-base
|
||||
container_name: ca.org2.example.com
|
||||
hostname: ca.org2.example.com
|
||||
environment:
|
||||
- FABRIC_CA_SERVER_CA_NAME=ca-org2
|
||||
- FABRIC_CA_SERVER_TLS_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.org2.example.com-cert.pem
|
||||
- FABRIC_CA_SERVER_TLS_KEYFILE=/etc/hyperledger/fabric-ca-server-config/1ee551a8753171c0377366e96a1d7ec01afddb868c9483cc501b6f8ac7ae752f_sk
|
||||
ports:
|
||||
- "8054:7054"
|
||||
volumes:
|
||||
- ./e2e_cli/crypto-config/peerOrganizations/org2.example.com/ca/:/etc/hyperledger/fabric-ca-server-config
|
||||
command: sh -c 'fabric-ca-server start --ca.certfile /etc/hyperledger/fabric-ca-server-config/ca.org2.example.com-cert.pem --ca.keyfile /etc/hyperledger/fabric-ca-server-config/1ee551a8753171c0377366e96a1d7ec01afddb868c9483cc501b6f8ac7ae752f_sk -b admin:adminpw -d'
|
||||
|
||||
|
||||
orderer.example.com: # There can be multiple orderers
|
||||
extends:
|
||||
file: orderer-base.yaml
|
||||
file: base.yaml
|
||||
service: orderer-base
|
||||
container_name: orderer.example.com
|
||||
hostname: orderer.example.com
|
||||
|
@ -36,39 +64,29 @@ services:
|
|||
command: orderer start
|
||||
|
||||
cli:
|
||||
image: yeasy/hyperledger-fabric:1.0.0
|
||||
#image: yeasy/hyperledger-fabric:1.0.0
|
||||
#image: hyperledger/fabric-tools:x86_64-1.0.0
|
||||
extends:
|
||||
file: base.yaml
|
||||
service: cli-base
|
||||
container_name: fabric-cli
|
||||
hostname: fabric-cli
|
||||
tty: true
|
||||
environment:
|
||||
#- GOPATH=/opt/gopath
|
||||
- CORE_PEER_ID=fabric-cli
|
||||
- CORE_LOGGING_LEVEL=DEBUG
|
||||
- CORE_PEER_ADDRESS=peer0.org1.example.com:7051 # default to operate on peer0.org1
|
||||
- CORE_PEER_LOCALMSPID=Org1MSP
|
||||
- CORE_PEER_TLS_ENABLED=true # to enable TLS, change to true
|
||||
- CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
|
||||
- CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
|
||||
- CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
|
||||
- CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp
|
||||
- CHANNEL_NAME:="businesschannel"
|
||||
- ORDERER_CA=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
|
||||
volumes:
|
||||
#- ./scripts:/opt/gopath/src/github.com/hyperledger/fabric/peer/scripts/
|
||||
- ./scripts:/tmp/scripts
|
||||
- ./e2e_cli/channel-artifacts:/tmp/channel-artifacts
|
||||
- ./e2e_cli/configtx.yaml:/etc/hyperledger/fabric/configtx.yaml
|
||||
- ./e2e_cli/crypto-config.yaml:/etc/hyperledger/fabric/crypto-config.yaml
|
||||
- ./e2e_cli/crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto
|
||||
- ./e2e_cli/examples:/opt/gopath/src/github.com/hyperledger/fabric/examples
|
||||
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
|
||||
command: bash -c 'while true; do sleep 20170504; done'
|
||||
|
||||
## following are peer nodes ##
|
||||
|
||||
peer0.org1.example.com:
|
||||
extends:
|
||||
file: peer-base.yaml
|
||||
file: base.yaml
|
||||
service: peer-base
|
||||
container_name: peer0.org1.example.com
|
||||
hostname: peer0.org1.example.com
|
||||
|
@ -85,11 +103,10 @@ services:
|
|||
- 7051:7051
|
||||
- 7052:7052
|
||||
- 7053:7053
|
||||
command: peer node start
|
||||
|
||||
peer1.org1.example.com:
|
||||
extends:
|
||||
file: peer-base.yaml
|
||||
file: base.yaml
|
||||
service: peer-base
|
||||
container_name: peer1.org1.example.com
|
||||
hostname: peer1.org1.example.com
|
||||
|
@ -107,11 +124,10 @@ services:
|
|||
- 8051:7051
|
||||
- 8052:7052
|
||||
- 8053:7053
|
||||
command: peer node start
|
||||
|
||||
peer0.org2.example.com:
|
||||
extends:
|
||||
file: peer-base.yaml
|
||||
file: base.yaml
|
||||
service: peer-base
|
||||
container_name: peer0.org2.example.com
|
||||
hostname: peer0.org2.example.com
|
||||
|
@ -129,11 +145,10 @@ services:
|
|||
- 9051:7051
|
||||
- 9052:7052
|
||||
- 9053:7053
|
||||
command: peer node start
|
||||
|
||||
peer1.org2.example.com:
|
||||
extends:
|
||||
file: peer-base.yaml
|
||||
file: base.yaml
|
||||
service: peer-base
|
||||
container_name: peer1.org2.example.com
|
||||
hostname: peer1.org2.example.com
|
||||
|
@ -151,4 +166,3 @@ services:
|
|||
- 10051:7051
|
||||
- 10052:7052
|
||||
- 10053:7053
|
||||
command: peer node start
|
||||
|
|
|
@ -8,10 +8,12 @@
|
|||
version: '2.0'
|
||||
|
||||
services:
|
||||
ca:
|
||||
image: hyperledger/fabric-ca
|
||||
container_name: fabric-ca
|
||||
hostname: fabric-ca
|
||||
ca.example.com: # not used currently
|
||||
extends:
|
||||
file: base.yaml
|
||||
service: ca-base
|
||||
container_name: ca.example.com
|
||||
hostname: ca.example.com
|
||||
# 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:
|
||||
- "7054:7054"
|
||||
|
@ -19,7 +21,7 @@ services:
|
|||
|
||||
orderer.example.com: # There can be multiple orderers
|
||||
extends:
|
||||
file: orderer-base.yaml
|
||||
file: base.yaml
|
||||
service: orderer-base
|
||||
container_name: orderer.example.com
|
||||
hostname: orderer.example.com
|
||||
|
@ -35,40 +37,29 @@ services:
|
|||
#extends:
|
||||
# file: peer-base-dev.yaml
|
||||
# service: peer-base
|
||||
image: yeasy/hyperledger-fabric:1.0.0
|
||||
#image: yeasy/hyperledger-fabric:1.0.1
|
||||
extends:
|
||||
file: base.yaml
|
||||
service: cli-base
|
||||
container_name: fabric-cli
|
||||
hostname: fabric-cli
|
||||
tty: true
|
||||
environment:
|
||||
- CORE_PEER_ID=fabric-cli
|
||||
- CORE_LOGGING_LEVEL=DEBUG
|
||||
- CORE_PEER_ADDRESS=peer0.org1.example.com:7051 # default to operate on peer0.org1
|
||||
- CORE_PEER_LOCALMSPID=Org1MSP
|
||||
- CORE_PEER_TLS_ENABLED=true # to enable TLS, change to true
|
||||
- CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
|
||||
- CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
|
||||
- CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
|
||||
- CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp
|
||||
- CHANNEL_NAME:="businesschannel"
|
||||
- ORDERER_CA=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
|
||||
volumes:
|
||||
#- $GOPATH/src/github.com/hyperledger/:/go/src/github.com/hyperledger/
|
||||
- ./scripts:/tmp/scripts
|
||||
- ./e2e_cli/channel-artifacts:/tmp/channel-artifacts
|
||||
- ./e2e_cli/configtx.yaml:/etc/hyperledger/fabric/configtx.yaml
|
||||
- ./e2e_cli/crypto-config.yaml:/etc/hyperledger/fabric/crypto-config.yaml
|
||||
- ./e2e_cli/crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto
|
||||
- ./e2e_cli/examples:/opt/gopath/src/github.com/hyperledger/fabric/examples
|
||||
- $GOPATH/src/github.com/hyperledger/fabric:/opt/gopath/src/github.com/hyperledger/fabric
|
||||
- /tmp/:/tmp/
|
||||
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
|
||||
command: bash -c 'while true; do sleep 20170504; done'
|
||||
|
||||
|
||||
peer0.org1.example.com:
|
||||
extends:
|
||||
file: peer-base-dev.yaml
|
||||
service: peer-base
|
||||
file: base.yaml
|
||||
service: peer-base-dev
|
||||
container_name: peer0.org1.example.com
|
||||
hostname: peer0.org1.example.com
|
||||
environment:
|
||||
|
|
|
@ -11,7 +11,7 @@ version: '2.0'
|
|||
|
||||
services:
|
||||
ca:
|
||||
image: hyperledger/fabric-ca
|
||||
image: yeasy/hyperledger-fabric-ca:1.0.1
|
||||
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
|
||||
|
@ -20,7 +20,7 @@ services:
|
|||
command: fabric-ca-server start -b admin:adminpw
|
||||
|
||||
orderer0: # There can be multiple orderers
|
||||
image: hyperledger/fabric-orderer
|
||||
image: yeasy/hyperledger-fabric-orderer:1.0.1
|
||||
container_name: fabric-orderer0
|
||||
hostname: orderer0
|
||||
environment:
|
||||
|
|
|
@ -1,70 +1,51 @@
|
|||
## Usage of cryptogen and configtxgen
|
||||
|
||||
As we already put the orderer_genesis.block, channel.tx, Org1MSPanchors.tx, Org2MSPanchors.tx under e2e_cli/channel-artifacts/.
|
||||
and put cryptographic materials to e2e_cli/crypto_config. So this doc will explain how we use cryptogen and configtxgen those two foundamental tools to manually create artifacts and certificates.
|
||||
To bootup a fabric network, we need:
|
||||
|
||||
> Artifacts:
|
||||
> * `orderer_genesis.block`: Genesis block for the ordering service
|
||||
> * `channel.tx`: Channel transaction file for peers broadcast to the orderer at channel creation time.
|
||||
> * `Org1MSPanchors.tx`, `Org2MSPanchors.tx`: Anchor peers, as the name described, use for specify each Org's anchor peer on this channel.
|
||||
* crypto_config: crypto keys/certs for all organizations, see `e2e_cli/crypto-config`
|
||||
* orderer_genesis.block: genesis block to bootup orderer, see `e2e_cli/channel-artifacts`
|
||||
* channel.tx: transaction to create an application channel, see `e2e_cli/channel-artifacts`
|
||||
* Org1MSPanchors.tx, Org2MSPanchors.tx: Transaction to update anchor config in Org1 and Org2, see `e2e_cli/channel-artifacts`
|
||||
|
||||
> Certificates:
|
||||
> * All files under crypto-config.
|
||||
|
||||
### cryptogen
|
||||
|
||||
This tool will generate the x509 certificates used to identify and authenticate the various components in the network.
|
||||
|
||||
First boot network through `docker-compose-2orgs-4peers.yaml`
|
||||
### Generate crypto-config using cryptogen
|
||||
|
||||
```bash
|
||||
$ (sudo) docker-compose -f docker-compose-2orgs-4peers.yaml up
|
||||
$ cryptogen generate --config=/etc/hyperledger/fabric/crypto-config.yaml --output ./crypto-config
|
||||
```
|
||||
cryptogen will read configuration from `crypto-config.yaml`, by default it was put under `/etc/hyperledger/fabric/`.
|
||||
|
||||
and execute `cryptogen generate` command
|
||||
|
||||
```bash
|
||||
$ cryptogen generate --config=/etc/hyperledger/fabric/crypto-config.yaml --output ./crypto
|
||||
```
|
||||
cryptogen will read configuration from `crypto-config.yaml`, so if we want to add(change) Orgs or perrs topology, we should change this file first.
|
||||
|
||||
> The results will save under directory crypto, and this directory has mounted from host, defined in the `docker-compose-2orgs-4peers.yaml.yaml`.
|
||||
> for more information refer to Example2
|
||||
Then put the generated `crypto-config` under `/etc/hyperledger/fabric/`.
|
||||
|
||||
|
||||
### [configtxgen](http://hyperledger-fabric.readthedocs.io/en/latest/configtxgen.html?highlight=crypto#)
|
||||
### Generate blocks/txs using [configtxgen](http://hyperledger-fabric.readthedocs.io/en/latest/configtxgen.html?highlight=crypto#)
|
||||
|
||||
This tool will generate genesis block, channel configuration transaction and update anchor peer.
|
||||
the following is a general steps after changing the configtx.yaml.
|
||||
|
||||
The `configtxgen` tool is in `/go/bin/`, and when it's executed,
|
||||
it will read configuration from `/etc/hyperledger/fabric/configtx.yaml`,
|
||||
So if we want to regenerate `orderer.genesis.block` and `channel.tx`, we should
|
||||
replace `configtx.yaml` using our own configtx.yaml first.
|
||||
By default, configtxgen will read configuration from `/etc/hyperledger/fabric/configtx.yaml`, Please customize the configtx.yaml file before running.
|
||||
|
||||
#### Create orderer genesis block
|
||||
|
||||
```bash
|
||||
root@cli: configtxgen -profile TwoOrgsOrdererGenesis -outputBlock ./channel-artifacts/orderer.genesis.block
|
||||
$ configtxgen -profile TwoOrgsOrdererGenesis -outputBlock ./channel-artifacts/orderer.genesis.block
|
||||
```
|
||||
|
||||
#### Create channel transaction artifact
|
||||
|
||||
```bash
|
||||
root@cli: CHANNEL_NAME=businesschannel
|
||||
root@cli: configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ./channel-artifacts/channel.tx -channelID ${CHANNEL_NAME}
|
||||
$ CHANNEL_NAME=businesschannel
|
||||
$ configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ./channel-artifacts/channel.tx -channelID ${CHANNEL_NAME}
|
||||
```
|
||||
`channel.tx` is used for generating new channel `businesschannel`
|
||||
|
||||
`channel.tx` is used for creating a new application channel `businesschannel`
|
||||
|
||||
#### Update anchor peer for Organizations on the channel
|
||||
|
||||
Chose peer peer0.org1.example.com as org1's anchor peer, and peer0.org2.example.com as org2's anchor peer.
|
||||
Choose peer peer0.org1.example.com as org1's anchor peer, and peer0.org2.example.com as org2's anchor peer.
|
||||
|
||||
```bash
|
||||
root@cli: configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org1MSPanchors.tx -channelID ${CHANNEL_NAME} -asOrg Org1MSP
|
||||
$ configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org1MSPanchors.tx -channelID ${CHANNEL_NAME} -asOrg Org1MSP
|
||||
```
|
||||
|
||||
```bash
|
||||
root@cli: configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org2MSPanchors.tx -channelID ${CHANNEL_NAME} -asOrg Org2MSP
|
||||
$ configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org2MSPanchors.tx -channelID ${CHANNEL_NAME} -asOrg Org2MSP
|
||||
```
|
||||
|
||||
> more details refer to Example2
|
||||
|
|
|
@ -6,6 +6,23 @@
|
|||
version: '2'
|
||||
|
||||
services:
|
||||
zookeeper:
|
||||
image: hyperledger/fabric-zookeeper
|
||||
restart: always
|
||||
ports:
|
||||
- '2181'
|
||||
- '2888'
|
||||
- '3888'
|
||||
|
||||
kafka:
|
||||
image: hyperledger/fabric-kafka
|
||||
restart: always
|
||||
environment:
|
||||
- KAFKA_MESSAGE_MAX_BYTES=103809024 # 99 * 1024 * 1024 B
|
||||
- KAFKA_REPLICA_FETCH_MAX_BYTES=103809024 # 99 * 1024 * 1024 B
|
||||
- KAFKA_UNCLEAN_LEADER_ELECTION_ENABLE=false
|
||||
ports:
|
||||
- '9092'
|
||||
|
||||
orderer.example.com:
|
||||
container_name: orderer.example.com
|
||||
|
@ -22,6 +39,9 @@ services:
|
|||
- ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key
|
||||
- ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt
|
||||
- ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt]
|
||||
- ORDERER_KAFKA_RETRY_SHORTINTERVAL=1s
|
||||
- ORDERER_KAFKA_RETRY_SHORTTOTAL=30s
|
||||
- ORDERER_KAFKA_VERBOSE=true
|
||||
working_dir: /opt/gopath/src/github.com/hyperledger/fabric
|
||||
command: orderer
|
||||
volumes:
|
||||
|
|
|
@ -1,16 +1,14 @@
|
|||
-----BEGIN CERTIFICATE-----
|
||||
MIICczCCAhmgAwIBAgIRAMhEZyeKhxydxHUEhg2oaR4wCgYIKoZIzj0EAwIwczEL
|
||||
MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG
|
||||
cmFuY2lzY28xGTAXBgNVBAoTEG9yZzEuZXhhbXBsZS5jb20xHDAaBgNVBAMTE2Nh
|
||||
Lm9yZzEuZXhhbXBsZS5jb20wHhcNMTcwNjIzMDk0NTE4WhcNMjcwNjIxMDk0NTE4
|
||||
WjBzMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMN
|
||||
U2FuIEZyYW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEcMBoGA1UE
|
||||
AxMTY2Eub3JnMS5leGFtcGxlLmNvbTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IA
|
||||
BK/9v1lYLk11rbMn3NC8QWYpUWfR1zp5ZgEfTy+tjUltLOv3kMRwEKRh5g9VcfbX
|
||||
5HZGXvgLe7ergIYE1JO4pNqjgY0wgYowDgYDVR0PAQH/BAQDAgGmMA8GA1UdJQQI
|
||||
MAYGBFUdJQAwDwYDVR0TAQH/BAUwAwEB/zApBgNVHQ4EIgQg8vWgjVlptKIfmbVm
|
||||
ekJlZKPmQKJo0va/53oOBm77Qm8wKwYDVR0jBCQwIoAg8vWgjVlptKIfmbVmekJl
|
||||
ZKPmQKJo0va/53oOBm77Qm8wCgYIKoZIzj0EAwIDSAAwRQIhAMDV3r/I11xDy9Zb
|
||||
e9s1ofL/N7h2FJnB0EF1as2vtEwFAiA7qZXGmKmhi/PSI2QYSJQdy4DkL0e2lVHb
|
||||
L9ehMXWqfA==
|
||||
MIICFzCCAb2gAwIBAgIUc1+agvv6qzp9xDWl6g9WpYORxuYwCgYIKoZIzj0EAwIw
|
||||
aDELMAkGA1UEBhMCVVMxFzAVBgNVBAgTDk5vcnRoIENhcm9saW5hMRQwEgYDVQQK
|
||||
EwtIeXBlcmxlZGdlcjEPMA0GA1UECxMGRmFicmljMRkwFwYDVQQDExBmYWJyaWMt
|
||||
Y2Etc2VydmVyMB4XDTE3MDkwMTEyMTAwMFoXDTMyMDgyODEyMTAwMFowaDELMAkG
|
||||
A1UEBhMCVVMxFzAVBgNVBAgTDk5vcnRoIENhcm9saW5hMRQwEgYDVQQKEwtIeXBl
|
||||
cmxlZGdlcjEPMA0GA1UECxMGRmFicmljMRkwFwYDVQQDExBmYWJyaWMtY2Etc2Vy
|
||||
dmVyMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE08uF7jpdq4dFRpIv6bYBjbnr
|
||||
aDgLlD5FCeNz5An577q1h0r7YH6ZwOuhyzhdoIfeYLeDfaj2Xbra8vr350yDhqNF
|
||||
MEMwDgYDVR0PAQH/BAQDAgEGMBIGA1UdEwEB/wQIMAYBAf8CAQEwHQYDVR0OBBYE
|
||||
FCZc/+QicFoIqTNZnnlTYoj04lMPMAoGCCqGSM49BAMCA0gAMEUCIQD8Ho4Lv8wr
|
||||
6EJX4fxm0c5Kucj1/GuQYp1+hWI2Kv2opQIgfX/moBhtbfVX2P5uFq/ps1xga5QB
|
||||
fAicNHzdIZIEINc=
|
||||
-----END CERTIFICATE-----
|
||||
|
|
|
@ -1,16 +1,14 @@
|
|||
-----BEGIN CERTIFICATE-----
|
||||
MIICcTCCAhigAwIBAgIQVyhICNdAdNW5x3TyyfZzNzAKBggqhkjOPQQDAjBzMQsw
|
||||
CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy
|
||||
YW5jaXNjbzEZMBcGA1UEChMQb3JnMi5leGFtcGxlLmNvbTEcMBoGA1UEAxMTY2Eu
|
||||
b3JnMi5leGFtcGxlLmNvbTAeFw0xNzA2MjMwOTQ1MThaFw0yNzA2MjEwOTQ1MTha
|
||||
MHMxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1T
|
||||
YW4gRnJhbmNpc2NvMRkwFwYDVQQKExBvcmcyLmV4YW1wbGUuY29tMRwwGgYDVQQD
|
||||
ExNjYS5vcmcyLmV4YW1wbGUuY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE
|
||||
Wzs88GuU7yNwyNqYPN9WBahQOQD6sko7wJ9UHvoH8TaZrTxHpYNrUB2Q4EQ60gNV
|
||||
ekDe5PjYDzaAlMBzWDeL3KOBjTCBijAOBgNVHQ8BAf8EBAMCAaYwDwYDVR0lBAgw
|
||||
BgYEVR0lADAPBgNVHRMBAf8EBTADAQH/MCkGA1UdDgQiBCBKVrz2SRPkml1qBd6a
|
||||
cfP6HDn/HENx+7PZI82OPg91vTArBgNVHSMEJDAigCBKVrz2SRPkml1qBd6acfP6
|
||||
HDn/HENx+7PZI82OPg91vTAKBggqhkjOPQQDAgNHADBEAiA7DsmjqkefyEsN6lUD
|
||||
NdUxbI6VfYNti7UMafFrfMIaPgIgcHuQIzX1i/sC5NynVlWelzsHDSeUMUH/9SSQ
|
||||
Sh0ZsPA=
|
||||
MIICFzCCAb2gAwIBAgIURsIbQqHWP/Xld/+cNpoiUjDkf7EwCgYIKoZIzj0EAwIw
|
||||
aDELMAkGA1UEBhMCVVMxFzAVBgNVBAgTDk5vcnRoIENhcm9saW5hMRQwEgYDVQQK
|
||||
EwtIeXBlcmxlZGdlcjEPMA0GA1UECxMGRmFicmljMRkwFwYDVQQDExBmYWJyaWMt
|
||||
Y2Etc2VydmVyMB4XDTE3MDkwMTEyMTAwMFoXDTMyMDgyODEyMTAwMFowaDELMAkG
|
||||
A1UEBhMCVVMxFzAVBgNVBAgTDk5vcnRoIENhcm9saW5hMRQwEgYDVQQKEwtIeXBl
|
||||
cmxlZGdlcjEPMA0GA1UECxMGRmFicmljMRkwFwYDVQQDExBmYWJyaWMtY2Etc2Vy
|
||||
dmVyMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEHTlmMB4Qe7S6vPto+nx/HnL4
|
||||
9urpL/WDp7VobCJ6wGEe95GfgVYhrWlknVNyGo4KpXekmLY37gk5uqgLJ9H/GKNF
|
||||
MEMwDgYDVR0PAQH/BAQDAgEGMBIGA1UdEwEB/wQIMAYBAf8CAQEwHQYDVR0OBBYE
|
||||
FDckAC9W802EVzO70nN2k9zx8xYQMAoGCCqGSM49BAMCA0gAMEUCIQCDHyBcBMgm
|
||||
DnuCxZyHCPTGGWM43DgBfArjz50kU9LJ/gIgNQ2JVOd4bkHKp/XX3FMz/PsFfgqi
|
||||
40DhRcAuWgRE6Q4=
|
||||
-----END CERTIFICATE-----
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
# 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-orderer image.
|
||||
|
||||
version: '2'
|
||||
|
||||
services:
|
||||
orderer-base:
|
||||
image: yeasy/hyperledger-fabric-orderer:1.0.0
|
||||
environment:
|
||||
- ORDERER_GENERAL_LOGLEVEL=DEBUG
|
||||
- ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
|
||||
- ORDERER_GENERAL_GENESISMETHOD=file
|
||||
- ORDERER_GENERAL_GENESISFILE=/var/hyperledger/orderer/orderer.genesis.block
|
||||
- ORDERER_GENERAL_LOCALMSPID=OrdererMSP
|
||||
- ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp
|
||||
- ORDERER_GENERAL_LEDGERTYPE=file
|
||||
- ORDERER_GENERAL_BATCHTIMEOUT=2s
|
||||
- ORDERER_GENERAL_MAXMESSAGECOUNT=10
|
||||
- ORDERER_GENERAL_MAXWINDOWSIZE=1000
|
||||
- ORDERER_GENERAL_LISTENPORT=7050
|
||||
#- ORDERER_RAMLEDGER_HISTORY_SIZE=100 #only useful when use ram ledger
|
||||
# enabled TLS
|
||||
- ORDERER_GENERAL_TLS_ENABLED=true
|
||||
- ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key
|
||||
- ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt
|
||||
- ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt]
|
||||
expose:
|
||||
- "7050" #
|
||||
command: orderer start
|
|
@ -1,40 +0,0 @@
|
|||
# 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-base:
|
||||
image: yeasy/hyperledger-fabric:1.0.0
|
||||
environment:
|
||||
#- CORE_PEER_ID=peer0
|
||||
- CORE_PEER_ADDRESSAUTODETECT=false
|
||||
- CORE_LOGGING_LEVEL=DEBUG
|
||||
- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=10_default # uncomment this to use specific network
|
||||
#- CORE_PEER_NETWORKID=dev
|
||||
- CORE_PEER_GOSSIP_USELEADERELECTION=true
|
||||
- CORE_PEER_GOSSIP_ORGLEADER=false # this node is the group leader, default to false
|
||||
- CORE_PEER_PROFILE_ENABLED=false
|
||||
- CORE_PEER_TLS_ENABLED=true
|
||||
- CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/tls/server.crt
|
||||
- CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/tls/server.key
|
||||
- CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/tls/ca.crt
|
||||
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: bash -c 'bash /tmp/peer_build.sh; peer node start'
|
|
@ -1,40 +0,0 @@
|
|||
# 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-base:
|
||||
image: yeasy/hyperledger-fabric-peer:1.0.0
|
||||
environment:
|
||||
#- CORE_PEER_ID=peer0
|
||||
- CORE_PEER_ADDRESSAUTODETECT=false
|
||||
- CORE_LOGGING_LEVEL=DEBUG
|
||||
- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=10_default # uncomment this to use specific network
|
||||
#- CORE_PEER_NETWORKID=dev
|
||||
- CORE_PEER_GOSSIP_USELEADERELECTION=true
|
||||
- CORE_PEER_GOSSIP_ORGLEADER=false # this node is the group leader, default to false
|
||||
- CORE_PEER_PROFILE_ENABLED=false
|
||||
- CORE_PEER_TLS_ENABLED=true
|
||||
- CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/tls/server.crt
|
||||
- CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/tls/server.key
|
||||
- CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/tls/ca.crt
|
||||
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
|
|
@ -39,11 +39,9 @@ installChaincode 3
|
|||
|
||||
# Instantiate chaincode on all peers
|
||||
# Instantiate can only be executed once on any node
|
||||
echo_b "Instantiating chaincode on all 4 peers..."
|
||||
echo_b "Instantiating chaincode on all 2 channels (once for each channel)..."
|
||||
instantiateChaincode 0
|
||||
instantiateChaincode 1
|
||||
instantiateChaincode 2
|
||||
instantiateChaincode 3
|
||||
|
||||
|
||||
echo
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Importing useful functions for cc testing
|
||||
if [ -f ./func.sh ]; then
|
||||
source ./func.sh
|
||||
elif [ -f scripts/func.sh ]; then
|
||||
source scripts/func.sh
|
||||
fi
|
||||
|
||||
echo
|
||||
echo " ============================================== "
|
||||
echo " ==========initialize businesschannel========== "
|
||||
echo " ============================================== "
|
||||
echo
|
||||
|
||||
echo_b "Channel name : "$CHANNEL_NAME
|
||||
|
||||
## Create channel
|
||||
echo_b "Creating channel..."
|
||||
createChannel
|
||||
|
||||
## Join all the peers to the channel
|
||||
echo_b "Having all peers join the channel..."
|
||||
joinChannel 0
|
||||
|
||||
|
||||
## Set the anchor peers for each org in the channel
|
||||
echo_b "Updating anchor peers for peer0/org1..."
|
||||
updateAnchorPeers 0
|
||||
|
||||
## Install chaincode on all peers
|
||||
echo_b "Installing chaincode on peer0..."
|
||||
installChaincode 0
|
||||
|
||||
# Instantiate chaincode on all peers
|
||||
# Instantiate can only be executed once on any node
|
||||
echo_b "Instantiating chaincode on the channel..."
|
||||
instantiateChaincode 0
|
||||
|
||||
|
||||
echo
|
||||
echo_g "===================== All GOOD, initialization completed ===================== "
|
||||
echo
|
||||
|
||||
echo
|
||||
echo " _____ _ _ ____ "
|
||||
echo "| ____| | \ | | | _ \ "
|
||||
echo "| _| | \| | | | | |"
|
||||
echo "| |___ | |\ | | |_| |"
|
||||
echo "|_____| |_| \_| |____/ "
|
||||
echo
|
||||
|
||||
exit 0
|
|
@ -9,43 +9,19 @@ fi
|
|||
|
||||
echo_b "Channel name : "$CHANNEL_NAME
|
||||
|
||||
echo_b "====================1.Create channel(default newchannel) ============================="
|
||||
createChannel
|
||||
|
||||
sleep 2
|
||||
|
||||
echo_b "====================2.Join pee0 to the channel ======================================"
|
||||
joinChannel 0
|
||||
|
||||
sleep 2
|
||||
|
||||
echo_b "====================3.set anchor peers for org1 in the channel==========================="
|
||||
updateAnchorPeers 0
|
||||
|
||||
sleep 2
|
||||
|
||||
echo_b "=====================4.Install chaincode test_cc on Peer0/Org0========================"
|
||||
installChaincode 0
|
||||
|
||||
sleep 2
|
||||
|
||||
echo_b "=====================5.Instantiate chaincode, this will take a while, pls waiting...==="
|
||||
instantiateChaincode 0
|
||||
|
||||
sleep 2
|
||||
|
||||
echo_b "====================6.Query the existing value of a===================================="
|
||||
echo_b "====================Query the existing value of a===================================="
|
||||
chaincodeQuery 0 100
|
||||
|
||||
echo_b "=====================7.Invoke a transaction to transfer 10 from a to b=================="
|
||||
echo_b "=====================Invoke a transaction to transfer 10 from a to b=================="
|
||||
chaincodeInvoke 0
|
||||
|
||||
sleep 2
|
||||
|
||||
echo_b "=====================8.Check if the result of a is 90==================================="
|
||||
echo_b "=====================Check if the result of a is 90==================================="
|
||||
chaincodeQuery 0 90
|
||||
|
||||
echo
|
||||
echo_g "=====================9.All GOOD, MVE Test completed ===================== "
|
||||
echo_g "=====================All GOOD, MVE Test completed ===================== "
|
||||
echo
|
||||
exit 0
|
||||
|
|
|
@ -19,9 +19,9 @@ fi
|
|||
#: ${CHANNEL_NAME:="businesschannel"}
|
||||
|
||||
echo_b "Qscc GetChainInfo"
|
||||
|
||||
peer chaincode query -C "" -n qscc -c '{"Args":["GetChainInfo","businesschannel"]}'
|
||||
|
||||
peer chaincode query -C "" -n qscc -c '{"Args":["GetBlockByNumber","businesschannel","5"]}'
|
||||
echo_b "Qscc GetBlockByNumber 2"
|
||||
peer chaincode query -C "" -n qscc -c '{"Args":["GetBlockByNumber","businesschannel","2"]}'
|
||||
|
||||
echo_g "Qscc testing done!"
|
Loading…
Reference in New Issue