Clean up code

pull/117/head
Baohua Yang 2018-01-18 17:33:15 +08:00
parent b4a4c23247
commit 65a648e29e
25 changed files with 25268 additions and 24471 deletions

View File

@ -8,6 +8,7 @@ CODE_BUILD_WAIT=30 # time to wait to build peer/orderer from local code
NETWORK_INIT_WAIT=2 # time to wait the fabric network finish initialization
COMPOSE_FILE ?= "docker-compose-2orgs-4peers-solo.yaml"
#COMPOSE_FILE ?= "test-solo.yaml"
LOG_PATH ?= solo/logs
@ -31,7 +32,6 @@ test:
@echo "Please make sure u have setup Docker and pulled images by 'make setup'."
make ready # Finish all testing
make stop clean
ready: # create/join channel, install/instantiate cc
@ -86,19 +86,19 @@ chaincode_dev: restart chaincode_init test_cc_peer0 stop
test_channel_create: # Init the channel
@echo "Create channel on the fabric network"
docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/test_channel_create.sh"
@docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/test_channel_create.sh"
test_channel_join: # Init the channel
@echo "Join channel"
docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/test_channel_join.sh"
@docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/test_channel_join.sh"
update_anchors: # Update the anchor peer
@echo "Update anchors on the fabric network"
docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/test_update_anchors.sh"
@docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/test_update_anchors.sh"
test_channel_update: # send the channel update transaction
@echo "Test channel update with adding new org"
docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/test_channel_update.sh"
@docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/test_channel_update.sh"
################## Configtxlator testing operations ################
test_configtxlator: # Test change config using configtxlator
@ -125,38 +125,38 @@ test_cc: # test chaincode, deprecated
test_cc_install: # Install the chaincode
@echo "Install chaincode on the fabric network"
docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/test_cc_install.sh"
@docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/test_cc_install.sh"
test_cc_instantiate: # Instantiate the chaincode
@echo "Instantiate chaincode on the fabric network"
docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/test_cc_instantiate.sh"
@docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/test_cc_instantiate.sh"
test_cc_upgrade: # Upgrade the chaincode
@echo "Upgrade chaincode on the fabric network"
docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/test_cc_upgrade.sh"
@docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/test_cc_upgrade.sh"
test_cc_invoke_query: # test user chaincode on all peers
@echo "Invoke and query cc example02 on all peers"
docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/test_cc_invoke_query.sh"
@docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/test_cc_invoke_query.sh"
test_qscc: # test qscc queries
@echo "Test QSCC query"
docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/test_qscc.sh"
@docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/test_qscc.sh"
test_lscc: # test lscc quries
@echo "Test LSCC query"
docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/test_lscc.sh"
@docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/test_lscc.sh"
# FIXME: docker doesn't support wildcard in cp right now
test_fetch_blocks: # test fetching channel blocks fetch
@echo "Test fetching block files"
docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/test_fetch_blocks.sh"
@docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/test_fetch_blocks.sh"
################## Env setup related, no need to see usually ################
setup: # setup the environment
bash scripts/setup_env.sh # Installing Docker and Docker-Compose
bash scripts/download_images.sh # Pull required Docker images
bash scripts/env_setup.sh # Installing Docker and Docker-Compose
#bash scripts/download_images.sh # Pull required Docker images
check: # Check shell scripts grammar
@echo "Check shell scripts grammar"
@ -168,9 +168,9 @@ clean: # clean up containers
@-docker ps -a | awk '$$2 ~ /dev-peer/ { print $$1 }' | xargs -r -I {} docker rm -f {}
@-docker images | awk '$$1 ~ /dev-peer/ { print $$3 }' | xargs -r -I {} docker rmi -f {}
clean_env: # clean up environment
env_clean: # clean up environment
@echo "Clean all images and containers"
bash scripts/clean_env.sh
bash scripts/env_clean.sh
cli: # enter the cli container
docker exec -it fabric-cli bash
@ -222,5 +222,5 @@ download: # download required images
################## chaincode dev mode ################
chaincode_init: # start chaincode in dev mode and do install/instantiate
@echo "Install and instantiate cc example02 on the fabric dev network"
docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/init_chaincode_dev.sh"
@docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/init_chaincode_dev.sh"

View File

@ -64,6 +64,7 @@ services:
- CORE_LOGGING_LEVEL=DEBUG
- CORE_LOGGING_FORMAT=%{color}[%{id:03x} %{time:01-02 15:04:05.00 MST}] [%{longpkg}] %{callpath} -> %{level:.4s}%{color:reset} %{message}
- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=v102_default # uncomment this to use specific network
- CORE_PEER_ADDRESSAUTODETECT=true # default to false
- CORE_PEER_GOSSIP_ORGLEADER=false # whether this node is the group leader, default to false
- CORE_PEER_GOSSIP_USELEADERELECTION=true
- CORE_PEER_PROFILE_ENABLED=false

View File

@ -1,35 +0,0 @@
#!/usr/bin/env bash
# This script will remove all containers and hyperledger related images
# Detecting whether can import the header file to render colorful cli output
# Need add choice option
if [ -f ./header.sh ]; then
source ./header.sh
elif [ -f scripts/header.sh ]; then
source scripts/header.sh
else
echo_r() {
echo "$@"
}
echo_g() {
echo "$@"
}
echo_b() {
echo "$@"
}
fi
echo_b "Clean up all containers..."
docker rm -f `docker ps -qa`
echo_b "Clean up all chaincode images..."
docker rmi -f $(docker images |grep 'dev-peer'|awk '{print $3}')
echo_b "Clean up all hyperledger related images..."
docker rmi -f $(docker images |grep 'hyperledger'|awk '{print $3}')
echo_b "Clean up dangling images..."
docker rmi $(docker images -q -f dangling=true)
echo_g "Env cleanup done!"

View File

@ -1,25 +1,13 @@
#!/usr/bin/env bash
# Detecting whether can import the header file to render colorful cli output
if [ -f ./header.sh ]; then
source ./header.sh
elif [ -f scripts/header.sh ]; then
source scripts/header.sh
else
alias echo_r="echo"
alias echo_g="echo"
alias echo_b="echo"
fi
ARCH=x86_64
BASEIMAGE_RELEASE=0.3.2
BASE_VERSION=1.1.0
PROJECT_VERSION=1.0.2
# For testing 1.0.0 images
IMG_TAG=1.0.2
echo_b "Downloading images from DockerHub... need a while"
echo "Downloading images from DockerHub... need a while"
# TODO: we may need some checking on pulling result?
docker pull yeasy/hyperledger-fabric-base:$IMG_TAG \
@ -33,7 +21,7 @@ docker pull yeasy/hyperledger-fabric-base:$IMG_TAG \
# Only useful for debugging
# docker pull yeasy/hyperledger-fabric
echo_b "===Pulling fabric images from official repo... with tag = ${IMG_TAG}"
echo "===Pulling fabric images from official repo... with tag = ${IMG_TAG}"
docker pull hyperledger/fabric-peer:$ARCH-$IMG_TAG
docker pull hyperledger/fabric-tools:$ARCH-$IMG_TAG
docker pull hyperledger/fabric-orderer:$ARCH-$IMG_TAG
@ -45,6 +33,6 @@ docker pull hyperledger/fabric-couchdb:$ARCH-$IMG_TAG
docker pull hyperledger/fabric-kafka:$ARCH-$IMG_TAG
docker pull hyperledger/fabric-zookeeper:$ARCH-$IMG_TAG
echo_g "Done, now can startup the network using docker-compose..."
echo "Done, now can startup the network using docker-compose..."
exit 0

View File

@ -0,0 +1,17 @@
#!/usr/bin/env bash
# This script will remove all containers and hyperledger related images
echo "Clean up all containers..."
docker rm -f `docker ps -qa`
echo "Clean up all chaincode images..."
docker rmi -f $(docker images |grep 'dev-peer'|awk '{print $3}')
echo "Clean up all hyperledger related images..."
docker rmi -f $(docker images |grep 'hyperledger'|awk '{print $3}')
echo "Clean up dangling images..."
docker rmi $(docker images -q -f dangling=true)
echo "Env cleanup done!"

View File

@ -0,0 +1,24 @@
#!/usr/bin/env bash
# Install docker on Ubuntu/Debian system
install_docker() {
echo "Install Docker..."
wget -qO- https://get.docker.com/ | sh
sudo service docker stop
#nohup sudo docker daemon --api-cors-header="*" -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock&
echo "Docker Installation Done"
}
install_docker_compose() {
echo "Install Docker-Compose..."
command -v "curl" >/dev/null 2>&1 || sudo apt-get update && apt-get install curl -y
curl -L https://github.com/docker/compose/releases/download/1.17.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version
echo "Docker-Compose Installation Done"
}
command -v "docker" >/dev/null 2>&1 && echo "Docker already installed" || install_docker
command -v "docker-compose" >/dev/null 2>&1 && echo "Docker-Compose already installed" || install_docker_compose

View File

@ -1,23 +1,21 @@
#!/bin/bash
#!/usr/bin/env bash
# Some useful functions for cc testing
# Detecting whether can import the header file to render colorful cli output
if [ -f ./header.sh ]; then
source ./header.sh
elif [ -f scripts/header.sh ]; then
source scripts/header.sh
else
echo_r() {
echo "$@"
}
echo_g() {
echo "$@"
}
echo_b() {
echo "$@"
}
fi
echo_r () {
[ $# -ne 1 ] && return 0
echo -e "\033[31m$1\033[0m"
}
echo_g () {
[ $# -ne 1 ] && return 0
echo -e "\033[32m$1\033[0m"
}
echo_y () {
[ $# -ne 1 ] && return 0
echo -e "\033[33m$1\033[0m"
}
echo_b () {
[ $# -ne 1 ] && return 0
echo -e "\033[34m$1\033[0m"
}
# Define those global variables
if [ -f ./variables.sh ]; then
@ -25,7 +23,7 @@ if [ -f ./variables.sh ]; then
elif [ -f scripts/variables.sh ]; then
source scripts/variables.sh
else
echo "Cannot find the variables.sh files, pls check"
echo_r "Cannot find the variables.sh files, pls check"
exit 1
fi
@ -46,15 +44,30 @@ setOrdererEnvs () {
#t="\${ORG${org}_PEER${peer}_URL}" && CORE_PEER_ADDRESS=`eval echo $t`
}
# Set global env variables for fabric cli, after seting:
# Set global env variables for fabric cli, after setting:
# client is the admin as given org
# TLS root cert is configured to given peer's
# remote peer address is configured to given peer's
# CORE_PEER_LOCALMSPID=Org1MSP
# CORE_PEER_ADDRESS=peer0.org1.example.com:7051
# CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp
# CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
# Usage: setEnvs org peer
setEnvs () {
local org=$1 # 1 or 2
local peer=$2 # 0 or 1
[ -z $org ] && [ -z $peer ] && echo_r "input param invalid" && exit -1
# a means a mirror peer
if [ $peer = "a" ]; then
export CORE_PEER_LOCALMSPID=Org1MSP
export CORE_PEER_ADDRESS=peer0.org1.example.com:7051
export CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp
export CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
return
fi
local t=""
export CORE_PEER_LOCALMSPID="Org${org}MSP"
#CORE_PEER_MSPCONFIGPATH=\$${ORG${org}_ADMIN_MSP}
@ -128,18 +141,16 @@ channelCreate() {
[ -z $channel ] && [ -z $tx ] && [ -z $org ] && [ -z $peer ] && echo_r "input param invalid" && exit -1
echo "=== Create Channel ${channel} by org $org peer $peer === "
echo "=== Create Channel ${channel} by org $org/peer $peer === "
setEnvs $org $peer
channelCreateAction "${channel}" "${tx}"
local rc=$?
local rc=1
local counter=0
while [ ${counter} -lt ${MAX_RETRY} -a ${rc} -ne 0 ]; do
echo "Failed to create channel $channel, retry after 3s"
sleep 3
channelCreateAction "${channel}" "${tx}"
rc=$?
let counter=${counter}+1
#COUNTER=` expr $COUNTER + 1`
[ $rc -ne 0 ] && echo "Failed to create channel $channel, retry after 3s" && sleep 3
done
[ $rc -ne 0 ] && cat log.txt
verifyResult ${rc} "Channel ${channel} creation failed"
@ -180,10 +191,10 @@ channelJoin () {
local peer=$3
[ -z $channel ] && [ -z $org ] && [ -z $peer ] && echo_r "input param invalid" && exit -1
echo "=== Join org$org/peer$peer into channel ${channel} === "
echo "=== Join org $org/peer $peer into channel ${channel} === "
setEnvs $org $peer
channelJoinWithRetry ${channel} $peer
echo "=== org$org/peer$peer joined into channel ${channel} === "
echo "=== org $org/peer $peer joined into channel ${channel} === "
}
getShasum () {
@ -266,7 +277,7 @@ channelSignConfigTx () {
local peer=$3
local tx=$4
[ -z $channel ] && [ -z $tx ] && [ -z $org ] && [ -z $peer ] && echo_r "input param invalid" && exit -1
echo "=== Sign channel config tx $tx for channel $channel by org $org peer $peer === "
echo "=== Sign channel config tx $tx for channel $channel by org $org/peer $peer === "
[ -f ${CHANNEL_ARTIFACTS}/${tx} ] || { echo_r "${tx} not exist"; exit 1; }
setEnvs $org $peer
@ -275,9 +286,9 @@ channelSignConfigTx () {
rc=$?
[ $rc -ne 0 ] && cat log.txt
if [ $rc -ne 0 ]; then
echo_r "Sign channel config tx for channel $channel by org $org peer $peer failed"
echo_r "Sign channel config tx for channel $channel by org $org/peer $peer failed"
else
echo "=== Sign channel config tx channel $channel by org $org peer $peer is successful === "
echo "=== Sign channel config tx channel $channel by org $org/peer $peer is successful === "
fi
}
@ -324,7 +335,7 @@ chaincodeInstall () {
local version=$4
local path=$5
[ -z $org ] && [ -z $peer ] && [ -z $name ] && [ -z $version ] && [ -z $path ] && echo_r "input param invalid" && exit -1
echo "=== Install Chaincode $name:$version ($path) on org${org} peer$peer === "
echo "=== Install Chaincode $name:$version ($path) on org ${org}/peer $peer === "
setEnvs $org $peer
peer chaincode install \
-n ${name} \
@ -333,7 +344,7 @@ chaincodeInstall () {
>&log.txt
rc=$?
[ $rc -ne 0 ] && cat log.txt
verifyResult $rc "Chaincode installation on remote peer$peer has Failed"
verifyResult $rc "Chaincode installation on remote org ${org}/peer$peer has Failed"
echo "=== Chaincode is installed on remote peer$peer === "
}
@ -348,7 +359,7 @@ chaincodeInstantiate () {
local args=$6
[ -z $channel ] && [ -z $org ] && [ -z $peer ] && [ -z $name ] && [ -z $version ] && [ -z $args ] && echo_r "input param invalid" && exit -1
setEnvs $org $peer
echo "=== chaincodeInstantiate for channel ${channel} on org $org peer $peer ===="
echo "=== chaincodeInstantiate for channel ${channel} on org $org/peer $peer ===="
# while 'peer chaincode' command can get the orderer endpoint from the peer (if join was successful),
# lets supply it directly as we know it using the "-o" option
if [ -z "$CORE_PEER_TLS_ENABLED" -o "$CORE_PEER_TLS_ENABLED" = "false" ]; then
@ -374,7 +385,7 @@ chaincodeInstantiate () {
fi
rc=$?
[ $rc -ne 0 ] && cat log.txt
verifyResult $rc "ChaincodeInstantiation on peer$peer in channel ${channel} failed"
verifyResult $rc "ChaincodeInstantiation on org $org/peer$peer in channel ${channel} failed"
echo "=== Chaincode Instantiated in channel ${channel} by peer$peer ==="
}
@ -423,14 +434,14 @@ chaincodeQuery () {
local args=$5
[ -z $channel ] && [ -z $org ] && [ -z $peer ] && [ -z $name ] && [ -z $args ] && echo_r "input param invalid" && exit -1
[ $# -gt 5 ] && local expected_result=$6
echo "=== Querying on org$org peer$peer in channel ${channel}... === "
echo "=== Querying on org $org/peer $peer in channel ${channel}... === "
local rc=1
local starttime=$(date +%s)
setEnvs $org $peer
# we either get a successful response, or reach TIMEOUT
while [ "$(($(date +%s)-starttime))" -lt "$TIMEOUT" -a $rc -ne 0 ]; do
echo "Attempting to Query peer${peer}.org${org} ...$(($(date +%s)-starttime)) secs"
echo "Attempting to Query org ${org}/peer ${peer} ...$(($(date +%s)-starttime)) secs"
peer chaincode query \
-C "${channel}" \
-n "${name}" \
@ -483,7 +494,7 @@ chaincodeUpgrade () {
local version=$5
local args=$6
[ -z $channel ] && [ -z $org ] && [ -z $peer ] && [ -z $name ] && [ -z $version ] && [ -z $args ] && echo_r "input param invalid" && exit -1
echo "=== Upgrade chaincode to version $version on peer$peer in channel ${channel} === "
echo "=== Upgrade chaincode to version $version on org ${org}/peer $peer in channel ${channel} === "
setEnvs $org $peer
# while 'peer chaincode' command can get the orderer endpoint from the peer (if join was successful),
@ -570,8 +581,7 @@ configtxlatorCompare() {
[ $? -eq 0 ] || echo_r "Failed to compute config update"
}
# Run cmd inside the config generator container
gen_con_exec() {
docker exec -it $GEN_CONTAINER "$@"
}
}

View File

@ -1,19 +0,0 @@
#!/usr/bin/env bash
## DO NOT MODIFY THE FOLLOWING PART, UNLESS YOU KNOW WHAT IT MEANS ##
echo_r () {
[ $# -ne 1 ] && return 0
echo -e "\033[31m$1\033[0m"
}
echo_g () {
[ $# -ne 1 ] && return 0
echo -e "\033[32m$1\033[0m"
}
echo_y () {
[ $# -ne 1 ] && return 0
echo -e "\033[33m$1\033[0m"
}
echo_b () {
[ $# -ne 1 ] && return 0
echo -e "\033[34m$1\033[0m"
}

View File

@ -1,40 +0,0 @@
#!/usr/bin/env bash
# Install docker on Ubuntu/Debian system
# Detecting whether can import the header file to render colorful cli output
if [ -f ./header.sh ]; then
source ./header.sh
elif [ -f scripts/header.sh ]; then
source scripts/header.sh
else
alias echo_r="echo"
alias echo_g="echo"
alias echo_b="echo"
fi
if [ xroot != x$(whoami) ]
then
echo_r "You must run as root (Hint: sudo su)"
exit
fi
apt-get update && apt-get install curl -y
echo_b "Install Docker..."
wget -qO- https://get.docker.com/ | sh
sudo service docker stop
nohup sudo docker daemon --api-cors-header="*" -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock&
echo_g "Docker Installation Done"
echo_b "Install Docker-Compose..."
curl -L https://github.com/docker/compose/releases/download/1.17.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
docker-compose --version
echo_g "Docker-Compose Installation Done"

View File

@ -8,9 +8,6 @@ elif [ -f scripts/func.sh ]; then
fi
# Instantiate chaincode in the channel, executed once on any node is enough
CC_NAME=${CC_02_NAME}
CC_INIT_ARGS=${CC_02_INIT_ARGS}
# (once for each channel is enough, we make it concurrent here)
echo_b "=== Instantiating chaincode on channel ${APP_CHANNEL}... ==="
@ -19,4 +16,4 @@ chaincodeInstantiate "${APP_CHANNEL}" 2 0 ${CC_NAME} ${CC_INIT_VERSION} ${CC_INI
echo_g "=== Instantiate chaincode on channel ${APP_CHANNEL} done ==="
echo
echo

View File

@ -40,9 +40,6 @@ ORG1_PEER1_URL="peer1.org1.example.com:7051"
ORG2_PEER0_URL="peer0.org2.example.com:7051"
ORG2_PEER1_URL="peer1.org2.example.com:7051"
CC_INIT_VERSION=1.0
CC_UPGRADE_VERSION=1.1
# Chaincode exp02 related
CC_02_NAME="exp02"
CC_02_PATH="examples/chaincode/go/chaincode_example02"
@ -59,6 +56,16 @@ CC_MAP_UPGRADE_ARGS='{"Args":["upgrade",""]}'
CC_MAP_INVOKE_ARGS='{"Args":["invoke","put","key","value"]}'
CC_MAP_QUERY_ARGS='{"Args":["get","key"]}'
# unique chaincode params
CC_NAME=${CC_02_NAME}
CC_PATH=${CC_02_PATH}
CC_INIT_ARGS=${CC_02_INIT_ARGS}
CC_INIT_VERSION=1.0
CC_UPGRADE_ARGS=${CC_02_UPGRADE_ARGS}
CC_UPGRADE_VERSION=1.1
CC_INVOKE_ARGS=${CC_02_INVOKE_ARGS}
CC_QUERY_ARGS=${CC_02_QUERY_ARGS}
# TLS config
CORE_PEER_TLS_ENABLED="true"
@ -98,4 +105,4 @@ UPDATED_CFG_PB=updated_config.pb
CFG_DELTA_JSON=config_delta.json
CFG_DELTA_PB=config_delta.pb
CFG_DELTA_ENV_JSON=config_delta_env.json
CFG_DELTA_ENV_PB=config_delta_env.pb
CFG_DELTA_ENV_PB=config_delta_env.pb

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,169 @@
# All elements in this file should depend on the base.yaml
# Provided solo-base fabric network with:
# ca.org1.example.com
# ca.org2.example.com
# orderer.example.com
# peer0.org1.example.com
# peer1.org1.example.com
# peer0.org2.example.com
# peer1.org2.example.com
# cli
version: '2' # v3 does not support 'extends' yet
services:
orderer.example.com: # orderer in solo mode
extends:
file: base.yaml
service: orderer-base
container_name: orderer.example.com
hostname: orderer.example.com
ports:
- "7050:7050"
volumes:
- ./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
## following are peer nodes ##
peer0.org1.example.com:
extends:
file: base.yaml
service: peer-base
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:
- ./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
ports:
- 7051:7051
- 7052:7052
- 7053:7053
peer0-a.org1.example.com:
extends:
file: base.yaml
service: peer-base
container_name: peer0-a.org1.example.com
hostname: peer0-a.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_GOSSIP_BOOTSTRAP=peer0.org1.example.com:7051
- CORE_PEER_LOCALMSPID=Org1MSP
volumes:
- ./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
expose:
- 7051
- 7052
- 7053
peer1.org1.example.com:
extends:
file: base.yaml
service: peer-base
container_name: peer1.org1.example.com
hostname: peer1.org1.example.com
environment:
- CORE_PEER_ID=peer1.org1.example.com
- CORE_PEER_ADDRESS=peer1.org1.example.com:7051
- CORE_PEER_CHAINCODELISTENADDRESS=peer1.org1.example.com:7052
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org1.example.com:7051
- CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org1.example.com:7051
- CORE_PEER_LOCALMSPID=Org1MSP
volumes:
- ./solo/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/msp:/etc/hyperledger/fabric/msp
- ./solo/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls:/etc/hyperledger/fabric/tls
ports:
- 8051:7051
- 8052:7052
- 8053:7053
peer0.org2.example.com:
extends:
file: base.yaml
service: peer-base
container_name: peer0.org2.example.com
hostname: peer0.org2.example.com
environment:
- CORE_PEER_ID=peer0.org2.example.com
- CORE_PEER_ADDRESS=peer0.org2.example.com:7051
- CORE_PEER_CHAINCODELISTENADDRESS=peer0.org2.example.com:7052
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org2.example.com:7051
- CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org2.example.com:7051
- CORE_PEER_LOCALMSPID=Org2MSP
volumes:
- ./solo/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp:/etc/hyperledger/fabric/msp
- ./solo/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls:/etc/hyperledger/fabric/tls
ports:
- 9051:7051
- 9052:7052
- 9053:7053
peer1.org2.example.com:
extends:
file: base.yaml
service: peer-base
container_name: peer1.org2.example.com
hostname: peer1.org2.example.com
environment:
- CORE_PEER_ID=peer1.org2.example.com
- CORE_PEER_ADDRESS=peer1.org2.example.com:7051
- CORE_PEER_CHAINCODELISTENADDRESS=peer1.org2.example.com:7052
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org2.example.com:7051
- CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org2.example.com:7051
- CORE_PEER_LOCALMSPID=Org2MSP
volumes:
- ./solo/crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/msp:/etc/hyperledger/fabric/msp
- ./solo/crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/tls:/etc/hyperledger/fabric/tls
ports:
- 10051:7051
- 10052:7052
- 10053:7053
peer0.org3.example.com:
extends:
file: base.yaml
service: peer-base
container_name: peer0.org3.example.com
hostname: peer0.org3.example.com
environment:
- CORE_PEER_ID=peer0.org3.example.com
- CORE_PEER_ADDRESS=peer0.org3.example.com:7051
- CORE_PEER_CHAINCODELISTENADDRESS=peer0.org3.example.com:7052
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org3.example.com:7051
- CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org3.example.com:7051
- CORE_PEER_LOCALMSPID=Org3MSP
volumes:
- ./solo/crypto-config/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/msp:/etc/hyperledger/fabric/msp
- ./solo/crypto-config/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls:/etc/hyperledger/fabric/tls
ports:
- 11051:7051
- 11052:7052
- 11053:7053
cli: # client node
extends:
file: base.yaml
service: cli-base
container_name: fabric-cli
hostname: fabric-cli
volumes:
- ./scripts:/tmp/scripts
- ./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/examples