-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yaml
421 lines (405 loc) · 16.1 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
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
version: '3'
#
# network
#
networks:
fabric_loc:
name: fabric_loc
#
# volume
#
volumes:
orderer.riverchain.com:
peer0.org1.riverchain.com:
peer0.org2.riverchain.com:
services:
#
# ca service
#
ca_org1:
image: hyperledger/fabric-ca:1.5.2
platform: linux/amd64
environment:
- FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
- FABRIC_CA_SERVER_CA_NAME=ca-org1
- FABRIC_CA_SERVER_TLS_ENABLED=true
- FABRIC_CA_SERVER_PORT=7054
- FABRIC_CA_SERVER_OPERATIONS_LISTENADDRESS=0.0.0.0:17054
ports:
- "7054:7054"
- "17054:17054"
command: sh -c 'fabric-ca-server start -b admin:adminpw -d'
volumes:
- ./.data/organizations/fabric-ca/org1:/etc/hyperledger/fabric-ca-server
- ./organizations/fabric-ca/org1/fabric-ca-server-config.yaml:/etc/hyperledger/fabric-ca-server/fabric-ca-server-config.yaml
container_name: ca_org1
depends_on:
- ca_orderer
networks:
- fabric_loc
ca_org2:
image: hyperledger/fabric-ca:1.5.2
platform: linux/amd64
environment:
- FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
- FABRIC_CA_SERVER_CA_NAME=ca-org2
- FABRIC_CA_SERVER_TLS_ENABLED=true
- FABRIC_CA_SERVER_PORT=8054
- FABRIC_CA_SERVER_OPERATIONS_LISTENADDRESS=0.0.0.0:18054
ports:
- "8054:8054"
- "18054:18054"
command: sh -c 'fabric-ca-server start -b admin:adminpw -d'
volumes:
- ./.data/organizations/fabric-ca/org2:/etc/hyperledger/fabric-ca-server
- ./organizations/fabric-ca/org2/fabric-ca-server-config.yaml:/etc/hyperledger/fabric-ca-server/fabric-ca-server-config.yaml
container_name: ca_org2
depends_on:
- ca_org1
networks:
- fabric_loc
ca_orderer:
image: hyperledger/fabric-ca:1.5.2
platform: linux/amd64
environment:
- FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
- FABRIC_CA_SERVER_CA_NAME=ca-orderer
- FABRIC_CA_SERVER_TLS_ENABLED=true
- FABRIC_CA_SERVER_PORT=9054
- FABRIC_CA_SERVER_OPERATIONS_LISTENADDRESS=0.0.0.0:19054
ports:
- "9054:9054"
- "19054:19054"
command: sh -c 'fabric-ca-server start -b admin:adminpw -d'
volumes:
- ./.data/organizations/fabric-ca/orderer:/etc/hyperledger/fabric-ca-server
- ./organizations/fabric-ca/orderer/fabric-ca-server-config.yaml:/etc/hyperledger/fabric-ca-server/fabric-ca-server-config.yaml
container_name: ca_orderer
networks:
- fabric_loc
# sleep 5s for avoid mount files issues, that cause infra_builder error
# let ca containers able to run & load ca-cert completely
infra_prebuild:
image: ubuntu:22.10
platform: linux/amd64
command: sh -c "sleep 5"
depends_on:
- ca_org1
- ca_org2
- ca_orderer
infra_builder:
build:
context: .
dockerfile: ./fabric-bin.Dockerfile
image: fabric-bin-base
platform: linux/amd64
working_dir: /opt
volumes:
# scripts & configtx template
- ./scripts:/opt/scripts
- ./configtx:/opt/configtx
# rewire
- ./organizations/fabric-ca/org1/fabric-ca-server-config.yaml:/opt/organizations/fabric-ca/org1/fabric-ca-server-config.yaml
- ./organizations/fabric-ca/org2/fabric-ca-server-config.yaml:/opt/organizations/fabric-ca/org2/fabric-ca-server-config.yaml
- ./organizations/fabric-ca/orderer/fabric-ca-server-config.yaml:/opt/organizations/fabric-ca/orderer/fabric-ca-server-config.yaml
- ./organizations/fabric-ca/registerEnroll.sh:/opt/organizations/fabric-ca/registerEnroll.sh
- ./organizations/ccp-generate.sh:/opt/organizations/ccp-generate.sh
- ./organizations/ccp-template.json:/opt/organizations/ccp-template.json
- ./organizations/ccp-template.yaml:/opt/organizations/ccp-template.yaml
# data
- ./.data/system-genesis-block:/opt/system-genesis-block
- ./.data/organizations:/opt/organizations
command: scripts/bootstrap/bootstrap.sh
depends_on:
infra_prebuild:
condition: service_completed_successfully
networks:
- fabric_loc
#
# orderer node
#
orderer.riverchain.com:
container_name: orderer.riverchain.com
image: hyperledger/fabric-orderer:2.2.5
platform: linux/amd64
environment:
- FABRIC_LOGGING_SPEC=INFO
- ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
- ORDERER_GENERAL_LISTENPORT=7050
- ORDERER_GENERAL_GENESISMETHOD=file
- ORDERER_GENERAL_GENESISFILE=/var/hyperledger/orderer/orderer.genesis.block
- ORDERER_GENERAL_LOCALMSPID=OrdererMSP
- ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp
- ORDERER_OPERATIONS_LISTENADDRESS=0.0.0.0:17050
# enabled TLS
- 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=[/var/hyperledger/orderer/tls/ca.crt]
- ORDERER_KAFKA_TOPIC_REPLICATIONFACTOR=1
- ORDERER_KAFKA_VERBOSE=true
- ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt
- ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key
- ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt]
working_dir: /opt/gopath/src/github.com/hyperledger/fabric
command: orderer
volumes:
- ./.data/system-genesis-block/genesis.block:/var/hyperledger/orderer/orderer.genesis.block
- ./.data/organizations/ordererOrganizations/riverchain.com/orderers/orderer.riverchain.com/msp:/var/hyperledger/orderer/msp
- ./.data/organizations/ordererOrganizations/riverchain.com/orderers/orderer.riverchain.com/tls/:/var/hyperledger/orderer/tls
- orderer.riverchain.com:/var/hyperledger/production/orderer
ports:
- 7050:7050
- 17050:17050
depends_on:
infra_builder:
condition: service_completed_successfully
networks:
- fabric_loc
#
# peer node
#
peer0.org1.riverchain.com:
container_name: peer0.org1.riverchain.com
image: hyperledger/fabric-peer:2.2.5
platform: linux/amd64
environment:
#Generic peer variables
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=fabric_test
- FABRIC_LOGGING_SPEC=INFO
#- FABRIC_LOGGING_SPEC=DEBUG
- CORE_PEER_TLS_ENABLED=true
- CORE_PEER_PROFILE_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
# Peer specific variabes
- CORE_PEER_ID=peer0.org1.riverchain.com
- CORE_PEER_ADDRESS=peer0.org1.riverchain.com:7051
- CORE_PEER_LISTENADDRESS=0.0.0.0:7051
- CORE_PEER_CHAINCODEADDRESS=peer0.org1.riverchain.com:7052
- CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:7052
- CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org1.riverchain.com:7051
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.riverchain.com:7051
- CORE_PEER_LOCALMSPID=Org1MSP
- CORE_OPERATIONS_LISTENADDRESS=0.0.0.0:17051
# counch db
- CORE_LEDGER_STATE_STATEDATABASE=CouchDB
- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb0:5984
# The CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME and CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD
# provide the credentials for ledger to connect to CouchDB. The username and password must
# match the username and password set for the associated CouchDB.
- CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=admin
- CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=adminpw
volumes:
- /var/run/docker.sock:/host/var/run/docker.sock
- ./.data/organizations/peerOrganizations/org1.riverchain.com/peers/peer0.org1.riverchain.com/msp:/etc/hyperledger/fabric/msp
- ./.data/organizations/peerOrganizations/org1.riverchain.com/peers/peer0.org1.riverchain.com/tls:/etc/hyperledger/fabric/tls
- peer0.org1.riverchain.com:/var/hyperledger/production
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
command: peer node start
ports:
- 7051:7051
- 17051:17051
depends_on:
- couchdb0
- orderer.riverchain.com
networks:
- fabric_loc
peer0.org2.riverchain.com:
container_name: peer0.org2.riverchain.com
image: hyperledger/fabric-peer:2.2.5
platform: linux/amd64
environment:
#Generic peer variables
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=fabric_test
- FABRIC_LOGGING_SPEC=INFO
#- FABRIC_LOGGING_SPEC=DEBUG
- CORE_PEER_TLS_ENABLED=true
- CORE_PEER_PROFILE_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
# Peer specific variabes
- CORE_PEER_ID=peer0.org2.riverchain.com
- CORE_PEER_ADDRESS=peer0.org2.riverchain.com:9051
- CORE_PEER_LISTENADDRESS=0.0.0.0:9051
- CORE_PEER_CHAINCODEADDRESS=peer0.org2.riverchain.com:9052
- CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:9052
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org2.riverchain.com:9051
- CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org2.riverchain.com:9051
- CORE_PEER_LOCALMSPID=Org2MSP
- CORE_OPERATIONS_LISTENADDRESS=0.0.0.0:19051
# counch db
- CORE_LEDGER_STATE_STATEDATABASE=CouchDB
- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb1:5984
# The CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME and CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD
# provide the credentials for ledger to connect to CouchDB. The username and password must
# match the username and password set for the associated CouchDB.
- CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=admin
- CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=adminpw
volumes:
- /var/run/docker.sock:/host/var/run/docker.sock
- ./.data/organizations/peerOrganizations/org2.riverchain.com/peers/peer0.org2.riverchain.com/msp:/etc/hyperledger/fabric/msp
- ./.data/organizations/peerOrganizations/org2.riverchain.com/peers/peer0.org2.riverchain.com/tls:/etc/hyperledger/fabric/tls
- peer0.org2.riverchain.com:/var/hyperledger/production
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
command: peer node start
ports:
- 9051:9051
- 19051:19051
depends_on:
- couchdb1
- orderer.riverchain.com
networks:
- fabric_loc
#
# couchdb
#
couchdb0:
container_name: couchdb0
image: couchdb:3.1.1
platform: linux/amd64
# Populate the COUCHDB_USER and COUCHDB_PASSWORD to set an admin user and password
# for CouchDB. This will prevent CouchDB from operating in an "Admin Party" mode.
environment:
- COUCHDB_USER=admin
- COUCHDB_PASSWORD=adminpw
# Comment/Uncomment the port mapping if you want to hide/expose the CouchDB service,
# for example map it to utilize Fauxton User Interface in dev environments.
ports:
- "5984:5984"
depends_on:
infra_builder:
condition: service_completed_successfully
networks:
- fabric_loc
couchdb1:
container_name: couchdb1
image: couchdb:3.1.1
platform: linux/amd64
# Populate the COUCHDB_USER and COUCHDB_PASSWORD to set an admin user and password
# for CouchDB. This will prevent CouchDB from operating in an "Admin Party" mode.
environment:
- COUCHDB_USER=admin
- COUCHDB_PASSWORD=adminpw
# Comment/Uncomment the port mapping if you want to hide/expose the CouchDB service,
# for example map it to utilize Fauxton User Interface in dev environments.
depends_on:
infra_builder:
condition: service_completed_successfully
ports:
- "7984:5984"
networks:
- fabric_loc
#
# cli
#
cli:
container_name: cli
image: hyperledger/fabric-tools:2.2.5
tty: true
stdin_open: true
platform: linux/amd64
environment:
- GOPATH=/opt/gopath
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- FABRIC_LOGGING_SPEC=INFO
#- FABRIC_LOGGING_SPEC=DEBUG
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
command: /bin/bash
volumes:
- /var/run/:/host/var/run/
- ./scripts:/opt/gopath/src/github.com/hyperledger/fabric/peer/scripts/
- ./.data/organizations:/opt/gopath/src/github.com/hyperledger/fabric/peer/organizations
# rewire
- ./organizations/fabric-ca/org1/fabric-ca-server-config.yaml:/opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/fabric-ca/org1/fabric-ca-server-config.yaml
- ./organizations/fabric-ca/org2/fabric-ca-server-config.yaml:/opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/fabric-ca/org2/fabric-ca-server-config.yaml
- ./organizations/fabric-ca/orderer/fabric-ca-server-config.yaml:/opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/fabric-ca/orderer/fabric-ca-server-config.yaml
- ./organizations/fabric-ca/registerEnroll.sh:/opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/fabric-ca/registerEnroll.sh
- ./organizations/ccp-generate.sh:/opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/ccp-generate.sh
- ./organizations/ccp-template.json:/opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/ccp-template.json
- ./organizations/ccp-template.yaml:/opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/ccp-template.yaml
depends_on:
- peer0.org1.riverchain.com
- peer0.org2.riverchain.com
networks:
- fabric_loc
#
# create riverchain channel
#
channel_ctr:
build:
context: .
dockerfile: ./fabric-bin.Dockerfile
image: fabric-bin-base
platform: linux/amd64
working_dir: /opt
environment:
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
volumes:
# docker.sock
- /var/run/docker.sock:/var/run/docker.sock
# fabric
- ./scripts:/opt/scripts
- ./configtx:/opt/configtx
- ./config:/opt/config
# rewire
- ./organizations/fabric-ca/org1/fabric-ca-server-config.yaml:/opt/organizations/fabric-ca/org1/fabric-ca-server-config.yaml
- ./organizations/fabric-ca/org2/fabric-ca-server-config.yaml:/opt/organizations/fabric-ca/org2/fabric-ca-server-config.yaml
- ./organizations/fabric-ca/orderer/fabric-ca-server-config.yaml:/opt/organizations/fabric-ca/orderer/fabric-ca-server-config.yaml
- ./organizations/fabric-ca/registerEnroll.sh:/opt/organizations/fabric-ca/registerEnroll.sh
- ./organizations/ccp-generate.sh:/opt/organizations/ccp-generate.sh
- ./organizations/ccp-template.json:/opt/organizations/ccp-template.json
- ./organizations/ccp-template.yaml:/opt/organizations/ccp-template.yaml
# data
- ./.data/system-genesis-block:/opt/system-genesis-block
- ./.data/channel-artifacts:/opt/channel-artifacts
- ./.data/organizations:/opt/organizations
command: scripts/createChannel.sh riverchain 3 5 false
depends_on:
- orderer.riverchain.com
- cli
networks:
- fabric_loc
#
# local aws svc
#
localstack:
container_name: aws-mock-localstack_main
image: localstack/localstack:2.1
platform: linux/amd64
ports:
- "4566:4566" # LocalStack Gateway
- "4510-4559:4510-4559" # external services port range
environment:
- DEBUG=DEBUG-LOCALSTACK
- DOCKER_HOST=unix:///var/run/docker.sock
volumes:
- "./.data/localstack:/var/lib/localstack"
- "/var/run/docker.sock:/var/run/docker.sock"
depends_on:
- infra_builder
networks:
- fabric_loc
awscli:
build:
context: .
dockerfile: ./aws-cli.Dockerfile
platform: linux/amd64
image: awslocal
container_name: aws-mock-awscli
working_dir: /opt
environment:
- LOCALSTACK_HOST=localstack:4566
- WORK_DIR=/opt
volumes:
- ./.data/organizations:/opt/organizations
- ./scripts:/opt/scripts
command: scripts/bootstrap/upload-creds.sh
depends_on:
- localstack
networks:
- fabric_loc