Update code structures

pull/55/head
Baohua Yang 2017-06-07 15:53:15 +08:00
parent 1c52d748b4
commit 5fef78ba41
33 changed files with 661 additions and 176 deletions

View File

@ -206,9 +206,9 @@ $ ./peer/scripts/new-channel-auto-test.sh
### Manually create artifacts (optional) ### Manually create artifacts (optional)
**Skip this step**, as we already put the needed artifacts `orderer_genesis.block` and `channel.tx` under `e2e_cli/channel-artifacts/`. **Skip this step**, as we already put the needed artifacts `orderer.genesis.block` and `channel.tx` under `e2e_cli/channel-artifacts/`.
Detailed steps in [GenerateArtifacts](./GenerateArtifacts.md) explains the creation of `orderer_genesis.block` (needed by orderer to bootup) and `channel.tx` (needed by cli to create new channel) and crypto related configuration files. Detailed steps in [GenerateArtifacts](artifacts_generation.md) explains the creation of `orderer.genesis.block` (needed by orderer to bootup) and `channel.tx` (needed by cli to create new channel) and crypto related configuration files.
### Create new channel ### Create new channel

View File

@ -0,0 +1,103 @@
#!/bin/bash +x
#
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
#set -e
CHANNEL_NAME=$1
: ${CHANNEL_NAME:="mychannel"}
echo $CHANNEL_NAME
export FABRIC_ROOT=$PWD/../..
export FABRIC_CFG_PATH=$PWD
echo
OS_ARCH=$(echo "$(uname -s|tr '[:upper:]' '[:lower:]'|sed 's/mingw64_nt.*/windows/')-$(uname -m | sed 's/x86_64/amd64/g')" | awk '{print tolower($0)}')
## Using docker-compose template replace private key file names with constants
function replacePrivateKey () {
ARCH=`uname -s | grep Darwin`
if [ "$ARCH" == "Darwin" ]; then
OPTS="-it"
else
OPTS="-i"
fi
cp docker-compose-e2e-template.yaml docker-compose-e2e.yaml
CURRENT_DIR=$PWD
cd crypto-config/peerOrganizations/org1.example.com/ca/
PRIV_KEY=$(ls *_sk)
cd $CURRENT_DIR
sed $OPTS "s/CA1_PRIVATE_KEY/${PRIV_KEY}/g" docker-compose-e2e.yaml
cd crypto-config/peerOrganizations/org2.example.com/ca/
PRIV_KEY=$(ls *_sk)
cd $CURRENT_DIR
sed $OPTS "s/CA2_PRIVATE_KEY/${PRIV_KEY}/g" docker-compose-e2e.yaml
}
## Generates Org certs using cryptogen tool
function generateCerts (){
CRYPTOGEN=$FABRIC_ROOT/release/$OS_ARCH/bin/cryptogen
if [ -f "$CRYPTOGEN" ]; then
echo "Using cryptogen -> $CRYPTOGEN"
else
echo "Building cryptogen"
make -C $FABRIC_ROOT release
fi
echo
echo "##########################################################"
echo "##### Generate certificates using cryptogen tool #########"
echo "##########################################################"
$CRYPTOGEN generate --config=./crypto-config.yaml
echo
}
## Generate orderer genesis block , channel configuration transaction and anchor peer update transactions
function generateChannelArtifacts() {
CONFIGTXGEN=$FABRIC_ROOT/release/$OS_ARCH/bin/configtxgen
if [ -f "$CONFIGTXGEN" ]; then
echo "Using configtxgen -> $CONFIGTXGEN"
else
echo "Building configtxgen"
make -C $FABRIC_ROOT release
fi
echo "##########################################################"
echo "######### Generating Orderer Genesis block ##############"
echo "##########################################################"
# Note: For some unknown reason (at least for now) the block file can't be
# named orderer.genesis.block or the orderer will fail to launch!
$CONFIGTXGEN -profile TwoOrgsOrdererGenesis -outputBlock ./channel-artifacts/genesis.block
echo
echo "#################################################################"
echo "### Generating channel configuration transaction 'channel.tx' ###"
echo "#################################################################"
$CONFIGTXGEN -profile TwoOrgsChannel -outputCreateChannelTx ./channel-artifacts/channel.tx -channelID $CHANNEL_NAME
echo
echo "#################################################################"
echo "####### Generating anchor peer update for Org1MSP ##########"
echo "#################################################################"
$CONFIGTXGEN -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org1MSPanchors.tx -channelID $CHANNEL_NAME -asOrg Org1MSP
echo
echo "#################################################################"
echo "####### Generating anchor peer update for Org2MSP ##########"
echo "#################################################################"
$CONFIGTXGEN -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org2MSPanchors.tx -channelID $CHANNEL_NAME -asOrg Org2MSP
echo
}
generateCerts
replacePrivateKey
generateChannelArtifacts

View File

@ -10,7 +10,7 @@ services:
- ORDERER_GENERAL_LOGLEVEL=INFO - ORDERER_GENERAL_LOGLEVEL=INFO
- ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
- ORDERER_GENERAL_GENESISMETHOD=file - ORDERER_GENERAL_GENESISMETHOD=file
- ORDERER_GENERAL_GENESISFILE=/var/hyperledger/orderer/orderer_genesis.block #Need to be confirm orderer.block - ORDERER_GENERAL_GENESISFILE=/var/hyperledger/orderer/orderer.genesis.block #Need to be confirm orderer.block
- ORDERER_GENERAL_LOCALMSPID=OrdererMSP - ORDERER_GENERAL_LOCALMSPID=OrdererMSP
- ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp
- ORDERER_GENERAL_LEDGERTYPE=ram - ORDERER_GENERAL_LEDGERTYPE=ram
@ -26,7 +26,7 @@ services:
ports: ports:
- "7050:7050" - "7050:7050"
volumes: volumes:
- ./e2e_cli/channel-artifacts/orderer_genesis.block:/var/hyperledger/orderer/orderer_genesis.block - ./e2e_cli/channel-artifacts/orderer.genesis.block:/var/hyperledger/orderer/orderer.genesis.block
- ./e2e_cli/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp:/var/hyperledger/orderer/msp - ./e2e_cli/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp:/var/hyperledger/orderer/msp
- ./e2e_cli/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/:/var/hyperledger/orderer/tls - ./e2e_cli/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/:/var/hyperledger/orderer/tls
command: orderer command: orderer

View File

@ -25,7 +25,7 @@ services:
- ORDERER_GENERAL_LOGLEVEL=INFO - ORDERER_GENERAL_LOGLEVEL=INFO
- ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
- ORDERER_GENERAL_GENESISMETHOD=file - ORDERER_GENERAL_GENESISMETHOD=file
- ORDERER_GENERAL_GENESISFILE=/var/hyperledger/orderer/orderer_genesis.block #Need to be confirm orderer.block - ORDERER_GENERAL_GENESISFILE=/var/hyperledger/orderer/orderer.genesis.block #Need to be confirm orderer.block
- ORDERER_GENERAL_LOCALMSPID=OrdererMSP - ORDERER_GENERAL_LOCALMSPID=OrdererMSP
- ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp
- ORDERER_GENERAL_LEDGERTYPE=ram - ORDERER_GENERAL_LEDGERTYPE=ram
@ -41,7 +41,7 @@ services:
ports: ports:
- "7050:7050" - "7050:7050"
volumes: volumes:
- ./e2e_cli/channel-artifacts/orderer_genesis.block:/var/hyperledger/orderer/orderer_genesis.block - ./e2e_cli/channel-artifacts/orderer.genesis.block:/var/hyperledger/orderer/orderer.genesis.block
- ./e2e_cli/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp:/var/hyperledger/orderer/msp - ./e2e_cli/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp:/var/hyperledger/orderer/msp
- ./e2e_cli/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/:/var/hyperledger/orderer/tls - ./e2e_cli/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/:/var/hyperledger/orderer/tls
command: orderer command: orderer

View File

@ -1,9 +1,9 @@
# https://github.com/yeasy/docker-compose-files/tree/master/hyperledger # https://github.com/yeasy/docker-compose-files/tree/master/hyperledger
# This compose file will start a Hyperledger Fabric 1.0 MVE, including # This compose file will start a Hyperledger Fabric 1.0 MVE, including
# * ca # * 1 ca
# * orderer # * 1 orderer
# * peer # * 4 peers in 2 orgs
# * sdk for testing # * cli for testing
version: '2.0' version: '2.0'
@ -18,70 +18,66 @@ services:
command: fabric-ca-server start -b admin:adminpw command: fabric-ca-server start -b admin:adminpw
orderer.example.com: # There can be multiple orderers orderer.example.com: # There can be multiple orderers
container_name: orderer.example.com
extends: extends:
file: peer-base.yml file: docker-compose-base.yaml
service: orderer.example.com service: orderer.example.com
peer0.org1.example.com: peer0.org1.example.com:
extends: extends:
file: peer-base.yml file: docker-compose-base.yaml
service: peer0.org1.example.com service: peer0.org1.example.com
container_name: peer0.org1.example.com
peer1.org1.example.com: peer1.org1.example.com:
extends: extends:
file: peer-base.yml file: docker-compose-base.yaml
service: peer1.org1.example.com service: peer1.org1.example.com
container_name: peer1.org1.example.com
peer0.org2.example.com: peer0.org2.example.com:
extends: extends:
file: peer-base.yml file: docker-compose-base.yaml
service: peer0.org2.example.com service: peer0.org2.example.com
container_name: peer0.org2.example.com
peer1.org2.example.com: peer1.org2.example.com:
extends: extends:
file: peer-base.yml file: docker-compose-base.yaml
service: peer1.org2.example.com service: peer1.org2.example.com
container_name: peer1.org2.example.com
cli: cli:
extends:
file: peer.yml
service: peer
container_name: fabric-cli container_name: fabric-cli
hostname: cli hostname: fabric-cli
image: hyperledger/fabric-tools
tty: true
environment: environment:
- CORE_PEER_ID=cli - CORE_PEER_ID=fabric-cli
- CORE_PEER_ADDRESS=peer0.org1.example.com:7051 - CORE_LOGGING_LEVEL=DEBUG
- CORE_PEER_ADDRESS=peer0.org1.example.com:7051 # default to operate on peer0.org1
- CORE_PEER_LOCALMSPID=Org1MSP - CORE_PEER_LOCALMSPID=Org1MSP
- CORE_PEER_TLS_ENABLED=false # to enable TLS, change to true - 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_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_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_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 - CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp
links:
- orderer.example.com
- peer0.org1.example.com
- peer1.org1.example.com
- peer0.org2.example.com
- peer1.org2.example.com
volumes: volumes:
#- ./e2e_cli/examples:/opt/gopath/src/github.com/hyperledger/fabric/examples #- ./e2e_cli/examples:/opt/gopath/src/github.com/hyperledger/fabric/examples
- ./e2e_cli/crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ - ./e2e_cli/crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/
- ./e2e_cli/crypto-config:/etc/hyperledger/fabric/crypto-config
- ./scripts:/opt/gopath/src/github.com/hyperledger/fabric/peer/scripts/ - ./scripts:/opt/gopath/src/github.com/hyperledger/fabric/peer/scripts/
- ./e2e_cli/channel-artifacts:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts - ./e2e_cli/channel-artifacts:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts
- ./e2e_cli/configtx.yaml:/opt/gopath/src/github.com/hyperledger/fabric/peer/configtx.yaml - ./e2e_cli/crypto-config:/etc/hyperledger/fabric/crypto-config
- ./e2e_cli/crypto-config.yaml:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto-config.yaml - ./e2e_cli/configtx.yaml:/etc/hyperledger/fabric/peer/configtx.yaml
- ./e2e_cli/crypto-config.yaml:/etc/hyperledger/fabric/peer/crypto-config.yaml
depends_on: depends_on:
- orderer.example.com - orderer.example.com
- peer0.org1.example.com - peer0.org1.example.com
- peer1.org1.example.com - peer1.org1.example.com
- peer0.org2.example.com - peer0.org2.example.com
- peer1.org2.example.com - peer1.org2.example.com
links:
- orderer.example.com
- peer0.org1.example.com
- peer1.org1.example.com
- peer0.org2.example.com
- peer1.org2.example.com
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
command: bash -c 'while true; do sleep 20170504; done' command: bash -c 'while true; do sleep 20170504; done'
#networks: #networks:

View File

@ -1,64 +1,53 @@
version: '2' # Base compose files for:
# orderer.example.com
# peer0.org1.example.com
# peer1.org1.example.com
# peer0.org2.example.com
# peer1.org2.example.com
version: '2' # v3 does not support 'extends' yet
services: services:
orderer.example.com: # There can be multiple orderers orderer.example.com: # There can be multiple orderers
image: hyperledger/fabric-orderer extends:
file: orderer-base.yaml
service: orderer-base
container_name: orderer.example.com container_name: orderer.example.com
hostname: orderer.example.com hostname: orderer.example.com
environment:
- ORDERER_GENERAL_LOGLEVEL=INFO
- ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
- ORDERER_GENERAL_GENESISMETHOD=file
- ORDERER_GENERAL_GENESISFILE=/var/hyperledger/orderer/orderer_genesis.block #Need to be confirm orderer.block
- ORDERER_GENERAL_LOCALMSPID=OrdererMSP
- ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp
- ORDERER_GENERAL_LEDGERTYPE=file
- ORDERER_GENERAL_BATCHTIMEOUT=10s
- ORDERER_GENERAL_MAXMESSAGECOUNT=10
- ORDERER_GENERAL_MAXWINDOWSIZE=1000
- ORDERER_GENERAL_LISTENPORT=7050
- ORDERER_RAMLEDGER_HISTORY_SIZE=100
- ORDERER_GENERAL_TLS_ENABLED=false # to enable TLS, make this 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]
ports: ports:
- "7050:7050" - "7050:7050"
volumes: volumes:
- ./e2e_cli/channel-artifacts/orderer_genesis.block:/var/hyperledger/orderer/orderer_genesis.block - ./e2e_cli/channel-artifacts/orderer.genesis.block:/var/hyperledger/orderer/orderer.genesis.block
- ./e2e_cli/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp:/var/hyperledger/orderer/msp - ./e2e_cli/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp:/var/hyperledger/orderer/msp
- ./e2e_cli/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/:/var/hyperledger/orderer/tls - ./e2e_cli/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/:/var/hyperledger/orderer/tls
command: orderer command: orderer start
peer0.org1.example.com: peer0.org1.example.com:
extends: extends:
file: peer.yml file: peer-base.yaml
service: peer service: peer-base
container_name: peer0.org1.example.com container_name: peer0.org1.example.com
hostname: peer0.org1.example.com hostname: peer0.org1.example.com
environment: environment:
- CORE_PEER_ID=peer0.org1.example.com - CORE_PEER_ID=peer0.org1.example.com
- CORE_PEER_ADDRESS=peer0.org1.example.com:7051 - CORE_PEER_ADDRESS=peer0.org1.example.com:7051
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7051 - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7051
- CORE_PEER_GOSSIP_ORGLEADER=true
# - CORE_PEER_COMMITTER_LEDGER_ORDERER=orderer.example.com:7050
- CORE_PEER_LOCALMSPID=Org1MSP - CORE_PEER_LOCALMSPID=Org1MSP
- 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
ports:
- 7051:7051
- 7053:7053
volumes: volumes:
- ./e2e_cli/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp:/etc/hyperledger/fabric/msp - ./e2e_cli/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp:/etc/hyperledger/fabric/msp
- ./e2e_cli/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls:/etc/hyperledger/fabric/tls - ./e2e_cli/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls:/etc/hyperledger/fabric/tls
command: peer node start --peer-defaultchain=false ports:
- 7051:7051
- 7053:7053
command: peer node start
peer1.org1.example.com: peer1.org1.example.com:
extends: extends:
file: peer.yml file: peer-base.yaml
service: peer service: peer-base
container_name: peer1.org1.example.com container_name: peer1.org1.example.com
hostname: peer1.org1.example.com hostname: peer1.org1.example.com
environment: environment:
@ -67,23 +56,18 @@ services:
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org1.example.com:7051 - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org1.example.com:7051
- CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org1.example.com:7051 - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org1.example.com:7051
- CORE_PEER_LOCALMSPID=Org1MSP - CORE_PEER_LOCALMSPID=Org1MSP
- CORE_PEER_GOSSIP_ORGLEADER=true
# - CORE_PEER_COMMITTER_LEDGER_ORDERER=orderer.example.com:7050
- 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
ports:
- 8051:7051
- 8053:7053
volumes: volumes:
- ./e2e_cli/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/msp:/etc/hyperledger/fabric/msp - ./e2e_cli/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/msp:/etc/hyperledger/fabric/msp
- ./e2e_cli/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls:/etc/hyperledger/fabric/tls - ./e2e_cli/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls:/etc/hyperledger/fabric/tls
command: peer node start --peer-defaultchain=false ports:
- 8051:7051
- 8053:7053
command: peer node start
peer0.org2.example.com: peer0.org2.example.com:
extends: extends:
file: peer.yml file: peer-base.yaml
service: peer service: peer-base
container_name: peer0.org2.example.com container_name: peer0.org2.example.com
hostname: peer0.org2.example.com hostname: peer0.org2.example.com
environment: environment:
@ -92,23 +76,18 @@ services:
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org2.example.com:7051 - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org2.example.com:7051
- CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org2.example.com:7051 - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org2.example.com:7051
- CORE_PEER_LOCALMSPID=Org2MSP - CORE_PEER_LOCALMSPID=Org2MSP
- CORE_PEER_GOSSIP_ORGLEADER=true
# - CORE_PEER_COMMITTER_LEDGER_ORDERER=orderer.example.com:7050
- 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
ports:
- 9051:7051
- 9053:7053
volumes: volumes:
- ./e2e_cli/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp:/etc/hyperledger/fabric/msp - ./e2e_cli/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp:/etc/hyperledger/fabric/msp
- ./e2e_cli/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls:/etc/hyperledger/fabric/tls - ./e2e_cli/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls:/etc/hyperledger/fabric/tls
command: peer node start --peer-defaultchain=false ports:
- 9051:7051
- 9053:7053
command: peer node start
peer1.org2.example.com: peer1.org2.example.com:
extends: extends:
file: peer.yml file: peer-base.yaml
service: peer service: peer-base
container_name: peer1.org2.example.com container_name: peer1.org2.example.com
hostname: peer1.org2.example.com hostname: peer1.org2.example.com
environment: environment:
@ -117,15 +96,10 @@ services:
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org2.example.com:7051 - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org2.example.com:7051
- CORE_PEER_GOSSIP_BOOTSTRAP=peer1.org2.example.com:7051 - CORE_PEER_GOSSIP_BOOTSTRAP=peer1.org2.example.com:7051
- CORE_PEER_LOCALMSPID=Org2MSP - CORE_PEER_LOCALMSPID=Org2MSP
- CORE_PEER_GOSSIP_ORGLEADER=true
# - CORE_PEER_COMMITTER_LEDGER_ORDERER=orderer.example.com:7050
- 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
ports:
- 10051:7051
- 10053:7053
volumes: volumes:
- ./e2e_cli/crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/msp:/etc/hyperledger/fabric/msp - ./e2e_cli/crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/msp:/etc/hyperledger/fabric/msp
- ./e2e_cli/crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/tls:/etc/hyperledger/fabric/tls - ./e2e_cli/crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/tls:/etc/hyperledger/fabric/tls
command: peer node start --peer-defaultchain=false ports:
- 10051:7051
- 10053:7053
command: peer node start

View File

@ -24,7 +24,7 @@ services:
container_name: fabric-orderer0 container_name: fabric-orderer0
hostname: orderer0 hostname: orderer0
environment: environment:
- ORDERER_GENERAL_LEDGERTYPE=ram - ORDERER_GENERAL_LEDGERTYPE=file
- ORDERER_GENERAL_BATCHTIMEOUT=10s - ORDERER_GENERAL_BATCHTIMEOUT=10s
- ORDERER_GENERAL_MAXMESSAGECOUNT=10 - ORDERER_GENERAL_MAXMESSAGECOUNT=10
- ORDERER_GENERAL_MAXWINDOWSIZE=1000 - ORDERER_GENERAL_MAXWINDOWSIZE=1000
@ -45,7 +45,6 @@ services:
environment: environment:
- CORE_PEER_ID=peer0 - CORE_PEER_ID=peer0
- CORE_PEER_GOSSIP_ORGLEADER=true - CORE_PEER_GOSSIP_ORGLEADER=true
# - CORE_PEER_COMMITTER_LEDGER_ORDERER=orderer0:7050
links: links:
- orderer0 - orderer0
ports: ports:
@ -64,7 +63,6 @@ services:
- CORE_PEER_ID=cli - CORE_PEER_ID=cli
- CORE_PEER_ADDRESS=peer0:7051 - CORE_PEER_ADDRESS=peer0:7051
#- CORE_PEER_LOCALMSPID=Org0MSP #- CORE_PEER_LOCALMSPID=Org0MSP
#- CORE_PEER_COMMITTER_LEDGER_ORDERER=orderer:7050
links: links:
- peer0 - peer0
- orderer0 - orderer0

View File

@ -0,0 +1,108 @@
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
version: '2'
services:
orderer.example.com:
container_name: orderer.example.com
image: hyperledger/fabric-orderer
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
# 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]
working_dir: /opt/gopath/src/github.com/hyperledger/fabric
command: orderer
volumes:
- ../channel-artifacts/genesis.block:/var/hyperledger/orderer/orderer.genesis.block
- ../crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp:/var/hyperledger/orderer/msp
- ../crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/:/var/hyperledger/orderer/tls
ports:
- 7050:7050
peer0.org1.example.com:
container_name: peer0.org1.example.com
extends:
file: peer-base.yaml
service: peer-base
environment:
- CORE_PEER_ID=peer0.org1.example.com
- CORE_PEER_ADDRESS=peer0.org1.example.com:7051
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7051
- CORE_PEER_LOCALMSPID=Org1MSP
volumes:
- /var/run/:/host/var/run/
- ../crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp:/etc/hyperledger/fabric/msp
- ../crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls:/etc/hyperledger/fabric/tls
ports:
- 7051:7051
- 7053:7053
peer1.org1.example.com:
container_name: peer1.org1.example.com
extends:
file: peer-base.yaml
service: peer-base
environment:
- CORE_PEER_ID=peer1.org1.example.com
- CORE_PEER_ADDRESS=peer1.org1.example.com:7051
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org1.example.com:7051
- CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org1.example.com:7051
- CORE_PEER_LOCALMSPID=Org1MSP
volumes:
- /var/run/:/host/var/run/
- ../crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/msp:/etc/hyperledger/fabric/msp
- ../crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls:/etc/hyperledger/fabric/tls
ports:
- 8051:7051
- 8053:7053
peer0.org2.example.com:
container_name: peer0.org2.example.com
extends:
file: peer-base.yaml
service: peer-base
environment:
- CORE_PEER_ID=peer0.org2.example.com
- CORE_PEER_ADDRESS=peer0.org2.example.com:7051
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org2.example.com:7051
- CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org2.example.com:7051
- CORE_PEER_LOCALMSPID=Org2MSP
volumes:
- /var/run/:/host/var/run/
- ../crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp:/etc/hyperledger/fabric/msp
- ../crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls:/etc/hyperledger/fabric/tls
ports:
- 9051:7051
- 9053:7053
peer1.org2.example.com:
container_name: peer1.org2.example.com
extends:
file: peer-base.yaml
service: peer-base
environment:
- CORE_PEER_ID=peer1.org2.example.com
- CORE_PEER_ADDRESS=peer1.org2.example.com:7051
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org2.example.com:7051
- CORE_PEER_GOSSIP_BOOTSTRAP=peer1.org2.example.com:7051
- CORE_PEER_LOCALMSPID=Org2MSP
volumes:
- /var/run/:/host/var/run/
- ../crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/msp:/etc/hyperledger/fabric/msp
- ../crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/tls:/etc/hyperledger/fabric/tls
ports:
- 10051:7051
- 10053:7053

View File

@ -0,0 +1,27 @@
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
version: '2'
services:
peer-base:
image: hyperledger/fabric-peer
environment:
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
# the following setting starts chaincode containers on the same
# bridge network as the peers
# https://docs.docker.com/compose/networking/
- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=e2ecli_default
#- CORE_LOGGING_LEVEL=ERROR
- CORE_LOGGING_LEVEL=DEBUG
- CORE_PEER_TLS_ENABLED=true
- CORE_PEER_ENDORSER_ENABLED=true
- CORE_PEER_GOSSIP_USELEADERELECTION=true
- CORE_PEER_GOSSIP_ORGLEADER=false
- CORE_PEER_PROFILE_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
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
command: peer node start

View File

@ -1,3 +1,8 @@
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
--- ---
################################################################################ ################################################################################
# #
@ -50,18 +55,6 @@ Organizations:
# MSPDir is the filesystem path which contains the MSP configuration # MSPDir is the filesystem path which contains the MSP configuration
MSPDir: crypto-config/ordererOrganizations/example.com/msp MSPDir: crypto-config/ordererOrganizations/example.com/msp
# BCCSP (Blockchain crypto provider): Select which crypto implementation or
# library to use
BCCSP:
Default: SW
SW:
Hash: SHA2
Security: 256
# Location of Key Store. If this is unset, a location will
# be chosen using 'MSPDir'/keystore
FileKeyStore:
KeyStore:
- &Org1 - &Org1
# DefaultOrg defines the organization which is used in the sampleconfig # DefaultOrg defines the organization which is used in the sampleconfig
# of the fabric.git development environment # of the fabric.git development environment
@ -72,18 +65,6 @@ Organizations:
MSPDir: crypto-config/peerOrganizations/org1.example.com/msp MSPDir: crypto-config/peerOrganizations/org1.example.com/msp
# BCCSP (Blockchain crypto provider): Select which crypto implementation or
# library to use
BCCSP:
Default: SW
SW:
Hash: SHA2
Security: 256
# Location of Key Store. If this is unset, a location will
# be chosen using 'MSPDir'/keystore
FileKeyStore:
KeyStore:
AnchorPeers: AnchorPeers:
# AnchorPeers defines the location of peers which can be used # AnchorPeers defines the location of peers which can be used
# for cross org gossip communication. Note, this value is only # for cross org gossip communication. Note, this value is only
@ -101,18 +82,6 @@ Organizations:
MSPDir: crypto-config/peerOrganizations/org2.example.com/msp MSPDir: crypto-config/peerOrganizations/org2.example.com/msp
# BCCSP (Blockchain crypto provider): Select which crypto implementation or
# library to use
BCCSP:
Default: SW
SW:
Hash: SHA2
Security: 256
# Location of Key Store. If this is unset, a location will
# be chosen using 'MSPDir'/keystore
FileKeyStore:
KeyStore:
AnchorPeers: AnchorPeers:
# AnchorPeers defines the location of peers which can be used # AnchorPeers defines the location of peers which can be used
# for cross org gossip communication. Note, this value is only # for cross org gossip communication. Note, this value is only

View File

@ -1,3 +1,8 @@
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# "OrdererOrgs" - Definition of organizations managing orderer nodes # "OrdererOrgs" - Definition of organizations managing orderer nodes
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------

View File

@ -0,0 +1,69 @@
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
version: '2'
services:
orderer.example.com:
extends:
file: base/docker-compose-base.yaml
service: orderer.example.com
container_name: orderer.example.com
peer0.org1.example.com:
container_name: peer0.org1.example.com
extends:
file: base/docker-compose-base.yaml
service: peer0.org1.example.com
peer1.org1.example.com:
container_name: peer1.org1.example.com
extends:
file: base/docker-compose-base.yaml
service: peer1.org1.example.com
peer0.org2.example.com:
container_name: peer0.org2.example.com
extends:
file: base/docker-compose-base.yaml
service: peer0.org2.example.com
peer1.org2.example.com:
container_name: peer1.org2.example.com
extends:
file: base/docker-compose-base.yaml
service: peer1.org2.example.com
cli:
container_name: cli
image: hyperledger/fabric-tools
tty: true
environment:
- GOPATH=/opt/gopath
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- CORE_LOGGING_LEVEL=DEBUG
- CORE_PEER_ID=cli
- CORE_PEER_ADDRESS=peer0.org1.example.com:7051
- CORE_PEER_LOCALMSPID=Org1MSP
- CORE_PEER_TLS_ENABLED=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
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
command: /bin/bash -c './scripts/script.sh ${CHANNEL_NAME}; sleep $TIMEOUT'
volumes:
- /var/run/:/host/var/run/
- ../chaincode/go/:/opt/gopath/src/github.com/hyperledger/fabric/examples/chaincode/go
- ./crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/
- ./scripts:/opt/gopath/src/github.com/hyperledger/fabric/peer/scripts/
- ./channel-artifacts:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts
depends_on:
- orderer.example.com
- peer0.org1.example.com
- peer1.org1.example.com
- peer0.org2.example.com
- peer1.org2.example.com

View File

@ -0,0 +1,67 @@
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
version: '2'
services:
couchdb0:
container_name: couchdb0
image: hyperledger/fabric-couchdb
# 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.
ports:
- "5984:5984"
peer0.org1.example.com:
environment:
- CORE_LEDGER_STATE_STATEDATABASE=CouchDB
- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb0:5984
depends_on:
- couchdb0
couchdb1:
container_name: couchdb1
image: hyperledger/fabric-couchdb
# 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.
ports:
- "6984:5984"
peer1.org1.example.com:
environment:
- CORE_LEDGER_STATE_STATEDATABASE=CouchDB
- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb1:5984
depends_on:
- couchdb1
couchdb2:
container_name: couchdb2
image: hyperledger/fabric-couchdb
# 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.
ports:
- "7984:5984"
peer0.org2.example.com:
environment:
- CORE_LEDGER_STATE_STATEDATABASE=CouchDB
- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb2:5984
depends_on:
- couchdb2
couchdb3:
container_name: couchdb3
image: hyperledger/fabric-couchdb
# 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.
ports:
- "8984:5984"
peer1.org2.example.com:
environment:
- CORE_LEDGER_STATE_STATEDATABASE=CouchDB
- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb3:5984
depends_on:
- couchdb3

View File

@ -0,0 +1,67 @@
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
version: '2'
services:
ca0:
image: hyperledger/fabric-ca
environment:
- FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
- FABRIC_CA_SERVER_CA_NAME=ca-org1
- FABRIC_CA_SERVER_TLS_ENABLED=true
- 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/CA1_PRIVATE_KEY
ports:
- "7054:7054"
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/CA1_PRIVATE_KEY -b admin:adminpw -d'
volumes:
- ./crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/fabric-ca-server-config
container_name: ca_peerOrg1
ca1:
image: hyperledger/fabric-ca
environment:
- FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
- FABRIC_CA_SERVER_CA_NAME=ca-org2
- FABRIC_CA_SERVER_TLS_ENABLED=true
- 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/CA2_PRIVATE_KEY
ports:
- "8054:7054"
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/CA2_PRIVATE_KEY -b admin:adminpw -d'
volumes:
- ./crypto-config/peerOrganizations/org2.example.com/ca/:/etc/hyperledger/fabric-ca-server-config
container_name: ca_peerOrg2
orderer.example.com:
extends:
file: base/docker-compose-base.yaml
service: orderer.example.com
container_name: orderer.example.com
peer0.org1.example.com:
container_name: peer0.org1.example.com
extends:
file: base/docker-compose-base.yaml
service: peer0.org1.example.com
peer1.org1.example.com:
container_name: peer1.org1.example.com
extends:
file: base/docker-compose-base.yaml
service: peer1.org1.example.com
peer0.org2.example.com:
container_name: peer0.org2.example.com
extends:
file: base/docker-compose-base.yaml
service: peer0.org2.example.com
peer1.org2.example.com:
container_name: peer1.org2.example.com
extends:
file: base/docker-compose-base.yaml
service: peer1.org2.example.com

View File

@ -0,0 +1,67 @@
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
version: '2'
services:
ca0:
image: hyperledger/fabric-ca
environment:
- FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
- FABRIC_CA_SERVER_CA_NAME=ca-org1
- FABRIC_CA_SERVER_TLS_ENABLED=true
- 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/2628c774d6def25e2bf6147c30f25fe76469d63d257965ac867544acd090148c_sk
ports:
- "7054:7054"
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/2628c774d6def25e2bf6147c30f25fe76469d63d257965ac867544acd090148c_sk -b admin:adminpw -d'
volumes:
- ./crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/fabric-ca-server-config
container_name: ca_peerOrg1
ca1:
image: hyperledger/fabric-ca
environment:
- FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
- FABRIC_CA_SERVER_CA_NAME=ca-org2
- FABRIC_CA_SERVER_TLS_ENABLED=true
- 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/3f39c678fc9b1f79cddb94f1e896cc3c487aa25c2ebf8b7f3e0205c2d21a37ec_sk
ports:
- "8054:7054"
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/3f39c678fc9b1f79cddb94f1e896cc3c487aa25c2ebf8b7f3e0205c2d21a37ec_sk -b admin:adminpw -d'
volumes:
- ./crypto-config/peerOrganizations/org2.example.com/ca/:/etc/hyperledger/fabric-ca-server-config
container_name: ca_peerOrg2
orderer.example.com:
extends:
file: base/docker-compose-base.yaml
service: orderer.example.com
container_name: orderer.example.com
peer0.org1.example.com:
container_name: peer0.org1.example.com
extends:
file: base/docker-compose-base.yaml
service: peer0.org1.example.com
peer1.org1.example.com:
container_name: peer1.org1.example.com
extends:
file: base/docker-compose-base.yaml
service: peer1.org1.example.com
peer0.org2.example.com:
container_name: peer0.org2.example.com
extends:
file: base/docker-compose-base.yaml
service: peer0.org2.example.com
peer1.org2.example.com:
container_name: peer1.org2.example.com
extends:
file: base/docker-compose-base.yaml
service: peer1.org2.example.com

View File

@ -0,0 +1,32 @@
# 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: hyperledger/fabric-orderer
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

View File

@ -7,7 +7,7 @@
version: '2' version: '2'
services: services:
peer: peer-base:
image: yeasy/hyperledger-fabric image: yeasy/hyperledger-fabric
environment: environment:
#- CORE_PEER_ID=peer0 #- CORE_PEER_ID=peer0
@ -15,17 +15,15 @@ services:
- CORE_LOGGING_LEVEL=DEBUG - CORE_LOGGING_LEVEL=DEBUG
#- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=hyperledger_fabric # uncomment this to use specific network #- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=hyperledger_fabric # uncomment this to use specific network
#- CORE_PEER_NETWORKID=dev #- CORE_PEER_NETWORKID=dev
- CORE_NEXT=true
- CORE_PEER_ENDORSER_ENABLED=true - CORE_PEER_ENDORSER_ENABLED=true
- CORE_PEER_COMMITTER_ENABLED=true - CORE_PEER_COMMITTER_ENABLED=true
- 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_PROFILE_ENABLED=false
- CORE_PEER_GOSSIP_ORGLEADER=false # this node is the group leader, default to true - CORE_PEER_TLS_ENABLED=true
- CORE_PEER_GOSSIP_USELEADERELECTION=false # automatically run leader election, default to false - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/tls/server.crt
- CORE_PEER_GOSSIP_IGNORESECURITY=true - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/tls/server.key
# The following setting skips the gossip handshake since we are - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/tls/ca.crt
# are not doing mutual TLS
- CORE_PEER_GOSSIP_SKIPHANDSHAKE=true
#- CORE_PEER_COMMITTER_LEDGER_ORDERER=orderer:7050
expose: expose:
- "7050" # Rest - "7050" # Rest
- "7051" # Grpc - "7051" # Grpc
@ -39,6 +37,7 @@ services:
- "7059" # tlsCAA - "7059" # tlsCAA
volumes: # docker.sock is mapped as the default CORE_VM_ENDPOINT volumes: # docker.sock is mapped as the default CORE_VM_ENDPOINT
- /var/run/docker.sock:/var/run/docker.sock - /var/run/docker.sock:/var/run/docker.sock
- $GOPATH/src/github.com/hyperledger/:/go/src/github.com/hyperledger/
#volumes: #volumes:
# - /var/run/:/host/var/run/ # - /var/run/:/host/var/run/
command: peer node start command: peer node start

View File

@ -7,25 +7,23 @@
version: '2' version: '2'
services: services:
peer: peer-base:
image: hyperledger/fabric-peer image: hyperledger/fabric-peer
environment: environment:
#- CORE_PEER_ID=peer0 #- CORE_PEER_ID=peer0
- CORE_PEER_ADDRESSAUTODETECT=true - CORE_PEER_ADDRESSAUTODETECT=true
- CORE_LOGGING_LEVEL=DEBUG - CORE_LOGGING_LEVEL=DEBUG
#- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=hyperledger_fabric # uncomment this to use specific network #- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=hyperledger_fabric # uncomment this to use specific network
#- CORE_PEER_NETWORKID=dev #- CORE_PEER_NETWORKID=dev
- CORE_NEXT=true
- CORE_PEER_ENDORSER_ENABLED=true - CORE_PEER_ENDORSER_ENABLED=true
- CORE_PEER_COMMITTER_ENABLED=true - CORE_PEER_COMMITTER_ENABLED=true
- 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_PROFILE_ENABLED=false
- CORE_PEER_GOSSIP_ORGLEADER=false # this node is the group leader, default to true - CORE_PEER_TLS_ENABLED=true
- CORE_PEER_GOSSIP_USELEADERELECTION=false # automatically run leader election, default to false - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/tls/server.crt
- CORE_PEER_GOSSIP_IGNORESECURITY=true - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/tls/server.key
# The following setting skips the gossip handshake since we are - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/tls/ca.crt
# are not doing mutual TLS
- CORE_PEER_GOSSIP_SKIPHANDSHAKE=true
#- CORE_PEER_COMMITTER_LEDGER_ORDERER=orderer:7050
expose: expose:
- "7050" # Rest - "7050" # Rest
- "7051" # Grpc - "7051" # Grpc

View File

@ -1,13 +1,16 @@
#!/usr/bin/env bash #!/usr/bin/env bash
source ./header.sh source scripts/header.sh
ARCH=x86_64 ARCH=x86_64
BASE_VERSION=1.0.0-preview BASE_VERSION=0.3.1
PROJECT_VERSION=1.0.0-preview PROJECT_VERSION=1.0.0-preview
IMG_VERSION=0.9.4 IMG_VERSION=0.9.4
echo_b "Downloading images from DockerHub..." # For testing latest images
IMG_VERSION=latest
echo_b "Downloading images from DockerHub... need a while"
docker pull yeasy/hyperledger-fabric-base:$IMG_VERSION \ docker pull yeasy/hyperledger-fabric-base:$IMG_VERSION \
&& docker pull yeasy/hyperledger-fabric-peer:$IMG_VERSION \ && docker pull yeasy/hyperledger-fabric-peer:$IMG_VERSION \
@ -19,7 +22,10 @@ docker pull yeasy/hyperledger-fabric-base:$IMG_VERSION \
echo_b "Rename images with official tags..." echo_b "Rename images with official tags..."
docker tag yeasy/hyperledger-fabric-peer:$IMG_VERSION hyperledger/fabric-peer \ docker tag yeasy/hyperledger-fabric-peer:$IMG_VERSION hyperledger/fabric-peer \
&& docker tag yeasy/hyperledger-fabric-peer:$IMG_VERSION hyperledger/fabric-tools \
&& docker tag yeasy/hyperledger-fabric-orderer:$IMG_VERSION hyperledger/fabric-orderer \ && docker tag yeasy/hyperledger-fabric-orderer:$IMG_VERSION hyperledger/fabric-orderer \
&& docker tag yeasy/hyperledger-fabric-ca:$IMG_VERSION hyperledger/fabric-ca \ && docker tag yeasy/hyperledger-fabric-ca:$IMG_VERSION hyperledger/fabric-ca \
&& docker tag yeasy/hyperledger-fabric-base:$IMG_VERSION hyperledger/fabric-ccenv:$ARCH-$BASE_VERSION \ && docker tag yeasy/hyperledger-fabric-base:$IMG_VERSION hyperledger/fabric-ccenv:$ARCH-$PROJECT_VERSION \
&& docker tag yeasy/hyperledger-fabric-base:$IMG_VERSION hyperledger/fabric-baseos:$ARCH-$BASE_VERSION && docker tag yeasy/hyperledger-fabric-base:$IMG_VERSION hyperledger/fabric-baseos:$ARCH-$BASE_VERSION
echo_g "Done, now can startup the network using docker-compose..."

View File

@ -1,8 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
source ./scripts/header.sh source scripts/header.sh
COMPOSE_FILE=${1:-"docker-compose-2orgs.yml"} COMPOSE_FILE=${1:-"docker-compose-2orgs-4peers.yml"}
echo_b "Start up with ${COMPOSE_FILE}" echo_b "Start up with ${COMPOSE_FILE}"

View File

@ -56,9 +56,9 @@ createChannel() {
setGlobals 0 setGlobals 0
if [ -z "$CORE_PEER_TLS_ENABLED" -o "$CORE_PEER_TLS_ENABLED" = "false" ]; then if [ -z "$CORE_PEER_TLS_ENABLED" -o "$CORE_PEER_TLS_ENABLED" = "false" ]; then
peer channel create -o orderer.example.com:7050 -c $CHANNEL_NAME -f ./peer/channel-artifacts/channel.tx >&log.txt peer channel create -o orderer.example.com:7050 -c $CHANNEL_NAME -f ./channel-artifacts/channel.tx >&log.txt
else else
peer channel create -o orderer.example.com:7050 -c $CHANNEL_NAME -f ./peer/channel-artifacts/channel.tx --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA >&log.txt peer channel create -o orderer.example.com:7050 -c $CHANNEL_NAME -f ./channel-artifacts/channel.tx --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA >&log.txt
fi fi
res=$? res=$?
cat log.txt cat log.txt
@ -72,9 +72,9 @@ updateAnchorPeers() {
setGlobals $PEER setGlobals $PEER
if [ -z "$CORE_PEER_TLS_ENABLED" -o "$CORE_PEER_TLS_ENABLED" = "false" ]; then if [ -z "$CORE_PEER_TLS_ENABLED" -o "$CORE_PEER_TLS_ENABLED" = "false" ]; then
peer channel create -o orderer.example.com:7050 -c $CHANNEL_NAME -f ./peer/channel-artifacts/${CORE_PEER_LOCALMSPID}anchors.tx >&log.txt peer channel update -o orderer.example.com:7050 -c $CHANNEL_NAME -f ./channel-artifacts/${CORE_PEER_LOCALMSPID}anchors.tx >&log.txt
else else
peer channel create -o orderer.example.com:7050 -c $CHANNEL_NAME -f ./peer/channel-artifacts/${CORE_PEER_LOCALMSPID}anchors.tx --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA >&log.txt peer channel update -o orderer.example.com:7050 -c $CHANNEL_NAME -f ./channel-artifacts/${CORE_PEER_LOCALMSPID}anchors.tx --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA >&log.txt
fi fi
res=$? res=$?
cat log.txt cat log.txt
@ -192,15 +192,15 @@ echo "Having all peers join the channel..."
joinChannel joinChannel
## Set the anchor peers for each org in the channel ## Set the anchor peers for each org in the channel
echo "Updating anchor peers using peer0/org1(peer0) for org1..." echo "Updating anchor peers for org1..."
updateAnchorPeers 0 updateAnchorPeers 0
echo "Updating anchor peers using peer0/org2(peer2) for org2..." echo "Updating anchor peers for org2..."
updateAnchorPeers 2 updateAnchorPeers 2
## Install chaincode on Peer0/Org1 and Peer0/Org2 ## Install chaincode on Peer0/Org1 and Peer2/Org2
echo "Installing chaincode on peer0/org1..." echo "Installing chaincode on org1/peer0..."
installChaincode 0 installChaincode 0
echo "Install chaincode on peer0/org2.." echo "Install chaincode on org2/peer2..."
installChaincode 2 installChaincode 2
#Instantiate chaincode on Peer0/Org2 #Instantiate chaincode on Peer0/Org2
@ -208,11 +208,11 @@ echo "Instantiating chaincode on peer0/org2..."
instantiateChaincode 2 instantiateChaincode 2
#Query on chaincode on Peer0/Org1 #Query on chaincode on Peer0/Org1
echo "Querying chaincode on peer0/org1..." echo "Querying chaincode on org1/peer0..."
chaincodeQuery 0 100 chaincodeQuery 0 100
#Invoke on chaincode on Peer0/Org1 #Invoke on chaincode on Peer0/Org1
echo "Sending invoke transaction on peer0/org1..." echo "Sending invoke transaction on org1/peer0..."
chaincodeInvoke 0 chaincodeInvoke 0
## Install chaincode on Peer1/Org2 ## Install chaincode on Peer1/Org2