2

I tried to extend the fabcar network to 2 peers running on the same system. I encountered some errors.

I made the following changes to the docker compose file.

  peer1.org1.example.com:
  container_name: peer1.org1.example.com
  image: hyperledger/fabric-peer
  environment:
    - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
    - CORE_PEER_ID=peer1.org1.example.com
    - CORE_LOGGING_PEER=debug
    - CORE_CHAINCODE_LOGGING_LEVEL=DEBUG
    - CORE_PEER_LOCALMSPID=Org1MSP
    - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/peer/
    - CORE_PEER_ADDRESS=peer1.org1.example.com:7051
    # # 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=${COMPOSE_PROJECT_NAME}_basic
    - CORE_LEDGER_STATE_STATEDATABASE=CouchDB
    - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb1:5984
    # The CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME and CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD
    # provide the credentials for ledger to connect to CouchDB.  The username and password must
    # match the username and password set for the associated CouchDB.
    - CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=
    - CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=
  working_dir: /opt/gopath/src/github.com/hyperledger/fabric
  command: peer node start
  # command: peer node start --peer-chaincodedev=true
  ports:
    - 8051:7051
    - 8053:7053
  volumes:
      - /var/run/:/host/var/run/
      - ./crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/msp:/etc/hyperledger/msp/peer
      - ./crypto-config/peerOrganizations/org1.example.com/users:/etc/hyperledger/msp/users
      - ./config:/etc/hyperledger/configtx
  depends_on:
    - orderer.example.com
    - couchdb1
  networks:
    - basic

couchdb1:
container_name: couchdb1
image: hyperledger/fabric-couchdb
# Populate the COUCHDB_USER and COUCHDB_PASSWORD to set an admin user and password
# for CouchDB.  This will prevent CouchDB from operating in an "Admin Party" mode.
environment:
  - COUCHDB_USER=
  - COUCHDB_PASSWORD=
ports:
  - 6984:5984
networks:
  - basic

In the start.sh file, I added a line of code to join peer 1 to the channel.

When I execute ./startFabric.sh node, I get the following error:

Error response from daemon, container not running.

Logs are as below:

CONTAINER ID        IMAGE                        COMMAND                  CREATED             STATUS                     PORTS                                            NAMES

b602e1898831        hyperledger/fabric-peer      "peer node start"        3 minutes ago       Exited (1) 3 minutes ago                                                    peer1.org1.example.com
780acf5be420        hyperledger/fabric-couchdb   "tini -- /docker-ent…"   3 minutes ago       Up 3 minutes               4369/tcp, 9100/tcp, 0.0.0.0:6984->5984/tcp       couchdb1

d93c8d14e07d        hyperledger/fabric-peer      "peer node start"        3 minutes ago       Up 3 minutes               0.0.0.0:7051->7051/tcp, 0.0.0.0:7053->7053/tcp   peer0.org1.example.com

f8d5a07e0c14        hyperledger/fabric-couchdb   "tini -- /docker-ent…"   3 minutes ago       Up 3 minutes               4369/tcp, 9100/tcp, 0.0.0.0:5984->5984/tcp       couchdb

0c8be993aaad        hyperledger/fabric-orderer   "orderer"                3 minutes ago       Up 3 minutes               0.0.0.0:7050->7050/tcp                           orderer.example.com

29484423ee69        hyperledger/fabric-ca        "sh -c 'fabric-ca-se…"   3 minutes ago       Exited (1) 3 minutes ago                                                    ca.example.com

Digitals-MacBook-Air-3:fabcar digital3$ docker logs b602e1898831  
2018-06-28 08:12:18.923 UTC [main] main -> ERRO 001 **Cannot run peer because error when setting up MSP of type bccsp from directory /etc/hyperledger/msp/peer/: could not load a valid signer certificate from directory /etc/hyperledger/msp/peer/signcerts: stat /etc/hyperledger/msp/peer/signcerts: no such file or directory**

Changes I made are:

  1. In crypto-config: changed template count to 2.
  2. In docker-compose , added another service for peer1 with database as couchdb1. No changes to CLI.
  3. In the start.sh file, I wrote a line of code to add peer 1 to the channel.

When I run ./startFabric.sh node in the fabcar directory, I get the above mentioned errors.

I am making edits in the basic-network and not first network.

I just checked my certificate directory: It looks as below

CRYPTOCONFIG - PeerOrganisations - Peers - peer0 , peer1

Peer0 has all the certificates

Peer1 only has the msp folder, no tls folder. The msp folder only has admincerts and keystore

Update:

I managed to generate the certificates for both peers and successful ran the ./startFabric.sh node command from the fabcar directory. However, I faced an issue when I executed the enrollAdmin command.

Error: Calling enrollment endpoint failed with error [Error: connect ECONNREFUSED 10.228.27.101:7054] at ClientRequest. (/Users/digital3/fabric-samples/fabcar/node_modules/fabric-ca-client/lib/FabricCAClientImpl.js:883:12) at emitOne (events.js:116:13) at ClientRequest.emit (events.js:211:7) at Socket.socketErrorListener (_http_client.js:387:9) at emitOne (events.js:116:13) at Socket.emit (events.js:211:7) at emitErrorNT (internal/streams/destroy.js:64:8) at _combinedTickCallback (internal/process/next_tick.js:138:11) at process._tickCallback (internal/process/next_tick.js:180:9) Failed to enroll admin: Error: Failed to enroll admin

Could you help me with this

1 Answers1

0

If you want to add additional peer node(s), you will also need to generate the relevant crypto material.

On line 63 of the crypto-config.yaml file in the basic-network directory, set the value of Count to '2', e.g.:

# "Template"
# ---------------------------------------------------------------------------
# Allows for the definition of 1 or more hosts that are created sequentially
# from a template. By default, this looks like "peer%d" from 0 to Count-1.
# You may override the number of nodes (Count), the starting index (Start)
# or the template used to construct the name (Hostname).
#
# Note: Template and Specs are not mutually exclusive.  You may define both
# sections and the aggregate nodes will be created for you.  Take care with
# name collisions
# ---------------------------------------------------------------------------
Template:
  Count: 2
  # Start: 5
  # Hostname: {{.Prefix}}{{.Index}} # default

This will have the cryptogen step generate key material for two peer nodes for the org: Org1.

christo4ferris
  • 4,039
  • 1
  • 17
  • 30
  • Hi, I did this already. Have added the edits I made in the question – Surya Suresh Jun 29 '18 at 04:55
  • Added info about crypto config. I think some certificates are missing for peer1. Could you tell me how to generate it. Should I delete the folder and run cryptogen again – Surya Suresh Jun 29 '18 at 05:02