搭建fabric数据监控blockchain-explorer

Hyperledger Explorer


0、前提条件

  • nodejs 6.9.x (Note that v7.x is not yet supported)
  • PostgreSQL 9.5 or greater
  • docker 17.06.2-ce [https://www.docker.com/community-edition]
  • docker-compose 1.14.0 [https://docs.docker.com/compose/]

1、下载代码

  • git clone https://github.com/hyperledger/blockchain-explorer.git
  • cd blockchain-explorer

2、初始化数据

    sudo -u postgres psql
    \i app/db/explorerpg.sql
    \i app/db/updatepg.sql
重点:
vim  /var/lib/pgsql/10/data/pg_hba.conf
将所有登录要求全部改成信任(strust),否则启动项目时,会报错:用户登录失败
# "local" is for Unix domain socket connections only
local   all             all                                     trust
# IPv4 local connections:
host    all             all             127.0.0.1/32            trust
# IPv6 local connections:
host    all             all             ::1/128                 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local   replication     all                                     peer
#host    replication     all             127.0.0.1/32            ident
#host    replication     all             ::1/128                 ident
host    all             all             0.0.0.0/0               trust  

3、开始启动hyperledger-explorer

打开一个控制台:
cd blockchain-explorer
(修改config.json中对应的ip、配置文件路径、通道名称、数据库连接名称密码ip等)
再打开一个控制台:
cd blockchain-explorer/app/test
npm install
npm run test
cd blockchain-explorer
npm install
cd client/
npm install
npm test -- -u --coverage
npm run build
再打开一个控制台:
cd blockchain-explorer/
./start.sh (it will have the backend up).
tail -f log.log (view log)

你可能感兴趣的:(fabric)