BYFN CLI Container Missing Admin Certificates

Q

How to fix the ".../org1.example.com/users/Admin@org1.example.com/msp does not exist" when running the BYFN CLI "peer" command?

✍: FYIcenter.com

A

When you build your BYFN network manually, you may end up missing admin user certificate on the CLI Docker container.

1. Check the certificate directory for the org1.example.com organization:

$ docker exec -it cli bash
bash-4.4#

bash-4.4# cd /opt/gopath/src/github.com/hyperledger/fabric/peer

bash-4.4# ls crypto/peerOrganizations/org1.example.com/
drwxr-xr-x    4 root     root          4096 Apr  1 02:34 peers

As you can see the "users" sub-directory is missing on the CLI container.

2. Check the hosting system for the same directory:

$ cd ~/hyperledger-binaries/fabric-samples/first-network

$ ls -l crypto-config/peerOrganizations/org1.example.com/
drwxr-xr-x 4 root      root 4096 Apr  11 02:34 peers

$ ls -l
...
-rw-rw-r-- 1 fyicenter fyicenter 3906 Feb 21 23:01 crypto-config.yaml
drwxr-xr-x 4 root      root      4096 Apr  1 02:34 crypto-config
-rw-rw-r-- 1 fyicenter fyicenter 2973 Feb 21 23:01 docker-compose-cli.yaml
...

As you can see the "users" sub-directory is missing on the hosting system too. Also

Also notice that the owner of the "crypto-config/.../peers" sub-directory tree is "root", not your own account. That's probably the root cause of missing admin user certificates.

3. Remove the "crypto-config" sub-directory tree. Then re-run the "cryptogen" command to generate all certificates again.

$ sudo rm -rf crypto-config

$ ../bin/cryptogen generate --config=./crypto-config.yaml
org1.example.com
org2.example.com

$ ls -l crypto-config/peerOrganizations/org1.example.com/
drwxr-xr-x 2 fyicenter fyicenter 4096 Apr  11 14:08 ca
drwxr-xr-x 5 fyicenter fyicenter 4096 Apr  11 14:08 msp
drwxr-xr-x 4 fyicenter fyicenter 4096 Apr  11 14:08 peers
drwxr-xr-x 2 fyicenter fyicenter 4096 Apr  11 14:08 tlsca
drwxr-xr-x 4 fyicenter fyicenter 4096 Apr  11 14:08 users

4. Remove BYFN Docker container images from the Docker Engine. Then re-run the "docker-compose up" command to deploy and start BYFN network:

$ ./byfn.sh down

$ docker-compose -f docker-compose-cli.yaml up
...
Creating peer1.org2.example.com ... done
Creating peer0.org2.example.com ... done
Creating orderer.example.com    ... done
Creating peer0.org1.example.com ... done
Creating peer1.org1.example.com ... done
Creating cli                    ... done

5. Verify BYFN Docker containers:

$ docker ps -a 

IMAGE                             COMMAND            STATUS      NAMES
hyperledger/fabric-tools:latest   "/bin/bash"        Up 1 minute cli
hyperledger/fabric-peer:latest    "peer node start"  Up 1 minute peer1.org1.example.com
hyperledger/fabric-peer:latest    "peer node start"  Up 1 minute peer0.org2.example.com
hyperledger/fabric-peer:latest    "peer node start"  Up 1 minute peer0.org1.example.com
hyperledger/fabric-peer:latest    "peer node start"  Up 1 minute peer1.org2.example.com
hyperledger/fabric-orderer:latest "orderer"          Exited (2)  orderer.example.com

CLI and peer containers are running. But orderer container failed. See next tutorial on how to fix the issue.

 

BYFN Error - "unable to bootstrap orderer"

BYFN CLI Container "peer" Command

BYFN (Build Your First Network)

⇑⇑ Hyperledger Tutorials

2020-10-10, 899🔥, 0💬