diff --git a/.gitignore b/.gitignore index c0ea96ca37..d7f10ff6e1 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,8 @@ .*.sw* # installed platform-specific binaries /bin + +first-network/channel-artifacts/*.tx +first-network/channel-artifacts/*.block +first-network/crypto-config/* + diff --git a/basic-network/.env b/basic-network/.env new file mode 100644 index 0000000000..4fd2ee0d73 --- /dev/null +++ b/basic-network/.env @@ -0,0 +1 @@ +COMPOSE_PROJECT_NAME=net diff --git a/basic-network/docker-compose.yml b/basic-network/docker-compose.yml index df84452769..e836a59973 100644 --- a/basic-network/docker-compose.yml +++ b/basic-network/docker-compose.yml @@ -5,6 +5,9 @@ # version: '2' +networks: + basic: + services: ca.example.com: image: hyperledger/fabric-ca:x86_64-1.0.0-beta @@ -17,6 +20,8 @@ services: volumes: - ./crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/fabric-ca-server-config container_name: ca.example.com + networks: + - basic orderer.example.com: container_name: orderer.example.com @@ -37,6 +42,8 @@ services: - ./crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/:/etc/hyperledger/msp/orderer - ./crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/:/etc/hyperledger/msp/peerOrg1 - ./crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/:/etc/hyperledger/msp/peerOrg2 + networks: + - basic peer0.org1.example.com: container_name: peer0.org1.example.com @@ -52,7 +59,7 @@ services: # # the following setting starts chaincode containers on the same # # bridge network as the peers # # https://docs.docker.com/compose/networking/ - - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=composer_default + - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=${COMPOSE_PROJECT_NAME}_basic - CORE_LEDGER_STATE_STATEDATABASE=CouchDB - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb:5984 working_dir: /opt/gopath/src/github.com/hyperledger/fabric @@ -68,6 +75,8 @@ services: - ./config:/etc/hyperledger/configtx depends_on: - orderer.example.com + networks: + - basic couchdb: container_name: couchdb @@ -76,3 +85,5 @@ services: - 5984:5984 environment: DB_URL: http://localhost:5984/member_db + networks: + - basic diff --git a/first-network/.env b/first-network/.env new file mode 100644 index 0000000000..4fd2ee0d73 --- /dev/null +++ b/first-network/.env @@ -0,0 +1 @@ +COMPOSE_PROJECT_NAME=net diff --git a/first-network/base/peer-base.yaml b/first-network/base/peer-base.yaml index 89ed7283a4..3063386f30 100644 --- a/first-network/base/peer-base.yaml +++ b/first-network/base/peer-base.yaml @@ -4,6 +4,7 @@ # version: '2' + services: peer-base: image: hyperledger/fabric-peer @@ -12,7 +13,7 @@ services: # the following setting starts chaincode containers on the same # bridge network as the peers # https://docs.docker.com/compose/networking/ - - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=byfn_default + - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=${COMPOSE_PROJECT_NAME}_byfn #- CORE_LOGGING_LEVEL=ERROR - CORE_LOGGING_LEVEL=DEBUG - CORE_PEER_TLS_ENABLED=true diff --git a/first-network/byfn.sh b/first-network/byfn.sh index b4a43b2c44..6f46c95afb 100755 --- a/first-network/byfn.sh +++ b/first-network/byfn.sh @@ -24,6 +24,7 @@ # prepending $PWD/../bin to PATH to ensure we are picking up the correct binaries # this may be commented out to resolve installed version of tools if desired export PATH=${PWD}/../bin:${PWD}:$PATH +export FABRIC_CFG_PATH=${PWD} # Print the usage message function printHelp () { @@ -64,7 +65,7 @@ function askProceed () { ;; * ) echo "invalid response" - proceed + askProceed ;; esac } diff --git a/first-network/docker-compose-cli.yaml b/first-network/docker-compose-cli.yaml index 36483348b4..aadfa37b83 100644 --- a/first-network/docker-compose-cli.yaml +++ b/first-network/docker-compose-cli.yaml @@ -5,6 +5,9 @@ version: '2' +networks: + byfn: + services: orderer.example.com: @@ -12,30 +15,40 @@ services: file: base/docker-compose-base.yaml service: orderer.example.com container_name: orderer.example.com + networks: + - byfn peer0.org1.example.com: container_name: peer0.org1.example.com extends: file: base/docker-compose-base.yaml service: peer0.org1.example.com + networks: + - byfn peer1.org1.example.com: container_name: peer1.org1.example.com extends: file: base/docker-compose-base.yaml service: peer1.org1.example.com + networks: + - byfn peer0.org2.example.com: container_name: peer0.org2.example.com extends: file: base/docker-compose-base.yaml service: peer0.org2.example.com + networks: + - byfn peer1.org2.example.com: container_name: peer1.org2.example.com extends: file: base/docker-compose-base.yaml service: peer1.org2.example.com + networks: + - byfn cli: container_name: cli @@ -67,3 +80,6 @@ services: - peer1.org1.example.com - peer0.org2.example.com - peer1.org2.example.com + networks: + - byfn + diff --git a/first-network/docker-compose-couch.yaml b/first-network/docker-compose-couch.yaml index d2049b7fdd..7472a65b25 100644 --- a/first-network/docker-compose-couch.yaml +++ b/first-network/docker-compose-couch.yaml @@ -5,6 +5,9 @@ version: '2' +networks: + byfn: + services: couchdb0: container_name: couchdb0 @@ -13,6 +16,8 @@ services: # for example map it to utilize Fauxton User Interface in dev environments. ports: - "5984:5984" + networks: + - byfn peer0.org1.example.com: environment: @@ -28,6 +33,8 @@ services: # for example map it to utilize Fauxton User Interface in dev environments. ports: - "6984:5984" + networks: + - byfn peer1.org1.example.com: environment: @@ -43,6 +50,8 @@ services: # for example map it to utilize Fauxton User Interface in dev environments. ports: - "7984:5984" + networks: + - byfn peer0.org2.example.com: environment: @@ -58,6 +67,8 @@ services: # for example map it to utilize Fauxton User Interface in dev environments. ports: - "8984:5984" + networks: + - byfn peer1.org2.example.com: environment: diff --git a/first-network/docker-compose-e2e-template.yaml b/first-network/docker-compose-e2e-template.yaml index d30d0ef57c..327e3d2bd1 100644 --- a/first-network/docker-compose-e2e-template.yaml +++ b/first-network/docker-compose-e2e-template.yaml @@ -5,6 +5,8 @@ version: '2' + networks: + byfn: services: ca0: image: hyperledger/fabric-ca @@ -20,6 +22,8 @@ services: volumes: - ./crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/fabric-ca-server-config container_name: ca_peerOrg1 + networks: + - byfn ca1: image: hyperledger/fabric-ca @@ -35,33 +39,45 @@ services: volumes: - ./crypto-config/peerOrganizations/org2.example.com/ca/:/etc/hyperledger/fabric-ca-server-config container_name: ca_peerOrg2 + networks: + - byfn orderer.example.com: extends: file: base/docker-compose-base.yaml service: orderer.example.com container_name: orderer.example.com + networks: + - byfn peer0.org1.example.com: container_name: peer0.org1.example.com extends: file: base/docker-compose-base.yaml service: peer0.org1.example.com + networks: + - byfn peer1.org1.example.com: container_name: peer1.org1.example.com extends: file: base/docker-compose-base.yaml service: peer1.org1.example.com + networks: + - byfn peer0.org2.example.com: container_name: peer0.org2.example.com extends: file: base/docker-compose-base.yaml service: peer0.org2.example.com + networks: + - byfn peer1.org2.example.com: container_name: peer1.org2.example.com extends: file: base/docker-compose-base.yaml service: peer1.org2.example.com + networks: + - byfn