-
Notifications
You must be signed in to change notification settings - Fork 2
/
docker-compose.yaml
executable file
·226 lines (211 loc) · 9.3 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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
#
# Copyright . All Rights Reserved.
#
version: '3.7'
volumes:
peer0:
# peer1:
x-peer:
&peer-defaults
image: hyperledger/fabric-peer:${FABRIC_VERSION:-latest}
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: hyperledger/fabric-ca:${FABRIC_VERSION:-latest}
environment:
# - FABRIC_LOGGING_SPEC=debug
- 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
logging:
driver: "json-file"
options:
max-size: "50m"
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=${DEFAULT_NETWORK_NAME:-fabric-starter}_default
- CORE_VM_DOCKER_ATTACHSTDOUT=true
# - CORE_LOGGING_LEVEL=DEBUG
# - FABRIC_LOGGING_SPEC=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
- /var/run/:/host/var/run/
logging:
driver: "json-file"
options:
max-size: "50m"
# peer1:
# << : *peer-defaults
# container_name: peer1.${ORG:-org1}.${DOMAIN:-example.com}
# environment:
# - CORE_PEER_ID=peer1.${ORG:-org1}.${DOMAIN:-example.com}
# - CORE_PEER_LOCALMSPID=${ORG:-org1}
# - CORE_PEER_ADDRESS=peer1.${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=${DEFAULT_NETWORK_NAME:-fabric-starter}_default
# - CORE_VM_DOCKER_ATTACHSTDOUT=true
## - CORE_LOGGING_LEVEL=DEBUG
# - FABRIC_LOGGING_SPEC=debug
# - CORE_CHAINCODE_LOGGING_LEVEL=DEBUG
# - CORE_CHAINCODE_LOGGING_SHIM=debug
# - CORE_PEER_GOSSIP_USELEADERELECTION=false
# - CORE_PEER_GOSSIP_ORGLEADER=false
# # Don't particiapte in external gossip- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.${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/peer1.${ORG:-org1}.${DOMAIN:-example.com}/:/etc/hyperledger/crypto/peer
# - peer1:/var/hyperledger/production
# - /var/run/:/host/var/run/
# logging:
# driver: "json-file"
# options:
# max-size: "50m"
cli.peer:
container_name: cli.${ORG:-org1}.${DOMAIN:-example.com}
# build:
# args:
# FABRIC_VERSION: ${FABRIC_VERSION:-latest}
# context: ./fabric-tools-extended
image: olegabu/fabric-tools-extended:snapshot-0.9-1.4.3
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
- FABRIC_LOGGING_SPEC=info
- 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_HOME:-./chaincode}:/opt/chaincode
- ${CHAINCODE_HOME:-./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
logging:
driver: "json-file"
options:
max-size: "50m"
# fabric-rest api server
api:
# build: ../fabric-starter-rest
image: seria1coder/fabric-starter-rest-serial-coder-extended:${FABRIC_STARTER_REST_VERSION:-latest}
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
- CORE_PEER_LOCALMSPID=${ORG:-org1}
- CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/crypto/peeradmin/msp
# - ORGS=${ORGS:-"org1":"peer0.org1.example.com:7051"}
# - CAS=${CAS:-"org1":"ca.org1.example.com:7054"}
- ORGS="${ORG-org1}":"peer0.${ORG-org1}.${DOMAIN-example.com}:7051"
- CAS="${ORG-org1}":"ca.${ORG-org1}.${DOMAIN-example.com}:7054"
- DISCOVER_AS_LOCALHOST=false
- ENROLL_ID
- ENROLL_SECRET
- P=${PWD}
- HFC_LOGGING={"debug":"console","info":"console"}
- INVOKE_RETRY_COUNT=1
- AUTO_TRADE_CHANNEL_ID=auto-trade
- AUTO_TRADE_CHAINCODE_ID=auto_trade
# to troubleshoot grpc issues https://github.com/grpc/grpc/blob/master/doc/environment_variables.md
# - GRPC_VERBOSITY=DEBUG
# - GRPC_TRACE=connectivity_state,health_check_client,timer,timer_check,tcp,api
depends_on:
- peer0
# - peer1
volumes:
- ./crypto-config:/usr/src/app/crypto-config
- ./templates:/usr/src/app/templates
- ${WEBAPP_HOME:-./webapp}:/usr/src/app/webapp
- ./crypto-config/peerOrganizations/${ORG:-org1}.${DOMAIN:-example.com}/msp:/usr/src/app/msp
- ./crypto-config/peerOrganizations/${ORG:-org1}.${DOMAIN:-example.com}/users/Admin@${ORG:-org1}.${DOMAIN:-example.com}:/etc/hyperledger/crypto/peeradmin
command: sh -c "sleep 1 && npm start"
logging:
driver: "json-file"
options:
max-size: "50m"
# simple http server to disseminate certificates
www.peer:
container_name: www.${ORG:-org1}.${DOMAIN:-example.com}
image: nginx:1.17.4
# ports:
# - ${WWW_PORT:-8081}:80
volumes:
- ./crypto-config/peerOrganizations/${ORG:-org1}.${DOMAIN:-example.com}/msp:/usr/share/nginx/html/msp
logging:
driver: "json-file"
options:
max-size: "50m"
networks:
default:
external:
name: ${DEFAULT_NETWORK_NAME:-fabric-dev-deployer}_default