fabric-samples/balance-transfer/runApp.sh
Bret Harrison bb3ac84e6e [FAB-5363] fabric-samples update balance
Update balance transfer sample to use the
connection profile and node 8.

Change-Id: I17c74c6cb23ebe55a8f2bba735d41525ae9e5ab1
Signed-off-by: Bret Harrison <beharrison@nc.rr.com>
Signed-off-by: ratnakar <asara.ratnakar@gmail.com>
2017-10-31 16:00:14 -04:00

64 lines
1.3 KiB
Bash
Executable file

#!/bin/bash
#
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
function dkcl(){
CONTAINER_IDS=$(docker ps -aq)
echo
if [ -z "$CONTAINER_IDS" -o "$CONTAINER_IDS" = " " ]; then
echo "========== No containers available for deletion =========="
else
docker rm -f $CONTAINER_IDS
fi
echo
}
function dkrm(){
DOCKER_IMAGE_IDS=$(docker images | grep "dev\|none\|test-vp\|peer[0-9]-" | awk '{print $3}')
echo
if [ -z "$DOCKER_IMAGE_IDS" -o "$DOCKER_IMAGE_IDS" = " " ]; then
echo "========== No images available for deletion ==========="
else
docker rmi -f $DOCKER_IMAGE_IDS
fi
echo
}
function restartNetwork() {
echo
#teardown the network and clean the containers and intermediate images
cd artifacts
docker-compose down
dkcl
dkrm
#Cleanup the stores
rm -rf ./fabric-client-kv-org*
#Start the network
docker-compose up -d
cd -
echo
}
function installNodeModules() {
echo
if [ -d node_modules ]; then
echo "============== node modules installed already ============="
else
echo "============== Installing node modules ============="
npm install
fi
echo
}
restartNetwork
installNodeModules
PORT=4000 node app