diff --git a/Dockerfile b/Dockerfile
index e6f52e008..71722d6ca 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -35,9 +35,6 @@ RUN apk add --no-cache --virtual npm-deps python make g++ && \
pip install --upgrade pip setuptools && \
rm -r /root/.cache
-# install yarn
-RUN npm install -g yarn
-
# install NPM dependencies
RUN cd $EXPLORER_APP_PATH && npm install && npm build
@@ -51,4 +48,4 @@ RUN apk del npm-deps
EXPOSE 8080
# run blockchain explorer main app
-CMD node $DEFAULT_WORKDIR/explorer/main.js
+CMD node $DEFAULT_WORKDIR/explorer/main.js && tail -f /dev/null
diff --git a/README.md b/README.md
index e68196206..5f415a884 100644
--- a/README.md
+++ b/README.md
@@ -272,6 +272,19 @@ From new terminal.
- `cd blockchain-explorer/`
- `./deploy_explorer.sh dockerConfig` (it will automatically deploy both database and frontend apps using Hyperledger Fabric network configuration stored under `examples/dockerConfig` folder)
+Note: the example with additional information can be found at [examples/net1](./examples/net1) folder.
+
+### Joining existing Docker network
+If the Blockchain network is deployed in the Docker, you may pass network name as second parameter to join that network
+(docker_network in the example below):
+- `./deploy_explorer.sh dockerConfig docker_network`
+
+### Steps to stop containers
+- `./deploy_explorer.sh --down`
+
+### Steps to remove containers and clean images
+- `./deploy_explorer.sh --clean`
+
## Hyperledger Explorer Swagger
diff --git a/app/persistence/fabric/postgreSQL/db/createdb.sh b/app/persistence/fabric/postgreSQL/db/createdb.sh
index b4ad8ffed..67acca1e2 100755
--- a/app/persistence/fabric/postgreSQL/db/createdb.sh
+++ b/app/persistence/fabric/postgreSQL/db/createdb.sh
@@ -1,3 +1,7 @@
+#!/bin/bash
+
+
+echo "Copying ENV variables into temp file..."
node processenv.js
if [ $( jq .DATABASE_USERNAME /tmp/process.env.json) == null ]; then
export USER=$( jq .postgreSQL.username ../../../../explorerconfig.json )
@@ -14,14 +18,18 @@ if [ $(jq .DATABASE_PASSWORD /tmp/process.env.json) == null ]; then
else
export PASSWD=$(jq .DATABASE_PASSWORD /tmp/process.env.json | sed "y/\"/'/")
fi
+echo "USER=${USER}"
+echo "DATABASE=${DATABASE}"
+echo "PASSWD=${PASSWD}"
if [ -f /tmp/process.env.json ] ; then
rm /tmp/process.env.json
fi
- case $OSTYPE in
- darwin*) psql postgres -v dbname=$DATABASE -v user=$USER -v passwd=$PASSWD -f ./explorerpg.sql ;
- psql postgres -v dbname=$DATABASE -v user=$USER -v passwd=$PASSWD -f ./updatepg.sql ;;
- linux*) sudo -u postgres psql -v dbname=$DATABASE -v user=$USER -v passwd=$PASSWD -f ./explorerpg.sql ;
- sudo -u postgres psql -v dbname=$DATABASE -v user=$USER -v passwd=$PASSWD -f ./updatepg.sql ;;
- esac
+echo "Executing SQL scripts..."
+case $OSTYPE in
+darwin*) psql postgres -v dbname=$DATABASE -v user=$USER -v passwd=$PASSWD -f ./explorerpg.sql ;
+psql postgres -v dbname=$DATABASE -v user=$USER -v passwd=$PASSWD -f ./updatepg.sql ;;
+linux*) sudo -u postgres psql -v dbname=$DATABASE -v user=$USER -v passwd=$PASSWD -f ./explorerpg.sql ;
+sudo -u postgres psql -v dbname=$DATABASE -v user=$USER -v passwd=$PASSWD -f ./updatepg.sql ;;
+esac
diff --git a/app/persistence/fabric/postgreSQL/db/updatepg.sql b/app/persistence/fabric/postgreSQL/db/updatepg.sql
index 588878ea9..6a37da423 100644
--- a/app/persistence/fabric/postgreSQL/db/updatepg.sql
+++ b/app/persistence/fabric/postgreSQL/db/updatepg.sql
@@ -2,4 +2,4 @@
-- SPDX-License-Identifier: Apache-2.0
--
-\c fabricexplorer;
+\c :dbname;
diff --git a/app/persistence/postgreSQL/pgservice.js b/app/persistence/postgreSQL/pgservice.js
index d47514ce3..dbaa74bbb 100644
--- a/app/persistence/postgreSQL/pgservice.js
+++ b/app/persistence/postgreSQL/pgservice.js
@@ -20,20 +20,25 @@ var helper = require('../../common/helper');
var logger = helper.getLogger('pgservice');
class pgservice {
-
constructor(pgconfig) {
this.pgconfig = pgconfig;
+ this.pgconfig.host = process.env.DATABASE_HOST || pgconfig.host;
+ this.pgconfig.port = process.env.DATABASE_PORT || pgconfig.port;
+ this.pgconfig.database = process.env.DATABASE_DATABASE || pgconfig.database;
+ this.pgconfig.username = process.env.DATABASE_USERNAME || pgconfig.username;
+ this.pgconfig.passwd = process.env.DATABASE_PASSWD || pgconfig.passwd;
+
this.connectionString =
'postgres://' +
- pgconfig.username +
+ this.pgconfig.username +
':' +
- pgconfig.passwd +
+ this.pgconfig.passwd +
'@' +
- pgconfig.host +
+ this.pgconfig.host +
':' +
- pgconfig.port +
+ this.pgconfig.port +
'/' +
- pgconfig.database;
+ this.pgconfig.database;
console.log(this.connectionString);
@@ -81,7 +86,7 @@ class pgservice {
saveRow(tablename, columnValues) {
let _self = this;
- return new Promise(function (resolve, reject) {
+ return new Promise(function(resolve, reject) {
var addSqlParams = [];
var updatesqlcolumn = [];
var updatesqlflag = [];
@@ -132,7 +137,7 @@ class pgservice {
*/
updateRowByPk(tablename, columnAndValue, pkName, pkValue) {
let _self = this;
- return new Promise(function (resolve, reject) {
+ return new Promise(function(resolve, reject) {
var addSqlParams = [];
var updateParms = [];
@@ -196,7 +201,7 @@ class pgservice {
*/
updateRow(tablename, columnAndValue, condition) {
let _self = this;
- return new Promise(function (resolve, reject) {
+ return new Promise(function(resolve, reject) {
var addSqlParams = [];
var updateParms = [];
@@ -244,15 +249,13 @@ class pgservice {
});
}
-
-
/**
* excute update or delete sql.
* @param string updateSql the excute sql
*/
updateBySql(updateSql) {
let _self = this;
- return new Promise(function (resolve, reject) {
+ return new Promise(function(resolve, reject) {
logger.debug(`update sql is : ${updateSql}`);
_self.client.query(updateSql, [], (err, res) => {
@@ -285,7 +288,7 @@ class pgservice {
*/
getRowByPk(tablename, column, pkColumn, value) {
let _self = this;
- return new Promise(function (resolve, reject) {
+ return new Promise(function(resolve, reject) {
if (column == '') column = '*';
var sql = ` select ${column} from ${tablename} where ${pkColumn} = ${value} `;
@@ -312,7 +315,7 @@ class pgservice {
*/
getRowByPkOne(sql) {
let _self = this;
- return new Promise(function (resolve, reject) {
+ return new Promise(function(resolve, reject) {
//var sql = ` select ${column} from ${tablename} where ${pkColumn} = ${value} `
_self.client.query(sql, (err, res) => {
@@ -341,7 +344,7 @@ class pgservice {
*/
getRowsByCondition(tablename, column, condtion, orderBy, limit) {
let _self = this;
- return new Promise(function (resolve, reject) {
+ return new Promise(function(resolve, reject) {
if (column == '') column = '*';
var updatewhereparm = ' (1=1) ';
@@ -381,7 +384,7 @@ class pgservice {
*/
getRowsBySQl(sqlcharacter, condition, limit) {
let _self = this;
- return new Promise(function (resolve, reject) {
+ return new Promise(function(resolve, reject) {
var updatewhereparm = ' (1=1) ';
var addSqlParams = [];
@@ -410,7 +413,7 @@ class pgservice {
}
getRowsBySQlQuery(sql) {
let _self = this;
- return new Promise(function (resolve, reject) {
+ return new Promise(function(resolve, reject) {
_self.client.query(sql, (err, res) => {
if (err) {
reject(err);
@@ -434,7 +437,7 @@ class pgservice {
*/
getRowsBySQlNoCondtion(sqlcharacter, limit) {
let _self = this;
- return new Promise(function (resolve, reject) {
+ return new Promise(function(resolve, reject) {
var sql;
if (limit && sqlcharacter) {
sql = `${sqlcharacter} ${limit}`;
@@ -458,14 +461,14 @@ class pgservice {
}
/**
- * 自动橱窗日志查找/评价历史记录查找
- * @param unknown_type sql
- * @param unknown_type DB
- * @return unknown
- */
+ * 自动橱窗日志查找/评价历史记录查找
+ * @param unknown_type sql
+ * @param unknown_type DB
+ * @return unknown
+ */
getRowsBySQlCase(sql) {
let _self = this;
- return new Promise(function (resolve, reject) {
+ return new Promise(function(resolve, reject) {
_self.client.query(sql, (err, res) => {
if (err) {
reject(err);
@@ -488,7 +491,7 @@ class pgservice {
*/
getSQL2Map(sql, key) {
let _self = this;
- return new Promise(function (resolve, reject) {
+ return new Promise(function(resolve, reject) {
_self.client.query(sql, (err, res) => {
if (err) {
reject(err);
@@ -517,7 +520,7 @@ class pgservice {
*/
getSQL2Map4Arr(sql, key) {
let _self = this;
- return new Promise(function (resolve, reject) {
+ return new Promise(function(resolve, reject) {
_self.client.query(sql, (err, rows) => {
if (err) {
reject(err);
diff --git a/deploy_explorer.sh b/deploy_explorer.sh
index c2910110b..65cfa622e 100755
--- a/deploy_explorer.sh
+++ b/deploy_explorer.sh
@@ -69,6 +69,7 @@ function config(){
# Default Hyperledger Explorer Database Credentials.
explorer_db_user="hppoc"
explorer_db_pwd="password"
+ explorer_db_name="fabricexplorer"
#configure explorer to connect to specific Blockchain network using given configuration
network_config_file=$(pwd)/examples/$fabricBlockchainNetworkName/config.json
#configure explorer to connect to specific Blockchain network using given crypto materials
@@ -137,8 +138,9 @@ function deploy_run_database(){
-d \
--name $fabric_explorer_db_name \
--net $docker_network_name --ip $db_ip \
- -e POSTGRES_PASSWORD=$explorer_db_pwd \
- -e PGPASSWORD=$explorer_db_pwd \
+ -e DATABASE_DATABASE=$explorer_db_name \
+ -e DATABASE_USERNAME=$explorer_db_user \
+ -e DATABASE_PASSWORD=$explorer_db_pwd \
$fabric_explorer_db_tag
}
@@ -156,11 +158,8 @@ function deploy_load_database(){
sleep 1s
echo "Waiting...1s"
sleep 1s
- echo "Creating Default user..."
- docker exec $fabric_explorer_db_name psql -h localhost -U postgres -c "CREATE USER $explorer_db_user WITH PASSWORD '$explorer_db_pwd'"
echo "Creating default database schemas..."
- docker exec $fabric_explorer_db_name psql -h localhost -U postgres -a -f /opt/explorerpg.sql
- docker exec $fabric_explorer_db_name psql -h localhost -U postgres -a -f /opt/updatepg.sql
+ docker exec $fabric_explorer_db_name /bin/bash /opt/createdb.sh
}
function deploy_build_explorer(){
@@ -195,6 +194,12 @@ function deploy_run_explorer(){
hyperledger-blockchain-explorer
}
+function connect_to_network(){
+ echo "Trying to join to existing network $1"
+ docker network connect $1 $(docker ps -qf name=^/$fabric_explorer_name$)
+ docker network connect $1 $(docker ps -qf name=^/$fabric_explorer_db_name$)
+}
+
function deploy(){
deploy_prepare_network
@@ -209,13 +214,29 @@ function deploy(){
deploy_build_explorer
fi
deploy_run_explorer
+
+ if [ -n "$2" ]; then
+ connect_to_network $2
+ fi
}
function main(){
banner
- #Pass arguments to function exactly as-is
- config "$@"
- deploy
+ #Pass arguments to function exactly as-is
+ config "$@"
+
+ MODE=$1;
+ if [ "$MODE" == "--down" ]; then
+ echo "Stopping Hyperledger Fabric explorer containers..."
+ elif [ "$MODE" == "--clean" ]; then
+ echo "Cleaning Hyperledger Fabric explorer images..."
+ stop_explorer
+ stop_database
+ docker rmi $(docker images -q ${fabric_explorer_db_tag})
+ docker rmi $(docker images -q ${fabric_explorer_tag})
+ else
+ deploy "$@"
+ fi
}
#Pass arguments to function exactly as-is
diff --git a/examples/net1/README.md b/examples/net1/README.md
index 5d43d460d..de05b20e2 100644
--- a/examples/net1/README.md
+++ b/examples/net1/README.md
@@ -4,14 +4,13 @@ This folder contains the configuration settings of **Hyperledger Explorer**.
At Hyperledger Fabric network level, the differences between standard deployment and dockerized deployment is that:
-* Crypto material is saved always under **/tmp/crypto**
+* Crypto material is saved always under **/tmp/crypto** (can be configured in [deploy_explorer.sh](../../deploy_explorer.sh) )
As consequence, it needs to be references always as (see the example below):
```json
-"admin": {
- "key": "/tmp/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore",
- "cert": "/tmp/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts"
+"tlsCACerts": {
+ "path": "/tmp/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt"
}
```
For a complete **Hyperledger Fabric** network configuration file see examples:
@@ -45,27 +44,27 @@ This means that **by default**, created containers will have next configuration:
Be aware that several configurations may coexist using same Hyperledger Explorer Docker images. Following shows an example of 2 different configurations (development and production) that might be applied to explorer deployment.
- ```bash
- examples
- ├── development
- │ ├── config.json
- │ ├── crypto
- │ │ ├── ordererOrganizations
- │ │ │ └── readme.txt
- │ │ ├── peerOrganizations
- │ │ │ └── readme.txt
- │ │ └── readme.txt
- │ └── README.md
- └── production
- ├── config.json
- ├── crypto
- │ ├── ordererOrganizations
- │ │ └── readme.txt
- │ ├── peerOrganizations
- │ │ └── readme.txt
- │ └── readme.txt
- └── README.md
- ```
+```bash
+ examples
+ ├── development
+ │ ├── config.json
+ │ ├── crypto
+ │ │ ├── ordererOrganizations
+ │ │ │ └── readme.txt
+ │ │ ├── peerOrganizations
+ │ │ │ └── readme.txt
+ │ │ └── readme.txt
+ │ └── README.md
+ └── production
+ ├── config.json
+ ├── crypto
+ │ ├── ordererOrganizations
+ │ │ └── readme.txt
+ │ ├── peerOrganizations
+ │ │ └── readme.txt
+ │ └── readme.txt
+ └── README.md
+```
## Example file
@@ -73,63 +72,252 @@ A complete configuration **example** file is shown below for 2 ORG Blockchain in
```json
{
- "network-config": {
- "org1": {
- "name": "peerOrg1",
- "mspid": "Org1MSP",
- "peer1": {
- "requests": "grpcs://127.0.0.1:7051",
- "events": "grpcs://127.0.0.1:7053",
- "server-hostname": "peer0.org1.example.com",
- "tls_cacerts": "/tmp/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt"
- },
- "peer2": {
- "requests": "grpcs://127.0.0.1:8051",
- "events": "grpcs://127.0.0.1:8053",
- "server-hostname": "peer1.org1.example.com",
- "tls_cacerts": "/tmp/crypto/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt"
- },
- "admin": {
- "key": "/tmp/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore",
- "cert": "/tmp/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts"
- }
- },
- "org2": {
- "name": "peerOrg2",
- "mspid": "Org2MSP",
- "peer1": {
- "requests": "grpcs://127.0.0.1:9051",
- "events": "grpcs://127.0.0.1:9053",
- "server-hostname": "peer0.org2.example.com",
- "tls_cacerts": "/tmp/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt"
- },
- "peer2": {
- "requests": "grpcs://127.0.0.1:10051",
- "events": "grpcs://127.0.0.1:10053",
- "server-hostname": "peer1.org2.example.com",
- "tls_cacerts": "/tmp/crypto/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/tls/ca.crt"
- },
- "admin": {
- "key": "/tmp/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/keystore",
- "cert": "/tmp/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/signcerts"
- }
- }
- },
- "channel": "main",
- "orderers": [{
- "mspid": "OrdererMSP",
- "server-hostname": "orderer.example.com",
- "requests": "grpcs://127.0.0.1:7050",
- "tls_cacerts": "/tmp/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/tls/ca.crt"
- }],
- "keyValueStore": "/tmp/fabric-client-kvs",
- "configtxgenToolPath": "fabric-path/fabric-samples/bin",
- "SYNC_START_DATE_FORMAT": "YYYY/MM/DD",
- "syncStartDate": "2018/01/01",
- "eventWaitTime": "30000",
- "license": "Apache-2.0",
- "version": "1.1"
+ "network-configs": {
+ "network-1": {
+ "version": "1.0",
+ "clients": {
+ "client-1": {
+ "tlsEnable": true,
+ "organization": "Org1MSP",
+ "channel": "mychannel",
+ "credentialStore": {
+ "path": "./tmp/credentialStore_Org1/credential",
+ "cryptoStore": {
+ "path": "./tmp/credentialStore_Org1/crypto"
+ }
+ }
+ }
+ },
+ "channels": {
+ "mychannel": {
+ "peers": {
+ "peer0.org1.example.com": {}
+ },
+ "connection": {
+ "timeout": {
+ "peer": {
+ "endorser": "6000",
+ "eventHub": "6000",
+ "eventReg": "6000"
+ }
+ }
+ }
+ }
+ },
+ "organizations": {
+ "Org1MSP": {
+ "mspid": "Org1MSP",
+ "fullpath": false,
+ "adminPrivateKey": {
+ "path":
+ "/tmp/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore"
+ },
+ "signedCert": {
+ "path":
+ "/tmp/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts"
+ }
+ },
+ "Org2MSP": {
+ "mspid": "Org2MSP",
+ "adminPrivateKey": {
+ "path":
+ "/tmp/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/keystore"
+ }
+ },
+ "OrdererMSP": {
+ "mspid": "OrdererMSP",
+ "adminPrivateKey": {
+ "path":
+ "/tmp/crypto/ordererOrganizations/example.com/users/Admin@example.com/msp/keystore"
+ }
+ }
+ },
+ "peers": {
+ "peer0.org1.example.com": {
+ "tlsCACerts": {
+ "path":
+ "/tmp/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt"
+ },
+ "url": "grpcs://localhost:7051",
+ "eventUrl": "grpcs://localhost:7053",
+ "grpcOptions": {
+ "ssl-target-name-override": "peer0.org1.example.com"
+ }
+ },
+ "peer1.org1.example.com": {
+ "tlsCACerts": {
+ "path":
+ "/tmp/crypto/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt"
+ },
+ "url": "grpcs://localhost:8051",
+ "eventUrl": "grpcs://localhost:8053",
+ "grpcOptions": {
+ "ssl-target-name-override": "peer1.org1.example.com"
+ }
+ },
+ "peer0.org2.example.com": {
+ "tlsCACerts": {
+ "path":
+ "/tmp/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt"
+ },
+ "url": "grpcs://localhost:9051",
+ "eventUrl": "grpcs://localhost:9053",
+ "grpcOptions": {
+ "ssl-target-name-override": "peer0.org2.example.com"
+ }
+ },
+ "peer1.org2.example.com": {
+ "tlsCACerts": {
+ "path":
+ "/tmp/crypto/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/tls/ca.crt"
+ },
+ "url": "grpcs://localhost:10051",
+ "eventUrl": "grpcs://localhost:10053",
+ "grpcOptions": {
+ "ssl-target-name-override": "peer1.org2.example.com"
+ }
+ }
+ },
+ "orderers": {
+ "orderer.example.com": {
+ "url": "grpcs://localhost:7050"
+ }
+ }
+ }
+ },
+ "configtxgenToolPath": "/fabric-path/workspace/fabric-samples/bin",
+ "license": "Apache-2.0"
+}
+```
+
+Note: Make sure you put the right node IPs, ports and certs paths before running **Hyperledger Explorer**
+
+### Example of running BE with [Fabric Network](https://github.com/hyperledger/fabric-samples/tree/master/first-network)
+
+1. Follow the instruction how to run the Blockchain network.
+2. Copy crypto materials from the `fabric-network/crypto-config` to `./examples//crypto`.
+3. Update your `config.json` to something similar to
+```json
+{
+ "network-configs": {
+ "network-1": {
+ "version": "1.0",
+ "clients": {
+ "client-1": {
+ "tlsEnable": true,
+ "organization": "Org1MSP",
+ "channel": "mychannel",
+ "credentialStore": {
+ "path": "./tmp/credentialStore_Org1/credential",
+ "cryptoStore": {
+ "path": "./tmp/credentialStore_Org1/crypto"
+ }
+ }
+ }
+ },
+ "channels": {
+ "mychannel": {
+ "peers": {
+ "peer0.org1.example.com": {}
+ },
+ "connection": {
+ "timeout": {
+ "peer": {
+ "endorser": "6000",
+ "eventHub": "6000",
+ "eventReg": "6000"
+ }
+ }
+ }
+ }
+ },
+ "organizations": {
+ "Org1MSP": {
+ "mspid": "Org1MSP",
+ "fullpath": false,
+ "adminPrivateKey": {
+ "path":
+ "/tmp/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore"
+ },
+ "signedCert": {
+ "path":
+ "/tmp/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts"
+ }
+ },
+ "Org2MSP": {
+ "mspid": "Org2MSP",
+ "adminPrivateKey": {
+ "path":
+ "/tmp/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/keystore"
+ }
+ },
+ "OrdererMSP": {
+ "mspid": "OrdererMSP",
+ "adminPrivateKey": {
+ "path":
+ "/tmp/crypto/ordererOrganizations/example.com/users/Admin@example.com/msp/keystore"
+ }
+ }
+ },
+ "peers": {
+ "peer0.org1.example.com": {
+ "tlsCACerts": {
+ "path":
+ "/tmp/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt"
+ },
+ "url": "grpcs://peer0.org1.example.com:7051",
+ "eventUrl": "grpcs://peer0.org1.example.com:7053",
+ "grpcOptions": {
+ "ssl-target-name-override": "peer0.org1.example.com"
+ }
+ },
+ "peer1.org1.example.com": {
+ "tlsCACerts": {
+ "path":
+ "/tmp/crypto/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt"
+ },
+ "url": "grpcs://peer1.org1.example.com:8051",
+ "eventUrl": "grpcs://peer1.org1.example.com:8053",
+ "grpcOptions": {
+ "ssl-target-name-override": "peer1.org1.example.com"
+ }
+ },
+ "peer0.org2.example.com": {
+ "tlsCACerts": {
+ "path":
+ "/tmp/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt"
+ },
+ "url": "grpcs://peer0.org2.example.com:9051",
+ "eventUrl": "grpcs://peer0.org2.example.com:9053",
+ "grpcOptions": {
+ "ssl-target-name-override": "peer0.org2.example.com"
+ }
+ },
+ "peer1.org2.example.com": {
+ "tlsCACerts": {
+ "path":
+ "/tmp/crypto/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/tls/ca.crt"
+ },
+ "url": "grpcs://peer1.org2.example.com:10051",
+ "eventUrl": "grpcs://peer1.org2.example.com:10053",
+ "grpcOptions": {
+ "ssl-target-name-override": "peer1.org2.example.com"
+ }
+ }
+ },
+ "orderers": {
+ "orderer.example.com": {
+ "url": "grpcs://orderer.example.com:7050"
+ }
+ }
+ }
+ },
+ "configtxgenToolPath": "/home/fabric-path/workspace/fabric-samples/bin",
+ "license": "Apache-2.0"
}
```
-Note: Make sure you put the right node IPs, ports and certs paths before running **Hyperledger Explorer**
\ No newline at end of file
+4. in case if port 8080 is occupied in your system, the `deploy_explorer.sh` should be updated. Please update the line 193
+`-p 8080:8080 \` to `-p :8080 \`, where is a free port, where BE can be browsed.
+5. issue `./deploy_explorer.sh net_byfn` and wait.
+6. open the browser `http://localhost:` and explore the blockchain network.
\ No newline at end of file
diff --git a/examples/net1/config.json b/examples/net1/config.json
index 9e9f609cb..e33f89cbc 100644
--- a/examples/net1/config.json
+++ b/examples/net1/config.json
@@ -1,58 +1,117 @@
{
- "network-config": {
- "org1": {
- "name": "peerOrg1",
- "mspid": "Org1MSP",
- "peer1": {
- "requests": "grpcs://127.0.0.1:7051",
- "events": "grpcs://127.0.0.1:7053",
- "server-hostname": "peer0.org1.example.com",
- "tls_cacerts": "/tmp/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt"
- },
- "peer2": {
- "requests": "grpcs://127.0.0.1:8051",
- "events": "grpcs://127.0.0.1:8053",
- "server-hostname": "peer1.org1.example.com",
- "tls_cacerts": "/tmp/crypto/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt"
- },
- "admin": {
- "key": "/tmp/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore",
- "cert": "/tmp/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts"
- }
- },
- "org2": {
- "name": "peerOrg2",
- "mspid": "Org2MSP",
- "peer1": {
- "requests": "grpcs://127.0.0.1:9051",
- "events": "grpcs://127.0.0.1:9053",
- "server-hostname": "peer0.org2.example.com",
- "tls_cacerts": "/tmp/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt"
- },
- "peer2": {
- "requests": "grpcs://127.0.0.1:10051",
- "events": "grpcs://127.0.0.1:10053",
- "server-hostname": "peer1.org2.example.com",
- "tls_cacerts": "/tmp/crypto/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/tls/ca.crt"
- },
- "admin": {
- "key": "/tmp/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/keystore",
- "cert": "/tmp/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/signcerts"
- }
- }
- },
- "channel": "main",
- "orderers": [{
- "mspid": "OrdererMSP",
- "server-hostname": "orderer.example.com",
- "requests": "grpcs://127.0.0.1:7050",
- "tls_cacerts": "/tmp/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/tls/ca.crt"
- }],
- "keyValueStore": "/tmp/fabric-client-kvs",
- "configtxgenToolPath": "fabric-path/fabric-samples/bin",
- "SYNC_START_DATE_FORMAT": "YYYY/MM/DD",
- "syncStartDate": "2018/01/01",
- "eventWaitTime": "30000",
- "license": "Apache-2.0",
- "version": "1.1"
-}
\ No newline at end of file
+ "network-configs": {
+ "network-1": {
+ "version": "1.0",
+ "clients": {
+ "client-1": {
+ "tlsEnable": true,
+ "organization": "Org1MSP",
+ "channel": "mychannel",
+ "credentialStore": {
+ "path": "./tmp/credentialStore_Org1/credential",
+ "cryptoStore": {
+ "path": "./tmp/credentialStore_Org1/crypto"
+ }
+ }
+ }
+ },
+ "channels": {
+ "mychannel": {
+ "peers": {
+ "peer0.org1.example.com": {}
+ },
+ "connection": {
+ "timeout": {
+ "peer": {
+ "endorser": "6000",
+ "eventHub": "6000",
+ "eventReg": "6000"
+ }
+ }
+ }
+ }
+ },
+ "organizations": {
+ "Org1MSP": {
+ "mspid": "Org1MSP",
+ "fullpath": false,
+ "adminPrivateKey": {
+ "path":
+ "/tmp/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore"
+ },
+ "signedCert": {
+ "path":
+ "/tmp/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts"
+ }
+ },
+ "Org2MSP": {
+ "mspid": "Org2MSP",
+ "adminPrivateKey": {
+ "path":
+ "/tmp/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/keystore"
+ }
+ },
+ "OrdererMSP": {
+ "mspid": "OrdererMSP",
+ "adminPrivateKey": {
+ "path":
+ "/tmp/crypto/ordererOrganizations/example.com/users/Admin@example.com/msp/keystore"
+ }
+ }
+ },
+ "peers": {
+ "peer0.org1.example.com": {
+ "tlsCACerts": {
+ "path":
+ "/tmp/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt"
+ },
+ "url": "grpcs://localhost:7051",
+ "eventUrl": "grpcs://localhost:7053",
+ "grpcOptions": {
+ "ssl-target-name-override": "peer0.org1.example.com"
+ }
+ },
+ "peer1.org1.example.com": {
+ "tlsCACerts": {
+ "path":
+ "/tmp/crypto/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt"
+ },
+ "url": "grpcs://localhost:8051",
+ "eventUrl": "grpcs://localhost:8053",
+ "grpcOptions": {
+ "ssl-target-name-override": "peer1.org1.example.com"
+ }
+ },
+ "peer0.org2.example.com": {
+ "tlsCACerts": {
+ "path":
+ "/tmp/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt"
+ },
+ "url": "grpcs://localhost:9051",
+ "eventUrl": "grpcs://localhost:9053",
+ "grpcOptions": {
+ "ssl-target-name-override": "peer0.org2.example.com"
+ }
+ },
+ "peer1.org2.example.com": {
+ "tlsCACerts": {
+ "path":
+ "/tmp/crypto/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/tls/ca.crt"
+ },
+ "url": "grpcs://localhost:10051",
+ "eventUrl": "grpcs://localhost:10053",
+ "grpcOptions": {
+ "ssl-target-name-override": "peer1.org2.example.com"
+ }
+ }
+ },
+ "orderers": {
+ "orderer.example.com": {
+ "url": "grpcs://localhost:7050"
+ }
+ }
+ }
+ },
+ "configtxgenToolPath": "/fabric-path/workspace/fabric-samples/bin",
+ "license": "Apache-2.0"
+}
diff --git a/postgres-Dockerfile b/postgres-Dockerfile
index c82631a86..465e564d0 100644
--- a/postgres-Dockerfile
+++ b/postgres-Dockerfile
@@ -5,17 +5,25 @@
FROM postgres:10.4-alpine
+# default database name for HLF Explorer db connection
+ENV DATABASE_DATABASE fabricexplorer
+
# default username for HLF Explorer db connection
-ENV USERNAME hppoc
+ENV DATABASE_USERNAME hppoc
# default password for HLF Explorer db connection
-ENV PGPASSWORD password
+ENV DATABASE_PASSWORD password
-# default password for postgres default user
-ENV POSTGRES_PASSWORD password
+RUN apk update \
+ && apk add jq \
+ && apk add nodejs \
+ && apk add sudo \
+ && rm -rf /var/cache/apk/*
WORKDIR /opt
# Copy files
-COPY app/persistence/postgreSQL/db/explorerpg.sql /opt/explorerpg.sql
-COPY app/persistence/postgreSQL/db/updatepg.sql /opt/updatepg.sql
\ No newline at end of file
+COPY app/persistence/fabric/postgreSQL/db/explorerpg.sql /opt/explorerpg.sql
+COPY app/persistence/fabric/postgreSQL/db/updatepg.sql /opt/updatepg.sql
+COPY app/persistence/fabric/postgreSQL/db/createdb.sh /opt/createdb.sh
+COPY app/persistence/fabric/postgreSQL/db/processenv.js /opt/processenv.js
\ No newline at end of file