Hyperledger fabric test (ten) fabric browser deployment

Hyperledger fabric test (ten) fabric browser deployment

Fabric browser deployment

Hyperledger Explorer is a simple, powerful, easy-to-use, and well-maintained open source program that can browse activities on the underlying fabric blockchain network. Users can configure and build Hyperledger Explorer on MacOS and Ubuntu. up to date! Hyperledger Explorer can now be used with Hyperledger Iroha.

Environmental preparation

Release version

Hyperledger Explorer version v1.1.1 (Jul 17, 2020)

Supported Fabric version v1.4.0 to v2.1.1

Supported NodeJS version 12.16.x

Uninstall software

Uninstall postgreSQL

sudo apt-get --purge remove postgresql\
rm -r /etc/postgresql/ #执行可选
rm -r /var/lib/postgresql/ #执行可选
userdel -r postgres #执行可选

Install postgresql

sudo apt-get install postgresql

Enter the database

sudo -u postgres psql

Database setting password

ALTER USER postgres WITH PASSWORD 'hello123'
\q

Pull the latest browser files

git clone https://github.com/hyperledger/blockchain-explorer.git
cd blockchain-explorer
vim app/explorerconfig.json

Modify app/explorerconfig.json to update PostgreSQL database settings.

"postgreSQL": {
    
    
    "host": "127.0.0.1",
    "port": "5432",
    "database": "fabricexplorer",
    "username": "hppoc",
    "passwd": "password"
}

(Optional) Another way to configure database settings is to use environment variables, such as setting:

export DATABASE_HOST=127.0.0.1
export DATABASE_PORT=5432
export DATABASE_DATABASE=fabricexplorer
export DATABASE_USERNAME=hppoc
export DATABASE_PASSWD=pass12345

Make the sql code of db executable:

chmod -R 775 app/persistence/fabric/postgreSQL/db

Modify app/platform/fabric/config.json to define your network connection configuration file:

{
    
    
    "network-configs": {
    
    
        "first-network": {
    
    
            "name": "firstnetwork",
            "profile": "./connection-profile/first-network.json",
            "enableAuthentication": false
        }
    },
    "license": "Apache-2.0"
}

first-network is the name of your connection profile and can be changed to any name.

name is the name you want to assign to the network, you can only change the value of name.

profile is the location of your connection profile, you can only change the value of profile.

Modify the connection profile in the JSON file app / platform / fabric / connection-profile / first-network.json:

Change the path to the fabric disk path in the first-network.json file: Provide the full disk path of the adminPrivateKey config option, usually ending with _sk, for example:
/fabric-path/fabric-samples/first-network/crypto-config/ peerOrganizations/org1.example.com/users/[email protected]/msp/keystore/aaacd899a6362a5c8cc1e6f86d13bfccc777375365bbda9c710bb7119993d71c_sk

​ adminUser and adminPassword are the credentials for the Explorer user to log in to the dashboard

enableAuthentication is a flag used to enable authentication using the login page. Setting it to false will skip authentication.

Run the create database script:

$ cd app/persistence/fabric/postgreSQL/db
$ sudo -u postgres ./createdb.sh

Connect to the PostgreSQL database and run the database status command:

$ sudo -u postgres psql -c '\l'
$ sudo -u postgres psql fabricexplorer -c '\d'

Important tips for establishing Hyperledger Explorer, repeat the following steps after each git pull to install, run tests and build projects:

cd ../../../../../
./main.sh install

(Optional) Clean up the /node_modules, client/node_modules, client/build, client/coverage, app/test/node_modules directories:

./main.sh clean

or:

$ cd blockchain-explorer
$ npm install
$ cd client/
$ npm install
$ npm run build

Run Hyperledger Explorer

If the blockchain network and the browser server are together, modify app/explorerconfig.json to update the synchronization settings.

"sync": {
    
    
  "type": "local"
}   

It will have backend and GUI services:

nohup ./start.sh &

It will stop the node server:

./stop.sh

Note: If you deploy the Hyperledger Fabric network on other computers, please define the following environment variables:

$ DISCOVERY_AS_LOCALHOST=false ./start.sh

Operate independently in different locations

Modify app/explorerconfig.json to update the synchronization settings.

"sync": {
    
    
  "type": "host"
}   

If you have used Hyperledger Explorer in your browser before, make sure to clear the cache before restarting.

It will start synchronizing nodes:

./syncstart.sh

It will stop syncing nodes:

./syncstop.sh

Note: If you deploy the Hyperledger Fabric network on other computers, please define the following environment variables:

$ DISCOVERY_AS_LOCALHOST=false ./syncstart.sh

problem:

SequelizeConnectionError: password authentication failed for user “postgres”

Solution: Modify the pg_hba.confconfiguration file and change the fourth field to trust

# Database administrative login by Unix domain socket
local   all             postgres                                peer

In order to avoid trouble, I changed the 4th field of all lines to trust to
execute last sudo /etc/init.d/postgresql reloadand reload the configuration file.

If there is a problem, follow the official account and send a private message to solve it.

Guess you like

Origin blog.csdn.net/Rcvisual/article/details/109379521