Simplify makefile
parent
4ebaf86749
commit
a0c9452765
|
@ -1,5 +1,6 @@
|
|||
KAFKA_ENABLED ?= false
|
||||
COUCHDB_ENABLED ?= false
|
||||
DEV_ENABLED ?= false
|
||||
|
||||
COMPOSE_FILE ?= "docker-compose-2orgs-4peers.yaml"
|
||||
|
||||
|
@ -11,7 +12,9 @@ ifeq ($(COUCHDB_ENABLED),true)
|
|||
COMPOSE_FILE="docker-compose-2orgs-4peers-couchdb.yaml"
|
||||
endif
|
||||
|
||||
COMPOSE_DEV_FILE="docker-compose-dev.yaml"
|
||||
ifeq ($(DEV_ENABLED),true)
|
||||
COMPOSE_FILE="docker-compose-1orgs-1peers-dev.yaml"
|
||||
endif
|
||||
|
||||
all:
|
||||
@echo "Run test with ${COMPOSE_FILE}"
|
||||
|
@ -25,10 +28,18 @@ all:
|
|||
|
||||
ready: restart
|
||||
@echo "Restart, init network and then do cc testing..."
|
||||
make init
|
||||
sleep 3
|
||||
if [ "$DEV_ENABLED" = "true" ]; then \
|
||||
sleep 35; \
|
||||
make init_peer0; \
|
||||
sleep 2; \
|
||||
make test_peer0; \
|
||||
else \
|
||||
sleep 3; \
|
||||
make init; \
|
||||
sleep 2; \
|
||||
make test_cc; \
|
||||
fi
|
||||
|
||||
make test_cc
|
||||
@echo "Now the fabric network is ready to play"
|
||||
@echo "run 'make cli' to enter into the fabric-cli container."
|
||||
@echo "run 'make stop' when done."
|
||||
|
@ -41,60 +52,17 @@ init: # initialize the fabric network
|
|||
@echo "Install and instantiate cc example02 on the fabric network"
|
||||
docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/initialize_all.sh"
|
||||
|
||||
stop: # stop the fabric network
|
||||
@echo "Stop the fabric network"
|
||||
docker-compose -f ${COMPOSE_FILE} down # Stop a fabric network
|
||||
|
||||
restart: stop clean start
|
||||
|
||||
################## Dev testing ################
|
||||
dev:
|
||||
@echo "Please make sure u have setup Docker and pulled images by 'make setup'."
|
||||
sleep 2
|
||||
|
||||
@echo "Restart and init dev network..."
|
||||
make dev_ready
|
||||
|
||||
make lscc qscc
|
||||
|
||||
make dev_stop
|
||||
|
||||
dev_ready:
|
||||
@echo "Restart and init network for dev mode..."
|
||||
make dev_restart
|
||||
sleep 35
|
||||
|
||||
make dev_init
|
||||
sleep 2
|
||||
|
||||
make test_peer0
|
||||
@echo "Now the fabric network is ready to play"
|
||||
@echo "run 'make cli' to enter into the fabric-cli container."
|
||||
@echo "run 'make dev_stop' when done."
|
||||
|
||||
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
|
||||
init_peer0: # 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 and clean the fabric dev network"
|
||||
docker-compose -f ${COMPOSE_DEV_FILE} down
|
||||
stop: # stop the fabric network
|
||||
@echo "Stop the fabric network"
|
||||
docker-compose -f ${COMPOSE_FILE} down # Stop a fabric network
|
||||
make clean
|
||||
|
||||
dev_restart: dev_stop dev_start
|
||||
restart: stop start
|
||||
|
||||
dev_download: # download required images
|
||||
@echo "Download Docker images for dev"
|
||||
docker pull yeasy/hyperledger-fabric:latest
|
||||
docker pull hyperledger/fabric-baseos:x86_64-0.4.1
|
||||
docker tag yeasy/hyperledger-fabric:latest hyperledger/fabric-ccenv:x86_64-1.1.0
|
||||
|
||||
dev_logs: # show dev logs
|
||||
docker-compose -f ${COMPOSE_DEV_FILE} logs -f --tail 200
|
||||
|
||||
################## Chaincode testing operations ################
|
||||
test_cc: # test user chaincode on all peers
|
||||
|
@ -154,3 +122,11 @@ gen_e2e: # generate e2e_cli artifacts
|
|||
|
||||
gen_kafka: # generate kafka artifacts
|
||||
cd kafka && bash gen_artifacts.sh
|
||||
|
||||
download: # download required images
|
||||
@echo "Download Docker images"
|
||||
docker pull yeasy/hyperledger-fabric:latest
|
||||
docker pull yeasy/hyperledger-fabric:1.0.2
|
||||
docker pull hyperledger/fabric-baseos:x86_64-0.4.1
|
||||
docker tag yeasy/hyperledger-fabric:latest hyperledger/fabric-ccenv:x86_64-1.1.0
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ Topics | Description
|
|||
[Use Events](./docs/events.md) | Get events with block-listener
|
||||
[Artifacts Generation](docs/artifacts_generation.md) | Will explain the usage of `cryptogen` and `configtxgen` to prepare the artifacts for booting the fabric network.
|
||||
[couchDB](docs/couchdb_usage.md) | Use couchDB as the state DB.
|
||||
[kafka](./kafka/README.md) | Use kafka as the orderering backend
|
||||
[kafka](./kafka/README.md) | Use kafka as the ordering backend
|
||||
[configtxlator](docs/configtxlator.md) | Use configtxlator to convert the configurations
|
||||
[WIP] [Some verification tests](docs/verification_test.md) |
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
version: '2'
|
||||
|
||||
services:
|
||||
peer-base-dev:
|
||||
peer-base:
|
||||
image: yeasy/hyperledger-fabric:latest
|
||||
restart: always
|
||||
environment:
|
||||
|
@ -42,7 +42,7 @@ services:
|
|||
- $GOPATH/src/github.com/hyperledger/fabric:/go/src/github.com/hyperledger/fabric
|
||||
command: bash -c 'bash /tmp/peer_build.sh; peer node start'
|
||||
|
||||
orderer-base-dev:
|
||||
orderer-base:
|
||||
image: yeasy/hyperledger-fabric:latest
|
||||
#image: hyperledger/fabric-orderer:x86_64-1.0.2
|
||||
restart: always
|
||||
|
@ -72,7 +72,7 @@ services:
|
|||
#command: bash -c 'bash /tmp/orderer_build.sh; orderer start' # use this if to debug orderer
|
||||
command: bash -c 'bash /tmp/orderer_build.sh; orderer start'
|
||||
|
||||
cli-base-dev:
|
||||
cli-base:
|
||||
image: yeasy/hyperledger-fabric:latest
|
||||
#image: hyperledger/fabric-tools:x86_64-1.0.2
|
||||
restart: always
|
||||
|
|
|
@ -10,8 +10,8 @@ version: '2.0'
|
|||
services:
|
||||
orderer.example.com: # There can be multiple orderers
|
||||
extends:
|
||||
file: base.yaml
|
||||
service: orderer-base-dev
|
||||
file: base-dev.yaml
|
||||
service: orderer-base
|
||||
container_name: orderer.example.com
|
||||
hostname: orderer.example.com
|
||||
ports:
|
||||
|
@ -25,8 +25,8 @@ services:
|
|||
|
||||
peer0.org1.example.com:
|
||||
extends:
|
||||
file: base.yaml
|
||||
service: peer-base-dev
|
||||
file: base-dev.yaml
|
||||
service: peer-base
|
||||
container_name: peer0.org1.example.com
|
||||
hostname: peer0.org1.example.com
|
||||
environment:
|
||||
|
@ -51,8 +51,8 @@ services:
|
|||
# service: peer-base
|
||||
#image: yeasy/hyperledger-fabric:1.0.2
|
||||
extends:
|
||||
file: base.yaml
|
||||
service: cli-base-dev
|
||||
file: base-dev.yaml
|
||||
service: cli-base
|
||||
container_name: fabric-cli
|
||||
hostname: fabric-cli
|
||||
tty: true
|
|
@ -1,77 +0,0 @@
|
|||
# https://github.com/yeasy/docker-compose-files/tree/master/hyperledger
|
||||
# This compose file will start a Hyperledger Fabric 1.0 MVE, including
|
||||
# * ca
|
||||
# * orderer
|
||||
# * peer
|
||||
# * sdk for testing
|
||||
|
||||
# all peers will join the default testchainid channel after bootup
|
||||
|
||||
version: '2.0'
|
||||
|
||||
services:
|
||||
ca:
|
||||
image: yeasy/hyperledger-fabric-ca:1.0.2
|
||||
container_name: fabric-ca
|
||||
hostname: ca
|
||||
# command: /go/src/github.com/hyperledger/fabric-ca/bin/ca server start -ca testdata/ec.pem -ca-key testdata/ec-key.pem -config testdata/testconfig.json
|
||||
ports:
|
||||
- "7054:7054"
|
||||
command: fabric-ca-server start -b admin:adminpw
|
||||
|
||||
orderer0: # There can be multiple orderers
|
||||
image: yeasy/hyperledger-fabric-orderer:1.0.2
|
||||
container_name: fabric-orderer0
|
||||
hostname: orderer0
|
||||
environment:
|
||||
- ORDERER_GENERAL_LEDGERTYPE=file
|
||||
- ORDERER_GENERAL_BATCHTIMEOUT=10s
|
||||
- ORDERER_GENERAL_MAXMESSAGECOUNT=10
|
||||
- ORDERER_GENERAL_MAXWINDOWSIZE=1000
|
||||
- ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
|
||||
- ORDERER_GENERAL_LISTENPORT=7050
|
||||
- ORDERER_RAMLEDGER_HISTORY_SIZE=100
|
||||
- CONFIGTX_ORDERER_ORDERERTYPE=solo
|
||||
ports:
|
||||
- "7050:7050"
|
||||
command: orderer
|
||||
|
||||
peer0:
|
||||
extends:
|
||||
file: peer-base.yaml
|
||||
service: peer
|
||||
container_name: fabric-peer0
|
||||
hostname: peer0
|
||||
environment:
|
||||
- CORE_PEER_ID=peer0
|
||||
- CORE_PEER_GOSSIP_ORGLEADER=true
|
||||
links:
|
||||
- orderer0
|
||||
ports:
|
||||
- 7051:7051
|
||||
depends_on:
|
||||
- orderer0
|
||||
command: peer node start -o orderer0:7050
|
||||
|
||||
cli:
|
||||
extends:
|
||||
file: peer-base.yaml
|
||||
service: peer
|
||||
container_name: fabric-cli
|
||||
hostname: cli
|
||||
environment:
|
||||
- CORE_PEER_ID=cli
|
||||
- CORE_PEER_ADDRESS=peer0:7051
|
||||
#- CORE_PEER_LOCALMSPID=Org0MSP
|
||||
links:
|
||||
- peer0
|
||||
- orderer0
|
||||
depends_on:
|
||||
- peer0
|
||||
- orderer0
|
||||
command: bash -c 'while true; do sleep 20170504; done'
|
||||
|
||||
#networks:
|
||||
# default:
|
||||
# external:
|
||||
# name: hyperledger_fabric
|
Loading…
Reference in New Issue