From c2c3217bd355188976775910ca10f63c52e71ddc Mon Sep 17 00:00:00 2001 From: lley154 Date: Thu, 30 May 2024 19:16:38 -0400 Subject: [PATCH] - simplified network down to remove all images and volumes - set default version for fabric and ca --- test-network/network.config | 4 ++-- test-network/network.sh | 39 ++++++++++--------------------------- 2 files changed, 12 insertions(+), 31 deletions(-) diff --git a/test-network/network.config b/test-network/network.config index ec107bbe..4e9c3907 100644 --- a/test-network/network.config +++ b/test-network/network.config @@ -1,8 +1,8 @@ # 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) -CA_IMAGETAG="default" +CA_IMAGETAG="1.5.7" # Using crpto vs CA. default is cryptogen CRYPTO="cryptogen" diff --git a/test-network/network.sh b/test-network/network.sh index 9739a68b..f7117eac 100755 --- a/test-network/network.sh +++ b/test-network/network.sh @@ -415,39 +415,20 @@ function queryChaincode() { } -# Tear down running network +# Tear down all docker networks function networkDown() { - local temp_compose=$COMPOSE_FILE_BASE - COMPOSE_FILE_BASE=compose-bft-test-net.yaml - 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}" + # remove all docker containers + docker rm -f $(docker ps -a -q) - # stop org3 containers also in addition to org1 and org2, in case we were running sample to add org3 - 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 + # Don't remove the generated artifacts -- note, the ledgers are always removed if [ "$MODE" != "restart" ]; then # 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 - #Cleanup the chaincode containers - clearContainers - #Cleanup images - removeUnwantedImages + # remove all docker volumes + docker volume prune -a + + # remove all docker networks + docker network prune + # 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' ## remove fabric ca artifacts