docker-compose-files/hyperledger_fabric/v1.0.0/Makefile

136 lines
3.8 KiB
Makefile
Raw Normal View History

2017-07-21 15:24:49 +08:00
COMPOSE_FILE="docker-compose-2orgs-4peers.yaml"
COMPOSE_DEV_FILE="docker-compose-dev.yaml"
2017-09-01 21:26:25 +08:00
COMPOSE_COUCHDB_FILE="docker-compose-2orgs-4peers-couchdb.yaml"
2017-07-21 15:24:49 +08:00
all:
2017-08-22 21:32:50 +08:00
@echo "Please make sure u have setup Docker and pulled images by 'make setup'."
sleep 2
2017-09-01 21:26:25 +08:00
make ready
make lscc qscc
2017-09-01 21:26:25 +08:00
make stop
ready:
@echo "Restart and init network..."
make restart init
2017-09-01 20:18:46 +08:00
sleep 2
2017-08-25 13:02:44 +08:00
make test_cc
2017-09-01 21:26:25 +08:00
@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."
2017-09-01 21:26:25 +08:00
start: # bootup the fabric network
@echo "Start a fabric network with 2-org-4-peer"
docker-compose -f ${COMPOSE_FILE} up -d # Start a fabric network
2017-09-01 21:26:25 +08:00
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"
2017-07-21 15:24:49 +08:00
2017-09-01 21:26:25 +08:00
stop: # stop the fabric network
@echo "Stop the fabric network"
docker-compose -f ${COMPOSE_FILE} down # Stop a fabric network
restart: stop start
################## Dev testing ################
dev:
@echo "Please make sure u have setup Docker and pulled images by 'make setup'."
sleep 2
2017-09-01 21:26:25 +08:00
@echo "Restart and init dev network..."
make dev_restart dev_init
2017-09-01 20:18:46 +08:00
sleep 2
make test_peer0
2017-09-01 21:26:25 +08:00
make lscc qscc
2017-09-01 20:18:46 +08:00
2017-09-01 21:26:25 +08:00
make dev_stop
2017-09-01 20:18:46 +08:00
2017-09-01 21:26:25 +08:00
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
2017-09-01 21:26:25 +08:00
dev_init: # initialize the fabric network
@echo "Install and instantiate cc example02 on the fabric dev network"
docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/initialize_peer0.sh"
2017-09-01 21:26:25 +08:00
dev_stop: # stop the fabric network for dev
@echo "Stop the fabric network with 1 peer for dev"
docker-compose -f ${COMPOSE_DEV_FILE} down
dev_restart: dev_stop dev_start
################## Couchdb testing ################
couch:
@echo "Please make sure u have setup Docker and pulled images by 'make setup'."
2017-09-01 20:18:46 +08:00
sleep 2
2017-09-01 21:26:25 +08:00
make couch_ready
make lscc qscc
make dev_stop
couch_ready:
@echo "Restart and init network with couchdb..."
make couch_restart couch_init
2017-09-01 20:18:46 +08:00
sleep 2
2017-08-25 13:02:44 +08:00
make test_cc
2017-08-22 21:32:50 +08:00
@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."
2017-09-01 21:26:25 +08:00
couch_start: # start fabric network with couchdb
@echo "Start a fabric network with couchdb"
docker-compose -f ${COMPOSE_COUCHDB_FILE} up -d
2017-07-21 15:24:49 +08:00
2017-09-01 21:26:25 +08:00
couch_init: # initialize the fabric network
@echo "Install and instantiate cc example02 on the fabric dev network"
2017-08-31 15:59:37 +08:00
docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/initialize_all.sh"
2017-07-21 15:24:49 +08:00
2017-09-01 21:26:25 +08:00
couch_stop: # stop the fabric network with couchdb
@echo "Stop the fabric network with 1 peer with couchdb"
docker-compose -f ${COMPOSE_COUCHDB_FILE} down
couch_restart: couch_stop couch_start
################## Chaincode testing operations ################
test_cc: # test user chaincode on all peers
2017-08-25 13:02:44 +08:00
@echo "Invoke and query cc example02 on all peers"
2017-08-31 15:59:37 +08:00
docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/test_cc_all.sh"
2017-08-25 13:02:44 +08:00
test_peer0: # test single peer
@echo "Invoke and query cc example02 on single peer0"
2017-08-31 15:59:37 +08:00
docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/test_cc_peer0.sh"
2017-07-21 15:24:49 +08:00
qscc: # test qscc quries
2017-08-31 15:59:37 +08:00
docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/test_qscc.sh"
2017-08-22 21:32:50 +08:00
lscc: # test lscc quries
2017-08-31 15:59:37 +08:00
docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/test_lscc.sh"
2017-08-22 21:32:50 +08:00
2017-09-01 21:26:25 +08:00
################## Env setup related, no need to see usually ################
2017-07-21 15:24:49 +08:00
2017-09-01 21:26:25 +08:00
setup: # setup the environment
bash scripts/setup_Docker.sh # Install Docker, Docker-Compose
bash scripts/download_images.sh # Pull required Docker images
2017-09-01 20:18:46 +08:00
2017-07-21 15:24:49 +08:00
clean: # clean up environment
2017-08-22 21:32:50 +08:00
@echo "Clean all images and containers"
2017-07-21 15:24:49 +08:00
bash scripts/clean_env.sh
cli: # enter the cli container
docker exec -it fabric-cli bash
ps: # show existing docker images
docker ps -a
2017-07-21 15:24:49 +08:00
logs: # show logs
2017-08-22 21:32:50 +08:00
docker-compose -f ${COMPOSE_FILE} logs -f --tail 200