Skip to content

Commit

Permalink
BE-563 Fix docker publish images
Browse files Browse the repository at this point in the history
BE-548 Fix for discovery protocol when TLS enabled

Change-Id: I6966136454b09a1297f62d6fca07bcbc22e07573
Signed-off-by: nfrunza <nfrunza@gmail.com>
  • Loading branch information
nfrunza committed Feb 28, 2019
1 parent 5941ea1 commit fa36248
Show file tree
Hide file tree
Showing 13 changed files with 3,686 additions and 4,300 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,7 @@ fabric-docker-compose-svt/channel-artifacts
fabric-docker-compose-svt/crypto-config
first-network/channel-artifacts/*
examples/*
app/platform/fabric/gateway/wallet/*

*.swp
package-lock.json
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Hyperledger Explorer is a simple, powerful, easy-to-use, highly maintainable, op

## Release Notes

- [Release Notes v0.3.9.1](release_notes/v0.3.9.1.md)
- [Release Notes v0.3.9](release_notes/v0.3.9.md)
- [Release Notes v0.3.8](release_notes/v0.3.8.md)
- [Release Notes v0.3.7](release_notes/v0.3.7.md)
Expand Down Expand Up @@ -131,6 +132,7 @@ Connect to PostgreSQL database.

- Setup your own network using [Build your network](http://hyperledger-fabric.readthedocs.io/en/latest/build_network.html) tutorial from Fabric. Once you setup the network, please modify the values in `/blockchain-explorer/app/platform/fabric/config.json` accordingly.
- Hyperledger Explorer defaults to [fabric-samples/first-network sample](https://github.com/hyperledger/fabric-samples).
- Make sure to set the environment variables ```CORE_PEER_GOSSIP_BOOTSTRAP``` and ```CORE_PEER_GOSSIP_EXTERNAL_ENDPOINT``` for each peer in the docker-compose.yaml file. These settings enable the Fabric discovery service, which is used by Hyperledger Explorer to discover the network topology.

<a name="Fabric-Configure-Hyperledger-Explorer"/>

Expand Down
15 changes: 13 additions & 2 deletions app/platform/fabric/FabricClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,19 @@ class FabricClient {
// Loading configuration for fabric-ca if enabled.
// It might be overriden by environment variables
Fabric_Client.addConfigFile(path.join(__dirname, 'config_ca.json'));
const asLocalhost =
String(
Fabric_Client.getConfigSetting('discovery-as-localhost', 'true')
) === 'true';

this.client_config = client_config;

// if disabled TLS, notify discovering component to use grpc protocol
// before initialising channel
if (this.client_config.client.tlsEnable === false) {
Fabric_Client.setConfigSetting('discovery-protocol', 'grpc');
}

// Loading client from network configuration file
logger.debug(
'Loading client [%s] from configuration ...',
Expand All @@ -66,7 +76,8 @@ class FabricClient {
// enable discover
await this.defaultChannel.initialize({
discover: true,
target: this.defaultPeer
target: this.defaultPeer,
asLocalhost: asLocalhost
});

let organization = client_config.client.organization;
Expand Down Expand Up @@ -500,7 +511,7 @@ class FabricClient {
} else {
logger.error(
'Peer configuration is not found in config.json for peer %s, so peer status not work for the peer',
peer.endpoint,
peer.endpoint
);
return;
}
Expand Down
74 changes: 74 additions & 0 deletions app/platform/fabric/config-composer-tagv037.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"network-configs": {
"network-1": {
"version": "1.0",
"clients": {
"client-1": {
"tlsEnable": false,
"organization": "Org1MSP",
"channel": "composerchannel",
"credentialStore": {
"path": "./tmp/credentialStore_Org1/credential",
"cryptoStore": {
"path": "./tmp/credentialStore_Org1/crypto"
}
}
}
},
"channels": {
"composerchannel": {
"peers": {
"peer0.org1.example.com": {}
},
"connection": {
"timeout": {
"peer": {
"endorser": "6000",
"eventHub": "6000",
"eventReg": "6000"
}
}
}
}
},
"organizations": {
"Org1MSP": {
"mspid": "Org1MSP",
"fullpath": false,
"adminPrivateKey": {
"path": "/Composer_Path/fabric-scripts/hlfv12/composer/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore"
},
"signedCert": {
"path": "/Composer_Path/fabric-scripts/hlfv12/composer/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts"
}
},
"OrdererMSP": {
"mspid": "OrdererMSP",
"adminPrivateKey": {
"path": "/Composer_Path/fabric-scripts/hlfv12/composer/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore"
}
}
},
"peers": {
"peer0.org1.example.com": {
"tlsCACerts": {
"path": "/Composer_Path/fabric-scripts/hlfv12/composer/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt"
},
"url": "grpc://127.0.0.1:7051",
"eventUrl": "grpc://127.0.0.1:7053",
"grpcOptions": {
"ssl-target-name-override": "peer0.org1.example.com"
}
}
},
"orderers": {
"orderer.example.com": {
"url": "grpc://127.0.0.1:7050"
}
}
},
"network-2": {}
},
"configtxgenToolPath": "/home/cadmin/fabric-samples/bin",
"license": "Apache-2.0"
}
Loading

0 comments on commit fa36248

Please sign in to comment.