티스토리 뷰

반응형
Github : https://github.com/hyperledger/blockchain-explorer

 

소스 코드 복제

# 소스 코드 복제
cd /opt/gopath/src/github.com/hyperledger/
git clone https://github.com/hyperledger/blockchain-explorer
cd blockchain-explorer

 

실행 환경 설정

docker-compose.yaml 파일 수정

# docker-compose.yaml 파일 수정
vi docker-compose.yaml

explorer.mynetwork.com 서비스의 볼륨 설정을 변경해줘야합니다.

byfn 네트워크 실행 시 만들어진 crypto-config 디렉토리를 ./examples/net1/crypto 디렉토리로 복사하거나, 해당 디렉토리로 볼륨을 설정해주어야 합니다.
여기서는 볼륨 경로를 수정하겠습니다.

  explorer.mynetwork.com:
...
   volumes:
...
      - /opt/gopath/src/github.com/hyperledger/fabric-samples/first-network/crypto-config:/tmp/crypto
...

※ byfn의 네트워크 이름은 net_byfn으로 설정되어있기 때문에 networks > mynetwork.com > external > name은 'net_byfn'으로 설정합니다.


만약, byfn 네트워크가 아닌 커스텀 네트워크로 띄웠다면 name을 수정해주어야 합니다.
네트워크는 다음 명령으로 확인 가능합니다.

# Docker 네트워크 확인
docker network ls

 

examples/net1/config.json 파일 수정

이 부분은 별다른 변경 사항이 없기 때문에 생략합니다.
만약, 네트워크의 이름(default: first-network)이나 profile 설정 파일을 변경하고 싶은 경우에는 수정이 필요합니다.

# examples/net1/config.json 파일 수정
vi examples/net1/config.json

 

examples/net1/connection-profile/first-network.json 파일 수정

# examples/net1/connection-profile/first-network.json 파일 수정
vi examples/net1/connection-profile/first-network.json

이곳에서는 채널 이름과 peers, organizations에 대한 항목 추가/수정이 필요합니다.
자신이 생성한 채널 이름에 맞게 설정해주어야 오류가 나지 않습니다.

또한, Org의 adminPrivateKey > path도 자신의 crypto-config 디렉토리 내에 있는 실제 _sk 값으로 변경해주어야 합니다.

{
        "name": "first-network",
        "version": "1.0.0",
        "client": {
                "tlsEnable": true,
                "adminUser": "admin",
                "adminPassword": "adminpw",
                "enableAuthentication": false,
                "organization": "Org1MSP",
                "connection": {
                        "timeout": {
                                "peer": {
                                        "endorser": "300"
                                },
                                "orderer": "300"
                        }
                }
        },
        "channels": {
                "hcchannel": {
                        "peers": {
                                "peer0.org1.example.com": {},
                                "peer1.org1.example.com": {},
                                "peer0.org2.example.com": {},
                                "peer1.org2.example.com": {}
                        },
                        "connection": {
                                "timeout": {
                                        "peer": {
                                                "endorser": "6000",
                                                "eventHub": "6000",
                                                "eventReg": "6000"
                                        }
                                }
                        }
                }
        },
        "organizations": {
                "Org1MSP": {
                        "mspid": "Org1MSP",
                        "fullpath": true,
                        "adminPrivateKey": {
                                "path": "/tmp/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore/14fa558d2f54bcefac57a6035212b03da846f3f5b0ac510e6eec2ba2977682da_sk"
                        },
                        "signedCert": {
                                "path": "/tmp/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts/Admin@org1.example.com-cert.pem"
                        }
                },
                "Org2MSP": {
                        "mspid": "Org2MSP",
                        "fullpath": true,
                        "adminPrivateKey": {
                                "path": "/tmp/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/keystore/ecf5efeee019bdc677700d4ec857c76a6585e5aa72118d4b8aea0f2ce81a9f8a_sk"
                        },
                        "signedCert": {
                                "path": "/tmp/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/signcerts/Admin@org2.example.com-cert.pem"
                        }
                }
        },
        "peers": {
                "peer0.org1.example.com": {
                        "tlsCACerts": {
                                "path": "/tmp/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt"
                        },
                        "url": "grpcs://peer0.org1.example.com:7051",
                        "eventUrl": "grpcs://peer0.org1.example.com:7053",
                        "grpcOptions": {
                                "ssl-target-name-override": "peer0.org1.example.com"
                        }
                },
                "peer1.org1.example.com": {
                        "tlsCACerts": {
                                "path": "/tmp/crypto/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt"
                        },
                        "url": "grpcs://peer1.org1.example.com:8051",
                        "eventUrl": "grpcs://peer1.org1.example.com:8053",
                        "grpcOptions": {
                                "ssl-target-name-override": "peer1.org1.example.com"
                        }
                },
                "peer0.org2.example.com": {
                        "tlsCACerts": {
                                "path": "/tmp/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt"
                        },
                        "url": "grpcs://peer0.org2.example.com:9051",
                        "eventUrl": "grpcs://peer0.org2.example.com:9053",
                        "grpcOptions": {
                                "ssl-target-name-override": "peer0.org2.example.com"
                        }
                },
                "peer1.org2.example.com": {
                        "tlsCACerts": {
                                "path": "/tmp/crypto/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/tls/ca.crt"
                        },
                        "url": "grpcs://peer1.org2.example.com:10051",
                        "eventUrl": "grpcs://peer1.org2.example.com:10053",
                        "grpcOptions": {
                                "ssl-target-name-override": "peer1.org2.example.com"
                        }
                }
        }
}

 

blockchain-explorer 실행/종료

blockchain-explorer 실행

이제 모든 설정이 끝났으면, blockchain-explorer를 실행합니다.

# blockchain-explorer 실행
cd /opt/gopath/src/github.com/hyperledger/blockchain-explorer
docker-compose up -d
docker container ls -a

※ docker-compose.yaml 파일에는 Prometheus와 Grafana 서비스도 정의되어있기 때문에, Prometheus와 Grafana 컨테이너도 함께 실행됩니다.

blockchain-explorer 종료

blockchain-explorer를 종료할 때에는 -v 옵션을 추가해 Docker 볼륨까지 제거합니다.

# blockchain-explorer 종료
cd /opt/gopath/src/github.com/hyperledger/blockchain-explorer
docker-compose down -v
반응형
댓글
반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/11   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
글 보관함