mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-22 01:25:10 +00:00
- simplified network down to remove all images and volumes
- set default version for fabric and ca
This commit is contained in:
parent
18c815dae9
commit
c2c3217bd3
2 changed files with 12 additions and 31 deletions
|
|
@ -1,8 +1,8 @@
|
||||||
# default image tag, example: "2.5.4". "default" will download the latest. (-i)
|
# default image tag, example: "2.5.4". "default" will download the latest. (-i)
|
||||||
IMAGETAG="default"
|
IMAGETAG="2.5.4"
|
||||||
|
|
||||||
# default ca image tag, example: "1.5.7". "default" will download the latest. (-cai)
|
# default ca image tag, example: "1.5.7". "default" will download the latest. (-cai)
|
||||||
CA_IMAGETAG="default"
|
CA_IMAGETAG="1.5.7"
|
||||||
|
|
||||||
# Using crpto vs CA. default is cryptogen
|
# Using crpto vs CA. default is cryptogen
|
||||||
CRYPTO="cryptogen"
|
CRYPTO="cryptogen"
|
||||||
|
|
|
||||||
|
|
@ -415,39 +415,20 @@ function queryChaincode() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Tear down running network
|
# Tear down all docker networks
|
||||||
function networkDown() {
|
function networkDown() {
|
||||||
local temp_compose=$COMPOSE_FILE_BASE
|
# remove all docker containers
|
||||||
COMPOSE_FILE_BASE=compose-bft-test-net.yaml
|
docker rm -f $(docker ps -a -q)
|
||||||
COMPOSE_BASE_FILES="-f compose/${COMPOSE_FILE_BASE} -f compose/${CONTAINER_CLI}/${CONTAINER_CLI}-${COMPOSE_FILE_BASE}"
|
|
||||||
COMPOSE_COUCH_FILES="-f compose/${COMPOSE_FILE_COUCH} -f compose/${CONTAINER_CLI}/${CONTAINER_CLI}-${COMPOSE_FILE_COUCH}"
|
|
||||||
COMPOSE_CA_FILES="-f compose/${COMPOSE_FILE_CA} -f compose/${CONTAINER_CLI}/${CONTAINER_CLI}-${COMPOSE_FILE_CA}"
|
|
||||||
COMPOSE_FILES="${COMPOSE_BASE_FILES} ${COMPOSE_COUCH_FILES} ${COMPOSE_CA_FILES}"
|
|
||||||
|
|
||||||
# stop org3 containers also in addition to org1 and org2, in case we were running sample to add org3
|
# Don't remove the generated artifacts -- note, the ledgers are always removed
|
||||||
COMPOSE_ORG3_BASE_FILES="-f addOrg3/compose/${COMPOSE_FILE_ORG3_BASE} -f addOrg3/compose/${CONTAINER_CLI}/${CONTAINER_CLI}-${COMPOSE_FILE_ORG3_BASE}"
|
|
||||||
COMPOSE_ORG3_COUCH_FILES="-f addOrg3/compose/${COMPOSE_FILE_ORG3_COUCH} -f addOrg3/compose/${CONTAINER_CLI}/${CONTAINER_CLI}-${COMPOSE_FILE_ORG3_COUCH}"
|
|
||||||
COMPOSE_ORG3_CA_FILES="-f addOrg3/compose/${COMPOSE_FILE_ORG3_CA} -f addOrg3/compose/${CONTAINER_CLI}/${CONTAINER_CLI}-${COMPOSE_FILE_ORG3_CA}"
|
|
||||||
COMPOSE_ORG3_FILES="${COMPOSE_ORG3_BASE_FILES} ${COMPOSE_ORG3_COUCH_FILES} ${COMPOSE_ORG3_CA_FILES}"
|
|
||||||
|
|
||||||
if [ "${CONTAINER_CLI}" == "docker" ]; then
|
|
||||||
DOCKER_SOCK=$DOCKER_SOCK ${CONTAINER_CLI_COMPOSE} ${COMPOSE_FILES} ${COMPOSE_ORG3_FILES} down --volumes --remove-orphans
|
|
||||||
elif [ "${CONTAINER_CLI}" == "podman" ]; then
|
|
||||||
${CONTAINER_CLI_COMPOSE} ${COMPOSE_FILES} ${COMPOSE_ORG3_FILES} down --volumes
|
|
||||||
else
|
|
||||||
fatalln "Container CLI ${CONTAINER_CLI} not supported"
|
|
||||||
fi
|
|
||||||
|
|
||||||
COMPOSE_FILE_BASE=$temp_compose
|
|
||||||
|
|
||||||
# Don't remove the generated artifacts -- note, the ledgers are always removed
|
|
||||||
if [ "$MODE" != "restart" ]; then
|
if [ "$MODE" != "restart" ]; then
|
||||||
# Bring down the network, deleting the volumes
|
# Bring down the network, deleting the volumes
|
||||||
${CONTAINER_CLI} volume rm docker_orderer.example.com docker_peer0.org1.example.com docker_peer0.org2.example.com
|
# remove all docker volumes
|
||||||
#Cleanup the chaincode containers
|
docker volume prune -a
|
||||||
clearContainers
|
|
||||||
#Cleanup images
|
# remove all docker networks
|
||||||
removeUnwantedImages
|
docker network prune
|
||||||
|
|
||||||
# remove orderer block and other channel configuration transactions and certs
|
# remove orderer block and other channel configuration transactions and certs
|
||||||
${CONTAINER_CLI} run --rm -v "$(pwd):/data" busybox sh -c 'cd /data && rm -rf system-genesis-block/*.block organizations/peerOrganizations organizations/ordererOrganizations'
|
${CONTAINER_CLI} run --rm -v "$(pwd):/data" busybox sh -c 'cd /data && rm -rf system-genesis-block/*.block organizations/peerOrganizations organizations/ordererOrganizations'
|
||||||
## remove fabric ca artifacts
|
## remove fabric ca artifacts
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue