hyperledger fabric 測驗(十)fabric瀏覽器部署
fabric瀏覽器部署
Hyperledger Explorer是一個簡單,強大,易于使用,維護良好的開源程式,可瀏覽底層fabric區塊鏈網路上的活動,用戶可以在MacOS和Ubuntu上配置和構建Hyperledger Explorer,最新!Hyperledger Explorer現在可以與Hyperledger Iroha一起使用,
環境準備
發行版本
Hyperledger Explorer版本 v1.1.1 (Jul 17, 2020)
支持的Fabric版本 v1.4.0 to v2.1.1
支持的NodeJS版本 12.16.x
卸載軟體
卸載postgreSQL
sudo apt-get --purge remove postgresql\
rm -r /etc/postgresql/ #執行可選
rm -r /var/lib/postgresql/ #執行可選
userdel -r postgres #執行可選
安裝postgresql
sudo apt-get install postgresql
進入資料庫
sudo -u postgres psql
資料庫設定密碼
ALTER USER postgres WITH PASSWORD 'hello123'
\q
拉取最新瀏覽器檔案
git clone https://github.com/hyperledger/blockchain-explorer.git
cd blockchain-explorer
vim app/explorerconfig.json
修改app / explorerconfig.json以更新PostgreSQL資料庫設定,
"postgreSQL": {
"host": "127.0.0.1",
"port": "5432",
"database": "fabricexplorer",
"username": "hppoc",
"passwd": "password"
}
(可選)配置資料庫設定的另一種方法是使用環境變數,例如設定:
export DATABASE_HOST=127.0.0.1
export DATABASE_PORT=5432
export DATABASE_DATABASE=fabricexplorer
export DATABASE_USERNAME=hppoc
export DATABASE_PASSWD=pass12345
使其db的sql代碼可執行:
chmod -R 775 app/persistence/fabric/postgreSQL/db
修改app / platform / fabric / config.json以定義您的網路連接組態檔:
{
"network-configs": {
"first-network": {
"name": "firstnetwork",
"profile": "./connection-profile/first-network.json",
"enableAuthentication": false
}
},
"license": "Apache-2.0"
}
first-network是您的連接組態檔的名稱,可以更改為任何名稱,
name是您要給網路指定的名稱,您只能更改name的值,
profile是您的連接組態檔的位置,您只能更改profile的值,
在JSON檔案app / platform / fabric / connection-profile / first-network.json中修改連接組態檔:
在first-network.json檔案中將path更改為fabric磁盤路徑:提供adminPrivateKey config選項的完整磁盤路徑,通常以_sk結尾,例如:
/fabric-path/fabric-samples/first-network/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com / msp / keystore / aaacd899a6362a5c8cc1e6f86d13bfccc777375365bbda9c710bb7119993d71c_sk
? adminUser和adminPassword是Explorer用戶登錄儀表板的憑據
enableAuthentication是用于使用登錄頁面啟用身份驗證的標志,設定為false將跳過身份驗證,
運行創建資料庫腳本:
$ cd app/persistence/fabric/postgreSQL/db
$ sudo -u postgres ./createdb.sh
連接到PostgreSQL資料庫并運行資料庫狀態命令:
$ sudo -u postgres psql -c '\l'
$ sudo -u postgres psql fabricexplorer -c '\d'
建立Hyperledger Explorer重要提示,每次git pull后重復以下步驟,安裝,運行測驗和構建專案:
cd ../../../../../
./main.sh install
(可選)清理/ node_modules,client / node_modules,client / build,client / coverage,app / test / node_modules目錄:
./main.sh clean
或者:
$ cd blockchain-explorer
$ npm install
$ cd client/
$ npm install
$ npm run build
運行Hyperledger Explorer
如果區塊鏈網路與瀏覽器服務器在一起,修改app/explorerconfig.json以更新同步設定,
"sync": {
"type": "local"
}
它將具有后端和GUI服務:
nohup ./start.sh &
它將停止節點服務器:
./stop.sh
注意:如果將Hyperledger Fabric網路部署在其他計算機上,請定義以下環境變數:
$ DISCOVERY_AS_LOCALHOST=false ./start.sh
在不同位置獨立運行
修改app/explorerconfig.json以更新同步設定,
"sync": {
"type": "host"
}
如果以前在瀏覽器中使用過Hyperledger Explorer,請確保在重新啟動之前清除快取,
它將開始同步節點:
./syncstart.sh
它將停止同步節點:
./syncstop.sh
注意:如果將Hyperledger Fabric網路部署在其他計算機上,請定義以下環境變數:
$ DISCOVERY_AS_LOCALHOST=false ./syncstart.sh
問題:
SequelizeConnectionError: password authentication failed for user “postgres”
解決:修改pg_hba.conf組態檔,將第4個欄位改為trust
# Database administrative login by Unix domain socket
local all postgres peer
為了避免麻煩,我將所有行的第4個欄位都改成了 trust
最后執行sudo /etc/init.d/postgresql reload,重新加載組態檔,
如果有問題,關注公眾號發私信來解決,
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/197287.html
標籤:python
