Hyperledger fabric multihost setup for first-network example -
i trying setup first-network example on multihost environment using docker swarm below configuration begin with:
host1
- orderer
- org1-pee0
- org1-peer1
- cli
host2
- org2-pee0
- org2-pee1
i have changed docker-compose-cli.yaml make compatible swarm(code given below). i not able add host2 / org2 peers channel.
executing below steps in order:
- byfn -m generate
- docker stack deploy --compose-file docker-compose-cli.yaml overnet
- enter cli docker , execute ./scripts/script.sh mychannel
i keep getting below error
2017-08-15 02:42:49.512 utc [msp] getdefaultsigningidentity -> debu 006 obtaining default signing identity
error: error getting endorser client channel: per:404 - error trying connect local peer
/opt/gopath/src/github.com/hyperledger/fabric/peer/common/common.go:116 github.com/hyperledger/fabric/peer/common.getendorserclient
/opt/gopath/src/github.com/hyperledger/fabric/peer/channel/channel.go:149 github.com/hyperledger/fabric/peer/channel.initcmdfactory
/opt/gopath/src/github.com/hyperledger/fabric/peer/channel/join.go:138 github.com/hyperledger/fabric/peer/channel.join
/opt/gopath/src/github.com/hyperledger/fabric/peer/channel/join.go:42 github.com/hyperledger/fabric/peer/channel.joincmd.func1
/opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/spf13/cobra/command.go:599
github.com/hyperledger/fabric/vendor/github.com/spf13/cobra.(*command).execute
/opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/spf13/cobra/command.go:689
github.com/hyperledger/fabric/vendor/github.com/spf13/cobra.(*command).executec
/opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/spf13/cobra/command.go:648
github.com/hyperledger/fabric/vendor/github.com/spf13/cobra.(*command).execute
/opt/gopath/src/github.com/hyperledger/fabric/peer/main.go:118 main.main
/opt/go/src/runtime/proc.go:192 runtime.main
/opt/go/src/runtime/asm_amd64.s:2087 runtime.goexit
caused by: x509: certificate valid peer0.org1.example.com, peer0, not peer0.org2.example.com
docker-compose-cli.yaml
orderer
version: '3' networks: overnet: services: orderer_example_com: image: hyperledger/fabric-orderer environment: - orderer_general_loglevel=debug - orderer_general_listenaddress=0.0.0.0 - orderer_general_genesismethod=file - orderer_general_genesisfile=/var/hyperledger/orderer/orderer.genesis.block - orderer_general_localmspid=orderermsp - orderer_general_localmspdir=/var/hyperledger/orderer/msp # enabled tls - orderer_general_tls_enabled=true - orderer_general_tls_privatekey=/var/hyperledger/orderer/tls/server.key - orderer_general_tls_certificate=/var/hyperledger/orderer/tls/server.crt - orderer_general_tls_rootcas=[/var/hyperledger/orderer/tls/ca.crt] working_dir: /opt/gopath/src/github.com/hyperledger/fabric command: orderer volumes: - ./channel-artifacts/genesis.block:/var/hyperledger/orderer/orderer.genesis.block - ./crypto-config/ordererorganizations/example.com/orderers/orderer.example.com/msp:/var/hyperledger/orderer/msp - ./crypto-config/ordererorganizations/example.com/orderers/orderer.example.com/tls/:/var/hyperledger/orderer/tls ports: - 7050:7050 # - 7049:7049 networks: - overnet deploy: replicas: 1 placement: constraints: [node.role == manager]
org1 peers
peer0_org1_example_com: image: hyperledger/fabric-peer volumes: - /var/run/:/host/var/run/ - ./crypto-config/peerorganizations/org1.example.com/peers/peer0.org1.example.com/msp:/etc/hyperledger/fabric/msp - ./crypto-config/peerorganizations/org1.example.com/peers/peer0.org1.example.com/tls:/etc/hyperledger/fabric/tls ports: - 7051:7051 - 7053:7053 environment: - core_vm_endpoint=unix:///host/var/run/docker.sock # following setting starts chaincode containers on same # bridge network peers # https://docs.docker.com/compose/networking/ - core_vm_docker_hostconfig_networkmode=overnet - core_logging_level=debug - core_peer_tls_enabled=true - core_peer_gossip_useleaderelection=true - core_peer_gossip_orgleader=false - core_peer_profile_enabled=true - core_peer_tls_cert_file=/etc/hyperledger/fabric/tls/server.crt - core_peer_tls_key_file=/etc/hyperledger/fabric/tls/server.key - core_peer_tls_rootcert_file=/etc/hyperledger/fabric/tls/ca.crt - core_peer_id=peer0.org1.example.com - core_peer_address=peer0.org1.example.com:7051 - core_peer_gossip_externalendpoint=peer0.org1.example.com:7051 - core_peer_localmspid=org1msp working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer command: peer node start networks: - overnet deploy: replicas: 1 placement: constraints: [node.role == manager]
org2 peers
peer0_org2_example_com: image: hyperledger/fabric-peer environment: - core_vm_endpoint=unix:///host/var/run/docker.sock # following setting starts chaincode containers on same # bridge network peers # https://docs.docker.com/compose/networking/ - core_vm_docker_hostconfig_networkmode=overnet - core_logging_level=debug - core_peer_tls_enabled=true - core_peer_gossip_useleaderelection=true - core_peer_gossip_orgleader=false - core_peer_profile_enabled=true - core_peer_tls_cert_file=/etc/hyperledger/fabric/tls/server.crt - core_peer_tls_key_file=/etc/hyperledger/fabric/tls/server.key - core_peer_tls_rootcert_file=/etc/hyperledger/fabric/tls/ca.crt - core_peer_id=peer0.org2.example.com - core_peer_address=peer0.org2.example.com:7051 - core_peer_gossip_externalendpoint=peer0.org2.example.com:7051 - core_peer_localmspid=org2msp volumes: - /var/run/:/host/var/run/ - ./crypto-config/peerorganizations/org2.example.com/peers/peer0.org2.example.com/msp:/etc/hyperledger/fabric/msp - ./crypto-config/peerorganizations/org2.example.com/peers/peer0.org2.example.com/tls:/etc/hyperledger/fabric/tls ports: - 9051:7051 - 9053:7053 working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer command: peer node start networks: - overnet deploy: mode: replicated replicas: 1 placement: constraints: [node.role == worker]
cli
cli: image: hyperledger/fabric-tools tty: true environment: - gopath=/opt/gopath - core_vm_endpoint=unix:///host/var/run/docker.sock - core_logging_level=debug - core_peer_id=cli - core_peer_address=peer0.org2.example.com:7051 - core_peer_localmspid=org1msp - core_peer_tls_enabled=true - core_peer_tls_cert_file=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerorganizations/org2.example.com/peers/peer0.org2.example.com/tls/server.crt - core_peer_tls_key_file=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerorganizations/org2.example.com/peers/peer0.org2.example.com/tls/server.key - core_peer_tls_rootcert_file=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerorganizations/org2.example.com/peers/peer0.org4.example.com/tls/ca.crt - core_peer_mspconfigpath=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerorganizations/org2.example.com/users/admin@org2.example.com/msp working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer # command: /bin/bash -c './scripts/script.sh ${channel_name}; sleep $timeout' volumes: - /var/run/:/host/var/run/ - ./chaincode/:/opt/gopath/src/github.com/hyperledger/fabric/examples/chaincode/go - ./crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ - ./scripts:/opt/gopath/src/github.com/hyperledger/fabric/peer/scripts/ - ./channel-artifacts:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts depends_on: - orderer_example_com - peer0_org1_example_com - peer1_org1_example_com - peer0_org2_example_com - peer1_org2_example_com networks: - overnet deploy: replicas: 1 placement: constraints: [node.role == manager]
crypto-config.yaml (did not make changes file, attaching here reference)
ordererorgs: # ------------------------------------------------------------------ # orderer # ------------------------------------------------------------------ - name: orderer domain: example.com # ---------------------------------------------------------------- # "specs" - see peerorgs below complete description # ---------------------------------------------------------------- specs: - hostname: orderer # -------------------------------------------------------------------- # "peerorgs" - definition of organizations managing peer nodes # -------------------------------------------------------------------- peerorgs: # ------------------------------------------------------------------ # org1 # ------------------------------------------------------------------ - name: org1 domain: org1.example.com # ---------------------------------------------------------------- # "specs" # ---------------------------------------------------------------- # uncomment section enable explicit definition of hosts in # configuration. users want use template, below # # specs array of spec entries. each spec entry consists of 2 fields: # - hostname: (required) desired hostname, sans domain. # - commonname: (optional) specifies template or explicit override # cn. default, template: # # "{{.hostname}}.{{.domain}}" # # obtains values spec.hostname , # org.domain, respectively. # --------------------------------------------------------------------------- # specs: # - hostname: foo # implicitly "foo.org2.example.com" # commonname: foo27.org5.example.com # overrides hostname-based fqdn set above # - hostname: bar # - hostname: baz # --------------------------------------------------------------------------- # "template" # --------------------------------------------------------------------------- # allows definition of 1 or more hosts created sequentially # template. default, looks "peer%d" 0 count-1. # may override number of nodes (count), starting index (start) # or template used construct name (hostname). # # note: template , specs not mutually exclusive. may define both # sections , aggregate nodes created you. take care # name collisions # --------------------------------------------------------------------------- template: count: 2 # start: 5 # hostname: {{.prefix}}{{.index}} # default # --------------------------------------------------------------------------- # "users" # --------------------------------------------------------------------------- # count: number of user accounts _in addition_ admin # --------------------------------------------------------------------------- users: count: 1 # ------------------------------------------------------------------ # org2: see "org1" full specification # ------------------------------------------------------------------ - name: org2 domain: org2.example.com template: count: 2 users: count: 1
first of all, think don't have to
enter cli docker , execute ./scripts/script.sh mychannel
or have commented docker compose file described in "start network" step?
on other hand, tell have achieved setting multihost environment using docker. however, instead of defining network overlay, defined network_mode: host
docker containers i'm going start up.
could show logs appearing in peer , in orderer?
Comments
Post a Comment