concept startup in category hyperledger

appears as: startup
Programming Hyperledger Fabric: Creating Permissioned Blockchains

This is an excerpt from Manning's book Programming Hyperledger Fabric: Creating Permissioned Blockchains.

Table 4.4. Settings to start Biotor peer
Setting Value Explanation
FABRIC_CFG_PATH $PWD All peer commands require a core.yaml file under FABRIC_CFG_PATH
CORE_CHAINCODE_MODE dev Dev mode is useful in development phase of the project when you want to be able to debug etc.
CORE_PEER_ID peer0.biotor.com Name of the peer
CORE_PEER_ADDRESS The address by which this peer is known to other peers in the same organization. Since we don’t have other peers in same organization we can set this to empty string.
CORE_PEER_LISTENADDRESS 0.0.0.0:8051 Address and port at which peer will listen for communication from other peers and applications but not the chaincode
CORE_PEER_GOSSIP_BOOTSTRAP A list of other peers in the same org that this peer reaches out to at startup to initialize the gossip protocol. As we don’t have any other peer in same org, we can set this to be empty.
CORE_PEER_GOSSIP_EXTERNALENDPOINT 127.0.0.1:8051 The address by which this peer is known to peers of other organizations.
CORE_PEER_CHAINCODEADDRESS We don’t need to set chaincode address in dev mode. So you can set it to empty or skip the setting.
CORE_PEER_CHAINCODELISTENADDRESS 0.0.0.0:8052 Address and port at which peer will listen for messages from chaincode.
CORE_PEER_LOCALMSPID BiotorMSP Must match with what you declared in configtx.yaml
CORE_PEER_MSPCONFIGPATH $PWD/crypto-config/peerOrganizations/biotor.com/peers/peer0.biotor.com/msp Directory containing the identity of the peer.
CORE_PEER_TLS_ENABLED false TLS must be disabled in dev mode according to Fabric docs.
CORE_PEER_TLS_CLIENTAUTHREQUIRED false
CORE_PEER_FILESYSTEMPATH $PWD/peer0.biotor.com Directory where peer will store all its data.
CORE_LEDGER_STATE_STATEDATABASE CouchDB We use CouchDB for the world state. That way we can inspect the world state independently using a UI or CLI that comes with CouchDB.
CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS 127.0.0.1:17055 Address and port where the CouchDB can be reached.
CORE_OPERATIONS_LISTENADDRESS 0.0.0.0:9433 The operations service can be considered as a black-box but we do need to provide a unique address for it.
GODEBUG netdns=go Use Go’s library for DNS name resolution instead of relying on C library routines.

We mentioned in Section 4.5 that the orderer reads a file named orderer.yaml on startup and looks for it under the FABRIC_CFG_PATH directory. In Section 4.5 we provided an orderer.yaml under the $/three-org-network directory to the orderer. If you have been observant, you would have noticed we did not copy over any orderer.yaml in Listing 9.4. The fabric-orderer Docker image comes pre-installed with a default orderer.yaml located at /etc/hyperledger/fabric. To help the orderer find this file we set FABRIC_CFG_PATH=/etc/hyperledger/fabric in Listing 9.4. This is also the default value of FABRIC_CFG_PATH inside the container anyway so in a way setting it was redundant in Listing 9.4. The lesson here is that if you are relying on the orderer to use a custom orderer.yaml, then you need to docker cp it to the right location prior to starting the container.

9.3.7. Debugging containers that crash on startup

Sometimes (or rather definitely at some point as your Docker usage increases) you will run into issues when a container immediately crashes on startup. Running docker ps will show the container has exited or it might not even show the container in the listing - use docker ps -a in that case to list all running as well as stopped containers. If the container is removed, then its logs will also be lost. How do you debug such a scenario? We have seen that all a container does when its started is to execute the Cmd or Entrypoint. If the Cmd or Entrypoint crashes, it will also crash the container. So we want to be able to get inside the container before the Cmd or Entrypoint starts and monitor the execution of the Cmd or Entrypoint. Take the case of the fabric-orderer. When the container starts, it will start executing the orderer binary. But for the orderer binary to work it expects a proper orderer.yaml file, a proper MSP directory and so on. We would like to make sure these exist and are as expected. How can we do this? We have already seen in Section 9.3.6 that the Cmd or Entrypoint can be overridden by specifying a different value on the command line. A common newbie mistake is to specify /bin/bash for the Cmd or Entrypoint with the intent that this would allow you to log into the container so that you can do ad-hoc tasks such as verifying the orderer.yaml or MSP directory for errors before starting the orderer. For example: