docker-compose-files/hyperledger_fabric/latest/base.yaml

134 lines
6.4 KiB
YAML
Raw Normal View History

2018-01-13 14:32:27 +08:00
# Contains the base template for all Hyperledger Fabric services
# Never directly use services in this template, but inherent
# All services are abstract without any names, config or port mapping
# https://github.com/yeasy/docker-compose-files
2018-01-13 14:32:27 +08:00
#
# * ca-base: base for fabric-ca
# * orderer-base: base for fabric-orderer
# * peer-base: base for fabric-peer
# * cli-base: base for fabric peer client
# * event-listener-base: base for fabric eventhub listener
# * kafka-base: base for kafka
# * zookeeper-base: base for fabric-zookeeper
# * couchdb-base: base for couchdb
# * explorer-base: base for Hyperledger blockchain-explorer
# * mysql-base: base for MySQL
2018-01-13 14:32:27 +08:00
version: '2' # compose v3 still doesn't support `extends`, shame!
services:
ca-base:
2018-10-11 13:53:01 +08:00
image: yeasy/hyperledger-fabric-ca:${FABRIC_IMG_TAG}
restart: always
2018-10-11 13:53:01 +08:00
network_mode: ${NETWORK}
environment:
- FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
2018-01-13 14:32:27 +08:00
- FABRIC_CA_SERVER_TLS_ENABLED=true # change to false to disable TLS
orderer-base:
2018-10-11 13:53:01 +08:00
image: yeasy/hyperledger-fabric-orderer:${FABRIC_IMG_TAG}
restart: always
2018-10-11 13:53:01 +08:00
network_mode: ${NETWORK}
# Default config can be found at https://github.com/hyperledger/fabric/blob/master/orderer/common/localconfig/config.go
environment:
2019-04-01 20:54:04 +08:00
- FABRIC_LOGGING_SPEC=INFO # default: INFO
2019-04-01 16:21:22 +08:00
- FABRIC_LOGGING_FORMAT="%{color}%{time:2006-01-02 15:04:05.000 MST} [%{module}] %{shortfunc} -> %{level:.4s} %{id:03x}%{color:reset} %{message}"
- ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 # default: 127.0.0.1
2019-05-02 09:12:47 +08:00
- ORDERER_GENERAL_LISTENPORT=7050
- ORDERER_GENERAL_GENESISMETHOD=file # default: provisional
2020-07-29 12:50:54 +08:00
- ORDERER_GENERAL_BOOTSTRAPFILE=/etc/hyperledger/fabric/orderer.genesis.block # by default, all materials should be put under $FABRIC_CFG_PATH, which defaults to /etc/hyperledger/fabric
- ORDERER_GENERAL_LOCALMSPID=OrdererMSP # default: DEFAULT
2020-07-29 12:50:54 +08:00
- ORDERER_GENERAL_LOCALMSPDIR=/etc/hyperledger/fabric/msp
- ORDERER_GENERAL_LEDGERTYPE=file
#- ORDERER_GENERAL_LEDGERTYPE=json # default: file
2019-01-09 17:08:03 +08:00
- ORDERER_OPERATIONS_LISTENADDRESS=0.0.0.0:8443 # operation RESTful API
- ORDERER_METRICS_PROVIDER=prometheus # prometheus will pull metrics from orderer via /metrics RESTful API
#- ORDERER_RAMLEDGER_HISTORY_SIZE=100 #only useful when use ram ledger
# enabled TLS
- ORDERER_GENERAL_TLS_ENABLED=true # default: false
2020-07-29 12:50:54 +08:00
- ORDERER_GENERAL_TLS_PRIVATEKEY=/etc/hyperledger/fabric/tls/server.key
- ORDERER_GENERAL_TLS_CERTIFICATE=/etc/hyperledger/fabric/tls/server.crt
- ORDERER_GENERAL_TLS_ROOTCAS=[/etc/hyperledger/fabric/tls/ca.crt]
2019-04-01 16:21:22 +08:00
# Only required by raft mode
2020-07-29 12:50:54 +08:00
- ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/etc/hyperledger/fabric/tls/server.key
- ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/etc/hyperledger/fabric/tls/server.crt
- ORDERER_GENERAL_CLUSTER_ROOTCAS=[/etc/hyperledger/fabric/tls/ca.crt]
2019-01-09 17:08:03 +08:00
#volumes:
#- $GOPATH/src/github.com/hyperledger/fabric:/go/src/github.com/hyperledger/fabric
expose:
2019-01-09 17:08:03 +08:00
- "7050" # gRPC
- "8443" # Operation REST
2017-12-06 16:24:33 +08:00
#command: bash -c 'bash /tmp/orderer_build.sh; orderer start' # use this if to debug orderer
command: orderer start
2018-01-30 15:54:49 +08:00
peer-base: # abstract base for fabric-peer, will be used in peer.yaml
2018-10-11 13:53:01 +08:00
image: yeasy/hyperledger-fabric-peer:${FABRIC_IMG_TAG}
2020-12-08 05:33:08 +08:00
#image: hyperledger/fabric-peer:${FABRIC_IMG_TAG}
restart: always
2018-10-11 13:53:01 +08:00
network_mode: ${NETWORK}
environment:
2019-01-09 17:08:03 +08:00
- FABRIC_LOGGING_SPEC=INFO
2019-04-01 16:21:22 +08:00
- FABRIC_LOGGING_FORMAT="%{color}%{time:2006-01-02 15:04:05.000 MST} [%{module}] %{shortfunc} -> %{level:.4s} %{id:03x}%{color:reset} %{message}"
- CORE_PEER_ADDRESSAUTODETECT=false
2018-10-11 13:53:01 +08:00
- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=${NETWORK} # uncomment this to use specific network
- CORE_PEER_GOSSIP_USELEADERELECTION=true
2018-08-22 17:27:45 +08:00
- CORE_PEER_GOSSIP_ORGLEADER=false # whether this node is the org leader, default to false
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=0.0.0.0:7051 # change to external addr for peers in other orgs
2019-01-09 17:08:03 +08:00
- CORE_OPERATIONS_LISTENADDRESS=0.0.0.0:9443 # operation RESTful API
- CORE_METRICS_PROVIDER=prometheus # prometheus will pull metrics from fabric via /metrics RESTful API
- CORE_PEER_PROFILE_ENABLED=false
2017-11-02 10:29:33 +08:00
- CORE_PEER_TLS_ENABLED=true
- CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/tls/server.crt
- CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/tls/server.key
- CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/tls/ca.crt
2021-05-04 05:24:01 +08:00
- CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:${FABRIC_IMG_TAG}
- CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:${FABRIC_IMG_TAG}
2020-12-08 05:33:08 +08:00
#- FABRIC_LOGGING_FORMAT=%{color}[%{id:03x} %{time:01-02 15:04:05.00 MST}] [%{longpkg}] %{callpath} -> %{level:.4s}%{color:reset} %{message}
2017-12-06 16:24:33 +08:00
volumes:
2019-12-28 09:43:08 +08:00
#- $GOPATH/src/github.com/hyperledger/fabric:/go/src/github.com/hyperledger/fabric
# docker.sock is mapped as the default CORE_VM_ENDPOINT
2018-08-27 10:52:46 +08:00
- /var/run/docker.sock:/var/run/docker.sock
expose:
2019-01-09 17:08:03 +08:00
- "7051" # gRPC
- "9443" # Operation REST
2017-12-06 16:24:33 +08:00
#command: bash -c 'bash /tmp/peer_build.sh; peer node start'
command: peer node start
2017-09-27 16:04:27 +08:00
cli-base:
2018-10-11 13:53:01 +08:00
image: yeasy/hyperledger-fabric:${FABRIC_IMG_TAG}
restart: always
2018-10-11 13:53:01 +08:00
network_mode: ${NETWORK}
tty: true
environment:
2019-07-20 02:41:57 +08:00
- FABRIC_LOGGING_SPEC=DEBUG
2019-01-09 17:08:03 +08:00
- FABRIC_LOGGING_FORMAT=%{color}[%{id:03x} %{time:01-02 15:04:05.00 MST}] [%{module}] %{shortfunc} -> %{level:.4s}%{color:reset} %{message}
2017-11-02 10:29:33 +08:00
- CORE_PEER_TLS_ENABLED=true # to enable TLS, change to true
2018-10-11 22:29:09 +08:00
- ORDERER_CA=/etc/hyperledger/fabric/crypto-config/ordererOrganizations/example.com/orderers/orderer0.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
2019-12-28 09:43:08 +08:00
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
2017-10-28 14:41:13 +08:00
command: bash -c 'cd /tmp; source scripts/func.sh; while true; do sleep 20170504; done'
2019-01-09 17:08:03 +08:00
prometheus: # prometheus will pull metrics from fabric
image: prom/prometheus:v2.6.0
restart: always
network_mode: ${NETWORK}
tty: true
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
2018-01-13 14:32:27 +08:00
explorer-base:
image: yeasy/blockchain-explorer:0.1.0-preview # Till we have official image
expose:
- "8080" # HTTP port
command: bash -c 'sleep 10; node main.js'
mysql-base: # mysql service
image: mysql:8.0
restart: always
2018-10-11 13:53:01 +08:00
network_mode: ${NETWORK}
2018-01-13 14:32:27 +08:00
expose:
- "3306"
2018-10-11 13:53:01 +08:00
networks:
default:
external:
name: ${NETWORK}