-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yaml
159 lines (146 loc) · 6.45 KB
/
docker-compose.yaml
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
#
# Copyright . All Rights Reserved.
#
version: '3.7'
volumes:
#peer0:
#peer1:
routes:
webapps:
x-peer:
&peer-defaults
image: ${DOCKER_REGISTRY:-docker.io}/hyperledger/fabric-peer:${FABRIC_VERSION:-1.4.2}
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
command: peer node start
volumes:
- /var/run/:/host/var/run/
depends_on:
- ca
services:
ca:
container_name: ca.${ORG:-org1}.${DOMAIN:-example.com}
image: ${DOCKER_REGISTRY:-docker.io}/hyperledger/fabric-ca:${FABRIC_VERSION:-latest}
environment:
- FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
- FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.${ORG:-org1}.${DOMAIN:-example.com}-cert.pem
- FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server-config/sk.pem
- FABRIC_CA_SERVER_TLS_ENABLED=true
- FABRIC_CA_SERVER_TLS_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.${ORG:-org1}.${DOMAIN:-example.com}-cert.pem
- FABRIC_CA_SERVER_TLS_KEYFILE=/etc/hyperledger/fabric-ca-server-config/sk.pem
command: sh -c 'fabric-ca-server start -b ${ENROLL_ID}:${ENROLL_SECRET} -d --ca.name default'
volumes:
- ./crypto-config/peerOrganizations/${ORG:-org1}.${DOMAIN:-example.com}/ca/:/etc/hyperledger/fabric-ca-server-config
- ./crypto-config/fabric-ca-server-config-${ORG:-org1}.yaml:/etc/hyperledger/fabric-ca-server/fabric-ca-server-config.yaml
restart: always
peer0:
<< : *peer-defaults
container_name: peer0.${ORG:-org1}.${DOMAIN:-example.com}
environment:
- CORE_PEER_ID=peer0.${ORG:-org1}.${DOMAIN:-example.com}
- CORE_PEER_LOCALMSPID=${ORG:-org1}
- CORE_PEER_ADDRESS=peer0.${ORG:-org1}.${DOMAIN:-example.com}:7051
- CORE_VM_ENDPOINT=unix:///host/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=fabric-starter_default
- CORE_VM_DOCKER_ATTACHSTDOUT=true
#- CORE_LOGGING_LEVEL=DEBUG
- CORE_CHAINCODE_LOGGING_LEVEL=DEBUG
- CORE_CHAINCODE_LOGGING_SHIM=debug
- CORE_PEER_GOSSIP_USELEADERELECTION=true
- CORE_PEER_GOSSIP_ORGLEADER=false
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.${ORG:-org1}.${DOMAIN:-example.com}:7051
- CORE_PEER_GOSSIP_BOOTSTRAP=peer0.${ORG:-org1}.${DOMAIN:-example.com}:7051
# The following setting skips the gossip handshake since we are
# are not doing mutual TLS
- CORE_PEER_GOSSIP_SKIPHANDSHAKE=true
- CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/crypto/peer/msp
- CORE_PEER_TLS_ENABLED=true
- CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/crypto/peer/tls/server.key
- CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/crypto/peer/tls/server.crt
- CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/crypto/peer/tls/ca.crt
volumes:
- ./crypto-config/peerOrganizations/${ORG:-org1}.${DOMAIN:-example.com}/peers/peer0.${ORG:-org1}.${DOMAIN:-example.com}/:/etc/hyperledger/crypto/peer
#- peer0:/var/hyperledger/production
- ./data/peer0:/var/hyperledger/production
- /var/run/:/host/var/run/
restart: always
cli.peer:
container_name: cli.${ORG:-org1}.${DOMAIN:-example.com}
#build:
# args:
# FABRIC_VERSION: ${FABRIC_VERSION:-latest}
# context: ./fabric-tools-extended
image: ${DOCKER_REGISTRY:-docker.io}/olegabu/fabric-tools-extended:${FABRIC_STARTER_VERSION:-local}
tty: true
environment:
- ORG=${ORG:-org1}
- DOMAIN=${DOMAIN:-example.com}
- ENROLL_ID
- ENROLL_SECRET
- LDAP_ENABLED
- GOPATH=/opt/gopath
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- CORE_PEER_LOCALMSPID=${ORG:-org1}
- CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/crypto/peeradmin/msp
- CORE_PEER_ADDRESS=peer0.${ORG:-org1}.${DOMAIN:-example.com}:7051
- CORE_LOGGING_LEVEL=DEBUG
- CORE_PEER_TLS_ENABLED=true
- CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/crypto/peer/tls/server.key
- CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/crypto/peer/tls/server.crt
- CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/crypto/peer/tls/ca.crt
working_dir: /etc/hyperledger
volumes:
- /var/run/:/host/var/run/
- ./chaincode:/opt/chaincode
- ./chaincode/go:/opt/gopath/src
- ./crypto-config:/etc/hyperledger/crypto-config
- ${FABRIC_STARTER_HOME:-.}/templates:/etc/hyperledger/templates
- ./crypto-config/peerOrganizations/${ORG:-org1}.${DOMAIN:-example.com}/users/Admin@${ORG:-org1}.${DOMAIN:-example.com}:/etc/hyperledger/crypto/peeradmin
- ./crypto-config/peerOrganizations/${ORG:-org1}.${DOMAIN:-example.com}/peers/peer0.${ORG:-org1}.${DOMAIN:-example.com}:/etc/hyperledger/crypto/peer
- ./crypto-config/peerOrganizations/${ORG:-org1}.${DOMAIN:-example.com}/peers/peer1.${ORG:-org1}.${DOMAIN:-example.com}:/etc/hyperledger/crypto/peer1
- ./crypto-config/ordererOrganizations/${DOMAIN:-example.com}/msp:/etc/hyperledger/crypto/orderer
restart: always
# fabric-rest api server
api:
# build: ../fabric-starter-rest
image: ${DOCKER_REGISTRY:-docker.io}/olegabu/fabric-starter-rest:${FABRIC_STARTER_REST_VERSION}
container_name: api.${ORG:-org1}.${DOMAIN:-example.com}
# ports:
# - ${API_PORT:-4000}:3000
environment:
- ORG=${ORG:-org1}
- DOMAIN=${DOMAIN:-example.com}
- CRYPTO_CONFIG_DIR=/usr/src/app/crypto-config
- WEBAPP_DIR=/usr/src/app/webapp
- MSP_DIR=/usr/src/app/msp
- ORGS=${ORGS:-"org1":"peer0.org1.example.com:7051"}
- CAS=${CAS:-"org1":"ca.org1.example.com:7054"}
- DISCOVER_AS_LOCALHOST=false
- ENROLL_ID
- ENROLL_SECRET
- P=${PWD}
depends_on:
- peer0
volumes:
- ./crypto-config:/usr/src/app/crypto-config
- ./webapp:/usr/src/app/webapp
- ./crypto-config/peerOrganizations/${ORG:-org1}.${DOMAIN:-example.com}/msp:/usr/src/app/msp
command: sh -c "sleep 15 && npm start"
restart: always
# simple http server to disseminate certificates
www.peer:
container_name: www.${ORG:-org1}.${DOMAIN:-example.com}
image: ${DOCKER_REGISTRY:-docker.io}/nginx
# ports:
# - ${WWW_PORT:-8081}:80
volumes:
- ./crypto-config/peerOrganizations/${ORG:-org1}.${DOMAIN:-example.com}/msp:/usr/share/nginx/html/msp
restart: always
networks:
default:
name: fabric-starter_default
driver: bridge
driver_opts:
com.docker.network.driver.mtu: ${MTU:-1500}