Add dev mode

pull/135/head
Baohua Yang 2019-12-13 21:05:18 -08:00
parent a0846ccebe
commit c7812b85b7
6 changed files with 98 additions and 200 deletions

View File

@ -6,7 +6,7 @@
# support advanced bash grammar
SHELL:=/bin/bash
# mode of the network: solo, kafka
# mode of the network: solo, kafka, raft, dev
HLF_MODE ?= raft
# mode of db: golevel, couchdb
@ -14,7 +14,7 @@ DB_MODE ?= golevel
NETWORK_INIT_WAIT ?= 2 # time to wait the fabric network finish initialization
COMPOSE_FILE ?= "docker-compose-2orgs-4peers-solo.yaml"
COMPOSE_FILE ?= "docker-compose-2orgs-4peers-raft.yaml"
LOG_PATH ?= solo/logs

View File

@ -1,97 +0,0 @@
# This is the development compose 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 yeasy/hyperledger-fabric image.
version: '2'
services:
orderer.example.com: # There can be multiple orderers
extends:
file: base.yaml
service: orderer-base
image: yeasy/hyperledger-fabric:${FABRIC_IMG_TAG}
container_name: orderer.example.com
hostname: orderer.example.com
ports:
- "7050:7050"
environment:
# Kafka related configurations
- ORDERER_KAFKA_RETRY_SHORTINTERVAL=1s
- ORDERER_KAFKA_RETRY_SHORTTOTAL=30s
- ORDERER_KAFKA_VERBOSE=true
volumes:
- $GOPATH/src/github.com/hyperledger/fabric:/go/src/github.com/hyperledger/fabric
# for solo case
#- ./solo/channel-artifacts/orderer.genesis.block:/var/hyperledger/orderer/orderer.genesis.block
#- ./solo/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp:/var/hyperledger/orderer/msp
#- ./solo/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/:/var/hyperledger/orderer/tls
# for kafka case
- ./kafka/channel-artifacts/orderer.genesis.block:/var/hyperledger/orderer/orderer.genesis.block
- ./kafka/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp:/var/hyperledger/orderer/msp
- ./kafka/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/:/var/hyperledger/orderer/tls
command: bash -c 'bash /tmp/orderer_build.sh; orderer start' # use this if to debug orderer
#command: bash -c 'orderer start'
peer0.org1.example.com:
extends:
file: base.yaml
service: peer-base
image: yeasy/hyperledger-fabric:${FABRIC_IMG_TAG}
container_name: peer0.org1.example.com
hostname: peer0.org1.example.com
environment:
- CORE_PEER_ID=peer0.org1.example.com
- CORE_PEER_ADDRESS=peer0.org1.example.com:7051
- CORE_PEER_CHAINCODELISTENADDRESS=peer0.org1.example.com:7052
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7051
- CORE_PEER_LOCALMSPID=Org1MSP
volumes:
- $GOPATH/src/github.com/hyperledger/fabric:/go/src/github.com/hyperledger/fabric
# solo mode configuration
#- ./solo/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp:/etc/hyperledger/fabric/msp
#- ./solo/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls:/etc/hyperledger/fabric/tls
# kafka mode configuration
- ./kafka/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp:/etc/hyperledger/fabric/msp
- ./kafka/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls:/etc/hyperledger/fabric/tls
ports:
- 7051:7051
- 7052:7052
- 7053:7053
#command: bash -c 'bash /tmp/peer_build.sh; peer node start'
command: bash -c 'peer node start'
#command: bash -c 'peer node start --peer-chaincodedev=true' # DEV mode
cli:
extends:
file: base.yaml
service: cli-base
image: yeasy/hyperledger-fabric:${FABRIC_IMG_TAG}
container_name: fabric-cli
hostname: fabric-cli
tty: true
environment:
- CORE_PEER_ID=fabric-cli
- CORE_PEER_ADDRESS=peer0.org1.example.com:7051 # default to operate on peer0.org1
- CORE_PEER_LOCALMSPID=Org1MSP
- CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
- CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
- CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
- CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp
volumes:
- $GOPATH/src/github.com/hyperledger/fabric:/opt/gopath/src/github.com/hyperledger/fabric
#- /tmp/:/tmp/
- ./scripts:/tmp/scripts
# solo mode configuration
#- ./solo/channel-artifacts:/tmp/channel-artifacts
#- ./solo/configtx.yaml:/etc/hyperledger/fabric/configtx.yaml
#- ./solo/crypto-config.yaml:/etc/hyperledger/fabric/crypto-config.yaml
#- ./solo/crypto-config:/etc/hyperledger/fabric/crypto-config
#- ./examples:/opt/gopath/src/github.com/hyperledger/fabric/examples
# kafka mode configuration
- ./kafka/channel-artifacts:/tmp/channel-artifacts
- ./kafka/configtx.yaml:/etc/hyperledger/fabric/configtx.yaml
- ./kafka/crypto-config.yaml:/etc/hyperledger/fabric/crypto-config.yaml
- ./kafka/crypto-config:/etc/hyperledger/fabric/crypto-config
- ./examples:/opt/gopath/src/github.com/hyperledger/fabric/examples

View File

@ -91,7 +91,6 @@ services:
expose:
- "7051" # gRPC
- "9443" # Operation REST
#command: bash -c 'bash /tmp/peer_build.sh; peer node start'
command: peer node start
cli-base:

View File

@ -1,92 +0,0 @@
# https://github.com/yeasy/files/tree/master/hyperledger
# This compose file will start a Hyperledger Fabric 1.0 MVE, including
# * 1 ca
# * 1 orderer
# * 1 peer
# * cli for testing
version: '2.0'
services:
orderer.example.com: # There can be multiple orderers
extends:
file: base-dev.yaml
service: orderer.example.com
depends_on:
- kafka0
- kafka1
- kafka2
- kafka3
peer0.org1.example.com:
extends:
file: base-dev.yaml
service: peer0.org1.example.com
depends_on:
- orderer.example.com
cli:
extends:
file: base-dev.yaml
service: cli
depends_on:
- peer0.org1.example.com
- orderer.example.com
# ZooKeeper services, at least 3 nodes
zookeeper0:
extends:
file: base-kafka.yaml
service: zookeeper0
zookeeper1:
extends:
file: base-kafka.yaml
service: zookeeper1
zookeeper2:
extends:
file: base-kafka.yaml
service: zookeeper2
# Kafka services, at least 4 node to tolerant work with 1 node failure
kafka0:
extends:
file: base-kafka.yaml
service: kafka0
depends_on:
- zookeeper0
- zookeeper1
- zookeeper2
kafka1:
extends:
file: base-kafka.yaml
service: kafka1
depends_on:
- zookeeper0
- zookeeper1
- zookeeper2
kafka2:
extends:
file: base-kafka.yaml
service: kafka2
depends_on:
- zookeeper0
- zookeeper1
- zookeeper2
kafka3:
extends:
file: base-kafka.yaml
service: kafka3
depends_on:
- zookeeper0
- zookeeper1
- zookeeper2
#networks:
# default:
# external:
# name: hyperledger_fabric

View File

@ -0,0 +1,84 @@
# https://github.com/yeasy/docker-compose-files/tree/master/hyperledger
# This compose file will start a Hyperledger Fabric 1.4 in dev mode, including
# It will map the $GOPATH/src/github.com/hyperledger/fabric:/go/src/github.com/hyperledger/fabric on peer0
# * 2 ca (not in use now)
# * 3 orderers
# * 4 peers in 2 orgs
# * cli for testing
version: '2.0'
services:
# ca.org1.example.com:
# extends:
# file: base-raft.yaml
# service: ca.org1.example.com
# ca.org2.example.com:
# extends:
# file: base-raft.yaml
# service: ca.org2.example.com
cli:
extends:
file: base-raft.yaml
service: cli
orderer0.example.com: # There can be multiple orderers
extends:
file: base-raft.yaml
service: orderer0.example.com
orderer1.example.com: # There can be multiple orderers
extends:
file: base-raft.yaml
service: orderer1.example.com
orderer2.example.com: # There can be multiple orderers
extends:
file: base-raft.yaml
service: orderer2.example.com
peer0.org1.example.com:
extends:
file: base-raft.yaml
service: peer0.org1.example.com
volumes:
- $GOPATH/src/github.com/hyperledger/fabric:/go/src/github.com/hyperledger/fabric
depends_on:
- orderer0.example.com
- orderer1.example.com
- orderer2.example.com
command: /go/src/github.com/hyperledger/fabric/peer/peer node start
peer1.org1.example.com:
extends:
file: base-raft.yaml
service: peer1.org1.example.com
depends_on:
- orderer0.example.com
- orderer1.example.com
- orderer2.example.com
peer0.org2.example.com:
extends:
file: base-raft.yaml
service: peer0.org2.example.com
depends_on:
- orderer0.example.com
- orderer1.example.com
- orderer2.example.com
peer1.org2.example.com:
extends:
file: base-raft.yaml
service: peer1.org2.example.com
depends_on:
- orderer0.example.com
- orderer1.example.com
- orderer2.example.com
#networks:
# default:
# external:
# name: hyperledger_fabric

View File

@ -45,6 +45,7 @@ services:
depends_on:
- orderer0.example.com
- orderer1.example.com
- orderer2.example.com
peer1.org1.example.com:
extends:
@ -53,6 +54,7 @@ services:
depends_on:
- orderer0.example.com
- orderer1.example.com
- orderer2.example.com
peer0.org2.example.com:
extends:
@ -61,6 +63,7 @@ services:
depends_on:
- orderer0.example.com
- orderer1.example.com
- orderer2.example.com
peer1.org2.example.com:
extends:
@ -69,6 +72,7 @@ services:
depends_on:
- orderer0.example.com
- orderer1.example.com
- orderer2.example.com
#networks:
# default: