# # Copyright O Corp. All Rights Reserved. # # SPDX-License-Identifier: Apache-2.0 # # https://github.com/yeasy/docker-compose-files/tree/master/hyperledger # This compose file will start a Hyperledger Fabric 1.0 MVE, including # * 1 ca # * 1 orderer # * 4 peers in 2 orgs # * cli for testing version: '3.2' services: ca.example.com: container_name: ${COMPOSE_PROJECT_NAME}_ca_orderer image: "hyperledger/fabric-ca:1.2.0" command: /bin/bash -c '/scripts/start-root-ca.sh 2>&1 | tee /data/logs/ca.orderer.example.com.log' environment: - FABRIC_CA_SERVER_HOME=/etc/hyperledger/fabric-ca - FABRIC_CA_SERVER_TLS_ENABLED=true - FABRIC_CA_SERVER_CSR_CN=ca.example.com - FABRIC_CA_SERVER_CSR_HOSTS=ca.example.com - FABRIC_CA_SERVER_DEBUG=true - BOOTSTRAP_USER_PASS=admin:adminpw - TARGET=/data/crypto-config/ordererOrganizations/example.com/ca - TLSTARGET=/data/crypto-config/ordererOrganizations/example.com/tlsca - TARGET_CERTFILE=/data/crypto-config/ordererOrganizations/example.com/ca/ca.example.com-cert.pem - FABRIC_ORGS=orderer org1 org2 volumes: - /opt/cello/scripts:/scripts - /opt/cello/fabric-1.2:/data ca.org1.example.com: container_name: ${COMPOSE_PROJECT_NAME}_ca_org1 image: "hyperledger/fabric-ca:1.2.0" command: /bin/bash -c '/scripts/start-root-ca.sh 2>&1 | tee /data/logs/ca.org1.example.com.log' environment: - FABRIC_CA_SERVER_HOME=/etc/hyperledger/fabric-ca - FABRIC_CA_SERVER_TLS_ENABLED=true - FABRIC_CA_SERVER_CSR_CN=ca.org1.example.com - FABRIC_CA_SERVER_CSR_HOSTS=ca.org1.example.com - FABRIC_CA_SERVER_DEBUG=true - BOOTSTRAP_USER_PASS=admin:adminpw - TARGET=/data/crypto-config/peerOrganizations/org1.example.com/ca - TLSTARGET=/data/crypto-config/peerOrganizations/org1.example.com/tlsca - TARGET_CERTFILE=/data/crypto-config/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem - FABRIC_ORGS=orderer org1 org2 volumes: - /opt/cello/scripts:/scripts - /opt/cello/fabric-1.2:/data ca.org2.example.com: container_name: ${COMPOSE_PROJECT_NAME}_ca_org2 image: "hyperledger/fabric-ca:1.2.0" command: /bin/bash -c '/scripts/start-root-ca.sh 2>&1 | tee /data/logs/ca.org2.example.com.log' environment: - FABRIC_CA_SERVER_HOME=/etc/hyperledger/fabric-ca - FABRIC_CA_SERVER_TLS_ENABLED=true - FABRIC_CA_SERVER_CSR_CN=ca.org2.example.com - FABRIC_CA_SERVER_CSR_HOSTS=ca.org2.example.com - FABRIC_CA_SERVER_DEBUG=true - BOOTSTRAP_USER_PASS=admin:adminpw - TARGET=/data/crypto-config/peerOrganizations/org2.example.com/ca - TLSTARGET=/data/crypto-config/peerOrganizations/org2.example.com/tlsca - TARGET_CERTFILE=/data/crypto-config/peerOrganizations/org2.example.com/ca/ca.org2.example.com-cert.pem - FABRIC_ORGS=orderer org1 org2 volumes: - /opt/cello/scripts:/scripts - /opt/cello/fabric-1.2:/data setup: container_name: ${COMPOSE_PROJECT_NAME}_setup image: "hyperledger/fabric-ca-tools:1.2.0" command: /bin/bash -c '/scripts/setup-fabric.sh 2>&1 | tee /data/logs/setup.log; sleep 99999' environment: - COMPOSE_PROJECT_NAME=${COMPOSE_PROJECT_NAME} volumes: - /opt/cello/scripts:/scripts - /opt/cello/fabric-1.2:/data depends_on: - ca.example.com - ca.org1.example.com - ca.org2.example.com orderer.example.com: image: "hyperledger/fabric-ca-orderer:1.2.0" container_name: ${COMPOSE_PROJECT_NAME}_orderer restart: always environment: - FABRIC_CA_CLIENT_HOME=/var/hyperledger/orderer - FABRIC_CA_CLIENT_TLS_CERTFILES=/data/crypto-config/ordererOrganizations/example.com/ca/ca.example.com-cert.pem - ENROLLMENT_URL=https://orderer.example.com:orderer.example.compw@ca.example.com:7054 - ORDERER_HOME=/var/hyperledger/orderer - ORDERER_HOST=orderer.example.com - ORDERER_GENERAL_LOGLEVEL=DEBUG - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_GENESISMETHOD=file - ORDERER_GENERAL_GENESISFILE=/data/genesis.block - ORDERER_GENERAL_LOCALMSPID=OrdererMSP - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - ORDERER_GENERAL_TLS_ENABLED=true - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_TLS_ROOTCAS=[/data/crypto-config/ordererOrganizations/example.com/ca/ca.example.com-cert.pem] - ORDERER_DEBUG_BROADCASTTRACEDIR=data/logs - ORDERER=orderer - DOMAIN=example.com ports: - ${ORDERER_PORT}:7050 volumes: - /opt/cello/scripts:/scripts - /opt/cello/fabric-1.2:/data external_links: - ${COMPOSE_PROJECT_NAME}_peer0.org1.example.com:peer0.org1.example.com - ${COMPOSE_PROJECT_NAME}_peer0.org2.example.com:peer0.org2.example.com - ${COMPOSE_PROJECT_NAME}_peer1.org1.example.com:peer1.org1.example.com - ${COMPOSE_PROJECT_NAME}_peer1.org2.example.com:peer1.org2.example.com depends_on: - setup command: /bin/bash -c '/scripts/start-orderer.sh 2>&1 | tee /data/logs/orderer.example.com.log' peer0.org1.example.com: image: "hyperledger/fabric-ca-peer:1.2.0" container_name: ${COMPOSE_PROJECT_NAME}_peer0_org1 #restart: always depends_on: - orderer.example.com environment: # the following setting starts chaincode containers on the same # bridge network as the peers # https://docs.docker.com/compose/networking/ - FABRIC_CA_CLIENT_HOME=/etc/hyperledger/fabric - FABRIC_CA_CLIENT_TLS_CERTFILES=/data/crypto-config/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem - ENROLLMENT_URL=https://peer0.org1.example.com:peer0.org1.example.compw@ca.org1.example.com:7054 - PEER_NAME=peer0.org1.example.com - PEER_HOME=/etc/hyperledger/fabric - PEER_HOST=peer0.org1.example.com - PEER_NAME_PASS=peer0.org1.example.com:peer0.org1.example.compw - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/msp - CORE_VM_ENDPOINT=unix:///var/run/docker.sock - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=${COMPOSE_PROJECT_NAME}_default - CORE_LOGGING_LEVEL=DEBUG - CORE_PEER_GOSSIP_USELEADERELECTION=true - CORE_PEER_GOSSIP_ORGLEADER=false # The following setting skips the gossip handshake since we are # are not doing mutual TLS - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7051 - CORE_PEER_GOSSIP_SKIPHANDSHAKE=true - 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=/data/crypto-config/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem - CORE_VM_DOCKER_HOSTCONFIG_MEMORY=268435456 #256M - CORE_PEER_ID=peer0.org1.example.com - CORE_PEER_LOCALMSPID=Org1MSP - CORE_PEER_ADDRESS=peer0.org1.example.com:7051 - ORG=org1 - PEER=peer0 - DOMAIN=org1.example.com working_dir: /etc/hyperledger/fabric ports: - ${PEER0_ORG1_GRPC_PORT}:7051 - ${PEER0_ORG1_EVENT_PORT}:7053 volumes: # docker.sock is mapped as the default CORE_VM_ENDPOINT - /var/run/docker.sock:/var/run/docker.sock - /opt/cello/scripts:/scripts - /opt/cello/fabric-1.2:/data command: /bin/bash -c '/scripts/start-peer.sh 2>&1 | tee /data/logs/peer0.org1.example.com.log' peer1.org1.example.com: container_name: ${COMPOSE_PROJECT_NAME}_peer1_org1 image: "hyperledger/fabric-ca-peer:1.2.0" #restart: always ports: - ${PEER1_ORG1_GRPC_PORT}:7051 - ${PEER1_ORG1_EVENT_PORT}:7053 depends_on: - orderer.example.com environment: - FABRIC_CA_CLIENT_HOME=/etc/hyperledger/fabric - FABRIC_CA_CLIENT_TLS_CERTFILES=/data/crypto-config/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem - ENROLLMENT_URL=https://peer1.org1.example.com:peer1.org1.example.compw@ca.org1.example.com:7054 - PEER_NAME=peer1.org1.example.com - PEER_HOME=/etc/hyperledger/fabric - PEER_HOST=peer1.org1.example.com - PEER_NAME_PASS=peer1.org1.example.com:peer1.org1.example.compw - CORE_PEER_ID=peer1.org1.example.com - CORE_PEER_LOCALMSPID=Org1MSP - CORE_PEER_ADDRESS=peer1.org1.example.com:7051 - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/msp # the following setting starts chaincode containers on the same # bridge network as the peers # https://docs.docker.com/compose/networking/ - CORE_VM_ENDPOINT=unix:///var/run/docker.sock - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=${COMPOSE_PROJECT_NAME}_default - CORE_LOGGING_LEVEL=DEBUG - CORE_PEER_GOSSIP_USELEADERELECTION=true - CORE_PEER_GOSSIP_ORGLEADER=false # The following setting skips the gossip handshake since we are # are not doing mutual TLS - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org1.example.com:7051 - CORE_PEER_GOSSIP_SKIPHANDSHAKE=true - 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=/data/crypto-config/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem - CORE_VM_DOCKER_HOSTCONFIG_MEMORY=268435456 #256M - ORG=org1 - PEER=peer1 - DOMAIN=org1.example.com - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org1.example.com:7051 working_dir: /etc/hyperledger/fabric volumes: - /var/run/docker.sock:/var/run/docker.sock - /opt/cello/scripts:/scripts - /opt/cello/fabric-1.2:/data command: /bin/bash -c '/scripts/start-peer.sh 2>&1 | tee /data/logs/peer1.org1.example.com.log' peer0.org2.example.com: container_name: ${COMPOSE_PROJECT_NAME}_peer0_org2 image: "hyperledger/fabric-ca-peer:1.2.0" #restart: always depends_on: - orderer.example.com ports: - ${PEER0_ORG2_GRPC_PORT}:7051 - ${PEER0_ORG2_EVENT_PORT}:7053 environment: - FABRIC_CA_CLIENT_HOME=/etc/hyperledger/fabric - FABRIC_CA_CLIENT_TLS_CERTFILES=/data/crypto-config/peerOrganizations/org2.example.com/ca/ca.org2.example.com-cert.pem - ENROLLMENT_URL=https://peer0.org2.example.com:peer0.org2.example.compw@ca.org2.example.com:7054 - PEER_NAME=peer0.org2.example.com - PEER_HOME=/etc/hyperledger/fabric - PEER_HOST=peer0.org2.example.com - PEER_NAME_PASS=peer0.org2.example.com:peer0.org2.example.compw - CORE_PEER_ID=peer0.org2.example.com - CORE_PEER_LOCALMSPID=Org2MSP - CORE_PEER_ADDRESS=peer0.org2.example.com:7051 - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/msp # the following setting starts chaincode containers on the same # bridge network as the peers # https://docs.docker.com/compose/networking/ # https://docs.docker.com/compose/networking/ - CORE_VM_ENDPOINT=unix:///var/run/docker.sock - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=${COMPOSE_PROJECT_NAME}_default - CORE_LOGGING_LEVEL=DEBUG - CORE_PEER_GOSSIP_USELEADERELECTION=true - CORE_PEER_GOSSIP_ORGLEADER=false # The following setting skips the gossip handshake since we are # are not doing mutual TLS - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org2.example.com:7051 - CORE_PEER_GOSSIP_SKIPHANDSHAKE=true - 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=/data/crypto-config/peerOrganizations/org2.example.com/ca/ca.org2.example.com-cert.pem - CORE_VM_DOCKER_HOSTCONFIG_MEMORY=268435456 #256M - ORG=org2 - PEER=peer0 - DOMAIN=org2.example.com working_dir: /etc/hyperledger/fabric volumes: - /var/run/docker.sock:/var/run/docker.sock - /opt/cello/scripts:/scripts - /opt/cello/fabric-1.2:/data command: /bin/bash -c '/scripts/start-peer.sh 2>&1 | tee /data/logs/peer0.org2.example.com.log' peer1.org2.example.com: container_name: ${COMPOSE_PROJECT_NAME}_peer1_org2 image: "hyperledger/fabric-ca-peer:1.2.0" #restart: always ports: - ${PEER1_ORG2_GRPC_PORT}:7051 - ${PEER1_ORG2_EVENT_PORT}:7053 depends_on: - orderer.example.com environment: - FABRIC_CA_CLIENT_HOME=/etc/hyperledger/fabric - FABRIC_CA_CLIENT_TLS_CERTFILES=/data/crypto-config/peerOrganizations/org2.example.com/ca/ca.org2.example.com-cert.pem - ENROLLMENT_URL=https://peer1.org2.example.com:peer1.org2.example.compw@ca.org2.example.com:7054 - PEER_NAME=peer1.org2.example.com - PEER_HOME=/etc/hyperledger/fabric - PEER_HOST=peer1.org2.example.com - PEER_NAME_PASS=peer1.org2.example.com:peer1.org2.example.compw - CORE_PEER_ID=peer1.org2.example.com - CORE_PEER_LOCALMSPID=Org2MSP - CORE_PEER_ADDRESS=peer1.org2.example.com:7051 - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/msp - CORE_VM_ENDPOINT=unix:///var/run/docker.sock # the following setting starts chaincode containers on the same # bridge network as the peers # https://docs.docker.com/compose/networking/ - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=${COMPOSE_PROJECT_NAME}_default - CORE_LOGGING_LEVEL=DEBUG - CORE_PEER_GOSSIP_USELEADERELECTION=true - CORE_PEER_GOSSIP_ORGLEADER=false # The following setting skips the gossip handshake since we are # are not doing mutual TLS - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org2.example.com:7051 - CORE_PEER_GOSSIP_SKIPHANDSHAKE=true - 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=/data/crypto-config/peerOrganizations/org2.example.com/ca/ca.org2.example.com-cert.pem - CORE_VM_DOCKER_HOSTCONFIG_MEMORY=268435456 #256M - ORG=org2 - PEER=peer1 - DOMAIN=org2.example.com - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org2.example.com:7051 working_dir: /etc/hyperledger/fabric volumes: - /var/run/docker.sock:/var/run/docker.sock - /opt/cello/scripts:/scripts - /opt/cello/fabric-1.2:/data command: /bin/bash -c '/scripts/start-peer.sh 2>&1 | tee /data/logs/peer1.org2.example.com.log' # cli: # client node # image: "hyperledger/fabric-tools:1.2.0" # container_name: ${COMPOSE_PROJECT_NAME}_cli # hostname: cli # restart: always # tty: true # environment: # #- GOPATH=/opt/gopath # - CORE_LOGGING_LEVEL=DEBUG # - CORE_LOGGING_FORMAT=%{color}[%{id:03x} %{time:01-02 15:04:05.00 MST}] [%{longpkg}] %{callpath} -> %{level:.4s}%{color:reset} %{message} # - CORE_PEER_TLS_ENABLED=true # to enable TLS, change to true # - ORDERER_CA=/etc/hyperledger/fabric/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem # depends_on: # - orderer.example.com # - peer0.org1.example.com # - peer1.org1.example.com # - peer0.org2.example.com # - peer1.org2.example.com # working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer # volumes: # - ${COMPOSE_PROJECT_PATH}/scripts:/tmp/scripts # - ${COMPOSE_PROJECT_PATH}/crypto-config.yaml:/etc/hyperledger/fabric/crypto-config.yaml # - ${COMPOSE_PROJECT_PATH}/crypto-config:/etc/hyperledger/fabric/crypto-config # - ${COMPOSE_PROJECT_PATH}/solo/configtx.yaml:/etc/hyperledger/fabric/configtx.yaml # - ${COMPOSE_PROJECT_PATH}/solo/channel-artifacts:/tmp/channel-artifacts # - ${COMPOSE_PROJECT_PATH}/examples:/opt/gopath/src/examples # 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; while true; do sleep 20180101; done' explorer: image: yeasy/blockchain-explorer:0.1.0-preview container_name: ${COMPOSE_PROJECT_NAME}_explorer hostname: explorer restart: always volumes: - ${COMPOSE_PROJECT_PATH}/explorer-artifacts/config.json:/blockchain-explorer/config.json - ${COMPOSE_PROJECT_PATH}/crypto-config:/blockchain-explorer/first-network/crypto-config ports: - "${EXPLORER_PORT}:8080" depends_on: - mysql - orderer.example.com - peer0.org1.example.com - peer1.org1.example.com - peer0.org2.example.com - peer1.org2.example.com links: - orderer.example.com - peer0.org1.example.com - peer1.org1.example.com - peer0.org2.example.com - peer1.org2.example.com command: bash -c 'sleep 30; node main.js' mysql: # mysql service image: mysql:5.7 container_name: ${COMPOSE_PROJECT_NAME}_mysql hostname: mysql restart: always environment: - MYSQL_ROOT_PASSWORD=root - MYSQL_DATABASE=fabricexplorer - STARTUP_SQL=/fabricexplorer.sql volumes: - ${COMPOSE_PROJECT_PATH}/explorer-artifacts/fabricexplorer.sql:/docker-entrypoint-initdb.d/fabricexplorer.sql expose: - "3306" command: mysqld