How do I Set up the Peer Binary to Work with Minifab


Brett Tiller
 

Rather than accessing the shell of each peer running in a docker container I’ve been unsuccessfully trying to set up the peer binary to run the peer cli commands from my computer.   I’m using Ubuntu 20.04 running in my WSL. 

 

What are the complete steps to get the peer binary working in minifab?  What I’ve tried is below.

 

I’ve downloaded hyperledger-fabric-linux-amd64-2.4.5.tar.gz, extracted it and added the path as described in https://hyperledger-fabric.readthedocs.io/en/release-2.4/deploypeer/peerdeploy.html?highlight=peer%20commands.  I’ve also set the FABRIC_CFG_PATH environment variable to the config directory of the extracted file.  I’ve been getting various errors trying to run the ‘peer node’ commands apparently due to the minifab file structure not matching up with the expected structure.

 

  1. In addition, while the peer cli has global flags to reference the location of needed files when using the cli, the peer node does not, so I was forced to use environment variables to set the locations.  Adding this global flag support to the ‘peer node’ cli would help a lot.
  2. Issues
    1. After the environment variable FABRIC_CFG_PATH is set to the location of the hyperledger config directory so that its core.yaml file can be found, the peer api expects that the msp certs are located as a subdirectory of this config directory; instead the msp directories for each org/peer are located by minifab in directory vars/keyfiles/peerOrganizations/<org name> or vars/keyfiles/peerOrganizations/<org name>/peers/<peer name>
      1. The workaround I tried was to then set the environment variable CORE_PEER_MSPCONFIGPATH=$PWD/msp.
        1. This way I could move to each org/peer directory as needed.
        2. Issue with this approach is that I must source in the .bashrc file everytime I move to a new correct directory so that the environment variable is reset in my environment.
    1. The next error that occurred was apparently due to the ca directory not being found.
      1. Error:
        1. Cannot run peer because error when setting up MSP of type bccsp from directory /home/btiller/mywork/primii/vars/keyfiles/peerOrganizations/wing11.auto1.car.dealers/peers/cars111.wing11.auto1.car.dealers/msp: KeyMaterial not found in SigningIdentityInfo
        2. The workaround tried was to set environment variable TLS_ROOT_CA=$PWD/ca
          1. This way I could move to each org/peer directory as needed.
          2. Issue with this approach is that I must source in the .bashrc file everytime I move to a new correct directory so that the environment variable is reset in my environment.
    1. The next error that occurred was the failure to create a keystore subdirectory in the msp directory
      1. Error
        1. Cannot run peer because could not initialize BCCSP Factories: Failed initializing BCCSP: Could not initialize BCCSP SW [Failed to initialize software key store: mkdir
        2. The workaround was to set the msp directory to rwx for all users
          1. sudo chmod 777 msp
    1. The next error that occurred is because the signcerts directory is expected to be a subdirectory of msp.   This directory location is true for peers, but not for the organizations
      1. Error
        1. Cannot run peer because could not load a valid signer certificate from directory /home/btiller/mywork/primii/vars/keyfiles/peerOrganizations/wing11.auto1.car.dealers/msp/signcerts: stat /home/btiller/mywork/primii/vars/keyfiles/peerOrganizations/wing11.auto1.car.dealers/msp/signcerts: no such file or directory
        2. Attempted workarounds
          1. Located signcerts directory from users/Admin@... and copied into msp directory. (FAILED)
            1. Causes previous error: KeyMaterial not found in SigningIdentityInfo

 

 

 

Brett Tiller

Sr. Software Engineer

984-349-4239 (mobile)

btiller@...

 

https://www.linkedin.com/company/securboration