轉載請註明出處:HyperLedger Cello學習筆記html
Hyperledger Cello是Hyperledger下的一個子項目,其主要功能以下:node
Master節點上的服務有:普通用戶控制檯、操控者控制檯、監控、容器編排引擎、日誌管理模塊、健康檢查模塊。python
Cello採起了一主多從的部署模式,Cello Service部署在Master節點上,提供宿主資源的裸機或虛擬環境稱爲Host,被Cello管理的區塊鏈服務單元稱爲Worker。整套環境部署要求至少一個Master與一個Worker。git
環境要求:
docker : 17.0+
docker-compose: 1.8.0~1.12.0github
//獲取源碼 [centos@baas src]$ git clone -b v0.9.0 https://github.com/hyperledger/cello.git && cd cello
[centos@baas cello]$ cd cello/scripts/master_node/ [centos@baas cello]$ VERSION=0.9.0 bash setup.sh
此過程將會安裝docker及docker-compose,還會下載相關鏡像。web
[centos@baas cello]$ docker images REPOSITORY TAG IMAGE ID CREATED SIZE hyperledger/cello-watchdog latest a8d77975c69e 10 days ago 1.04GB hyperledger/cello-watchdog x86_64-v0.9.0 a8d77975c69e 10 days ago 1.04GB hyperledger/cello-mongo latest 06cf2b88461a 10 days ago 1.04GB hyperledger/cello-mongo x86_64-0.9.0-snapshot-b6a340d 06cf2b88461a 10 days ago 1.04GB hyperledger/cello-baseimage x86_64-0.9.0-snapshot-b6a340d 3bdf82ef579a 10 days ago 1.04GB rabbitmq latest 5cb7660e7cfe 11 days ago 164MB hyperledger/cello-operator-dashboard latest 296a1e79edb9 12 days ago 1.04GB hyperledger/cello-operator-dashboard x86_64-v0.9.0 296a1e79edb9 12 days ago 1.04GB hyperledger/cello-engine latest ce8908b6719c 12 days ago 1.04GB hyperledger/cello-engine x86_64-v0.9.0 ce8908b6719c 12 days ago 1.04GB hyperledger/cello-baseimage latest a81a9fc8f1bd 2 weeks ago 1.04GB hyperledger/cello-baseimage x86_64-0.9.0 a81a9fc8f1bd 2 weeks ago 1.04GB hyperledger/cello-user-dashboard latest c09f0cd2edca 2 months ago 2.12GB hyperledger/cello-user-dashboard x86_64-v0.9.0 c09f0cd2edca 2 months ago 2.12GB itsthenetwork/nfs-server-alpine 9 30f582fb8f6e 12 months ago 51.9MB mongo 3.4.10 e905a87e116d 17 months ago 360MB node 9.2 cb4c45f7a9e3 17 months ago 676MB
//從新生成創始塊及其初始化相關的文件 [centos@baas cello]$ cd src/agent/docker/_compose_files/fabric-1.0/kafka [centos@baas kafka]$ ln -s ../crypto-config ./crypto-config [centos@baas kafka]$configtxgen -profile TwoOrgsOrdererGenesis -outputBlock ./channel-artifacts/orderer.genesis.block [centos@baas kafka]$configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ./channel-artifacts/new_businesschannel.tx -channelID businesschannel [centos@baas kafka]$configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org1MSPanchors.tx -channelID businesschannel -asOrg Org1MSP [centos@baas kafka]$configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org2MSPanchors.tx -channelID businesschannel -asOrg Org2MSP
修改docker-compose.yaml文件mongodb
operator-dashboard: image: hyperledger/cello-operator-dashboard container_name: cello-operator-dashboard hostname: cello-operator-dashboard restart: unless-stopped environment: - MONGO_URL=mongodb://cello-mongo:27017 # used by pymongo, deprecate soon - MONGO_HOST=mongo - MONGO_DB=dev - EXPLORER_PORT=8088 # 新增瀏覽器端口配置 - MONGODB_PORT=27017 - DEBUG=False # in debug mode, service will auto-restart - LOG_LEVEL=DEBUG # 修改日誌等級爲DEBUG - STATIC_FOLDER=$STATIC_FOLDER - TEMPLATE_FOLDER=$TEMPLATE_FOLDER - ENABLE_EMAIL_ACTIVE=$ENABLE_EMAIL_ACTIVE - BROKER=amqp://$RABBITMQ_DEFAULT_USER:$RABBITMQ_DEFAULT_PASS@rabbitmq:5672/$RABBITMQ_DEFAULT_VHOST - BACKEND=amqp://$RABBITMQ_DEFAULT_USER:$RABBITMQ_DEFAULT_PASS@rabbitmq:5672/$RABBITMQ_DEFAULT_VHOST ports: - "8080:8080" volumes: - $ROOT_PATH/src/agent/docker/_compose_files:/app/agent/docker/_compose_files/ # 新增映射目錄 - $ROOT_PATH/src/agent/docker/_compose_files:/cello
修改fabric-kafka-4.yaml文件docker
# 修改peer環境變量 - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=cello_net_kafka # 修改cli的command command: bash -c 'sleep 15; cd /tmp; source scripts/func.sh; bash scripts/test_channel_create.sh; bash scripts/test_channel_join.sh; bash scripts/test_cc_install.sh; bash scripts/test_cc_instantiate.sh ; while true; do sleep 20180101; done'
[centos@baas cello]$ make start //將會啓動master節點上的服務 [centos@raft-test--3 cello]$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 9f9b9abf94a8 hyperledger/cello-user-dashboard "/bin/sh -c 'ln -sf …" 8 minutes ago Up 8 minutes 0.0.0.0:8081->8081/tcp cello-user-dashboard 1ad2eca89aaa mongo:3.4.10 "docker-entrypoint.s…" 8 minutes ago Up 8 minutes 27017/tcp cello-dashboard_mongo 30c61b815fae rabbitmq "docker-entrypoint.s…" 8 minutes ago Up 8 minutes 4369/tcp, 5671-5672/tcp, 25672/tcp cello-dashboard_rabbitmq beb6bbe7d177 hyperledger/cello-engine "python restserver.py" 8 minutes ago Up 8 minutes 0.0.0.0:80->80/tcp cello-engine aa011f819b7d hyperledger/cello-watchdog "python watchdog.py" 8 minutes ago Up 8 minutes cello-watchdog 9c34f967b9c1 mongo:3.4.10 "docker-entrypoint.s…" 8 minutes ago Up 8 minutes 127.0.0.1:27017-27018->27017-27018/tcp cello-mongo 8ae375ce7593 hyperledger/cello-operator-dashboard "/bin/sh -c '/etc/in…" 8 minutes ago Up 8 minutes 0.0.0.0:8080->8080/tcp cello-operator-dashboard b102d502edd2 itsthenetwork/nfs-server-alpine:9 "/usr/bin/nfsd.sh" 3 days ago Up 3 days 0.0.0.0:2049->2049/tcp cello-nfs
//獲取源碼 [centos@baas src]$ git clone -b v0.9.0 https://github.com/hyperledger/cello.git && cd cello
[centos@baas cello]$ cd cello/scripts/worker_node/ [centos@baas cello]$ WORKER_TYPE=docker MASTER_NODE=x.x.x.x make setup-worker
此過程將會安裝docker,還會下載fabric相關鏡像,包括版本1.0、1.一、1.2。shell
[centos@baas cello]$ docker images hyperledger/fabric-ca 1.2.0 66cc132bd09c 10 months ago 252 MB hyperledger/fabric-ca amd64-1.2.0 66cc132bd09c 10 months ago 252 MB hyperledger/fabric-tools 1.2.0 379602873003 10 months ago 1.51 GB hyperledger/fabric-tools amd64-1.2.0 379602873003 10 months ago 1.51 GB hyperledger/fabric-ccenv amd64-1.2.0 6acf31e2d9a4 10 months ago 1.43 GB hyperledger/fabric-orderer 1.2.0 4baf7789a8ec 10 months ago 152 MB hyperledger/fabric-orderer amd64-1.2.0 4baf7789a8ec 10 months ago 152 MB hyperledger/fabric-peer 1.2.0 82c262e65984 10 months ago 159 MB hyperledger/fabric-peer amd64-1.2.0 82c262e65984 10 months ago 159 MB hyperledger/fabric-zookeeper 1.2.0 2b51158f3898 11 months ago 1.44 GB hyperledger/fabric-zookeeper amd64-0.4.10 2b51158f3898 11 months ago 1.44 GB hyperledger/fabric-kafka 1.2.0 936aef6db0e6 11 months ago 1.45 GB hyperledger/fabric-kafka amd64-0.4.10 936aef6db0e6 11 months ago 1.45 GB hyperledger/fabric-couchdb 1.2.0 3092eca241fc 11 months ago 1.61 GB hyperledger/fabric-couchdb amd64-0.4.10 3092eca241fc 11 months ago 1.61 GB hyperledger/fabric-baseimage amd64-0.4.10 62513965e238 11 months ago 1.39 GB hyperledger/fabric-baseos amd64-0.4.10 52190e831002 11 months ago 132 MB itsthenetwork/nfs-server-alpine 9 30f582fb8f6e 12 months ago 51.9 MB hyperledger/fabric-ca 1.1.0 72617b4fa9b4 14 months ago 299 MB hyperledger/fabric-ca x86_64-1.1.0 72617b4fa9b4 14 months ago 299 MB hyperledger/fabric-tools 1.1.0 b7bfddf508bc 14 months ago 1.46 GB hyperledger/fabric-tools x86_64-1.1.0 b7bfddf508bc 14 months ago 1.46 GB hyperledger/fabric-orderer 1.1.0 ce0c810df36a 14 months ago 180 MB hyperledger/fabric-orderer x86_64-1.1.0 ce0c810df36a 14 months ago 180 MB hyperledger/fabric-peer 1.1.0 b023f9be0771 14 months ago 187 MB hyperledger/fabric-peer x86_64-1.1.0 b023f9be0771 14 months ago 187 MB hyperledger/fabric-ccenv x86_64-1.1.0 c8b4909d8d46 14 months ago 1.39 GB hyperledger/fabric-baseimage x86_64-0.4.6 dbe6787b5747 15 months ago 1.37 GB hyperledger/fabric-zookeeper 1.1.0 92cbb952b6f8 15 months ago 1.39 GB hyperledger/fabric-zookeeper x86_64-0.4.6 92cbb952b6f8 15 months ago 1.39 GB hyperledger/fabric-kafka 1.1.0 554c591b86a8 15 months ago 1.4 GB hyperledger/fabric-kafka x86_64-0.4.6 554c591b86a8 15 months ago 1.4 GB hyperledger/fabric-couchdb 1.1.0 7e73c828fc5b 15 months ago 1.56 GB hyperledger/fabric-couchdb x86_64-0.4.6 7e73c828fc5b 15 months ago 1.56 GB hyperledger/fabric-baseos x86_64-0.4.6 220e5cf3fb7f 15 months ago 151 MB yeasy/blockchain-explorer 0.1.0-preview d3d781c8c96b 16 months ago 659 MB hyperledger/fabric-tools 1.0.5 6a8993b718c8 17 months ago 1.33 GB hyperledger/fabric-tools x86_64-1.0.5 6a8993b718c8 17 months ago 1.33 GB hyperledger/fabric-couchdb 1.0.5 9a58db2d2723 17 months ago 1.5 GB hyperledger/fabric-couchdb x86_64-1.0.5 9a58db2d2723 17 months ago 1.5 GB hyperledger/fabric-kafka 1.0.5 b8c5172bb83c 17 months ago 1.29 GB hyperledger/fabric-kafka x86_64-1.0.5 b8c5172bb83c 17 months ago 1.29 GB hyperledger/fabric-zookeeper 1.0.5 68945f4613fc 17 months ago 1.32 GB hyperledger/fabric-zookeeper x86_64-1.0.5 68945f4613fc 17 months ago 1.32 GB hyperledger/fabric-orderer 1.0.5 368c78b6f03b 17 months ago 151 MB hyperledger/fabric-orderer x86_64-1.0.5 368c78b6f03b 17 months ago 151 MB hyperledger/fabric-peer 1.0.5 c2ab022f0bdb 17 months ago 154 MB hyperledger/fabric-peer x86_64-1.0.5 c2ab022f0bdb 17 months ago 154 MB hyperledger/fabric-ccenv x86_64-1.0.5 33feadb8f7a6 17 months ago 1.28 GB hyperledger/fabric-ca 1.0.5 002c9089e464 17 months ago 238 MB hyperledger/fabric-ca x86_64-1.0.5 002c9089e464 17 months ago 238 MB hyperledger/fabric-baseimage x86_64-0.3.2 c92d9fdee998 21 months ago 1.26 GB hyperledger/fabric-baseos x86_64-0.3.2 bbcbb9da2d83 21 months ago 129 MB
//查看配置文件位於哪裏 systemctl show --property=FragmentPath docker //編輯配置文件內容,接收全部ip請求 sudo vim /usr/lib/systemd/system/docker.service [Service] ExecStart=/usr/bin/dockerd -H fd:// -H unix:///var/run/docker.sock -H tcp://0.0.0.0:2375 --default-ulimit=nofile=8192:16384 --default-ulimit=nproc=8192:16384 //使修改的配置生效 sudo systemctl daemon-reload; sudo systemctl restart docker.service
[centos@baas cello]$ docker ps |grep cli [centos@baas cello]$ docker logs -f xxxxxxx_cli === Creating channel businesschannel with new_businesschannel.tx... === === Create Channel businesschannel by org 1/peer 0 === === Channel businesschannel is created. === === Created channel businesschannel with new_businesschannel.tx === === Join peers 0 from org 1 into businesschannel... === === Join org 1/peer 0 into channel businesschannel === === org 1/peer 0 joined into channel businesschannel === === Join org 1/peer 1 into channel businesschannel === === org 1/peer 1 joined into channel businesschannel === === Join org 2/peer 0 into channel businesschannel === === org 2/peer 0 joined into channel businesschannel === === Join org 2/peer 1 into channel businesschannel === === org 2/peer 1 joined into channel businesschannel === === Join peers 0 from org 1 into businesschannel Complete === === Installing chaincode exp02 on all 4 peers... === === Install Chaincode exp02:1.0 (examples/chaincode/go/chaincode_example02) on org 1/peer 0 === === Chaincode is installed on remote peer0 === === Install Chaincode exp02:1.0 (examples/chaincode/go/chaincode_example02) on org 1/peer 1 === === Chaincode is installed on remote peer1 === === Install Chaincode exp02:1.0 (examples/chaincode/go/chaincode_example02) on org 2/peer 0 === === Chaincode is installed on remote peer0 === === Install Chaincode exp02:1.0 (examples/chaincode/go/chaincode_example02) on org 2/peer 1 === === Chaincode is installed on remote peer1 === === Install chaincode done === === Instantiating chaincode on channel businesschannel... === === chaincodeInstantiate for channel businesschannel on org 1/peer 0 ==== === Chaincode Instantiated in channel businesschannel by peer0 === === chaincodeInstantiate for channel businesschannel on org 2/peer 0 ==== === Chaincode Instantiated in channel businesschannel by peer0 === === Instantiate chaincode on channel businesschannel done ===
至此,fabric已經部署完成。vim
上傳合約
轉載請註明出處:HyperLedger Cello學習筆記