CentOS 7使用Docker Compose搭建Hyperledger Explorer

官方文档地址

https://github.com/hyperledger/blockchain-explorer#Run-Hyperledger-Explorer-using-Docker

搭建过程

下载代码

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

修改配置

Hyperledger Explorer部分默认配置是相对于first-network预设的,如果你正好按照官方教程搭建过first-network环境,下面很多配置都不用改了。

  • Hyperledger Explorer defaults to utilize fabric-samples/first-network.

1. blockchain-explorer/docker-compose.yaml

开头这个不用改,byfn.sh创建出来的first-network对应的网络名就是net_byfn

networks:
  mynetwork.com:
    external:
      name: net_byfn

下面需要修改

  explorer.mynetwork.com:
    image: hyperledger/explorer:latest
    ......
    volumes:
      ......
      - ./examples/net1/crypto:/tmp/crypto

修改./examples/net1/crypto为实际目录, 例如

volumes:
      - /home/xxx/go/fabric-samples/first-network/crypto-config:/tmp/crypto

注意xxx是你的用户名啊

2. blockchain-explorer\examples\net1\connection-profile\first-network.json

先查看下私钥文件的文件名

[xxx@localhost ~]$ cd /home/xxx/go/fabric-samples/first-network/crypto-config/peerOrganizations/org1.example.com/users/[email protected]/msp/keystore/
[xxx@localhost keystore]$ ls
eb95f81e489f1a25728740f1f3d8f22b28536d3e07f0df70b8a3d511f70b7f1a_sk

修改first-network.json,替换cd96d5260ad4757551ed4a5a991e62130f8008a0bf996e4e4b84cd097a747fec_sk为上面查到的值

    "organizations": {
        "Org1MSP": {
            "mspid": "Org1MSP",
            "fullpath": true,
            "adminPrivateKey": {
                "path": "/tmp/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp/keystore/eb95f81e489f1a25728740f1f3d8f22b28536d3e07f0df70b8a3d511f70b7f1a_sk"
            },
            ......
        }
    }

启动 停止 销毁

  • 启动
cd /blockchain-explorer
docker-compose up -d
  • 停止
cd /blockchain-explorer
docker-compose down
  • 销毁
cd /blockchain-explorer
docker-compose down -v

访问

http://ip:8090
用户名/密码是 admin/adminpw

image.png

你可能感兴趣的:(CentOS 7使用Docker Compose搭建Hyperledger Explorer)