1.环境架构
系统采用容器的方式运行,构建过程简单、各组件分工清晰:
1.Docker-compose:docker容器管理;
2.Golang SDK:go语言开发、编译环境;
3.Git:git镜像克隆与提交;
4.Rest Client: rest API测试;
容器主要运行的组件有:fabric-ca-server,fabric-orderer和fabric-peer;
2.部署环境配置
(1)Host Operation System
Ubuntu 16.04LTS Intel(R) Core(TM) i5-4440 CPU @ 3.10GHz
(2) docker version
Client:
Version: 17.06.0-ce
API version: 1.30
Go version: go1.8.3
Git commit: 02c1d87
Built: Fri Jun 23 21:23:31 2017
OS/Arch: linux/amd64
Server:
Version: 17.06.0-ce
API version: 1.30 (minimum version 1.12)
Go version: go1.8.3
Git commit: 02c1d87
Built: Fri Jun 23 21:19:04 2017
OS/Arch: linux/amd64
Experimental: false
(3) docker-compose version
docker-compose version 1.14.0, build c7bdf9e
docker-py version: 2.3.0
CPython version: 2.7.13
OpenSSL version: OpenSSL 1.0.1t 3 May 2016
(4) Git version
git version 2.7.4
(5) Git version
go version go1.8.3 linux/amd64
(6)Fabric version
hyperledger/fabric-ca x86_64-1.0.0-alpha 35311d8617b4 5 months ago 240MB
hyperledger/fabric-couchdb x86_64-1.0.0-alpha f3ce31e25872 5 months ago 1.51GB
hyperledger/fabric-kafka x86_64-1.0.0-alpha 589dad0b93fc 5 months ago 1.3GB
hyperledger/fabric-zookeeper x86_64-1.0.0-alpha 9a51f5be29c1 5 months ago 1.31GB
hyperledger/fabric-orderer x86_64-1.0.0-alpha 5685fd77ab7c 5 months ago 182MB
hyperledger/fabric-peer x86_64-1.0.0-alpha 784c5d41ac1d 5 months ago 184MB
hyperledger/fabric-javaenv x86_64-1.0.0-alpha a08f85d8f0a9 5 months ago 1.42GB
hyperledger/fabric-ccenv x86_64-1.0.0-alpha 91792014b61f 5 months ago 1.29GB
hyperledger/fabric-membersrvc latest b3654d32e4f9 10 months ago 1.42GB
3.安装与部署
3.1从 DockerHub上拉取镜像
docker pull hyperledger/fabric-orderer:x86_64-1.0.0-alpha
docker pull hyperledger/fabric-peer:x86_64-1.0.0-alpha
docker pull hyperledger/fabric-javaenv:x86_64-1.0.0-alpha
docker pull hyperledger/fabric-ccenv:x86_64-1.0.0-alpha
docker pull hyperledger/fabric-couchdb:x86_64-1.0.0-alpha # 存储
docker pull hyperledger/fabric-zookeeper:x86_64-1.0.0-alpha
docker pull hyperledger/fabric-kafka:x86_64-1.0.0-alpha
docker pull hyperledger/fabric-ca:x86_64-1.0.0-alpha
docker pull hyperledger/fabric-membersrvc:latest
3.2 Docker-compose.yml 编写
# This compose file will start a Hyperledger Fabric 1.0 MVE, including
# * ca
# * orderer
# * peer
# * sdk for testing
version: '3.3'
services:
# The membership service configuration
#membersrvc:
# image: hyperledger/fabric-membersrvc:latest
# ports:
# - "7060:7060"
# command: membersrvc
# The CA validation and check configuration
ca:
image: hyperledger/fabric-ca:x86_64-1.0.0-alpha
container_name: fabric-ca-server
ports:
- "7054:7054"
environment:
- FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
volumes:
- "./fabric-ca-server:/etc/hyperledger/fabric-ca-server"
command: sh -c 'fabric-ca-server start -b admin:adminpw'
# The orderer configuration
orderer:
image: hyperledger/fabric-orderer:x86_64-1.0.0-alpha
container_name: fabric-orderer
hostname: orderer
environment:
- ORDERER_GENERAL_LEDGERTYPE=ram
- ORDERER_GENERAL_BATCHTIMEOUT=10s
- ORDERER_GENERAL_MAXMESSAGECOUNT=10
- ORDERER_GENERAL_MAXWINDOWSIZE=1000
- ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
- ORDERER_GENERAL_LISTENPORT=7050
- ORDERER_RAMLEDGER_HISTORY_SIZE=100
- CONFIGTX_ORDERER_ORDERERTYPE=solo
ports:
- "7050:7050"
command: orderer
# The peer node configuration.
peer0:
image: hyperledger/fabric-peer:x86_64-1.0.0-alpha
container_name: fabric-peer0
hostname: peer0
environment:
- CORE_PEER_ID=peer0
- CORE_PEER_ADDRESSAUTODETECT=true
- CORE_LOGGING_LEVEL=INFO
- CORE_NEXT=true
- CORE_PEER_ENDORSER_ENABLED=true
- CORE_PEER_COMMITTER_ENABLED=true
- CORE_PEER_PROFILE_ENABLED=false
- CORE_PEER_GOSSIP_ORGLEADER=true
- CORE_PEER_GOSSIP_IGNORESECURITY=true
- CORE_PEER_COMMITTER_LEDGER_ORDERER=orderer:7050
links:
- ca
- orderer
ports:
- 7051:7051
depends_on:
- ca
- orderer
expose:
- "7050" # Rest port
- "7051" # Grpc port
- "7052" # Peer CLI port
- "7053" # Peer Event port
- "7054" # eCAP port
- "7055" # eCAA port
- "7056" # tCAP port
- "7057" # eCAA port
- "7058" # tlsCAP port
- "7059" # tlsCAA port
volumes:
- /var/run/docker.sock:/var/run/docker.sock
command: peer node start