Skip to content

Commit 9937c36

Browse files
committed
[FAB-3604] e2e_cli sample improvements
Covers the following : 1. Use cryptogen tool to generate org certificates for each run. 2. Make a generic docker-compose base file a. A docker-compose-cli.yaml extends the base and includes a cli container to run e2e test b. A docker-compose-e2e.yaml extends the base and includes fabric-ca container.(can be used for SDK or other tests) 3. A timer flag in docker-compose CLI container to stop killing CLI container NOTE: A docker-compose-e2e-template.yaml also included. This is required to generate docker-compose-e2e.yaml, as we need to replace the private key dyamically. USAGE: ./network_setup.sh <up|down|restart> [channel] [CLI timeout in sec] Ex: ./network_setup.sh up mychannel 10 This starts CLI with channelname mychannel, CLI timeout set to 10s ./network_setup.sh down Shutdown the network and clear all the artifacts. ./network_setup.sh restart xyz 10 restarts the network. Change-Id: I9bc80c0ad0e4dc259383038e7f69e3239a9409f3 Signed-off-by: ratnakar <[email protected]>
1 parent eff8380 commit 9937c36

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+628
-853
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,6 @@ report.xml
3737
.gradle
3838
build/
3939
bin/
40+
examples/e2e_cli/channel-artifacts/*.tx
41+
examples/e2e_cli/channel-artifacts/*.block
42+
examples/e2e_cli/crypto-config/*
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
version: '2'
2+
3+
services:
4+
5+
orderer.example.com:
6+
container_name: orderer.example.com
7+
image: hyperledger/fabric-orderer
8+
environment:
9+
- ORDERER_GENERAL_LOGLEVEL=debug
10+
- ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
11+
- ORDERER_GENERAL_GENESISMETHOD=file
12+
- ORDERER_GENERAL_GENESISFILE=/var/hyperledger/orderer/orderer.genesis.block
13+
- ORDERER_GENERAL_LOCALMSPID=OrdererMSP
14+
- ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp
15+
# enabled TLS
16+
- ORDERER_GENERAL_TLS_ENABLED=true
17+
- ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key
18+
- ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt
19+
- ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt]
20+
working_dir: /opt/gopath/src/github.com/hyperledger/fabric
21+
command: orderer
22+
volumes:
23+
- ../channel-artifacts/orderer.genesis.block:/var/hyperledger/orderer/orderer.genesis.block
24+
- ../crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp:/var/hyperledger/orderer/msp
25+
- ../crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/:/var/hyperledger/orderer/tls
26+
ports:
27+
- 7050:7050
28+
29+
## To enable CouchDB as state database, uncomment the following sections of this file:
30+
## 1) couchdb containers
31+
## 2) peer environment variables CORE_LEDGER_STATE_STATEDATABASE and
32+
## CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS
33+
## 3) couch container names in "depends_on" section
34+
35+
# couchdb0:
36+
# container_name: couchdb0
37+
# image: hyperledger/fabric-couchdb
38+
## Uncomment the port mapping if you want to expose the CouchDB service,
39+
## for example to utilize Fauxton User Interface in dev environments.
40+
# ports:
41+
# - "5984:5984"
42+
43+
peer0.org1.example.com:
44+
container_name: peer0.org1.example.com
45+
extends:
46+
file: peer-base.yaml
47+
service: peer-base
48+
environment:
49+
- CORE_PEER_ID=peer0.org1.example.com
50+
- CORE_PEER_ADDRESS=peer0.org1.example.com:7051
51+
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7051
52+
- CORE_PEER_LOCALMSPID=Org1MSP
53+
# - CORE_LEDGER_STATE_STATEDATABASE=CouchDB
54+
# - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb0:5984
55+
volumes:
56+
- /var/run/:/host/var/run/
57+
- ../crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp:/etc/hyperledger/fabric/msp
58+
- ../crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls:/etc/hyperledger/fabric/tls
59+
ports:
60+
- 7051:7051
61+
- 7053:7053
62+
#depends_on:
63+
# - couchdb0
64+
65+
# couchdb1:
66+
# container_name: couchdb1
67+
# image: hyperledger/fabric-couchdb
68+
## Uncomment the port mapping if you want to expose the CouchDB service,
69+
## for example to utilize Fauxton User Interface in dev environments.
70+
# ports:
71+
# - "6984:5984"
72+
73+
peer1.org1.example.com:
74+
container_name: peer1.org1.example.com
75+
extends:
76+
file: peer-base.yaml
77+
service: peer-base
78+
environment:
79+
- CORE_PEER_ID=peer1.org1.example.com
80+
- CORE_PEER_ADDRESS=peer1.org1.example.com:7051
81+
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org1.example.com:7051
82+
- CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org1.example.com:7051
83+
- CORE_PEER_LOCALMSPID=Org1MSP
84+
# - CORE_LEDGER_STATE_STATEDATABASE=CouchDB
85+
# - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb1:5984
86+
volumes:
87+
- /var/run/:/host/var/run/
88+
- ../crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/msp:/etc/hyperledger/fabric/msp
89+
- ../crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls:/etc/hyperledger/fabric/tls
90+
91+
ports:
92+
- 8051:7051
93+
- 8053:7053
94+
#depends_on:
95+
# - couchdb1
96+
97+
# couchdb2:
98+
# container_name: couchdb2
99+
# image: hyperledger/fabric-couchdb
100+
## Uncomment the port mapping if you want to expose the CouchDB service,
101+
## for example to utilize Fauxton User Interface in dev environments.
102+
# ports:
103+
# - "7984:5984"
104+
105+
peer0.org2.example.com:
106+
container_name: peer0.org2.example.com
107+
extends:
108+
file: peer-base.yaml
109+
service: peer-base
110+
environment:
111+
- CORE_PEER_ID=peer0.org2.example.com
112+
- CORE_PEER_ADDRESS=peer0.org2.example.com:7051
113+
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org2.example.com:7051
114+
- CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org2.example.com:7051
115+
- CORE_PEER_LOCALMSPID=Org2MSP
116+
# - CORE_LEDGER_STATE_STATEDATABASE=CouchDB
117+
# - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb2:5984
118+
volumes:
119+
- /var/run/:/host/var/run/
120+
- ../crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp:/etc/hyperledger/fabric/msp
121+
- ../crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls:/etc/hyperledger/fabric/tls
122+
ports:
123+
- 9051:7051
124+
- 9053:7053
125+
#depends_on:
126+
# - couchdb2
127+
128+
# couchdb3:
129+
# container_name: couchdb3
130+
# image: hyperledger/fabric-couchdb
131+
## Uncomment the port mapping if you want to expose the CouchDB service,
132+
## for example to utilize Fauxton User Interface in dev environments.
133+
# ports:
134+
# - "8984:5984"
135+
136+
peer1.org2.example.com:
137+
container_name: peer1.org2.example.com
138+
extends:
139+
file: peer-base.yaml
140+
service: peer-base
141+
environment:
142+
- CORE_PEER_ID=peer1.org2.example.com
143+
- CORE_PEER_ADDRESS=peer1.org2.example.com:7051
144+
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org2.example.com:7051
145+
- CORE_PEER_GOSSIP_BOOTSTRAP=peer1.org2.example.com:7051
146+
- CORE_PEER_LOCALMSPID=Org2MSP
147+
# - CORE_LEDGER_STATE_STATEDATABASE=CouchDB
148+
# - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb3:5984
149+
volumes:
150+
- /var/run/:/host/var/run/
151+
- ../crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/msp:/etc/hyperledger/fabric/msp
152+
- ../crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/tls:/etc/hyperledger/fabric/tls
153+
ports:
154+
- 10051:7051
155+
- 10053:7053
156+
#depends_on:
157+
# - couchdb3

examples/e2e_cli/peer-base/peer-base.yaml examples/e2e_cli/base/peer-base.yaml

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ services:
33
peer-base:
44
image: hyperledger/fabric-peer
55
environment:
6-
#- CORE_PEER_ADDRESSAUTODETECT=true
76
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
87
# the following setting starts chaincode containers on the same
98
# bridge network as the peers
@@ -12,13 +11,15 @@ services:
1211
#- CORE_LOGGING_LEVEL=ERROR
1312
- CORE_LOGGING_LEVEL=DEBUG
1413
- CORE_PEER_TLS_ENABLED=true
15-
- CORE_NEXT=true
1614
- CORE_PEER_ENDORSER_ENABLED=true
1715
- CORE_PEER_GOSSIP_USELEADERELECTION=true
1816
- CORE_PEER_GOSSIP_ORGLEADER=false
1917
# The following setting skips the gossip handshake since we are
2018
# are not doing mutual TLS
2119
- CORE_PEER_GOSSIP_SKIPHANDSHAKE=true
2220
- CORE_PEER_PROFILE_ENABLED=true
21+
- CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/tls/server.crt
22+
- CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/tls/server.key
23+
- CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/tls/ca.crt
2324
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
2425
command: peer node start --peer-defaultchain=false

examples/e2e_cli/channel-artifacts/.gitkeep

Whitespace-only changes.

examples/e2e_cli/configtx.yaml

+14-29
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ Profiles:
1717
Consortiums:
1818
SampleConsortium:
1919
Organizations:
20-
- *Org0
2120
- *Org1
21+
- *Org2
2222
TwoOrgsChannel:
2323
Consortium: SampleConsortium
2424
Application:
2525
<<: *ApplicationDefaults
2626
Organizations:
27-
- *Org0
2827
- *Org1
28+
- *Org2
2929

3030
################################################################################
3131
#
@@ -48,12 +48,7 @@ Organizations:
4848
ID: OrdererMSP
4949

5050
# MSPDir is the filesystem path which contains the MSP configuration
51-
MSPDir: crypto/orderer/localMspConfig
52-
53-
# AdminPrincipal dictates the type of principal used for an organization's Admins policy
54-
# Today, only the values of Role.ADMIN ad Role.MEMBER are accepted, which indicates a principal
55-
# of role type ADMIN and role type MEMBER respectively
56-
AdminPrincipal: Role.MEMBER
51+
MSPDir: crypto-config/ordererOrganizations/example.com/msp
5752

5853
# BCCSP (Blockchain crypto provider): Select which crypto implementation or
5954
# library to use
@@ -67,20 +62,15 @@ Organizations:
6762
FileKeyStore:
6863
KeyStore:
6964

70-
- &Org0
65+
- &Org1
7166
# DefaultOrg defines the organization which is used in the sampleconfig
7267
# of the fabric.git development environment
73-
Name: Org0MSP
68+
Name: Org1MSP
7469

7570
# ID to load the MSP definition as
76-
ID: Org0MSP
77-
78-
MSPDir: crypto/peer/peer0/localMspConfig
71+
ID: Org1MSP
7972

80-
# AdminPrincipal dictates the type of principal used for an organization's Admins policy
81-
# Today, only the values of Role.ADMIN ad Role.MEMBER are accepted, which indicates a principal
82-
# of role type ADMIN and role type MEMBER respectively
83-
AdminPrincipal: Role.MEMBER
73+
MSPDir: crypto-config/peerOrganizations/org1.example.com/msp
8474

8575
# BCCSP (Blockchain crypto provider): Select which crypto implementation or
8676
# library to use
@@ -98,23 +88,18 @@ Organizations:
9888
# AnchorPeers defines the location of peers which can be used
9989
# for cross org gossip communication. Note, this value is only
10090
# encoded in the genesis block in the Application section context
101-
- Host: peer0
91+
- Host: peer0.org1.example.com
10292
Port: 7051
10393

104-
- &Org1
94+
- &Org2
10595
# DefaultOrg defines the organization which is used in the sampleconfig
10696
# of the fabric.git development environment
107-
Name: Org1MSP
97+
Name: Org2MSP
10898

10999
# ID to load the MSP definition as
110-
ID: Org1MSP
111-
112-
MSPDir: crypto/peer/peer2/localMspConfig
100+
ID: Org2MSP
113101

114-
# AdminPrincipal dictates the type of principal used for an organization's Admins policy
115-
# Today, only the values of Role.ADMIN ad Role.MEMBER are accepted, which indicates a principal
116-
# of role type ADMIN and role type MEMBER respectively
117-
AdminPrincipal: Role.MEMBER
102+
MSPDir: crypto-config/peerOrganizations/org2.example.com/msp
118103

119104
# BCCSP (Blockchain crypto provider): Select which crypto implementation or
120105
# library to use
@@ -132,7 +117,7 @@ Organizations:
132117
# AnchorPeers defines the location of peers which can be used
133118
# for cross org gossip communication. Note, this value is only
134119
# encoded in the genesis block in the Application section context
135-
- Host: peer2
120+
- Host: peer0.org2.example.com
136121
Port: 7051
137122

138123
################################################################################
@@ -150,7 +135,7 @@ Orderer: &OrdererDefaults
150135
OrdererType: solo
151136

152137
Addresses:
153-
- orderer0:7050
138+
- orderer.example.com:7050
154139

155140
# Batch Timeout: The amount of time to wait before creating a batch
156141
BatchTimeout: 2s

examples/e2e_cli/crypto-config.yaml

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# ---------------------------------------------------------------------------
2+
# "OrdererOrgs" - Definition of organizations managing orderer nodes
3+
# ---------------------------------------------------------------------------
4+
OrdererOrgs:
5+
# ---------------------------------------------------------------------------
6+
# Orderer
7+
# ---------------------------------------------------------------------------
8+
- Name: Orderer
9+
Domain: example.com
10+
# ---------------------------------------------------------------------------
11+
# "Specs" - See PeerOrgs below for complete description
12+
# ---------------------------------------------------------------------------
13+
Specs:
14+
- Hostname: orderer
15+
# ---------------------------------------------------------------------------
16+
# "PeerOrgs" - Definition of organizations managing peer nodes
17+
# ---------------------------------------------------------------------------
18+
PeerOrgs:
19+
# ---------------------------------------------------------------------------
20+
# Org1
21+
# ---------------------------------------------------------------------------
22+
- Name: Org1
23+
Domain: org1.example.com
24+
# ---------------------------------------------------------------------------
25+
# "Specs"
26+
# ---------------------------------------------------------------------------
27+
# Uncomment this section to enable the explicit definition of hosts in your
28+
# configuration. Most users will want to use Template, below
29+
#
30+
# Specs is an array of Spec entries. Each Spec entry consists of two fields:
31+
# - Hostname: (Required) The desired hostname, sans the domain.
32+
# - CommonName: (Optional) Specifies the template or explicit override for
33+
# the CN. By default, this is the template:
34+
#
35+
# "{{.Hostname}}.{{.Domain}}"
36+
#
37+
# which obtains its values from the Spec.Hostname and
38+
# Org.Domain, respectively.
39+
# ---------------------------------------------------------------------------
40+
# Specs:
41+
# - Hostname: foo # implicitly "foo.org1.example.com"
42+
# CommonName: foo27.org5.example.com # overrides Hostname-based FQDN set above
43+
# - Hostname: bar
44+
# - Hostname: baz
45+
# ---------------------------------------------------------------------------
46+
# "Template"
47+
# ---------------------------------------------------------------------------
48+
# Allows for the definition of 1 or more hosts that are created sequentially
49+
# from a template. By default, this looks like "peer%d" from 0 to Count-1.
50+
# You may override the number of nodes (Count), the starting index (Start)
51+
# or the template used to construct the name (Hostname).
52+
#
53+
# Note: Template and Specs are not mutually exclusive. You may define both
54+
# sections and the aggregate nodes will be created for you. Take care with
55+
# name collisions
56+
# ---------------------------------------------------------------------------
57+
Template:
58+
Count: 2
59+
# Start: 5
60+
# Hostname: {{.Prefix}}{{.Index}} # default
61+
# ---------------------------------------------------------------------------
62+
# "Users"
63+
# ---------------------------------------------------------------------------
64+
# Count: The number of user accounts _in addition_ to Admin
65+
# ---------------------------------------------------------------------------
66+
Users:
67+
Count: 1
68+
# ---------------------------------------------------------------------------
69+
# Org2: See "Org1" for full specification
70+
# ---------------------------------------------------------------------------
71+
- Name: Org2
72+
Domain: org2.example.com
73+
Template:
74+
Count: 2
75+
Users:
76+
Count: 1

examples/e2e_cli/crypto/orderer/localMspConfig/admincerts/ordererOrg0.pem

-10
This file was deleted.

examples/e2e_cli/crypto/orderer/localMspConfig/cacerts/ordererOrg0.pem

-10
This file was deleted.

examples/e2e_cli/crypto/orderer/localMspConfig/keystore/ordererSigner.pem

-5
This file was deleted.

0 commit comments

Comments
 (0)