- 版本v1.0.0-rc1 https://github.com/hyperledger/blockchain-explorer/archive/v1.0.0-rc1.tar.gz
- nodejs8.11.x
- jq sudo apt install jq
- docker 18.09.2+
- docker compose 1.14.0
- PostgreSQL 9.5+ sudo apt-get install postgresql
- cd /etc/postgresql/9.5/main
- sudo vim pg_hba.conf
host all all 0.0.0.0/0 trust
local all all trust
- sudo vim postgresql.conf
listen_addresses = '*'
- systemctl restart postgresql-9.5.service
- systemctl status postgresql-9.5.service
- cd blockchain-explorer/app/persistence/fabric/postgreSQL
- chmod -R 775 db/
- cd blockchain-explorer/app/persistence/fabric/postgreSQL/db
- sudo -u postgres ./createdb.sh
- 配置first-network启动的docker配置文件fabric-samples/first-network/base/docker-compose-base.yaml 。添加红色部分,让explorer能够发现网络拓扑
orderer.example.com:
container_name: orderer.example.com
image: hyperledger/fabric-orderer:$IMAGE_TAG
environment:
- ORDERER_OPERATIONS_LISTENADDRESS=0.0.0.0:8443 # operation RESTful API
- ORDERER_METRICS_PROVIDER=prometheus # prometheus will pull metrics from orderer via /metrics RESTful API
ports:
- 7050:7050
- 8443:8443 # Operation REST
peer0.org1.example.com:
container_name: peer0.org1.example.com
extends:
file: peer-base.yaml
service: peer-base
environment:
- CORE_OPERATIONS_LISTENADDRESS=0.0.0.0:9443 # operation RESTful API
- CORE_METRICS_PROVIDER=prometheus # prometheus will pull metrics from orderer via /metrics RESTful API
ports:
- 7051:7051
- 7053:7053
- 9443:9443
peer1.org1.example.com:
container_name: peer1.org1.example.com
extends:
file: peer-base.yaml
service: peer-base
environment:
- CORE_OPERATIONS_LISTENADDRESS=0.0.0.0:9444 # operation RESTful API
- CORE_METRICS_PROVIDER=prometheus # prometheus will pull metrics from orderer via /metrics RESTful API
ports:
- 8051:7051
- 8053:7053
- 9444:9444
peer0.org2.example.com:
container_name: peer0.org2.example.com
extends:
file: peer-base.yaml
service: peer-base
environment:
- CORE_OPERATIONS_LISTENADDRESS=0.0.0.0:9445 # operation RESTful API
- CORE_METRICS_PROVIDER=prometheus # prometheus will pull metrics from orderer via /metrics RESTful API
ports:
- 9051:7051
- 9053:7053
- 9445:9445
peer1.org2.example.com:
container_name: peer1.org2.example.com
extends:
file: peer-base.yaml
service: peer-base
environment:
- CORE_OPERATIONS_LISTENADDRESS=0.0.0.0:9446 # operation RESTful API
- CORE_METRICS_PROVIDER=prometheus # prometheus will pull metrics from orderer via /metrics RESTful API
ports:
- 10051:7051
- 10053:7053
- 9446:9446
- 修改 /blockchain-explorer/app/platform/fabric/connection-profile/first-network.json 中的密钥/fabric-path/fabric-samples/first-network/crypto-config/peerOrganizations/org1.example.com/users/[email protected]/msp/keystore/ 有节点发现机制不用全配
- 里面的账号密码是CA的账号密码,在配置完登录界面时用
- blockchain-explorer/app/platform/fabric/config.json可以修改网络的名字和配置文件路径
- cd blockchain-explorer
- cnpm install
- cd blockchain-explorer/app/test
- cnpm install
- npm run test (有错误不要紧,是由于一个脚本的pgsql的账号密码没写对,不用管)
- cd blockchain-explorer/client
- cnpm install
- npm run test:ci -- -u --coverage
- npm run build
- cd blockchain-explorer/
- ./start.sh
- http://localhost:8080
- ./stop.sh